diff --git a/.gitignore b/.gitignore index bf72415..1fcd98b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,11 @@ ## ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +Source/HalTempFolder Source/TestStand/Reports Source/Nuget/cache/ -Source/Nuget/SolutionPackages +Source/Nuget/SolutionPackages/* +!Source/Nuget/SolutionPackages/readme.txt Thumbs.db @@ -366,4 +368,6 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd + +!**/HAL/Implementations/BIT/COEComm/build/** \ No newline at end of file diff --git a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.cs b/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.cs deleted file mode 100644 index e8f6fbf..0000000 --- a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.cs +++ /dev/null @@ -1,299 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ - -using NLog; -using Raytheon.Common; -using System; -using System.Net; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; - -namespace Raytheon.Instruments.EthernetSockets -{ - /// - /// Class for controlling a TCP client communication device - /// - public class TcpClient : ICommDevice - { - #region PrivateClassMembers - - private Socket _sock; - private string _remoteAddress; - private int _remotePort; - private IPEndPoint _remoteEP = null; - private IPAddress _ipAddress = null; - private object _syncObj = new object(); - - private readonly string _name; - private State _state; - - /// - /// NLog logger - /// - private static ILogger _logger; - /// - /// Raytheon configuration - /// - private readonly IConfigurationManager _configurationManager; - private readonly IConfiguration _configuration; - - #endregion - - public bool ClearErrors() => false; - public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } - public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } - public string DetailedStatus => $"This is a TCP/IP Device called {_name}"; - public InstrumentMetadata Info => throw new NotImplementedException(); - public State Status => _state; - public string Name => _name; - public SelfTestResult PerformSelfTest() => SelfTestResult; - public SelfTestResult SelfTestResult => SelfTestResult.Unknown; - public void Open() => Initialize(); - public void Close() => Disconnect(); - public void Shutdown() => Disconnect(); - public void Reset() - { - Close(); - Open(); - } - - #region Public Functions - - /// - /// CommDevice factory constructor - /// - /// - /// - public TcpClient(string deviceInstanceName, IConfigurationManager configurationManager, ILogger logger, string remoteAddress = "", int remotePort = 0) - { - _name = deviceInstanceName; - - _state = State.Uninitialized; - - _logger = logger; - - _configurationManager = configurationManager; - - // configuration obtained from [deviceInstanceName].xml file - _configuration = _configurationManager.GetConfiguration(Name); - - if (string.IsNullOrEmpty(remoteAddress)) - { - _remoteAddress = _configuration.GetConfigurationValue(deviceInstanceName, TcpClientConfigXml.REMOTE_ADDRESS.ToString(), "127.0.0.1"); - } - else - { - _remoteAddress = remoteAddress; - } - - if (remotePort == 0) - { - _remotePort = _configuration.GetConfigurationValue(deviceInstanceName, TcpClientConfigXml.REMOTE_PORT.ToString(), 0); - } - else - { - _remotePort = remotePort; - } - } - - /// - /// Constructor - /// - /// - /// - public TcpClient(string remoteAddress, int remotePort) - { - _remoteAddress = remoteAddress; - _remotePort = remotePort; - } - - /// - /// initialize instrument - /// - public void Initialize() - { - // if remoteAddress is a hostname - if (!IPAddress.TryParse(_remoteAddress, out _ipAddress)) - { - string preferredSubnet = ""; - - IPHostEntry host = Dns.GetHostEntry(_remoteAddress); - foreach (IPAddress ip in host.AddressList) - { - AddressFamily af = ip.AddressFamily; - if (af == AddressFamily.InterNetwork) - { - if (preferredSubnet != String.Empty) - { - if (Regex.IsMatch(ip.ToString(), preferredSubnet, RegexOptions.IgnoreCase)) - _ipAddress = ip; - } - else - _ipAddress = ip; - - if (_ipAddress != null) - break; - } - } - } - - if (_ipAddress != null) - { - if (_remoteEP == null) - _remoteEP = new IPEndPoint(_ipAddress, _remotePort); - } - else - throw new Exception($"Unable to create IPEndPoint to {_remoteAddress}, port {_remotePort}"); - - if (_sock == null) - _sock = new Socket(_ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - } - - /// - /// Connect to remote host - /// - /// - public void Connect() - { - lock (_syncObj) - { - try - { - if (!_sock.Connected && IsRemoteHostAlive()) - _sock.Connect(_remoteEP); - } - catch (ObjectDisposedException) - { - _sock = new Socket(_ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - if (IsRemoteHostAlive()) - _sock.Connect(_remoteEP); - } - catch (Exception) { throw; } - } - } - - /// - /// Disconnect from remote host - /// - /// - public void Disconnect() - { - lock (_syncObj) - { - if (_sock.Connected) - { - _sock.Shutdown(SocketShutdown.Both); - _sock.Disconnect(true); - _sock.Close(); - } - } - } - - /// - /// Ping if remote host is alive - /// - /// true/false - bool IsRemoteHostAlive() - { - bool isRemoteHostAlive = true; - - //Do a ping test to see if the server is reachable - try - { - Ping pingTest = new Ping(); - PingReply reply = pingTest.Send(_ipAddress); - if (reply.Status != IPStatus.Success) - isRemoteHostAlive = false; - } - catch (PingException) - { - isRemoteHostAlive = false; - } - - //See if the tcp state is ok - if (_sock.Poll(5000, SelectMode.SelectRead) && (_sock.Available == 0)) - { - isRemoteHostAlive = false; - } - - return isRemoteHostAlive; - } - - /// - /// Read data from the device. - /// - /// - /// - /// The number of bytes read - public uint Read(ref byte[] dataBuf) - { - int bytesRec = 0; - lock (_syncObj) - { - try - { - bytesRec = _sock.Receive(dataBuf); - } - catch (SocketException) - { - bytesRec = 0; - } - } - - return (uint)bytesRec; - } - - /// - /// Sets the read timeout - /// - /// - public void SetReadTimeout(uint timeoutMs) - { - _sock.ReceiveTimeout = (int)timeoutMs; - } - - /// - /// Write data to device. - /// - /// - /// The number of bytes written - public uint Write(byte[] dataBuf, uint numBytesToWrite) - { - int bytesWritten = 0; - lock (_syncObj) - { - try - { - bytesWritten = _sock.Send(dataBuf, (int)numBytesToWrite, SocketFlags.None); - } - catch (SocketException) - { - bytesWritten = 0; - } - } - - return (uint)bytesWritten; - } - - #endregion - } -} diff --git a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.csproj b/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.csproj deleted file mode 100644 index fb157c4..0000000 --- a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - - net472 - Library - Raytheon.Instruments.EthernetSockets.TcpClient - Raytheon.Instruments - CommDevice TCP implementation - CommDevice TCP implementation - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - Raytheon Technologies - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - - - - - - 1.0.0 - Debug;Release;Deploy - - - - - - - - - - - diff --git a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientFactory.cs b/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientFactory.cs deleted file mode 100644 index 74411ff..0000000 --- a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientFactory.cs +++ /dev/null @@ -1,122 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using NLog; -using Raytheon.Common; -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IO; -using System.Reflection; - -namespace Raytheon.Instruments.EthernetSockets -{ - [ExportInstrumentFactory(ModelNumber = "EthernetSocketsTcpClientFactory")] - public class TcpClientFactory : IInstrumentFactory - { - /// - /// The supported interfaces - /// - private readonly List _supportedInterfaces = new List(); - private static ILogger _logger; - private readonly IConfigurationManager _configurationManager; - private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; - private static string DefaultPath; - - public TcpClientFactory(string defaultConfigPath = DefaultConfigPath) - : this(null, defaultConfigPath) - { - } - - /// - /// COECommDeviceInstrumentFactory injection constructor - /// - /// - /// - /// - [ImportingConstructor] - public TcpClientFactory([Import(AllowDefault = false)] IConfigurationManager configManager, - [Import(AllowDefault = true)] string defaultConfigPath = null) - { - DefaultPath = defaultConfigPath; - _logger = LogManager.GetCurrentClassLogger(); - - if (NLog.LogManager.Configuration == null) - { - var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); - } - - _configurationManager = configManager ?? GetConfigurationManager(); - _supportedInterfaces.Add(typeof(ICommDevice)); - } - - /// - /// Gets the instrument - /// - /// - /// - public IInstrument GetInstrument(string name) - { - try - { - return new TcpClient(name, _configurationManager, _logger); - } - catch (Exception ex) - { - _logger.Error(ex, $"Unable to construct {name} instrument instance"); - return null; - } - } - - /// - /// Gets the instrument - /// - /// - /// - public object GetInstrument(string name, bool simulateHw) - { - try - { - return new TcpClient(name, _configurationManager, _logger); - } - catch (Exception ex) - { - _logger.Error(ex, $"Unable to construct {name} instrument instance"); - return null; - } - } - - /// - /// Gets supported interfaces - /// - /// - public ICollection GetSupportedInterfaces() - { - return _supportedInterfaces.ToArray(); - } - - /// - /// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService - /// - /// - private static IConfigurationManager GetConfigurationManager() - { - return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); - } - } -} \ No newline at end of file diff --git a/Source/Instruments/GeneralIntsrumentManager/GeneralIntsrumentManager.csproj b/Source/Instruments/GeneralIntsrumentManager/GeneralIntsrumentManager.csproj deleted file mode 100644 index 304b978..0000000 --- a/Source/Instruments/GeneralIntsrumentManager/GeneralIntsrumentManager.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - net472 - Library - Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager - Raytheon.Instruments - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - Raytheon Technologies - General Instrument Manager - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - Instrument Manager that works with RINSS or without RINSS - - 1.4.1 - Debug;Release;Deploy - - - - - - - - - - - - - - - - - - diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67XX.csproj b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67XX.csproj deleted file mode 100644 index eadf81c..0000000 --- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67XX.csproj +++ /dev/null @@ -1,43 +0,0 @@ - - - - - net472 - Library - Raytheon.Instruments.PowerSupplies.Keysight67XX - Raytheon.Instruments - Keysight 67XX Series Power Supply - Keysight 67XX Series Power Supply - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - Raytheon Technologies - TEEC - Copyright © Raytheon Technologies $(Year) - - - - - - 1.0.0 - - - - - - - - - - - - - - - - - - - diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerFactory.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerFactory.cs deleted file mode 100644 index f5cbe95..0000000 --- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerFactory.cs +++ /dev/null @@ -1,117 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using NLog; -using Raytheon.Common; -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IO; -using System.Reflection; - -namespace Raytheon.Instruments.PowerSupplies -{ - [ExportInstrumentFactory(ModelNumber = "PowerSupplyKeysightN67xxFactory")] - public class KeysightN67xxPowerFactory : IInstrumentFactory - { - /// - /// The supported interfaces - /// - private readonly List _supportedInterfaces = new List(); - private static ILogger _logger; - private readonly IConfigurationManager _configurationManager; - private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; - private static string DefaultPath; - - public KeysightN67xxPowerFactory(string defaultConfigPath = DefaultConfigPath) - : this(null, defaultConfigPath) - { - } - - /// - /// COECommDeviceInstrumentFactory injection constructor - /// - /// - /// - /// - [ImportingConstructor] - public KeysightN67xxPowerFactory([Import(AllowDefault = false)] IConfigurationManager configManager, - [Import(AllowDefault = true)] string defaultConfigPath = null) - { - DefaultPath = defaultConfigPath; - _logger = LogManager.GetCurrentClassLogger(); - - if (NLog.LogManager.Configuration == null) - { - var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); - } - - _configurationManager = configManager ?? GetConfigurationManager(); - _supportedInterfaces.Add(typeof(PowerSupply)); - } - - /// - /// Gets the instrument - /// - /// - /// - public IInstrument GetInstrument(string name) - { - return null; - } - - /// - /// Gets the instrument - /// - /// - /// - public object GetInstrument(string name, bool simulateHw) - { - try - { - if (simulateHw) - return new PowerSupplySim(name, _configurationManager, _logger); - else - return new KeysightN67xxPowerSupply(name, _configurationManager, _logger); - } - catch (Exception ex) - { - _logger.Error(ex, $"Unable to construct {name} instrument instance"); - return null; - } - } - - /// - /// Gets supported interfaces - /// - /// - public ICollection GetSupportedInterfaces() - { - return _supportedInterfaces.ToArray(); - } - - /// - /// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService - /// - /// - private static IConfigurationManager GetConfigurationManager() - { - return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); - } - } -} \ No newline at end of file diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerModule.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerModule.cs deleted file mode 100644 index 752b47c..0000000 --- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerModule.cs +++ /dev/null @@ -1,662 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using NLog; -using Raytheon.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace Raytheon.Instruments.PowerSupplies -{ - /// - /// Class to simulate any power supply module - /// - class KeysightN67xxPowerModule : PowerSupplyModule - { - private List _groupedModules; - private List _coupledModules; - private string _powerSupplySystemName; - private EthernetSockets.TcpClient _tcpClient; - IConfigurationFile _config; - - private ILogger _logger; - - /// - /// Constructor - /// - public KeysightN67xxPowerModule(string iniFilePath, string powerSupplySystemName) - { - _logger = LogManager.GetCurrentClassLogger(); - _powerSupplySystemName = powerSupplySystemName; - - _config = new ConfigurationFile(iniFilePath); - - string ipAddress = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.ETHERNET_ADDRESS.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - int port = 0; - Int32.TryParse(_config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.ETHERNET_PORT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out port); - string moduleDef = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.MODULE_DEFINITION.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - string coupledModules = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.COUPLED_MODULES.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - string groupedModules = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.GROUPED_MODULES.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - - PowerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); - _coupledModules = coupledModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); - _groupedModules = groupedModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); - - _tcpClient = new EthernetSockets.TcpClient(ipAddress, port); - _tcpClient.Initialize(); - _tcpClient.Connect(); - - ResetPowerSupplySystem(); - - bool systemRebooted = false; - if (_groupedModules.Count() > 1) - GroupModules(_groupedModules, out systemRebooted); - else if (_coupledModules.Count() > 1) - CoupleModules(_coupledModules); - - if (systemRebooted) - { - _tcpClient.Disconnect(); - _tcpClient.Connect(); - } - - if (_groupedModules.Count() > 1) - { - PowerModules.Clear(); - // since modules are grouped, we pick the first module as the representative module - PowerModules.Add(_groupedModules[0]); - } - - // build the power module map - string moduleIndex = ""; - double ovp = 0.0; - double ocp = 0.0; - double voltageSetPoint = 0.0; - double voltageSlewRate = -1.0; - - double minVoltage = 0.0; - double maxVoltage = 0.0; - double minCurrent = 0.0; - double maxCurrent = 0.0; - - for (int i = 0; i < PowerModules.Count(); i++) - { - string moduleName = PowerModules[i]; - - moduleIndex = _config.ReadValue(moduleName, PowerSupplyConfigIni.INDEX.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.OCP.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out ocp); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.OVP.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out ovp); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SETPOINT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSetPoint); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SLEW_RATE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSlewRate); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minVoltage); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxVoltage); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minCurrent); - Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxCurrent); - - PowerModuleInfoDict[moduleName] = new Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo(moduleIndex, ocp, ovp, voltageSetPoint, voltageSlewRate, minVoltage, maxVoltage, minCurrent, maxCurrent); - - ActivePowerModule = moduleName; - SetConstantVoltageMode(); - SetAndConfirmOvp(); - SetAndConfirmOcp(); - SetAndConfirmVoltageSetpoint(); - SetAndConfirmVoltageSlewRate(); - } - } - - /// - /// Enable or Disable Front Panel - /// - /// - /// - public override bool DisplayEnabled - { - set - { - SemObj?.Release(); - } - } - - /// - /// Enable or disable Front Panel - /// - /// - /// - public override bool FrontPanelEnabled - { - set - { - string command; - - try - { - lock (SyncObj) - { - if (value) - command = KeysightPowerSupplyScpiCommands.SET_FRONTPANEL_ENABLE_CMD + "\n"; - else - command = KeysightPowerSupplyScpiCommands.SET_FRONTPANEL_DISABLE_CMD + "\n"; - - SendCommand(command); - } - } - finally { SemObj?.Release(); } - } - } - - /// - /// Turn on power module's output - /// - /// - /// - public override void On() - { - try - { - lock (SyncObj) - { - CheckActivePowerModuleValidity(); - - string command = KeysightPowerSupplyScpiCommands.SET_OUTPUT_ENABLE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - SendCommand(command); - } - } - finally { SemObj?.Release(); } - } - - /// - /// Turn off power module's output - /// - /// - /// - public override void Off() - { - try - { - lock (SyncObj) - { - CheckActivePowerModuleValidity(); - - string command = KeysightPowerSupplyScpiCommands.SET_OUTPUT_DISABLE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - SendCommand(command); - } - } - finally { SemObj?.Release(); } - } - - /// - /// Perform self test - /// - /// - /// - public override SelfTestResult PerformSelfTest() - { - try - { - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.SELFTEST_CMD + "\n"; - - string rsp = SendCommandAndGetResponse(command); - - string[] stringVec = rsp.Split(','); - - int status = -1; - Int32.TryParse(stringVec[0], out status); - - if (status != 0) - { - SelfTestResult = SelfTestResult.Fail; - throw new Exception($"{_powerSupplySystemName}'s self-test failed with error code: {status}"); - } - else - SelfTestResult = SelfTestResult.Pass; - } - } - finally { SemObj?.Release(); } - - return SelfTestResult; - } - - /// - /// Set constant voltage mode - /// - /// - /// - private void SetConstantVoltageMode() - { - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.SET_CONSTANT_VOLTAGE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - SendCommand(command); - } - } - - /// - /// Set and Confirm OVP - /// - /// - /// - private void SetAndConfirmOvp() - { - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.SET_OVP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - SendCommand(command); - - command = KeysightPowerSupplyScpiCommands.READ_OVP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - double ovp = 0.0; - - Double.TryParse(rsp, out ovp); - - if (ovp != PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_) - throw new Exception($"Unable to set OVP. Expected OVP: {PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_}. Actual: {ovp}"); - } - } - - /// - /// Set and Confirm OCP - /// - /// - /// - private void SetAndConfirmOcp() - { - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.SET_OCP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - SendCommand(command); - - command = KeysightPowerSupplyScpiCommands.READ_OCP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - double ocp = 0.0; - - Double.TryParse(rsp, out ocp); - - if (ocp != PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_) - throw new Exception($"Unable to set OCP. Expected OCP: {PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_}. Actual: {ocp}"); - } - } - - /// - /// Set and Confirm Voltage Setpoint - /// - /// - /// - private void SetAndConfirmVoltageSetpoint() - { - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.SET_VOLTAGE_SETPOINT_CMD + " " + PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - SendCommand(command); - - command = KeysightPowerSupplyScpiCommands.READ_VOLTAGE_SETPOINT_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - double voltage = 0.0; - - Double.TryParse(rsp, out voltage); - - if (voltage != PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_) - throw new Exception($"Unable to set Voltage Setpoint. Expected Voltage Setpoint: {PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_}. Actual: {voltage}"); - } - } - - /// - /// Set and Confirm Slew Rate - /// - /// - /// - private void SetAndConfirmVoltageSlewRate() - { - lock (SyncObj) - { - if (PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_ > 0.0) - { - string command = KeysightPowerSupplyScpiCommands.SET_VOLTAGE_SLEW_RATE_CMD + " " + PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - SendCommand(command); - - command = KeysightPowerSupplyScpiCommands.READ_VOLTAGE_SLEW_RATE_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - double voltageSlewRate = 0.0; - - Double.TryParse(rsp, out voltageSlewRate); - - if (voltageSlewRate != PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_) - throw new Exception($"Unable to set Voltage Slew Rate. Expected Voltage Slew Rate: {PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_}. Actual: {voltageSlewRate}"); - } - } - } - - /// - /// Get error code - /// - /// - /// - protected override string GetErrorCode(out int errorCode) - { - errorCode = 0; - string rtn = ""; - - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.READ_ERROR_CODE_CMD + "\n"; - - string rsp = SendCommandAndGetResponse(command); - - string[] stringVec = rsp.Split(','); - - Int32.TryParse(stringVec[0], out errorCode); - - if (stringVec.Length > 1) - { - rtn = stringVec[1]; - } - } - - - return rtn; - } - - /// - /// Read voltage - /// - /// - /// - protected override double ReadVoltage() - { - double val = 0.0; - - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.READ_VOLTAGE_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - - Double.TryParse(rsp, out val); - } - - return val; - } - - /// - /// Read current - /// - /// - /// - protected override double ReadCurrent() - { - double val = 0.0; - - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.READ_CURRENT_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - - Double.TryParse(rsp, out val); - } - - return val; - - } - - /// - /// Read protection status - /// - /// - /// - protected override int ReadProtectionStatus() - { - int val = -1; - - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.READ_PROTECTION_STATUS_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - - Int32.TryParse(rsp, out val); - } - - return val; - } - - /// - /// Determine if module's output is on - /// - /// - /// - protected override bool IsOutputOn() - { - bool isOn = false; - - lock (SyncObj) - { - string command = KeysightPowerSupplyScpiCommands.READ_OUTPUT_STATUS_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n"; - - string rsp = SendCommandAndGetResponse(command); - - int status = -1; - - Int32.TryParse(rsp, out status); - - if (status == 1) - { - isOn = true; - } - } - - return isOn; - } - - /// - /// When modules are grouped, they act as one module - /// - /// - /// - private void GroupModules(List moduleList, out bool systemRebooted) - { - // 1. Group the channels - string groupListToDefine = "(@"; - string groupListToQuery = ""; - string moduleNumber = ""; - - systemRebooted = false; - - for (int i = 0; i < moduleList.Count; i++) - { - moduleNumber = _config.ReadValue(moduleList[i], PowerSupplyConfigIni.INDEX.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - - groupListToDefine += moduleNumber; - groupListToQuery += moduleNumber; - - // add a ',' if this is not the final element in the list - if (i < moduleList.Count() - 1) - { - groupListToDefine += ","; - groupListToQuery += ","; - } - else - { - groupListToDefine += ")"; - } - } - - groupListToQuery = "\"" + groupListToQuery + "\"\n"; - - // see if channels are grouped - string queryGroupCommand = KeysightPowerSupplyScpiCommands.QUERY_GROUP_CHANNELS + "\n"; - - for (int i = 1; i <= 2; i++) - { - string respStr = SendCommandAndGetResponse(queryGroupCommand); - - // if modules are not grouped - if (respStr != groupListToQuery) - { - groupListToDefine += "\n"; - - string groupCommand = KeysightPowerSupplyScpiCommands.SET_GROUP_DEFINE_CMD + " " + groupListToDefine; - - SendCommand(groupCommand); - } - else if (i == 1) - { - break; - } - else - { - string command = KeysightPowerSupplyScpiCommands.REBOOT_CMD + "\n"; - // after grouping the modules, need to reboot system for it to take effect - SendCommand(command); - - // wait 20 seconds for reboot - Thread.Sleep(20000); - - systemRebooted = true; - } - } - } - - /// - /// When modules are coupled, they turned on and off in unison - /// i.e turn on/off one module, all other coupled modules will automatically turn on/off - /// - /// - /// - private void CoupleModules(List moduleList) - { - string coupleListToDefine = ""; - string moduleNumber = ""; - - for (int i = 0; i < moduleList.Count(); i++) - { - moduleNumber = _config.ReadValue(moduleList[i], PowerSupplyConfigIni.INDEX.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - - coupleListToDefine += moduleNumber; - - // add a ',' if this is not the final element in the list - if (i < moduleList.Count() - 1) - { - coupleListToDefine += ","; - } - } - - coupleListToDefine += "\n"; - - // see if channels are grouped - string queryCoupleChannelCommand = KeysightPowerSupplyScpiCommands.QUERY_COUPLE_CHANNELS + "\n"; - - for (int i = 1; i <= 2; i++) - { - string respStr = SendCommandAndGetResponse(queryCoupleChannelCommand); - - string queryCoupleStateCommand = KeysightPowerSupplyScpiCommands.QUERY_COUPLE_STATE + "\n"; - string respStr2 = SendCommandAndGetResponse(queryCoupleStateCommand); - - if (coupleListToDefine != respStr || respStr2 == "0\n") - { - // send command to couple modules - string command = KeysightPowerSupplyScpiCommands.SET_COUPLE_CHANNELS_CMD + " " + coupleListToDefine; - SendCommand(command); - - // turn coupling on - command = KeysightPowerSupplyScpiCommands.SET_COUPLE_ON_CMD + "\n"; - SendCommand(command); - - // output protection on - command = KeysightPowerSupplyScpiCommands.SET_COUPLE_OUTPUT_PROTECT_ON_CMD + "\n"; - SendCommand(command); - } - else if (i == 1) - break; - } - } - - /// - /// Reset Power Supply System - /// - /// - /// - private void ResetPowerSupplySystem() - { - // send the command - string command = KeysightPowerSupplyScpiCommands.RESET_CMD + "\n"; - SendCommand(command); - } - - /// - /// Send command - /// - /// - /// - private void SendCommand(string command) - { - lock (SyncObj) - { - byte[] msg = Encoding.ASCII.GetBytes(command); - - _tcpClient.Write(msg, (uint)msg.Length); - } - } - - /// - /// Send command and get response - /// - /// - /// - private string SendCommandAndGetResponse(string command) - { - lock (SyncObj) - { - byte[] readBuf = new byte[100]; - _tcpClient.SetReadTimeout(2000); - - int bytesRec = 0; - - SendCommand(command); - - try - { - bytesRec = (int)_tcpClient.Read(ref readBuf); - } - catch (SocketException ex) - { - throw new Exception("SocketException Error Code: " + ex.ErrorCode + $" ({((SocketError)ex.ErrorCode).ToString()})"); - } - - return Encoding.ASCII.GetString(readBuf, 0, bytesRec); - } - } - } -} diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerSupply.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerSupply.cs deleted file mode 100644 index 7a4b607..0000000 --- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerSupply.cs +++ /dev/null @@ -1,131 +0,0 @@ -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ - -using NLog; -using Raytheon.Common; -using Raytheon.Instruments.EthernetSockets; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; - -namespace Raytheon.Instruments.PowerSupplies -{ - /// - /// Class for controlling a Keysightt N6700 Series Power Supply System - /// - public class KeysightN67xxPowerSupply : PowerSupply - { - private string _iniFilePath; - - private static ILogger _logger; - private readonly IConfigurationManager _configurationManager; - private readonly IConfiguration _configuration; - - /// - /// Constructor - /// - public KeysightN67xxPowerSupply(string deviceInstanceName, IConfigurationManager configurationManager, ILogger logger) - { - Name = deviceInstanceName; - _logger = logger; - _configurationManager = configurationManager; - - // configuration obtained from [deviceInstanceName].xml file - _configuration = _configurationManager.GetConfiguration(Name); - - string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - _iniFilePath = Path.Combine(assemblyFolder, _configuration.GetConfigurationValue(deviceInstanceName, PowerSupplyConfigXml.INI_FILE_PATH.ToString(), $".\\{Raytheon.Common.GeneralConstants.InstrumentConfigFolder}\\{deviceInstanceName}.ini")); - } - - /// - /// Perform shutdown - /// - /// - /// - public override void Shutdown() - { - } - - /// - /// Perform reset - /// - /// - /// - public override void Reset() - { - } - - /// - /// Clear errors - /// - /// - /// - public override bool ClearErrors() - { - return true; - } - - /// - /// Implement Indexer in order to access a specific power module - /// - /// - /// - public override PowerSupplyModule this[object powerDeviceId] - { - get - { - string powerDeviceName = String.Empty; - - if (powerDeviceId != null && (powerDeviceId.GetType().IsEnum || powerDeviceId is string)) - { - powerDeviceName = powerDeviceId.ToString(); - } - else if (powerDeviceId != null) - { - throw new ArgumentException($"{nameof(powerDeviceId)} must be null or enumerated or string type"); - } - - _powerSupplyModule.GetSemphamore().WaitOne(); - - if (powerDeviceId != null) - _powerSupplyModule.SetActivePowerModule(powerDeviceName); - - return _powerSupplyModule; - } - } - - /// - /// Group or couple modules as specified in config file - /// Gather information for each power module from config file - /// - /// - /// - public override void Initialize() - { - _powerSupplyModule = new KeysightN67xxPowerModule(_iniFilePath, Name); - } - } -} diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightPowerSupplyScpiCommands.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightPowerSupplyScpiCommands.cs deleted file mode 100644 index 12694dd..0000000 --- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightPowerSupplyScpiCommands.cs +++ /dev/null @@ -1,80 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Raytheon.Instruments.PowerSupplies -{ - public static class KeysightPowerSupplyScpiCommands - { - public static string CLEAR_CMD = "*CLS"; - public static string RESET_CMD = "*RST"; - public static string SELFTEST_CMD = "*TST?"; - public static string READ_ERROR_CODE_CMD = "SYST:ERR?"; - public static string REBOOT_CMD = "SYST:REB"; - - // panel disable/enable commands - public static string SET_FRONTPANEL_DISABLE_CMD = "SYST:COMM:RLST RWL"; - public static string SET_FRONTPANEL_ENABLE_CMD = "SYST:COMM:RLST REM"; - - // watchdog commands - public static string SET_WATCHDOGDELAY_CMD = "OUTP:PROT:WDOG:DEL"; - public static string SET_WATCHDOGON_CMD = "OUTP:PROT:WDOG ON"; - public static string SET_WATCHDOGOFF_CMD = "OUTP:PROT:WDOG OFF"; - - // coupling commands - public static string SET_COUPLE_CHANNELS_CMD = "OUTP:COUP:CHAN"; - public static string SET_COUPLE_ON_CMD = "OUTP:COUP ON"; - public static string SET_COUPLE_OUTPUT_PROTECT_ON_CMD = "OUTP:PROT:COUP ON"; - public static string QUERY_COUPLE_CHANNELS = "OUTP:COUP:CHAN?"; - public static string QUERY_COUPLE_STATE = "OUTP:COUP?"; - - // Grouping Commands - public static string SET_GROUP_DEFINE_CMD = "SYST:GRO:DEF"; - public static string UNGROUP_ALL_CHANNELS_CMD = "SYST:GRO:DEL:ALL"; - public static string QUERY_GROUP_CHANNELS = "SYST:GRO:CAT?"; - - // current commands - public static string SET_OCP_CMD = "CURR:LEV"; - public static string SET_OCP_ON_CMD = "CURR:PROT:STAT ON"; - public static string READ_CURRENT_CMD = "MEAS:CURR?"; - public static string READ_OCP_CMD = "CURR:LEV?"; - - // voltage commands - public static string SET_OVP_CMD = "VOLT:PROT"; - public static string SET_VOLTAGE_SLEW_RATE_CMD = "VOLT:SLEW"; - public static string SET_VOLTAGE_SETPOINT_CMD = "VOLT:LEV"; - public static string SET_CONSTANT_VOLTAGE_CMD = "STAT:OPER:ENAB 1"; - public static string READ_VOLTAGE_CMD = "MEAS:VOLT?"; - public static string READ_VOLTAGE_SETPOINT_CMD = "VOLT?"; - public static string READ_OVP_CMD = "VOLT:PROT?"; - public static string READ_VOLTAGE_SLEW_RATE_CMD = "VOLT:SLEW?"; - - // set output commands - public static string SET_OUTPUT_DISABLE_CMD = "OUTP OFF"; - public static string SET_OUTPUT_ENABLE_CMD = "OUTP ON"; - - //query status - public static string READ_OUTPUT_STATUS_CMD = "OUTP?"; - public static string READ_ERROR_STATUS_CMD = "SYST:ERR?"; - public static string READ_PROTECTION_STATUS_CMD = "STAT:QUES:COND?"; - } -} diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplyModuleSim.cs b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplyModuleSim.cs deleted file mode 100644 index 595ea3f..0000000 --- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplyModuleSim.cs +++ /dev/null @@ -1,252 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using NLog; -using Raytheon.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Raytheon.Instruments.PowerSupplies -{ - /// - /// Class to simulate any power supply module - /// - class PowerSupplyModuleSim : PowerSupplyModule - { - private List _groupedModules; - private List _coupledModules; - private string _powerSupplySystemName; - private bool _frontPanelEnabled = true; - - private ILogger _logger; - - /// - /// Constructor - /// - public PowerSupplyModuleSim(string iniFilePath, string powerSupplySystemName) - { - _logger = LogManager.GetCurrentClassLogger(); - _powerSupplySystemName = powerSupplySystemName; - - IConfigurationFile config = new ConfigurationFile(iniFilePath); - - string moduleDef = config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.MODULE_DEFINITION.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - string coupledModules = config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.COUPLED_MODULES.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - string groupedModules = config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.GROUPED_MODULES.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - - PowerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); - _coupledModules = coupledModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); - _groupedModules = groupedModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); - - if (_groupedModules.Count() > 1) - { - PowerModules.Clear(); - // since modules are grouped, we pick the first module as the representative module - PowerModules.Add(_groupedModules[0]); - } - - // build the power module map - string moduleIndex = ""; - double ovp = 0.0; - double ocp = 0.0; - double voltageSetPoint = 0.0; - double voltageSlewRate = 0.0; - - double minVoltage = 0.0; - double maxVoltage = 0.0; - double minCurrent = 0.0; - double maxCurrent = 0.0; - - for (int i = 0; i < PowerModules.Count(); i++) - { - string moduleName = PowerModules[i]; - - moduleIndex = config.ReadValue(moduleName, PowerSupplyConfigIni.INDEX.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.OCP.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out ocp); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.OVP.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out ovp); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SETPOINT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSetPoint); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SLEW_RATE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSlewRate); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minVoltage); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxVoltage); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minCurrent); - Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxCurrent); - - PowerModuleInfoDict[moduleName] = new Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo(moduleIndex, ocp, ovp, voltageSetPoint, voltageSlewRate, minVoltage, maxVoltage, minCurrent, maxCurrent); - } - } - - /// - /// Enable or Disable Front Panel - /// - /// - /// - public override bool DisplayEnabled - { - set { SemObj?.Release(); } - } - - /// - /// Enable or disable Front Panel - /// - /// - /// - public override bool FrontPanelEnabled - { - set {_frontPanelEnabled = value; SemObj?.Release(); } - } - - /// - /// Turn on power module's output - /// - /// - /// - public override void On() - { - try - { - lock (SyncObj) - { - CheckActivePowerModuleValidity(); - - if (_coupledModules.Contains(ActivePowerModule)) - { - foreach (string module in _coupledModules) - { - PowerModuleInfoDict[module].isOn_ = true; - } - } - else - PowerModuleInfoDict[ActivePowerModule].isOn_ = true; - } - } - finally { SemObj?.Release(); } - } - - /// - /// Turn off power module's output - /// - /// - /// - public override void Off() - { - try - { - lock (SyncObj) - { - CheckActivePowerModuleValidity(); - - if (_coupledModules.Contains(ActivePowerModule)) - { - foreach (string module in _coupledModules) - { - PowerModuleInfoDict[module].isOn_ = false; - } - } - else - PowerModuleInfoDict[ActivePowerModule].isOn_ = false; - } - } - finally { SemObj?.Release(); }; - } - - /// - /// Perform self test - /// - /// - /// - public override SelfTestResult PerformSelfTest() - { - try - { - lock (SyncObj) - { - SelfTestResult = SelfTestResult.Pass; - } - } - finally { SemObj?.Release(); }; - - return SelfTestResult; - } - - /// - /// Read voltage - /// - /// - /// - protected override double ReadVoltage() - { - double val = 0.0; - - lock (SyncObj) - { - if (PowerModuleInfoDict[ActivePowerModule].isOn_) - val = PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_; - } - - return val; - } - - /// - /// Read current - /// - /// - /// - protected override double ReadCurrent() - { - double val = 0.0; - - lock (SyncObj) - { - if (PowerModuleInfoDict[ActivePowerModule].isOn_) - val = (PowerModuleInfoDict[ActivePowerModule].currentLowerLimit_ + PowerModuleInfoDict[ActivePowerModule].currentUpperLimit_) / 2.0; - } - - return val; - } - - /// - /// Read protection status - /// - /// - /// - protected override int ReadProtectionStatus() - { - lock (SyncObj) - { - return 0; - } - } - - /// - /// Get error code - /// - /// - /// - protected override string GetErrorCode(out int errorCode) - { - lock (SyncObj) - { - errorCode = 0; - return ""; - } - } - - } -} diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.cs b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.cs deleted file mode 100644 index 5504d21..0000000 --- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.cs +++ /dev/null @@ -1,125 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using NLog; -using Raytheon.Common; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace Raytheon.Instruments.PowerSupplies -{ - /// - /// Class to simulate any power supply system - /// - public class PowerSupplySim : PowerSupply - { - private string _iniFilePath; - - private static ILogger _logger; - private readonly IConfigurationManager _configurationManager; - private readonly IConfiguration _configuration; - - /// - /// Constructor - /// - public PowerSupplySim(string deviceInstanceName, IConfigurationManager configurationManager, ILogger logger) - { - Name = deviceInstanceName; - _logger = logger; - _configurationManager = configurationManager; - _configuration = _configurationManager.GetConfiguration(Name); - - string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - _iniFilePath = Path.Combine(assemblyFolder,_configuration.GetConfigurationValue(deviceInstanceName, "IniFilePath", $".\\{Raytheon.Common.GeneralConstants.InstrumentConfigFolder}\\{deviceInstanceName}.ini")); - } - - /// - /// Perform shutdown - /// - /// - /// - public override void Shutdown() - { - } - - /// - /// Perform reset - /// - /// - /// - public override void Reset() - { - } - - /// - /// Clear errors - /// - /// - /// - public override bool ClearErrors() - { - return true; - } - - /// - /// Group or couple modules as specified in config file - /// Gather information for each power module from config file - /// - /// - /// - public override void Initialize() - { - _powerSupplyModule = new PowerSupplyModuleSim(_iniFilePath, Name); - } - - /// - /// Implement Indexer to obtain a power module - /// - /// - /// - public override PowerSupplyModule this[object powerDeviceId] - { - get - { - string powerDeviceName = String.Empty; - - if (powerDeviceId != null && (powerDeviceId.GetType().IsEnum || powerDeviceId is string)) - { - powerDeviceName = powerDeviceId.ToString(); - } - else if (powerDeviceId != null) - { - throw new ArgumentException($"{nameof(powerDeviceId)} must be null or enumerated or string type"); - } - - _powerSupplyModule.GetSemphamore().WaitOne(); - - if (powerDeviceId != null) - _powerSupplyModule.SetActivePowerModule(powerDeviceName); - - return _powerSupplyModule; - } - } - } -} diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.csproj b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.csproj deleted file mode 100644 index 64384fc..0000000 --- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - - net472 - Library - Raytheon.Instruments.PowerSupplies.Simulation - Raytheon.Instruments - Power Supply Simulation - Power Supply Simulation - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - Raytheon Technologies - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - - - - - - 1.0.0 - Debug;Release;Deploy - - - - - - - - - - - - - - - - - diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySimFactory.cs b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySimFactory.cs deleted file mode 100644 index fae00d2..0000000 --- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySimFactory.cs +++ /dev/null @@ -1,114 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using NLog; -using Raytheon.Common; -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IO; -using System.Reflection; - -namespace Raytheon.Instruments.PowerSupplies -{ - [ExportInstrumentFactory(ModelNumber = "PowerSupplySimulationFactory")] - public class PowerSupplySimulationFactory : IInstrumentFactory - { - /// - /// The supported interfaces - /// - private readonly List _supportedInterfaces = new List(); - private static ILogger _logger; - private readonly IConfigurationManager _configurationManager; - private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; - private static string DefaultPath; - - public PowerSupplySimulationFactory(string defaultConfigPath = DefaultConfigPath) - : this(null, defaultConfigPath) - { - } - - /// - /// COECommDeviceInstrumentFactory injection constructor - /// - /// - /// - /// - [ImportingConstructor] - public PowerSupplySimulationFactory([Import(AllowDefault = false)] IConfigurationManager configManager, - [Import(AllowDefault = true)] string defaultConfigPath = null) - { - DefaultPath = defaultConfigPath; - _logger = LogManager.GetCurrentClassLogger(); - - if (NLog.LogManager.Configuration == null) - { - var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); - } - - _configurationManager = configManager ?? GetConfigurationManager(); - _supportedInterfaces.Add(typeof(PowerSupply)); - } - - /// - /// Gets the instrument - /// - /// - /// - public IInstrument GetInstrument(string name) - { - return null; - } - - /// - /// Gets the instrument - /// - /// - /// - public object GetInstrument(string name, bool simulateHw) - { - try - { - return new PowerSupplySim(name, _configurationManager, _logger); - } - catch (Exception ex) - { - _logger.Error(ex, $"Unable to construct {name} instrument instance"); - return null; - } - } - - /// - /// Gets supported interfaces - /// - /// - public ICollection GetSupportedInterfaces() - { - return _supportedInterfaces.ToArray(); - } - - /// - /// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService - /// - /// - private static IConfigurationManager GetConfigurationManager() - { - return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); - } - } -} \ No newline at end of file diff --git a/Source/Interfaces/ICommDevice/CommDevice.Contracts.csproj b/Source/Interfaces/ICommDevice/CommDevice.Contracts.csproj deleted file mode 100644 index d3d1df5..0000000 --- a/Source/Interfaces/ICommDevice/CommDevice.Contracts.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - net472 - Library - Raytheon.Instruments.CommDevice.Contracts - Raytheon.Instruments - ICommDevice interface definition - true - Raytheon Technologies - HAL - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - - 1.0.0 - Debug;Release;Deploy - - - - - - - - - - diff --git a/Source/Interfaces/ICommDevice/ICommDevice.cs b/Source/Interfaces/ICommDevice/ICommDevice.cs deleted file mode 100644 index e85c655..0000000 --- a/Source/Interfaces/ICommDevice/ICommDevice.cs +++ /dev/null @@ -1,63 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using Raytheon.Communication; - -namespace Raytheon.Instruments -{ - /// - /// An interface to any device that you can write and read to/from - /// - public interface ICommDevice : IInstrument - { - /// - /// Close the communication interface - /// - [UmsCommand("ICommDevice.Close")] - void Close(); - - /// - /// Open the communication interface - /// - [UmsCommand("ICommDevice.Open")] - void Open(); - - /// - /// Reads data from a communication device - /// - /// - /// number of bytes read - [UmsCommand("ICommDevice.Read")] - uint Read(ref byte[] dataRead); - - /// - /// Set the timeout on a read - /// - /// - [UmsCommand("ICommDevice.SetReadTimeout")] - void SetReadTimeout(uint timeout); - - /// - /// Writes data to a communication device - /// - /// - /// - /// the number of bytes written - [UmsCommand("ICommDevice.Write")] - uint Write(byte[] data, uint numBytesToWrite); - } -} diff --git a/Source/Interfaces/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj b/Source/Interfaces/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj deleted file mode 100644 index da6120c..0000000 --- a/Source/Interfaces/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - net472 - Library - Raytheon.Instruments.InstrumentManager.Contracts - Raytheon.Instruments - Raytheon Technologies - Raytheon Configuration - Instrument Manager Interface - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - True - - 1.7.1.0 - Debug;Release;Deploy - - - - - - - - - - \ No newline at end of file diff --git a/Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj b/Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj deleted file mode 100644 index ecc1000..0000000 --- a/Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net472 - Library - Raytheon.Instruments.PowerSupply.Contracts - Raytheon.Instruments - PowerSupply Interface - true - Raytheon Technologies - HAL - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - 1.1.0.0 - Debug;Release;Deploy - - - - - - - - - - diff --git a/Source/Interfaces/PowerSupply/PowerSupply.cs b/Source/Interfaces/PowerSupply/PowerSupply.cs deleted file mode 100644 index 960964b..0000000 --- a/Source/Interfaces/PowerSupply/PowerSupply.cs +++ /dev/null @@ -1,63 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Raytheon.Instruments -{ - /// - /// Base class that defines interface for power supply systems - /// - public abstract class PowerSupply : Instrument - { - protected PowerSupplyModule _powerSupplyModule; - - /// - /// Implement Indexer in order to access a specific power module - /// - /// - /// - public virtual PowerSupplyModule this[object i] - { - get { return null; } - } - - /// - /// Get power supply module info dictionary - /// - /// - /// - public Dictionary GetPowerSupplyModuleInfoDict() - { - return _powerSupplyModule.PowerModuleInfoDict; - } - - /// - /// Get power supply module names - /// - /// - /// - public List GetPowerSupplyModuleNames() - { - return _powerSupplyModule.PowerModules; - } - } -} diff --git a/Source/Interfaces/PowerSupply/PowerSupplyModule.cs b/Source/Interfaces/PowerSupply/PowerSupplyModule.cs deleted file mode 100644 index 178fbd8..0000000 --- a/Source/Interfaces/PowerSupply/PowerSupplyModule.cs +++ /dev/null @@ -1,207 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using Raytheon.Instruments.PowerSupplies; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace Raytheon.Instruments -{ - /// - /// Base class that defines interface for power supply modules - /// - public abstract class PowerSupplyModule - { - protected Semaphore SemObj = new System.Threading.Semaphore(initialCount: 1, maximumCount: 1); - protected object SyncObj = new object(); - protected string ActivePowerModule; - - public List PowerModules { get; protected set; } - - public Dictionary PowerModuleInfoDict { get; protected set; } - - /// - /// Constructor - /// - public PowerSupplyModule() - { - PowerModuleInfoDict = new Dictionary(); - } - - /// - /// DisplayEnabled - some instruments will be no-op, but likely needed on all - /// will shut down any display on the hardware to hide any - /// classified information if visible - /// - public virtual bool DisplayEnabled - { - get; - set; - } - - /// - /// FrontPanelEnabled - some instruments will be no-op, but likely needed on all - /// has the ability to disable any panel buttons, so that - /// the hardware may not be changed by human touch - /// - public virtual bool FrontPanelEnabled - { - private get; - set; - } - - /// - /// SelfTestResult - end result of the hardware self test performed - /// - public SelfTestResult SelfTestResult - { - get; - set; - } - - /// - /// PerformSelfTest - do a hardware self test - /// - /// result of the self test - public abstract SelfTestResult PerformSelfTest(); - - /// - /// Set active module - /// - /// - /// - public void SetActivePowerModule(string activePowerModule) - { - ActivePowerModule = activePowerModule; - } - - /// - /// Check if active module is valid - /// - /// - /// - protected void CheckActivePowerModuleValidity() - { - if (ActivePowerModule == null || ActivePowerModule.Length == 0) - throw new Exception($"{nameof(ActivePowerModule)} is not set"); - - if (!PowerModuleInfoDict.ContainsKey(ActivePowerModule)) - throw new Exception($"Invalid power module: {ActivePowerModule}"); - } - - /// - /// Return semaphore - /// - /// - /// - public Semaphore GetSemphamore() { return SemObj; } - - /// - /// Turn on power module's output - /// - /// - /// - public abstract void On(); - - /// - /// Turn off power module's output - /// - /// - /// - public abstract void Off(); - - /// - /// Determine if module's output is on - /// - /// - /// - protected virtual bool IsOutputOn() - { - bool isOn = false; - - lock (SyncObj) - { - CheckActivePowerModuleValidity(); - - isOn = PowerModuleInfoDict[ActivePowerModule].isOn_; - } - - return isOn; - } - - /// - /// Read power supply module's data all at once - /// - /// - /// - public virtual void ReadPowerSupplyData(out double volts, out double current, out double voltSetpoint, out bool isOn, out int faultStatus) - { - volts = 0.0; - current = 0.0; - voltSetpoint = 0.0; - isOn = false; - faultStatus = 0; - try - { - lock (SyncObj) - { - CheckActivePowerModuleValidity(); - - volts = ReadVoltage(); - current = ReadCurrent(); - voltSetpoint = PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_; - isOn = IsOutputOn(); - faultStatus = ReadProtectionStatus(); - } - } - finally { SemObj?.Release(); }; - } - - /// - /// Read voltage - /// - /// - /// - protected abstract double ReadVoltage(); - - /// - /// Read current - /// - /// - /// - protected abstract double ReadCurrent(); - - /// - /// Read protection status - /// - /// - /// - protected abstract int ReadProtectionStatus(); - - /// - /// Get error code - /// - /// - /// - protected abstract string GetErrorCode(out int errorCode); - } -} diff --git a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerModuleMeasurementManager.cs b/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerModuleMeasurementManager.cs deleted file mode 100644 index 1636769..0000000 --- a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerModuleMeasurementManager.cs +++ /dev/null @@ -1,143 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using Raytheon.Common; -using Raytheon.Instruments; -using System; -using System.Collections.Generic; -using NLog; - -namespace Raytheon -{ - /// - /// Class for controlling all power supplies - /// - public class PowerModuleMeasurementManager - { - #region PrivateClassMembers - /// - /// NLog logger - /// - private static NLog.ILogger _logger; - - private PowerSupply _powerSupply; - - private IConfigurationFile _powerOffAndSelfTestConfig; - - #endregion - - public bool FrontPanelEnabled - { - private get { return false; } - set - { - if (_powerSupply != null) - { - _powerSupply[null].FrontPanelEnabled = value; - } - } - } - - /// - /// constructor - /// - /// - public PowerModuleMeasurementManager(PowerSupply powerSupply, IConfigurationFile powerOffAndSelfTestConfig) - { - _logger = LogManager.GetCurrentClassLogger(); - - _powerSupply = powerSupply; - _powerOffAndSelfTestConfig = powerOffAndSelfTestConfig; - } - - /// - /// The Finalizer - /// - ~PowerModuleMeasurementManager() - { - _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ..."); - } - - /// - /// Initialize the instrument(s) - /// - public void Initialize() - { - _logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); - } - - /// - /// Shuts down manager, clears resources - /// - public void Shutdown() - { - _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); - _powerSupply.Shutdown(); - } - - /// - /// Read various power supply data - /// - public void ReadPowerSupplyData(object module, out double voltage, out double current, out double voltageSetPoint, out bool isOn, out int faultStatus) - { - _powerSupply[module].ReadPowerSupplyData(out voltage, out current, out voltageSetPoint, out isOn, out faultStatus); - } - - /// - /// Get all the names of modules in the power system - /// - public List GetModuleNames() - { - return _powerSupply.GetPowerSupplyModuleNames(); - } - - /// - /// Get all the configuration information for each module - /// - public Dictionary GetPowerSupplyModuleInfoDict() - { - return _powerSupply.GetPowerSupplyModuleInfoDict(); - } - - /// - /// Enable the output of the power supply. - /// - /// The name of the module to enable. - public void OutputEnable(object module) - { - _powerSupply[module].On(); - } - - /// - /// Disable the output of the power supply. - /// - /// - /// - public void OutputDisable(object module) - { - _powerSupply[module].ReadPowerSupplyData(out double voltage, out double current, out double voltageSetPoint, out bool isOn, out int faultStatus); - - if (isOn) - { - _powerSupply[module].Off(); - - // save the time of this power off to file - MeasurementManager.PowerSupply.Util.SaveTime(_powerSupply.Name, DateTime.Now.ToString(), null, _powerOffAndSelfTestConfig); - } - } - } -} diff --git a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager .cs b/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager .cs deleted file mode 100644 index b4e5869..0000000 --- a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager .cs +++ /dev/null @@ -1,223 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using NLog; -using Raytheon.Common; -using Raytheon.Instruments; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Raytheon -{ - /// - /// Class for controlling all power supplies - /// - public class PowerSupplyMeasurementManager - { - #region PrivateClassMembers - /// - /// NLog logger - /// - private static NLog.ILogger _logger; - - private IConfigurationFile _powerOffAndSelfTestConfig; - - private IInstrumentManager _instrumentManager; - - private Dictionary _powerSystemNameToPowerModuleMeasurementManagerDict = new Dictionary(); - - string _powerSystemWithFailedSelfTest = String.Empty; - - #endregion - - /// - /// constructor - /// - /// the name specified in the Instruments.xml file - public PowerSupplyMeasurementManager(IInstrumentManager instrumentManager, string powerSupplySelfTestLogFile) - { - _logger = LogManager.GetCurrentClassLogger(); - - _powerOffAndSelfTestConfig = new ConfigurationFile(powerSupplySelfTestLogFile); - - _instrumentManager = instrumentManager; - } - - /// - /// The Finalizer - /// - ~PowerSupplyMeasurementManager() - { - _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ..."); - } - - /// - /// Implement Indexer to obtain a powermodulemeasurementmanager - /// - /// - /// - public PowerModuleMeasurementManager this[object powerSystemId] - { - get - { - string powerSystemName; - if (powerSystemId.GetType().IsEnum || powerSystemId is string) - { - powerSystemName = powerSystemId.ToString(); - } - else - { - throw new ArgumentException($"{nameof(powerSystemId)} must be an enumerated or string type"); - } - - if (!_powerSystemNameToPowerModuleMeasurementManagerDict.ContainsKey(powerSystemName)) - { - throw new Exception($"Invalid power supply system: {powerSystemName}"); - } - - return _powerSystemNameToPowerModuleMeasurementManagerDict[powerSystemName]; - } - } - - /// - /// Initialize the instrument(s) - /// - public void Initialize() - { - _logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); - - PerformSelfTest(); - - if (_powerSystemWithFailedSelfTest != String.Empty) - { - throw new Exception($"{_powerSystemWithFailedSelfTest}'s self-test failed."); - } - } - - /// - /// Perform self test on power supply system - /// Self test for each power system takes a while, so we don't want to run self test every time we initialize the power system - /// So we only want to run self test under 2 conditions: - /// 1. Certain time has elapsed since last power off - /// 2. Certain time has elapsed since last self test run ( in the absence of power off time) - /// - /// - /// - private async void PerformSelfTest() - { - _logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); - - string errorMsg = String.Empty; - - Dictionary> powerSystemToSelfTestTaskDict = new Dictionary>(); - - bool allSelfTestsPassed = true; - - ICollection psList = _instrumentManager.GetInstruments(typeof(PowerSupply)); - - foreach (PowerSupply ps in psList) - { - ps.Initialize(); - - // perform self test on power system - Task task = PerformSelfTestTask(ps); - powerSystemToSelfTestTaskDict[ps.Name] = task; - } - - foreach (var item in powerSystemToSelfTestTaskDict) - { - // wait for self test on power system to finish - SelfTestResult result = await item.Value; - - if (result == SelfTestResult.Fail && String.IsNullOrEmpty(_powerSystemWithFailedSelfTest)) - { - allSelfTestsPassed = false; - _powerSystemWithFailedSelfTest = item.Key; - } - } - - if (allSelfTestsPassed) - { - foreach (PowerSupply ps in psList) - { - _powerSystemNameToPowerModuleMeasurementManagerDict[ps.Name] = new PowerModuleMeasurementManager(ps, _powerOffAndSelfTestConfig); - } - } - } - - /// - /// Perform self test on power supply system - /// Self test for each power system takes a while, so we don't want to run self test every time we initialize the power system - /// So we only want to run self test under 2 conditions: - /// 1. Certain time has elapsed since last power off - /// 2. Certain time has elapsed since last self test run ( in the absence of power off time) - /// - /// - /// - private Task PerformSelfTestTask(PowerSupply ps) - { - SelfTestResult result = SelfTestResult.Pass; - - _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() for {ps.Name} is running..."); - - try - { - bool performSelfTest = false; - const int HOURS_ELAPSED = 2; - - string lastSaveTime = MeasurementManager.PowerSupply.Util.GetLastSavedTime(ps.Name, _powerOffAndSelfTestConfig); - - if (DateTime.TryParse(lastSaveTime, out DateTime dt)) - { - // if this power supply system has been turn off for a certain number of hours, then we want to perform self test on it - if (DateTime.Now.Subtract(dt).TotalHours >= HOURS_ELAPSED) - { - performSelfTest = true; - } - } - else { performSelfTest = true; } - - if (performSelfTest) - { - _logger?.Info($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() executing self-test for {ps.Name}..."); - - result = ps[null].PerformSelfTest(); - - if (result == SelfTestResult.Pass) - { - // save the time of this self test to file - MeasurementManager.PowerSupply.Util.SaveTime(ps.Name, null, DateTime.Now.ToString(), _powerOffAndSelfTestConfig); - } - } - else - _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() skipping self-test for {ps.Name}..."); - } - catch (Exception ex) - { - _logger?.Error(ex.Message + "\n" + ex.StackTrace); - } - - _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() for {ps.Name} is exiting..."); - - return Task.FromResult(result); - } - - - } -} diff --git a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager.csproj b/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager.csproj deleted file mode 100644 index 9ebb66f..0000000 --- a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - - net472 - Library - Raytheon.InstrumentManagers.PowerSupplyManager - Raytheon.InstrumentManagers - Power Supply Manager Implementation - Provide access to the actual power supplies - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - Raytheon Technologies - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - - - - - - 1.0.0 - Debug;Release;Deploy - - - - - - - - - - - - - - - - diff --git a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplySelfTestTime.cs b/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplySelfTestTime.cs deleted file mode 100644 index 5d2184c..0000000 --- a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplySelfTestTime.cs +++ /dev/null @@ -1,64 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ - -using System; -using System.Collections; -using System.IO; -using System.Xml.Serialization; - -namespace Raytheon -{ - /// - /// Serialiable class to store self test and power off time to XML - /// and restore info from XML to this class - /// - [Serializable] - public class PowerSupplySelfTestTime - { - [XmlAttribute("power_system")] - public string _powerSystem { get; set; } - - // date and time of last power off of a power module - [XmlAttribute("power_off_time")] - public string _powerOffTime { get; set; } - - // date and time of last successful self test - [XmlAttribute("self_test_time")] - public string _selfTestTime { get; set; } - - /// - /// constructor - /// - public PowerSupplySelfTestTime() - { - _powerOffTime = Raytheon.Common.GeneralConstants.DefaultConfigValue; - _powerSystem = Raytheon.Common.GeneralConstants.DefaultConfigValue; - _selfTestTime = Raytheon.Common.GeneralConstants.DefaultConfigValue; - } - - /// - /// constructor - /// - public PowerSupplySelfTestTime(string powerSystem, string powerOffTime, string selfTestTime) - { - _powerOffTime = powerOffTime; - _powerSystem = powerSystem; - _selfTestTime = selfTestTime; - } - } -} \ No newline at end of file diff --git a/Source/MeasurementManagers/PowerSupplyMeasurementManager/Util.cs b/Source/MeasurementManagers/PowerSupplyMeasurementManager/Util.cs deleted file mode 100644 index 2a036b1..0000000 --- a/Source/MeasurementManagers/PowerSupplyMeasurementManager/Util.cs +++ /dev/null @@ -1,115 +0,0 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED -/*------------------------------------------------------------------------- -RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION -PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS -AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO -UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO -RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS -CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS -OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON -COMPANY. - -THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. -GOVERNMENT. - -UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. --------------------------------------------------------------------------*/ -using Raytheon.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Raytheon.MeasurementManager.PowerSupply -{ - /// - /// Define non-specific constants - /// - internal static class Util - { - /// - /// Read from the XML file the time for this power system - /// If time of power off is available, we return this time - /// If time of last self test run is available, we return this time - /// - /// - /// - public static string GetLastSavedTime(string powerSystem, IConfigurationFile powerOffAndSelfTestConfig) - { - string savedTime = ""; - string powerOffTime = ""; - string selfTestTime = ""; - - List powerOffEntryListTemp = new List(); - - List powerOffEntryList = powerOffAndSelfTestConfig.ReadList(nameof(PowerSupplySelfTestTime), nameof(PowerSupplySelfTestTime), powerOffEntryListTemp); - - foreach (var powerOffEntry in powerOffEntryList) - { - if (powerOffEntry._powerSystem == powerSystem) - { - if (DateTime.TryParse(powerOffEntry._powerOffTime, out DateTime dt)) - powerOffTime = powerOffEntry._powerOffTime; - - if (DateTime.TryParse(powerOffEntry._selfTestTime, out dt)) - selfTestTime = powerOffEntry._selfTestTime; - } - } - - if (String.IsNullOrEmpty(powerOffTime)) - savedTime = selfTestTime; - else if (String.IsNullOrEmpty(selfTestTime)) - savedTime = powerOffTime; - else if (!String.IsNullOrEmpty(powerOffTime) && !String.IsNullOrEmpty(selfTestTime)) - { - if (DateTime.TryParse(powerOffTime, out DateTime powerOffDt) && DateTime.TryParse(selfTestTime, out DateTime selfTestDt)) - { - if (DateTime.Compare(powerOffDt, selfTestDt) == 1) - savedTime = powerOffTime; - else - savedTime = selfTestTime; - } - } - - return savedTime; - } - - /// - /// Save time of power off or self test event - /// - /// - /// - public static void SaveTime(string powerSystem, string powerOffTime, string selfTestTime, IConfigurationFile powerOffAndSelfTestConfig) - { - List powerOffEntryListTemp = new List(); - - List powerOffEntryList = powerOffAndSelfTestConfig.ReadList(nameof(PowerSupplySelfTestTime), nameof(PowerSupplySelfTestTime), powerOffEntryListTemp); - - var entry = powerOffEntryList.Find(b => b._powerSystem == powerSystem); - - if (entry != null) - { - if (!string.IsNullOrEmpty(powerOffTime)) - entry._powerOffTime = powerOffTime; - - if (!string.IsNullOrEmpty(selfTestTime)) - entry._selfTestTime = selfTestTime; - } - else - { - PowerSupplySelfTestTime data = new PowerSupplySelfTestTime(powerSystem, powerOffTime, selfTestTime); - if (string.IsNullOrEmpty(powerOffTime)) - data._powerOffTime = Raytheon.Common.GeneralConstants.DefaultConfigValue; - - if (string.IsNullOrEmpty(selfTestTime)) - data._selfTestTime = Raytheon.Common.GeneralConstants.DefaultConfigValue; - - powerOffEntryList.Add(data); - } - - powerOffAndSelfTestConfig.WriteList(nameof(PowerSupplySelfTestTime), nameof(PowerSupplySelfTestTime), powerOffEntryList); - } - } -} diff --git a/Source/Nuget/NugetOrg/newtonsoft.json.13.0.2.nupkg b/Source/Nuget/NugetOrg/newtonsoft.json.13.0.2.nupkg new file mode 100644 index 0000000..5bc58cb Binary files /dev/null and b/Source/Nuget/NugetOrg/newtonsoft.json.13.0.2.nupkg differ diff --git a/Source/Nuget/SolutionPackages/readme.txt b/Source/Nuget/SolutionPackages/readme.txt new file mode 100644 index 0000000..8c77d38 --- /dev/null +++ b/Source/Nuget/SolutionPackages/readme.txt @@ -0,0 +1,2 @@ +Don't put anything in this folder. +This folder is meant for projects to publish their packages to. \ No newline at end of file diff --git a/Source/Nuget/TSRealPackages/raytheon.configuration.2.6.1.nupkg b/Source/Nuget/TSRealPackages/raytheon.configuration.2.6.1.nupkg deleted file mode 100644 index 1195fbe..0000000 Binary files a/Source/Nuget/TSRealPackages/raytheon.configuration.2.6.1.nupkg and /dev/null differ diff --git a/Source/Nuget/TSRealPackages/raytheon.configuration.contracts.2.3.0.nupkg b/Source/Nuget/TSRealPackages/raytheon.configuration.contracts.2.3.0.nupkg deleted file mode 100644 index 8f9a6f0..0000000 Binary files a/Source/Nuget/TSRealPackages/raytheon.configuration.contracts.2.3.0.nupkg and /dev/null differ diff --git a/Source/Nuget/TSRealPackages/raytheon.framework.units.1.0.2.20.nupkg b/Source/Nuget/TSRealPackages/raytheon.framework.units.1.0.2.20.nupkg new file mode 100644 index 0000000..d345bde Binary files /dev/null and b/Source/Nuget/TSRealPackages/raytheon.framework.units.1.0.2.20.nupkg differ diff --git a/Source/Nuget/readme.md b/Source/Nuget/readme.md new file mode 100644 index 0000000..a4579b6 --- /dev/null +++ b/Source/Nuget/readme.md @@ -0,0 +1,20 @@ +# Introduction +TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project. + +# Getting Started +TODO: Guide users through getting your code up and running on their own system. In this section you can talk about: +1. Installation process +2. Software dependencies +3. Latest releases +4. API references + +# Build and Test +TODO: Describe and show how to build your code and run the tests. + +# Contribute +TODO: Explain how other users and developers can contribute to make your code better. + +If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files: +- [ASP.NET Core](https://github.com/aspnet/Home) +- [Visual Studio Code](https://github.com/Microsoft/vscode) +- [Chakra Core](https://github.com/Microsoft/ChakraCore) \ No newline at end of file diff --git a/Source/Program.props b/Source/Program.props deleted file mode 100644 index 084e1b6..0000000 --- a/Source/Program.props +++ /dev/null @@ -1,31 +0,0 @@ - - - - - $([System.DateTime]::get_now().ToString("yyyy")) - - $(Year) - $([System.DateTime]::get_now().ToString("MM")) - $([System.DateTime]::get_now().ToString("dd")) - $([MSBuild]::Divide($([System.DateTime]::get_Now().get_TimeOfDay().get_TotalMinutes()), 2).ToString('F0')) - - $(Major).$(Minor).$(Build).$(Revision) - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/Program.sln b/Source/Program.sln index a866412..02375ec 100644 --- a/Source/Program.sln +++ b/Source/Program.sln @@ -3,43 +3,364 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34408.163 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Program", "Program\Program.csproj", "{00896DC5-536A-4036-85A9-B9E7F9FB712E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "UnitTests\UnitTests.csproj", "{9425542E-2602-4043-8583-1378BD959589}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Program", "_Program", "{4D2003A8-CBCB-498C-9186-355650A84D41}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_2_Program", "_2_Program", "{4D2003A8-CBCB-498C-9186-355650A84D41}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interfaces", "Interfaces", "{B966EB5E-29AF-4641-A4EF-EB77444FE06A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TSRealLib", "TSRealLib", "{1D8C4DB7-A4CF-4F5A-BC8C-5D9A0C274E32}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Instruments.Contracts", "Interfaces\IInstrument\Instruments.Contracts.csproj", "{CDC73C19-53A6-47B3-9B53-54D99C551EC2}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_1_Solution_Items", "_1_Solution_Items", "{F05B61B8-F842-4D7B-B1FB-FD7838AFA0C3}" + ProjectSection(SolutionItems) = preProject + nuget.config = nuget.config + readme.txt = readme.txt + Solution.props = Solution.props + EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Instruments.InstrumentManager.Contracts", "Interfaces\IInstrumentManager\Instruments.InstrumentManager.Contracts.csproj", "{481E843F-3E5F-45E6-8CC9-2FE5D750038A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RINSS", "RINSS", "{FA7CB647-FC1A-444A-A3A4-198977F0ECC1}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Instruments", "Instruments", "{2075F72F-BBE8-48A2-B7CA-4401FEDA5457}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{E2B39C3C-4DC9-45A6-B7AF-A9D62707F05A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneralIntsrumentManager", "Instruments\GeneralIntsrumentManager\GeneralIntsrumentManager.csproj", "{3484D84A-5374-422D-B087-D16F9911749B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Raytheon.Common", "TSRealLib\Common\Raytheon.Common\Raytheon.Common.csproj", "{1E41B47E-5728-43E5-8DD6-97323FAEEC91}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerSupplies", "PowerSupplies", "{69413672-FD51-480A-B8D5-3E1C7B720929}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "InstrumentManager", "InstrumentManager", "{51A9B385-210C-4D8E-B7D7-78AB88E04F91}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EthernetSockets", "EthernetSockets", "{2CF1CAF6-8241-46A0-BC97-CF69F2F14C90}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneralInstrumentManager", "TSRealLib\RINSS\InstrumentManager\GeneralIntsrumentManager\GeneralInstrumentManager.csproj", "{B3B62B44-DC3F-4253-8EDB-BBAF16FDD508}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TcpClient", "Instruments\EthernetSockets\CommDeviceTcpClient\TcpClient.csproj", "{4B168939-2EC4-4710-B7C9-E41F6E4C6A23}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HAL", "HAL", "{FE5C86FF-63E9-432D-8CAE-B02E778FFE69}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDevice.Contracts", "Interfaces\ICommDevice\CommDevice.Contracts.csproj", "{372502DE-CB7B-4DBB-A669-0639BDAB0CFC}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interfaces", "Interfaces", "{22A60CBA-5ADA-47C6-95B4-EAEC014EC878}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerSupply.Contracts", "Interfaces\PowerSupply\PowerSupply.Contracts.csproj", "{2E6A9882-5CCD-4737-8170-2DF0943E5F3E}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{86B281CC-685A-4AE8-8032-D6E8BCB82010}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerSupplySim", "Instruments\PowerSupplies\PowerSupplySim\PowerSupplySim.csproj", "{E43692A0-43F8-40EB-A5F4-0F5F15FC1055}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Instruments.Contracts", "TSRealLib\HAL\Interfaces\Common\IInstrument\Instruments.Contracts.csproj", "{5F23BE1B-4E28-415A-8ECA-244DA0D020C5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeysightN67XX", "Instruments\PowerSupplies\Keysight67XX\KeysightN67XX.csproj", "{4FDBF1AB-19BE-419D-B2E6-B9D236F40914}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Instruments.InstrumentManager.Contracts", "TSRealLib\HAL\Interfaces\Common\IInstrumentManager\Instruments.InstrumentManager.Contracts.csproj", "{AC45C05E-41E4-4B21-8CB0-5342F0AB97A4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MeasurementManagers", "MeasurementManagers", "{C440909C-8430-4BFC-ADAD-2144BFFA050F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IDCPwr", "TSRealLib\HAL\Interfaces\IDCPwr\IDCPwr.csproj", "{3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerSupplyMeasurementManager", "MeasurementManagers\PowerSupplyMeasurementManager\PowerSupplyMeasurementManager.csproj", "{143332EA-D6A2-456E-991D-7710B911F2D5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IGeneralIO", "TSRealLib\HAL\Interfaces\IGeneralIO\IGeneralIO.csproj", "{0663A37A-7C4C-4D9C-8B88-CF574E2D28B2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProgramGui", "ProgramGUI\ProgramGui.csproj", "{44C9E245-6152-4EC9-ACE4-577FE366FCBD}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MAL", "MAL", "{8ED30995-03AD-4E9C-996E-3DC6820F78F9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Raytheon.Common", "Raytheon.Common\Raytheon.Common.csproj", "{E51671D2-86BE-4BCC-B7AF-2749CEDB19F2}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Managers", "Managers", "{CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Implementations", "Implementations", "{725BD0C7-E20F-44C7-AB93-6B13AFDED524}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DIO", "DIO", "{C5F530E1-F5AF-4D37-9250-A7506DAE86C6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerSupply", "PowerSupply", "{6320D476-BFFB-4053-8CB5-FC1D7529DB91}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DIOSim", "TSRealLib\HAL\Implementations\DIO\DIOSim\DIOSim.csproj", "{6FBB254A-EBF5-4BBE-B394-3150F84CB39D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DIOPickering40x", "TSRealLib\HAL\Implementations\DIO\DIOPickering40x\DIOPickering40x.csproj", "{D2E67674-00FA-463F-A184-93C8EA27F654}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DioMeasurementManager", "TSRealLib\MAL\Managers\DioMeasurementManager\DioMeasurementManager.csproj", "{12657FFD-3306-4F86-8AC4-A002ABD5F4ED}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ImplementationMaster", "ImplementationMaster", "{7785F435-3E45-4F3E-974F-A56AB8439D94}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DIOAdventech", "TSRealLib\HAL\Implementations\DIO\DIOAdvantech\DIOAdventech.csproj", "{5834B614-FA20-46D7-BBDB-D0310351A5F2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Raytheon.Instruments.Implementation", "TSRealLib\HAL\ImplementationMaster\Raytheon.Instruments.Implementation\Raytheon.Instruments.Implementation.csproj", "{B8C9F396-089A-4280-A26D-57A3472B717D}" + ProjectSection(ProjectDependencies) = postProject + {02E3B946-989E-4B21-AA73-1C94E869D1DA} = {02E3B946-989E-4B21-AA73-1C94E869D1DA} + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74} = {0AFD4A07-0D47-460A-84AA-4E2968B8FC74} + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0} = {0E3AAF01-A095-48A8-9C03-78B56D01EDC0} + {0E74A4AC-BE82-4081-812B-30140DA44A34} = {0E74A4AC-BE82-4081-812B-30140DA44A34} + {0EB1E967-572F-4529-A692-0D4DA35C9A91} = {0EB1E967-572F-4529-A692-0D4DA35C9A91} + {17AEB6D6-A495-438B-A718-F2DE2B129A69} = {17AEB6D6-A495-438B-A718-F2DE2B129A69} + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D} = {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D} + {294755E1-B1FC-4A3D-935A-822244DBBBD4} = {294755E1-B1FC-4A3D-935A-822244DBBBD4} + {2F23D966-B489-42D3-B972-EC9E42EEC512} = {2F23D966-B489-42D3-B972-EC9E42EEC512} + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF} = {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF} + {344945A0-86FC-47D8-BC28-E885E143A051} = {344945A0-86FC-47D8-BC28-E885E143A051} + {3BBA9856-1E71-4ECF-9A91-781B5861BA03} = {3BBA9856-1E71-4ECF-9A91-781B5861BA03} + {4A006486-5DD7-4508-BE68-17126336A9D8} = {4A006486-5DD7-4508-BE68-17126336A9D8} + {4A381627-AA7E-41DF-AD07-ADB1DF84427D} = {4A381627-AA7E-41DF-AD07-ADB1DF84427D} + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79} = {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79} + {524A9256-A9AE-488C-9012-BE3DFE01F7CB} = {524A9256-A9AE-488C-9012-BE3DFE01F7CB} + {5834B614-FA20-46D7-BBDB-D0310351A5F2} = {5834B614-FA20-46D7-BBDB-D0310351A5F2} + {5B8E150F-3078-45A2-A11F-100ABD6D269A} = {5B8E150F-3078-45A2-A11F-100ABD6D269A} + {5EB96A28-829A-440D-9607-8FAB07C4454B} = {5EB96A28-829A-440D-9607-8FAB07C4454B} + {61B161F9-60F2-4E59-9606-8953EB4F3EB4} = {61B161F9-60F2-4E59-9606-8953EB4F3EB4} + {62EDDCCC-9E4A-487C-A868-F5610AC81765} = {62EDDCCC-9E4A-487C-A868-F5610AC81765} + {636D154F-827B-4116-806B-93FB79AF15AD} = {636D154F-827B-4116-806B-93FB79AF15AD} + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D} = {697D54AD-03CE-48F5-9EA5-C48ECC158E1D} + {6AA94144-9108-4620-85ED-869BFE729303} = {6AA94144-9108-4620-85ED-869BFE729303} + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB} = {6CB5F73E-1DAF-4764-B85B-3007A08FADDB} + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B} = {6D332C2E-5CF3-4BFF-9D8F-D256E574033B} + {6F66D13A-2347-4186-A98E-ADE59B7552ED} = {6F66D13A-2347-4186-A98E-ADE59B7552ED} + {750E3C80-3188-4CE3-B55A-8F3DE808C427} = {750E3C80-3188-4CE3-B55A-8F3DE808C427} + {782F99C3-65B6-458F-B5CF-550137FDC54D} = {782F99C3-65B6-458F-B5CF-550137FDC54D} + {789A1184-DCBB-4CD1-BD0D-A136B0601631} = {789A1184-DCBB-4CD1-BD0D-A136B0601631} + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06} = {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06} + {80E2A78C-7515-45E3-93EB-2EAD660495A3} = {80E2A78C-7515-45E3-93EB-2EAD660495A3} + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE} = {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE} + {8EB251DC-80E5-4334-A869-DC96929418CE} = {8EB251DC-80E5-4334-A869-DC96929418CE} + {8EC8E495-4B07-4B69-A22A-4F18F19197EC} = {8EC8E495-4B07-4B69-A22A-4F18F19197EC} + {9FE0FC5C-D97F-4127-8607-C420138301AB} = {9FE0FC5C-D97F-4127-8607-C420138301AB} + {A330F9A5-061F-44A2-B87E-FD2E3A65716D} = {A330F9A5-061F-44A2-B87E-FD2E3A65716D} + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74} = {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74} + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90} = {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90} + {C4D5E27E-6130-44E9-B756-1F320F15431E} = {C4D5E27E-6130-44E9-B756-1F320F15431E} + {C638A7CA-5E7D-4D08-9913-EB47352B788C} = {C638A7CA-5E7D-4D08-9913-EB47352B788C} + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5} = {C77DFB22-DCCD-40F9-A822-8115FDFA35C5} + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314} = {D051CBF6-6FFE-4FFA-979B-6B3662A0D314} + {D2E67674-00FA-463F-A184-93C8EA27F654} = {D2E67674-00FA-463F-A184-93C8EA27F654} + {D3790203-AA88-435F-8249-80A7E4BFA841} = {D3790203-AA88-435F-8249-80A7E4BFA841} + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A} = {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A} + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF} = {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF} + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340} = {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340} + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D} = {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D} + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D} = {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DIOContec", "TSRealLib\HAL\Implementations\DIO\DIOContec\DIOContec.csproj", "{3BBA9856-1E71-4ECF-9A91-781B5861BA03}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DIOSiCp210x", "TSRealLib\HAL\Implementations\DIO\DIOSiCp210x\DIOSiCp210x.csproj", "{D3790203-AA88-435F-8249-80A7E4BFA841}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DIOSiUSBXp", "TSRealLib\HAL\Implementations\DIO\DIOSiUSBXp\DIOSiUSBXp.csproj", "{8EB251DC-80E5-4334-A869-DC96929418CE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DIOTeradyneEDigital6020A", "TSRealLib\HAL\Implementations\DIO\DIOTeradyneEDigital6020A\DIOTeradyneEDigital6020A.csproj", "{168F3B3F-46FC-42D7-806D-F7E6AB56EB9A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BIT", "BIT", "{197DBD10-4BFC-455B-A20C-74C56BF50114}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COEComm", "TSRealLib\HAL\Implementations\BIT\COEComm\COEComm.csproj", "{88D00E0D-1FF5-410B-9C11-17CC98BFD3BE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BITCOEDeviceNode", "TSRealLib\HAL\Implementations\BIT\BITCOEDeviceNode\BITCOEDeviceNode.csproj", "{0E3AAF01-A095-48A8-9C03-78B56D01EDC0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COECommDevice", "TSRealLib\HAL\Implementations\BIT\COECommDevice\COECommDevice.csproj", "{6AA94144-9108-4620-85ED-869BFE729303}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Chiller", "Chiller", "{4120F08F-0461-406D-88A4-B31E0984F2F4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChillerSim", "TSRealLib\HAL\Implementations\Chiller\ChillerSim\ChillerSim.csproj", "{43D621D9-7297-4444-8DE9-B6A0CEFAC079}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChillerFTS", "TSRealLib\HAL\Implementations\Chiller\ChillerFTS\ChillerFTS.csproj", "{0AFD4A07-0D47-460A-84AA-4E2968B8FC74}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommDevice", "CommDevice", "{241110F0-E21B-45F0-A8AD-ACE945DDD44E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceSim", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceSim\CommDeviceSim.csproj", "{8A895158-9799-40C0-B63A-7F41E5F8FBA0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceGeuSdlc", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceGeuSdlc\CommDeviceGeuSdlc.csproj", "{573097FA-7B92-4A4F-B7E9-817C09B4705F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceSerialAsync", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceSerialAsync\CommDeviceSerialAsync.csproj", "{524A9256-A9AE-488C-9012-BE3DFE01F7CB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceSuperFscc422", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceSuperFscc422\CommDeviceSuperFscc422.csproj", "{6644E15D-7D66-4D6C-AA31-30CD97CD1A88}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceTcpAsync", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceTcpAsync\CommDeviceTcpAsync.csproj", "{8EC8E495-4B07-4B69-A22A-4F18F19197EC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceTcpClient", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceTcpClient\CommDeviceTcpClient.csproj", "{A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceUdp", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceUdp\CommDeviceUdp.csproj", "{5B8E150F-3078-45A2-A11F-100ABD6D269A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommDeviceUdpAsync", "TSRealLib\HAL\Implementations\CommDevice\CommDeviceUdpAsync\CommDeviceUdpAsync.csproj", "{782F99C3-65B6-458F-B5CF-550137FDC54D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DMM", "DMM", "{7B5E1542-1D9C-45A7-B241-66D69F5A2920}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMMSim", "TSRealLib\HAL\Implementations\DMM\DMMSim\DMMSim.csproj", "{27200AEB-40FA-4CB7-9676-1FBE930B6D2A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IDmm", "TSRealLib\HAL\Interfaces\IDmm\IDmm.csproj", "{6EDBAC17-1C27-4AA4-87F8-524A6A311F29}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMMKeysightM9183", "TSRealLib\HAL\Implementations\DMM\DMMKeysightM9183\DMMKeysightM9183.csproj", "{64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMMKeysightScpi", "TSRealLib\HAL\Implementations\DMM\DMMKeysightScpi\DMMKeysightScpi.csproj", "{7E9316B6-A386-43CD-ABAE-97D6E1DF7D06}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMMNiPxi", "TSRealLib\HAL\Implementations\DMM\DMMNiPxi\DMMNiPxi.csproj", "{EFBD0787-39B1-40F4-93EC-CE9F1BAA1340}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMMSquibMeter101SQBRAK", "TSRealLib\HAL\Implementations\DMM\DMMSquibMeter101SQBRAK\DMMSquibMeter101SQBRAK.csproj", "{C77DFB22-DCCD-40F9-A822-8115FDFA35C5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMMVTI", "TSRealLib\HAL\Implementations\DMM\DMMVTI\DMMVTI.csproj", "{05A2A634-96E3-40EA-8527-10F547666FD0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IELoad", "TSRealLib\HAL\Interfaces\IELoad\IELoad.csproj", "{8D3E2585-D2CE-4158-96B9-8B75CE8CC99F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ELoad", "ELoad", "{98655D75-42ED-4A98-82E9-5115A17E65FF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ELoadSim", "TSRealLib\HAL\Implementations\ELoad\ELoadSim\ELoadSim.csproj", "{EB3D4A0C-4022-4588-8A7F-DF2B30D3953B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ELoadScpiKeysight", "TSRealLib\HAL\Implementations\ELoad\ELoadScpiKeysight\ELoadScpiKeysight.csproj", "{0E74A4AC-BE82-4081-812B-30140DA44A34}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EloadSystemScpiKeysight", "TSRealLib\HAL\Implementations\ELoad\EloadSystemScpiKeysight\EloadSystemScpiKeysight.csproj", "{4A006486-5DD7-4508-BE68-17126336A9D8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IELoadSystem", "TSRealLib\HAL\Interfaces\IELoadSystem\IELoadSystem.csproj", "{E2B2402C-4E23-468F-B87D-A4E20EEDFAC9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FlowMeter", "FlowMeter", "{41CAC6F7-3754-4793-B6DD-546154AFECB0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowMeterSim", "TSRealLib\HAL\Implementations\FlowMeter\FlowMeterSim\FlowMeterSim.csproj", "{C7F1C990-FEB2-455F-8049-FF49F17A1D2A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowMeterOmegaDPF20", "TSRealLib\HAL\Implementations\FlowMeter\FlowMeterOmegaDPF20\FlowMeterOmegaDPF20.csproj", "{5EB96A28-829A-440D-9607-8FAB07C4454B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowMeterOmegaM1676", "TSRealLib\HAL\Implementations\FlowMeter\FlowMeterOmegaM1676\FlowMeterOmegaM1676.csproj", "{80E2A78C-7515-45E3-93EB-2EAD660495A3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FPGA", "FPGA", "{44A33964-A695-40E1-AE85-AC584D499C8B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FpgaSim", "TSRealLib\HAL\Implementations\FPGA\FpgaSim\FpgaSim.csproj", "{D0CBE9EC-93F5-483E-8119-688B036F7B19}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomAsciiSerial", "TSRealLib\HAL\Implementations\FPGA\CustomAsciiSerial\CustomAsciiSerial.csproj", "{02E3B946-989E-4B21-AA73-1C94E869D1DA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ethernet", "TSRealLib\HAL\Implementations\FPGA\Ethernet\Ethernet.csproj", "{FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FpgaHssubChassisSs", "TSRealLib\HAL\Implementations\FPGA\FpgaHssubChassisSs\FpgaHssubChassisSs.csproj", "{6CB5F73E-1DAF-4764-B85B-3007A08FADDB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HssubCardSs", "TSRealLib\HAL\Implementations\FPGA\HssubCardSs\HssubCardSs.csproj", "{697D54AD-03CE-48F5-9EA5-C48ECC158E1D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FpgaHssubChassisTs", "TSRealLib\HAL\Implementations\FPGA\FpgaHssubChassisTs\FpgaHssubChassisTs.csproj", "{D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HssubCardTs", "TSRealLib\HAL\Implementations\FPGA\HssubCardTs\HssubCardTs.csproj", "{3153FB67-9399-4B5E-84EB-56DEEB2DDBDF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HssubCardSsHsi", "TSRealLib\HAL\Implementations\FPGA\HssubCardSsHsi\HssubCardSsHsi.csproj", "{A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PcNode2x", "TSRealLib\HAL\Implementations\FPGA\PcNode2x\PcNode2x.csproj", "{2F23D966-B489-42D3-B972-EC9E42EEC512}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PcNode3x", "TSRealLib\HAL\Implementations\FPGA\PcNode3x\PcNode3x.csproj", "{789A1184-DCBB-4CD1-BD0D-A136B0601631}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JTAG", "JTAG", "{8C0B9533-E157-4A74-902B-0122E7AF27C2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JtagSim", "TSRealLib\HAL\Implementations\JTAG\JtagSim\JtagSim.csproj", "{C8230DC5-E03E-4D00-9ED7-843E24BCA99C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JtagConsole", "TSRealLib\HAL\Implementations\JTAG\JtagConsole\JtagConsole.csproj", "{C4D5E27E-6130-44E9-B756-1F320F15431E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JtagTeradyneEDigital6020A", "TSRealLib\HAL\Implementations\JTAG\JtagTeradyneEDigital6020A\JtagTeradyneEDigital6020A.csproj", "{E5C8A941-CB64-47BC-AAEC-A59D3257B7FF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILspsChamber", "TSRealLib\HAL\Interfaces\ILspsChamber\ILspsChamber.csproj", "{C50C14C8-FEEB-45B7-9174-C79ED8F8876C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "INetCdfData", "TSRealLib\HAL\Interfaces\INetCdfData\INetCdfData.csproj", "{5F477C6B-1149-4A83-894B-1952218A1C1D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LSPS", "LSPS", "{3205C1EF-A509-4CE9-83BB-A8E21D2F89D6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LspsChamber", "TSRealLib\HAL\Implementations\LSPS\LspsChamber\LspsChamber.csproj", "{1C376A9E-5DEE-4937-91B0-2C70E0C3B54D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetCdfData", "NetCdfData", "{08A8EF58-1324-44EA-A107-FF8811081D76}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerSupplySystemKeysight", "TSRealLib\HAL\Implementations\PowerSupply\PowerSupplySystemKeysight\PowerSupplySystemKeysight.csproj", "{5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerSupplySystemSim", "TSRealLib\HAL\Implementations\PowerSupply\PowerSupplySystemSim\PowerSupplySystemSim.csproj", "{D7C27F0A-A942-4C14-BAAF-6729FCDAECA4}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerMeter", "PowerMeter", "{874AD6E7-E9E9-4DE7-9FFD-23FD109C6405}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPowerMeter", "TSRealLib\HAL\Interfaces\IPowerMeter\IPowerMeter.csproj", "{4666A155-B9AF-4D59-8667-03D8243A053A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerMeterSim", "TSRealLib\HAL\Implementations\PowerMeter\PowerMeterSim\PowerMeterSim.csproj", "{FCD4AE32-1952-48F6-8B96-B72D71323C90}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerMeterKeysightScpi", "TSRealLib\HAL\Implementations\PowerMeter\PowerMeterKeysightScpi\PowerMeterKeysightScpi.csproj", "{17AEB6D6-A495-438B-A718-F2DE2B129A69}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scope", "Scope", "{DED5C187-0CF4-4B28-B3D0-16A3FAC71075}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScopeSim", "TSRealLib\HAL\Implementations\Scope\ScopeSim\ScopeSim.csproj", "{CC8B3270-F70A-42AF-8B50-DC3D5CAC106C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScopeKeysightScpi", "TSRealLib\HAL\Implementations\Scope\ScopeKeysightScpi\ScopeKeysightScpi.csproj", "{D051CBF6-6FFE-4FFA-979B-6B3662A0D314}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScopeZBind", "TSRealLib\HAL\Implementations\Scope\ScopeZBind\ScopeZBind.csproj", "{750E3C80-3188-4CE3-B55A-8F3DE808C427}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScopeZtec", "TSRealLib\HAL\Implementations\Scope\ScopeZtec\ScopeZtec.csproj", "{344945A0-86FC-47D8-BC28-E885E143A051}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SignalGenerator", "SignalGenerator", "{5C96AAA5-FB5D-4FCB-AE48-14DB643CD9C8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SigGenSim", "TSRealLib\HAL\Implementations\SignalGenerator\SigGenSim\SigGenSim.csproj", "{E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SigGenKeysightScpi", "TSRealLib\HAL\Implementations\SignalGenerator\SigGenKeysightScpi\SigGenKeysightScpi.csproj", "{636D154F-827B-4116-806B-93FB79AF15AD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SpecAnalyzer", "SpecAnalyzer", "{5B8A35B7-B8C6-4F05-837B-E87E960D23B7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCdfData", "TSRealLib\HAL\Implementations\NetCdfData\NetCdfData.csproj", "{9FE0FC5C-D97F-4127-8607-C420138301AB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Switch", "Switch", "{BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchSim", "TSRealLib\HAL\Implementations\Switch\SwitchSim\SwitchSim.csproj", "{27E3003C-56DB-4AEB-9793-34202019638E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ISwitch", "TSRealLib\HAL\Interfaces\ISwitch\ISwitch.csproj", "{3CF79DF8-6637-4FA8-B6B0-191FF258B85F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchKeysightScpi", "TSRealLib\HAL\Implementations\Switch\SwitchKeysightScpi\SwitchKeysightScpi.csproj", "{61B161F9-60F2-4E59-9606-8953EB4F3EB4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchNiPxi", "TSRealLib\HAL\Implementations\Switch\SwitchNiPxi\SwitchNiPxi.csproj", "{62EDDCCC-9E4A-487C-A868-F5610AC81765}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchNise", "TSRealLib\HAL\Implementations\Switch\SwitchNise\SwitchNise.csproj", "{0EB1E967-572F-4529-A692-0D4DA35C9A91}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchPickeringLxi40_531_Soap", "TSRealLib\HAL\Implementations\Switch\SwitchPickeringLxi40_531_Soap\SwitchPickeringLxi40_531_Soap.csproj", "{4A381627-AA7E-41DF-AD07-ADB1DF84427D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchPickeringLxi60_522_Soap", "TSRealLib\HAL\Implementations\Switch\SwitchPickeringLxi60_522_Soap\SwitchPickeringLxi60_522_Soap.csproj", "{294755E1-B1FC-4A3D-935A-822244DBBBD4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchPickeringPipx40", "TSRealLib\HAL\Implementations\Switch\SwitchPickeringPipx40\SwitchPickeringPipx40.csproj", "{C638A7CA-5E7D-4D08-9913-EB47352B788C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchVTI", "TSRealLib\HAL\Implementations\Switch\SwitchVTI\SwitchVTI.csproj", "{47F43756-4A5D-4371-8435-349376E804ED}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TempMonitor", "TempMonitor", "{38C1823D-66E4-4BA1-8805-DE03463EF575}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TempMonitorSim", "TSRealLib\HAL\Implementations\TempMonitor\TempMonitorSim\TempMonitorSim.csproj", "{26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TempMonitorOmegaM3446", "TSRealLib\HAL\Implementations\TempMonitor\TempMonitorOmegaM3446\TempMonitorOmegaM3446.csproj", "{F3C16EA2-D71C-4DCB-8EA6-DA231001E51D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VideoRecorder", "VideoRecorder", "{1EC9E282-82E3-4301-999A-653031B7931E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VideoRecorderSim", "TSRealLib\HAL\Implementations\VideoRecorder\VideoRecorderSim\VideoRecorderSim.csproj", "{FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VideoRecorderVrsClient", "TSRealLib\HAL\Implementations\VideoRecorder\VideoRecorderVrsClient\VideoRecorderVrsClient.csproj", "{6D332C2E-5CF3-4BFF-9D8F-D256E574033B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitGenSoftMeasurementManager", "TSRealLib\MAL\Managers\BitGenSoftMeasurementManager\BitGenSoftMeasurementManager.csproj", "{75DE8955-BA8B-49F5-9FD2-4797EE418C3E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ManagerMaster", "ManagerMaster", "{9FF47FE0-9E1B-482D-B15C-AA714D9266A6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitMeasurementManager", "TSRealLib\MAL\Managers\BitMeasurementManager\BitMeasurementManager.csproj", "{9B2CD357-F5BF-4620-A30D-1E64493C4727}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SupportProjects", "SupportProjects", "{0DC3D58C-E587-48C8-88D6-09C492696A70}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Raytheon.MAL", "TSRealLib\MAL\ManagerMaster\Raytheon.MAL\Raytheon.MAL.csproj", "{243A86B7-AB5C-41D5-BE20-5DBFC76AF922}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChillerCartMeasurementManager", "TSRealLib\MAL\Managers\ChillerCartMeasurementManager\ChillerCartMeasurementManager.csproj", "{F8C8F889-FFA4-4472-B34A-A00A7642D63E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JtagMeasurementManager", "TSRealLib\MAL\Managers\JtagMeasurementManager\JtagMeasurementManager.csproj", "{E8697D3D-2124-4ADC-8DF6-124E934AACF2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RelayMeasurementManager", "TSRealLib\MAL\Managers\RelayMeasurementManager\RelayMeasurementManager.csproj", "{6142C17E-AE40-4A3C-AD26-F75713260F54}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RfMeasurementManager", "TSRealLib\MAL\Managers\RfMeasurementManager\RfMeasurementManager.csproj", "{476BE522-AEA4-468D-8A58-AA3B16EBDBED}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpaceChamberLspsMeasurementManager", "TSRealLib\MAL\Managers\SpaceChamberLSPSMeasurementManager\SpaceChamberLspsMeasurementManager.csproj", "{BD022297-AB3D-444B-A49E-455C6C1ED39E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SwitchMeasurementManager", "TSRealLib\MAL\Managers\SwitchMeasurementManager\SwitchMeasurementManager.csproj", "{3EFB3571-E1D5-4891-85A3-BAD4993DF91F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VideoRecorderMeasurementManager", "TSRealLib\MAL\Managers\VideoRecorderMeasurementManager\VideoRecorderMeasurementManager.csproj", "{9315093A-B6D1-46EE-82FC-E709DB3768BF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExcelZip", "TSRealLib\MAL\SupportProjects\ExcelZip\ExcelZip.csproj", "{C1A88E11-9FC2-43FA-8147-05096AFB3519}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FpgaMeasurementManager", "TSRealLib\MAL\Managers\FpgaMeasurementManager\FpgaMeasurementManager.csproj", "{FA376050-05BC-479F-8AA8-0DDF7843B174}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CryoMeasurementManager", "TSRealLib\MAL\Managers\CryoMeasurementManager\CryoMeasurementManager.csproj", "{08ABBFB2-1EE3-4A4F-B794-98298DC5288D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpticalBenchMeasurementManager", "TSRealLib\MAL\Managers\OpticalBenchMeasurementManager\OpticalBenchMeasurementManager.csproj", "{79E3B202-0BF5-4113-8297-FCAE55774A30}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TelemetryMeasurementManager", "TSRealLib\MAL\Managers\TelemetryMeasurementManager\TelemetryMeasurementManager.csproj", "{0FDC7C29-F359-41E2-B069-0B64A59CE1BD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBit", "TSRealLib\HAL\Interfaces\IBit\IBit.csproj", "{20802E22-C010-4F99-8A75-2904B5EC2FBF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IChiller", "TSRealLib\HAL\Interfaces\IChiller\IChiller.csproj", "{CF288338-4B3F-4913-BD0E-9A741CED3023}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IFlowMeter", "TSRealLib\HAL\Interfaces\IFlowMeter\IFlowMeter.csproj", "{BB1C6133-FE01-40EA-9DB5-D5B8210F501B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IOscilloScope", "TSRealLib\HAL\Interfaces\IOscilloScope\IOscilloScope.csproj", "{92CC097C-A382-4B9A-9837-C6F3828F010F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ISignalGenerator", "TSRealLib\HAL\Interfaces\ISignalGenerator\ISignalGenerator.csproj", "{756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITempMonitor", "TSRealLib\HAL\Interfaces\ITempMonitor\ITempMonitor.csproj", "{8984D4F7-61D7-4762-BD19-7458F32DA02C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IVideoRecorder", "TSRealLib\HAL\Interfaces\IVideoRecorder\IVideoRecorder.csproj", "{B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICommAsync", "TSRealLib\HAL\Interfaces\ICommAsync\ICommAsync.csproj", "{50350EF8-9635-4FF3-90D3-55D41E495EC4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IFpgaComm", "TSRealLib\HAL\Interfaces\IFpgaComm\IFpgaComm.csproj", "{267585A7-D290-43CF-9268-C3DED5999F00}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpecAnKeysightScpi", "TSRealLib\HAL\Implementations\SpecAnalyzer\SpecAnKeysightScpi\SpecAnKeysightScpi.csproj", "{6F66D13A-2347-4186-A98E-ADE59B7552ED}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpecAnSim", "TSRealLib\HAL\Implementations\SpecAnalyzer\SpecAnSim\SpecAnSim.csproj", "{A330F9A5-061F-44A2-B87E-FD2E3A65716D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ISpecAnalyzer", "TSRealLib\HAL\Interfaces\ISpecAnalyzer\ISpecAnalyzer.csproj", "{FD580799-3D22-42F1-AA49-0AF82653DFFB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jtag.Contracts", "TSRealLib\HAL\Interfaces\IJtag\Jtag.Contracts.csproj", "{A51FE553-264E-43DE-BB1A-C95ECDDDB760}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICommDevice", "TSRealLib\HAL\Interfaces\ICommDevice\ICommDevice.csproj", "{7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPowerSupplySystem", "TSRealLib\HAL\Interfaces\IPowerSupplySystem\IPowerSupplySystem.csproj", "{9BE7316F-AA0D-46C5-9AC4-1038697884A0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerSupplyMeasurementManager", "TSRealLib\MAL\Managers\PowerSupplyMeasurementManger\PowerSupplyMeasurementManager.csproj", "{C402EA41-F756-4270-946C-D3DC4E1BAEB5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Program", "Program\Program.csproj", "{FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -48,102 +369,860 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {00896DC5-536A-4036-85A9-B9E7F9FB712E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {00896DC5-536A-4036-85A9-B9E7F9FB712E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {00896DC5-536A-4036-85A9-B9E7F9FB712E}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU - {00896DC5-536A-4036-85A9-B9E7F9FB712E}.Deploy|Any CPU.Build.0 = Debug|Any CPU - {00896DC5-536A-4036-85A9-B9E7F9FB712E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {00896DC5-536A-4036-85A9-B9E7F9FB712E}.Release|Any CPU.Build.0 = Release|Any CPU {9425542E-2602-4043-8583-1378BD959589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9425542E-2602-4043-8583-1378BD959589}.Debug|Any CPU.Build.0 = Debug|Any CPU {9425542E-2602-4043-8583-1378BD959589}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU {9425542E-2602-4043-8583-1378BD959589}.Deploy|Any CPU.Build.0 = Debug|Any CPU {9425542E-2602-4043-8583-1378BD959589}.Release|Any CPU.ActiveCfg = Release|Any CPU {9425542E-2602-4043-8583-1378BD959589}.Release|Any CPU.Build.0 = Release|Any CPU - {CDC73C19-53A6-47B3-9B53-54D99C551EC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CDC73C19-53A6-47B3-9B53-54D99C551EC2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CDC73C19-53A6-47B3-9B53-54D99C551EC2}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU - {CDC73C19-53A6-47B3-9B53-54D99C551EC2}.Deploy|Any CPU.Build.0 = Debug|Any CPU - {CDC73C19-53A6-47B3-9B53-54D99C551EC2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CDC73C19-53A6-47B3-9B53-54D99C551EC2}.Release|Any CPU.Build.0 = Release|Any CPU - {481E843F-3E5F-45E6-8CC9-2FE5D750038A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {481E843F-3E5F-45E6-8CC9-2FE5D750038A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {481E843F-3E5F-45E6-8CC9-2FE5D750038A}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU - {481E843F-3E5F-45E6-8CC9-2FE5D750038A}.Deploy|Any CPU.Build.0 = Debug|Any CPU - {481E843F-3E5F-45E6-8CC9-2FE5D750038A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {481E843F-3E5F-45E6-8CC9-2FE5D750038A}.Release|Any CPU.Build.0 = Release|Any CPU - {3484D84A-5374-422D-B087-D16F9911749B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3484D84A-5374-422D-B087-D16F9911749B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3484D84A-5374-422D-B087-D16F9911749B}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU - {3484D84A-5374-422D-B087-D16F9911749B}.Deploy|Any CPU.Build.0 = Debug|Any CPU - {3484D84A-5374-422D-B087-D16F9911749B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3484D84A-5374-422D-B087-D16F9911749B}.Release|Any CPU.Build.0 = Release|Any CPU - {4B168939-2EC4-4710-B7C9-E41F6E4C6A23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B168939-2EC4-4710-B7C9-E41F6E4C6A23}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B168939-2EC4-4710-B7C9-E41F6E4C6A23}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {4B168939-2EC4-4710-B7C9-E41F6E4C6A23}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {4B168939-2EC4-4710-B7C9-E41F6E4C6A23}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B168939-2EC4-4710-B7C9-E41F6E4C6A23}.Release|Any CPU.Build.0 = Release|Any CPU - {372502DE-CB7B-4DBB-A669-0639BDAB0CFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {372502DE-CB7B-4DBB-A669-0639BDAB0CFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {372502DE-CB7B-4DBB-A669-0639BDAB0CFC}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {372502DE-CB7B-4DBB-A669-0639BDAB0CFC}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {372502DE-CB7B-4DBB-A669-0639BDAB0CFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {372502DE-CB7B-4DBB-A669-0639BDAB0CFC}.Release|Any CPU.Build.0 = Release|Any CPU - {2E6A9882-5CCD-4737-8170-2DF0943E5F3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E6A9882-5CCD-4737-8170-2DF0943E5F3E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E6A9882-5CCD-4737-8170-2DF0943E5F3E}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {2E6A9882-5CCD-4737-8170-2DF0943E5F3E}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {2E6A9882-5CCD-4737-8170-2DF0943E5F3E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E6A9882-5CCD-4737-8170-2DF0943E5F3E}.Release|Any CPU.Build.0 = Release|Any CPU - {E43692A0-43F8-40EB-A5F4-0F5F15FC1055}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E43692A0-43F8-40EB-A5F4-0F5F15FC1055}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E43692A0-43F8-40EB-A5F4-0F5F15FC1055}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {E43692A0-43F8-40EB-A5F4-0F5F15FC1055}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {E43692A0-43F8-40EB-A5F4-0F5F15FC1055}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E43692A0-43F8-40EB-A5F4-0F5F15FC1055}.Release|Any CPU.Build.0 = Release|Any CPU - {4FDBF1AB-19BE-419D-B2E6-B9D236F40914}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4FDBF1AB-19BE-419D-B2E6-B9D236F40914}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4FDBF1AB-19BE-419D-B2E6-B9D236F40914}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU - {4FDBF1AB-19BE-419D-B2E6-B9D236F40914}.Deploy|Any CPU.Build.0 = Debug|Any CPU - {4FDBF1AB-19BE-419D-B2E6-B9D236F40914}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4FDBF1AB-19BE-419D-B2E6-B9D236F40914}.Release|Any CPU.Build.0 = Release|Any CPU - {143332EA-D6A2-456E-991D-7710B911F2D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {143332EA-D6A2-456E-991D-7710B911F2D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {143332EA-D6A2-456E-991D-7710B911F2D5}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {143332EA-D6A2-456E-991D-7710B911F2D5}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {143332EA-D6A2-456E-991D-7710B911F2D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {143332EA-D6A2-456E-991D-7710B911F2D5}.Release|Any CPU.Build.0 = Release|Any CPU - {44C9E245-6152-4EC9-ACE4-577FE366FCBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {44C9E245-6152-4EC9-ACE4-577FE366FCBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {44C9E245-6152-4EC9-ACE4-577FE366FCBD}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {44C9E245-6152-4EC9-ACE4-577FE366FCBD}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {44C9E245-6152-4EC9-ACE4-577FE366FCBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {44C9E245-6152-4EC9-ACE4-577FE366FCBD}.Release|Any CPU.Build.0 = Release|Any CPU - {E51671D2-86BE-4BCC-B7AF-2749CEDB19F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E51671D2-86BE-4BCC-B7AF-2749CEDB19F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E51671D2-86BE-4BCC-B7AF-2749CEDB19F2}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {E51671D2-86BE-4BCC-B7AF-2749CEDB19F2}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {E51671D2-86BE-4BCC-B7AF-2749CEDB19F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E51671D2-86BE-4BCC-B7AF-2749CEDB19F2}.Release|Any CPU.Build.0 = Release|Any CPU + {1E41B47E-5728-43E5-8DD6-97323FAEEC91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E41B47E-5728-43E5-8DD6-97323FAEEC91}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E41B47E-5728-43E5-8DD6-97323FAEEC91}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {1E41B47E-5728-43E5-8DD6-97323FAEEC91}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {1E41B47E-5728-43E5-8DD6-97323FAEEC91}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E41B47E-5728-43E5-8DD6-97323FAEEC91}.Release|Any CPU.Build.0 = Release|Any CPU + {B3B62B44-DC3F-4253-8EDB-BBAF16FDD508}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B3B62B44-DC3F-4253-8EDB-BBAF16FDD508}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3B62B44-DC3F-4253-8EDB-BBAF16FDD508}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {B3B62B44-DC3F-4253-8EDB-BBAF16FDD508}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {B3B62B44-DC3F-4253-8EDB-BBAF16FDD508}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B3B62B44-DC3F-4253-8EDB-BBAF16FDD508}.Release|Any CPU.Build.0 = Release|Any CPU + {5F23BE1B-4E28-415A-8ECA-244DA0D020C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F23BE1B-4E28-415A-8ECA-244DA0D020C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F23BE1B-4E28-415A-8ECA-244DA0D020C5}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {5F23BE1B-4E28-415A-8ECA-244DA0D020C5}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {5F23BE1B-4E28-415A-8ECA-244DA0D020C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F23BE1B-4E28-415A-8ECA-244DA0D020C5}.Release|Any CPU.Build.0 = Release|Any CPU + {AC45C05E-41E4-4B21-8CB0-5342F0AB97A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC45C05E-41E4-4B21-8CB0-5342F0AB97A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC45C05E-41E4-4B21-8CB0-5342F0AB97A4}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {AC45C05E-41E4-4B21-8CB0-5342F0AB97A4}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {AC45C05E-41E4-4B21-8CB0-5342F0AB97A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC45C05E-41E4-4B21-8CB0-5342F0AB97A4}.Release|Any CPU.Build.0 = Release|Any CPU + {3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6}.Release|Any CPU.Build.0 = Release|Any CPU + {0663A37A-7C4C-4D9C-8B88-CF574E2D28B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0663A37A-7C4C-4D9C-8B88-CF574E2D28B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0663A37A-7C4C-4D9C-8B88-CF574E2D28B2}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {0663A37A-7C4C-4D9C-8B88-CF574E2D28B2}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {0663A37A-7C4C-4D9C-8B88-CF574E2D28B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0663A37A-7C4C-4D9C-8B88-CF574E2D28B2}.Release|Any CPU.Build.0 = Release|Any CPU + {6FBB254A-EBF5-4BBE-B394-3150F84CB39D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FBB254A-EBF5-4BBE-B394-3150F84CB39D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FBB254A-EBF5-4BBE-B394-3150F84CB39D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6FBB254A-EBF5-4BBE-B394-3150F84CB39D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6FBB254A-EBF5-4BBE-B394-3150F84CB39D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FBB254A-EBF5-4BBE-B394-3150F84CB39D}.Release|Any CPU.Build.0 = Release|Any CPU + {D2E67674-00FA-463F-A184-93C8EA27F654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2E67674-00FA-463F-A184-93C8EA27F654}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2E67674-00FA-463F-A184-93C8EA27F654}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {D2E67674-00FA-463F-A184-93C8EA27F654}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {D2E67674-00FA-463F-A184-93C8EA27F654}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2E67674-00FA-463F-A184-93C8EA27F654}.Release|Any CPU.Build.0 = Release|Any CPU + {12657FFD-3306-4F86-8AC4-A002ABD5F4ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12657FFD-3306-4F86-8AC4-A002ABD5F4ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12657FFD-3306-4F86-8AC4-A002ABD5F4ED}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {12657FFD-3306-4F86-8AC4-A002ABD5F4ED}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {12657FFD-3306-4F86-8AC4-A002ABD5F4ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12657FFD-3306-4F86-8AC4-A002ABD5F4ED}.Release|Any CPU.Build.0 = Release|Any CPU + {5834B614-FA20-46D7-BBDB-D0310351A5F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5834B614-FA20-46D7-BBDB-D0310351A5F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5834B614-FA20-46D7-BBDB-D0310351A5F2}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {5834B614-FA20-46D7-BBDB-D0310351A5F2}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {5834B614-FA20-46D7-BBDB-D0310351A5F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5834B614-FA20-46D7-BBDB-D0310351A5F2}.Release|Any CPU.Build.0 = Release|Any CPU + {B8C9F396-089A-4280-A26D-57A3472B717D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8C9F396-089A-4280-A26D-57A3472B717D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8C9F396-089A-4280-A26D-57A3472B717D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {B8C9F396-089A-4280-A26D-57A3472B717D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {B8C9F396-089A-4280-A26D-57A3472B717D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8C9F396-089A-4280-A26D-57A3472B717D}.Release|Any CPU.Build.0 = Release|Any CPU + {3BBA9856-1E71-4ECF-9A91-781B5861BA03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BBA9856-1E71-4ECF-9A91-781B5861BA03}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BBA9856-1E71-4ECF-9A91-781B5861BA03}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {3BBA9856-1E71-4ECF-9A91-781B5861BA03}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {3BBA9856-1E71-4ECF-9A91-781B5861BA03}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BBA9856-1E71-4ECF-9A91-781B5861BA03}.Release|Any CPU.Build.0 = Release|Any CPU + {D3790203-AA88-435F-8249-80A7E4BFA841}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3790203-AA88-435F-8249-80A7E4BFA841}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3790203-AA88-435F-8249-80A7E4BFA841}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {D3790203-AA88-435F-8249-80A7E4BFA841}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {D3790203-AA88-435F-8249-80A7E4BFA841}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3790203-AA88-435F-8249-80A7E4BFA841}.Release|Any CPU.Build.0 = Release|Any CPU + {8EB251DC-80E5-4334-A869-DC96929418CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8EB251DC-80E5-4334-A869-DC96929418CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8EB251DC-80E5-4334-A869-DC96929418CE}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {8EB251DC-80E5-4334-A869-DC96929418CE}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {8EB251DC-80E5-4334-A869-DC96929418CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8EB251DC-80E5-4334-A869-DC96929418CE}.Release|Any CPU.Build.0 = Release|Any CPU + {168F3B3F-46FC-42D7-806D-F7E6AB56EB9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {168F3B3F-46FC-42D7-806D-F7E6AB56EB9A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {168F3B3F-46FC-42D7-806D-F7E6AB56EB9A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {168F3B3F-46FC-42D7-806D-F7E6AB56EB9A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {168F3B3F-46FC-42D7-806D-F7E6AB56EB9A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {168F3B3F-46FC-42D7-806D-F7E6AB56EB9A}.Release|Any CPU.Build.0 = Release|Any CPU + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE}.Release|Any CPU.Build.0 = Release|Any CPU + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0}.Release|Any CPU.Build.0 = Release|Any CPU + {6AA94144-9108-4620-85ED-869BFE729303}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6AA94144-9108-4620-85ED-869BFE729303}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6AA94144-9108-4620-85ED-869BFE729303}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6AA94144-9108-4620-85ED-869BFE729303}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6AA94144-9108-4620-85ED-869BFE729303}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6AA94144-9108-4620-85ED-869BFE729303}.Release|Any CPU.Build.0 = Release|Any CPU + {43D621D9-7297-4444-8DE9-B6A0CEFAC079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {43D621D9-7297-4444-8DE9-B6A0CEFAC079}.Debug|Any CPU.Build.0 = Debug|Any CPU + {43D621D9-7297-4444-8DE9-B6A0CEFAC079}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {43D621D9-7297-4444-8DE9-B6A0CEFAC079}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {43D621D9-7297-4444-8DE9-B6A0CEFAC079}.Release|Any CPU.ActiveCfg = Release|Any CPU + {43D621D9-7297-4444-8DE9-B6A0CEFAC079}.Release|Any CPU.Build.0 = Release|Any CPU + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74}.Release|Any CPU.Build.0 = Release|Any CPU + {8A895158-9799-40C0-B63A-7F41E5F8FBA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A895158-9799-40C0-B63A-7F41E5F8FBA0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A895158-9799-40C0-B63A-7F41E5F8FBA0}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {8A895158-9799-40C0-B63A-7F41E5F8FBA0}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {8A895158-9799-40C0-B63A-7F41E5F8FBA0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A895158-9799-40C0-B63A-7F41E5F8FBA0}.Release|Any CPU.Build.0 = Release|Any CPU + {573097FA-7B92-4A4F-B7E9-817C09B4705F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {573097FA-7B92-4A4F-B7E9-817C09B4705F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {573097FA-7B92-4A4F-B7E9-817C09B4705F}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {573097FA-7B92-4A4F-B7E9-817C09B4705F}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {573097FA-7B92-4A4F-B7E9-817C09B4705F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {573097FA-7B92-4A4F-B7E9-817C09B4705F}.Release|Any CPU.Build.0 = Release|Any CPU + {524A9256-A9AE-488C-9012-BE3DFE01F7CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {524A9256-A9AE-488C-9012-BE3DFE01F7CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {524A9256-A9AE-488C-9012-BE3DFE01F7CB}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {524A9256-A9AE-488C-9012-BE3DFE01F7CB}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {524A9256-A9AE-488C-9012-BE3DFE01F7CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {524A9256-A9AE-488C-9012-BE3DFE01F7CB}.Release|Any CPU.Build.0 = Release|Any CPU + {6644E15D-7D66-4D6C-AA31-30CD97CD1A88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6644E15D-7D66-4D6C-AA31-30CD97CD1A88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6644E15D-7D66-4D6C-AA31-30CD97CD1A88}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6644E15D-7D66-4D6C-AA31-30CD97CD1A88}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6644E15D-7D66-4D6C-AA31-30CD97CD1A88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6644E15D-7D66-4D6C-AA31-30CD97CD1A88}.Release|Any CPU.Build.0 = Release|Any CPU + {8EC8E495-4B07-4B69-A22A-4F18F19197EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8EC8E495-4B07-4B69-A22A-4F18F19197EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8EC8E495-4B07-4B69-A22A-4F18F19197EC}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {8EC8E495-4B07-4B69-A22A-4F18F19197EC}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {8EC8E495-4B07-4B69-A22A-4F18F19197EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8EC8E495-4B07-4B69-A22A-4F18F19197EC}.Release|Any CPU.Build.0 = Release|Any CPU + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90}.Release|Any CPU.Build.0 = Release|Any CPU + {5B8E150F-3078-45A2-A11F-100ABD6D269A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B8E150F-3078-45A2-A11F-100ABD6D269A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B8E150F-3078-45A2-A11F-100ABD6D269A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {5B8E150F-3078-45A2-A11F-100ABD6D269A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {5B8E150F-3078-45A2-A11F-100ABD6D269A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B8E150F-3078-45A2-A11F-100ABD6D269A}.Release|Any CPU.Build.0 = Release|Any CPU + {782F99C3-65B6-458F-B5CF-550137FDC54D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {782F99C3-65B6-458F-B5CF-550137FDC54D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {782F99C3-65B6-458F-B5CF-550137FDC54D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {782F99C3-65B6-458F-B5CF-550137FDC54D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {782F99C3-65B6-458F-B5CF-550137FDC54D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {782F99C3-65B6-458F-B5CF-550137FDC54D}.Release|Any CPU.Build.0 = Release|Any CPU + {27200AEB-40FA-4CB7-9676-1FBE930B6D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27200AEB-40FA-4CB7-9676-1FBE930B6D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27200AEB-40FA-4CB7-9676-1FBE930B6D2A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {27200AEB-40FA-4CB7-9676-1FBE930B6D2A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {27200AEB-40FA-4CB7-9676-1FBE930B6D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27200AEB-40FA-4CB7-9676-1FBE930B6D2A}.Release|Any CPU.Build.0 = Release|Any CPU + {6EDBAC17-1C27-4AA4-87F8-524A6A311F29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6EDBAC17-1C27-4AA4-87F8-524A6A311F29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6EDBAC17-1C27-4AA4-87F8-524A6A311F29}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6EDBAC17-1C27-4AA4-87F8-524A6A311F29}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6EDBAC17-1C27-4AA4-87F8-524A6A311F29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6EDBAC17-1C27-4AA4-87F8-524A6A311F29}.Release|Any CPU.Build.0 = Release|Any CPU + {64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3}.Release|Any CPU.Build.0 = Release|Any CPU + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06}.Release|Any CPU.Build.0 = Release|Any CPU + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340}.Release|Any CPU.Build.0 = Release|Any CPU + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5}.Release|Any CPU.Build.0 = Release|Any CPU + {05A2A634-96E3-40EA-8527-10F547666FD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05A2A634-96E3-40EA-8527-10F547666FD0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05A2A634-96E3-40EA-8527-10F547666FD0}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {05A2A634-96E3-40EA-8527-10F547666FD0}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {05A2A634-96E3-40EA-8527-10F547666FD0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05A2A634-96E3-40EA-8527-10F547666FD0}.Release|Any CPU.Build.0 = Release|Any CPU + {8D3E2585-D2CE-4158-96B9-8B75CE8CC99F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D3E2585-D2CE-4158-96B9-8B75CE8CC99F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D3E2585-D2CE-4158-96B9-8B75CE8CC99F}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {8D3E2585-D2CE-4158-96B9-8B75CE8CC99F}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {8D3E2585-D2CE-4158-96B9-8B75CE8CC99F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D3E2585-D2CE-4158-96B9-8B75CE8CC99F}.Release|Any CPU.Build.0 = Release|Any CPU + {EB3D4A0C-4022-4588-8A7F-DF2B30D3953B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB3D4A0C-4022-4588-8A7F-DF2B30D3953B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB3D4A0C-4022-4588-8A7F-DF2B30D3953B}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {EB3D4A0C-4022-4588-8A7F-DF2B30D3953B}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {EB3D4A0C-4022-4588-8A7F-DF2B30D3953B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB3D4A0C-4022-4588-8A7F-DF2B30D3953B}.Release|Any CPU.Build.0 = Release|Any CPU + {0E74A4AC-BE82-4081-812B-30140DA44A34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E74A4AC-BE82-4081-812B-30140DA44A34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E74A4AC-BE82-4081-812B-30140DA44A34}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {0E74A4AC-BE82-4081-812B-30140DA44A34}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {0E74A4AC-BE82-4081-812B-30140DA44A34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E74A4AC-BE82-4081-812B-30140DA44A34}.Release|Any CPU.Build.0 = Release|Any CPU + {4A006486-5DD7-4508-BE68-17126336A9D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A006486-5DD7-4508-BE68-17126336A9D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A006486-5DD7-4508-BE68-17126336A9D8}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {4A006486-5DD7-4508-BE68-17126336A9D8}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {4A006486-5DD7-4508-BE68-17126336A9D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A006486-5DD7-4508-BE68-17126336A9D8}.Release|Any CPU.Build.0 = Release|Any CPU + {E2B2402C-4E23-468F-B87D-A4E20EEDFAC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2B2402C-4E23-468F-B87D-A4E20EEDFAC9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2B2402C-4E23-468F-B87D-A4E20EEDFAC9}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {E2B2402C-4E23-468F-B87D-A4E20EEDFAC9}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {E2B2402C-4E23-468F-B87D-A4E20EEDFAC9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2B2402C-4E23-468F-B87D-A4E20EEDFAC9}.Release|Any CPU.Build.0 = Release|Any CPU + {C7F1C990-FEB2-455F-8049-FF49F17A1D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7F1C990-FEB2-455F-8049-FF49F17A1D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7F1C990-FEB2-455F-8049-FF49F17A1D2A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C7F1C990-FEB2-455F-8049-FF49F17A1D2A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C7F1C990-FEB2-455F-8049-FF49F17A1D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7F1C990-FEB2-455F-8049-FF49F17A1D2A}.Release|Any CPU.Build.0 = Release|Any CPU + {5EB96A28-829A-440D-9607-8FAB07C4454B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EB96A28-829A-440D-9607-8FAB07C4454B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EB96A28-829A-440D-9607-8FAB07C4454B}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {5EB96A28-829A-440D-9607-8FAB07C4454B}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {5EB96A28-829A-440D-9607-8FAB07C4454B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EB96A28-829A-440D-9607-8FAB07C4454B}.Release|Any CPU.Build.0 = Release|Any CPU + {80E2A78C-7515-45E3-93EB-2EAD660495A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80E2A78C-7515-45E3-93EB-2EAD660495A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80E2A78C-7515-45E3-93EB-2EAD660495A3}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {80E2A78C-7515-45E3-93EB-2EAD660495A3}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {80E2A78C-7515-45E3-93EB-2EAD660495A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80E2A78C-7515-45E3-93EB-2EAD660495A3}.Release|Any CPU.Build.0 = Release|Any CPU + {D0CBE9EC-93F5-483E-8119-688B036F7B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0CBE9EC-93F5-483E-8119-688B036F7B19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0CBE9EC-93F5-483E-8119-688B036F7B19}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {D0CBE9EC-93F5-483E-8119-688B036F7B19}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {D0CBE9EC-93F5-483E-8119-688B036F7B19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0CBE9EC-93F5-483E-8119-688B036F7B19}.Release|Any CPU.Build.0 = Release|Any CPU + {02E3B946-989E-4B21-AA73-1C94E869D1DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02E3B946-989E-4B21-AA73-1C94E869D1DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02E3B946-989E-4B21-AA73-1C94E869D1DA}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {02E3B946-989E-4B21-AA73-1C94E869D1DA}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {02E3B946-989E-4B21-AA73-1C94E869D1DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02E3B946-989E-4B21-AA73-1C94E869D1DA}.Release|Any CPU.Build.0 = Release|Any CPU + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D}.Release|Any CPU.Build.0 = Release|Any CPU + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB}.Release|Any CPU.Build.0 = Release|Any CPU + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D}.Release|Any CPU.Build.0 = Release|Any CPU + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A}.Release|Any CPU.Build.0 = Release|Any CPU + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF}.Release|Any CPU.Build.0 = Release|Any CPU + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74}.Release|Any CPU.Build.0 = Release|Any CPU + {2F23D966-B489-42D3-B972-EC9E42EEC512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F23D966-B489-42D3-B972-EC9E42EEC512}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F23D966-B489-42D3-B972-EC9E42EEC512}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {2F23D966-B489-42D3-B972-EC9E42EEC512}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {2F23D966-B489-42D3-B972-EC9E42EEC512}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F23D966-B489-42D3-B972-EC9E42EEC512}.Release|Any CPU.Build.0 = Release|Any CPU + {789A1184-DCBB-4CD1-BD0D-A136B0601631}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {789A1184-DCBB-4CD1-BD0D-A136B0601631}.Debug|Any CPU.Build.0 = Debug|Any CPU + {789A1184-DCBB-4CD1-BD0D-A136B0601631}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {789A1184-DCBB-4CD1-BD0D-A136B0601631}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {789A1184-DCBB-4CD1-BD0D-A136B0601631}.Release|Any CPU.ActiveCfg = Release|Any CPU + {789A1184-DCBB-4CD1-BD0D-A136B0601631}.Release|Any CPU.Build.0 = Release|Any CPU + {C8230DC5-E03E-4D00-9ED7-843E24BCA99C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8230DC5-E03E-4D00-9ED7-843E24BCA99C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8230DC5-E03E-4D00-9ED7-843E24BCA99C}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C8230DC5-E03E-4D00-9ED7-843E24BCA99C}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C8230DC5-E03E-4D00-9ED7-843E24BCA99C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8230DC5-E03E-4D00-9ED7-843E24BCA99C}.Release|Any CPU.Build.0 = Release|Any CPU + {C4D5E27E-6130-44E9-B756-1F320F15431E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4D5E27E-6130-44E9-B756-1F320F15431E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4D5E27E-6130-44E9-B756-1F320F15431E}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C4D5E27E-6130-44E9-B756-1F320F15431E}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C4D5E27E-6130-44E9-B756-1F320F15431E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4D5E27E-6130-44E9-B756-1F320F15431E}.Release|Any CPU.Build.0 = Release|Any CPU + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF}.Release|Any CPU.Build.0 = Release|Any CPU + {C50C14C8-FEEB-45B7-9174-C79ED8F8876C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C50C14C8-FEEB-45B7-9174-C79ED8F8876C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C50C14C8-FEEB-45B7-9174-C79ED8F8876C}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C50C14C8-FEEB-45B7-9174-C79ED8F8876C}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C50C14C8-FEEB-45B7-9174-C79ED8F8876C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C50C14C8-FEEB-45B7-9174-C79ED8F8876C}.Release|Any CPU.Build.0 = Release|Any CPU + {5F477C6B-1149-4A83-894B-1952218A1C1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F477C6B-1149-4A83-894B-1952218A1C1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F477C6B-1149-4A83-894B-1952218A1C1D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {5F477C6B-1149-4A83-894B-1952218A1C1D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {5F477C6B-1149-4A83-894B-1952218A1C1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F477C6B-1149-4A83-894B-1952218A1C1D}.Release|Any CPU.Build.0 = Release|Any CPU + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D}.Release|Any CPU.Build.0 = Release|Any CPU + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79}.Release|Any CPU.Build.0 = Release|Any CPU + {D7C27F0A-A942-4C14-BAAF-6729FCDAECA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7C27F0A-A942-4C14-BAAF-6729FCDAECA4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7C27F0A-A942-4C14-BAAF-6729FCDAECA4}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {D7C27F0A-A942-4C14-BAAF-6729FCDAECA4}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {D7C27F0A-A942-4C14-BAAF-6729FCDAECA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7C27F0A-A942-4C14-BAAF-6729FCDAECA4}.Release|Any CPU.Build.0 = Release|Any CPU + {4666A155-B9AF-4D59-8667-03D8243A053A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4666A155-B9AF-4D59-8667-03D8243A053A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4666A155-B9AF-4D59-8667-03D8243A053A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {4666A155-B9AF-4D59-8667-03D8243A053A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {4666A155-B9AF-4D59-8667-03D8243A053A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4666A155-B9AF-4D59-8667-03D8243A053A}.Release|Any CPU.Build.0 = Release|Any CPU + {FCD4AE32-1952-48F6-8B96-B72D71323C90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCD4AE32-1952-48F6-8B96-B72D71323C90}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCD4AE32-1952-48F6-8B96-B72D71323C90}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {FCD4AE32-1952-48F6-8B96-B72D71323C90}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {FCD4AE32-1952-48F6-8B96-B72D71323C90}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCD4AE32-1952-48F6-8B96-B72D71323C90}.Release|Any CPU.Build.0 = Release|Any CPU + {17AEB6D6-A495-438B-A718-F2DE2B129A69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17AEB6D6-A495-438B-A718-F2DE2B129A69}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17AEB6D6-A495-438B-A718-F2DE2B129A69}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {17AEB6D6-A495-438B-A718-F2DE2B129A69}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {17AEB6D6-A495-438B-A718-F2DE2B129A69}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17AEB6D6-A495-438B-A718-F2DE2B129A69}.Release|Any CPU.Build.0 = Release|Any CPU + {CC8B3270-F70A-42AF-8B50-DC3D5CAC106C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC8B3270-F70A-42AF-8B50-DC3D5CAC106C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC8B3270-F70A-42AF-8B50-DC3D5CAC106C}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {CC8B3270-F70A-42AF-8B50-DC3D5CAC106C}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {CC8B3270-F70A-42AF-8B50-DC3D5CAC106C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC8B3270-F70A-42AF-8B50-DC3D5CAC106C}.Release|Any CPU.Build.0 = Release|Any CPU + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314}.Release|Any CPU.Build.0 = Release|Any CPU + {750E3C80-3188-4CE3-B55A-8F3DE808C427}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {750E3C80-3188-4CE3-B55A-8F3DE808C427}.Debug|Any CPU.Build.0 = Debug|Any CPU + {750E3C80-3188-4CE3-B55A-8F3DE808C427}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {750E3C80-3188-4CE3-B55A-8F3DE808C427}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {750E3C80-3188-4CE3-B55A-8F3DE808C427}.Release|Any CPU.ActiveCfg = Release|Any CPU + {750E3C80-3188-4CE3-B55A-8F3DE808C427}.Release|Any CPU.Build.0 = Release|Any CPU + {344945A0-86FC-47D8-BC28-E885E143A051}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {344945A0-86FC-47D8-BC28-E885E143A051}.Debug|Any CPU.Build.0 = Debug|Any CPU + {344945A0-86FC-47D8-BC28-E885E143A051}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {344945A0-86FC-47D8-BC28-E885E143A051}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {344945A0-86FC-47D8-BC28-E885E143A051}.Release|Any CPU.ActiveCfg = Release|Any CPU + {344945A0-86FC-47D8-BC28-E885E143A051}.Release|Any CPU.Build.0 = Release|Any CPU + {E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9}.Release|Any CPU.Build.0 = Release|Any CPU + {636D154F-827B-4116-806B-93FB79AF15AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {636D154F-827B-4116-806B-93FB79AF15AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {636D154F-827B-4116-806B-93FB79AF15AD}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {636D154F-827B-4116-806B-93FB79AF15AD}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {636D154F-827B-4116-806B-93FB79AF15AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {636D154F-827B-4116-806B-93FB79AF15AD}.Release|Any CPU.Build.0 = Release|Any CPU + {9FE0FC5C-D97F-4127-8607-C420138301AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FE0FC5C-D97F-4127-8607-C420138301AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FE0FC5C-D97F-4127-8607-C420138301AB}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {9FE0FC5C-D97F-4127-8607-C420138301AB}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {9FE0FC5C-D97F-4127-8607-C420138301AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FE0FC5C-D97F-4127-8607-C420138301AB}.Release|Any CPU.Build.0 = Release|Any CPU + {27E3003C-56DB-4AEB-9793-34202019638E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27E3003C-56DB-4AEB-9793-34202019638E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27E3003C-56DB-4AEB-9793-34202019638E}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {27E3003C-56DB-4AEB-9793-34202019638E}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {27E3003C-56DB-4AEB-9793-34202019638E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27E3003C-56DB-4AEB-9793-34202019638E}.Release|Any CPU.Build.0 = Release|Any CPU + {3CF79DF8-6637-4FA8-B6B0-191FF258B85F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CF79DF8-6637-4FA8-B6B0-191FF258B85F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CF79DF8-6637-4FA8-B6B0-191FF258B85F}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {3CF79DF8-6637-4FA8-B6B0-191FF258B85F}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {3CF79DF8-6637-4FA8-B6B0-191FF258B85F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CF79DF8-6637-4FA8-B6B0-191FF258B85F}.Release|Any CPU.Build.0 = Release|Any CPU + {61B161F9-60F2-4E59-9606-8953EB4F3EB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61B161F9-60F2-4E59-9606-8953EB4F3EB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61B161F9-60F2-4E59-9606-8953EB4F3EB4}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {61B161F9-60F2-4E59-9606-8953EB4F3EB4}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {61B161F9-60F2-4E59-9606-8953EB4F3EB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61B161F9-60F2-4E59-9606-8953EB4F3EB4}.Release|Any CPU.Build.0 = Release|Any CPU + {62EDDCCC-9E4A-487C-A868-F5610AC81765}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62EDDCCC-9E4A-487C-A868-F5610AC81765}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62EDDCCC-9E4A-487C-A868-F5610AC81765}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {62EDDCCC-9E4A-487C-A868-F5610AC81765}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {62EDDCCC-9E4A-487C-A868-F5610AC81765}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62EDDCCC-9E4A-487C-A868-F5610AC81765}.Release|Any CPU.Build.0 = Release|Any CPU + {0EB1E967-572F-4529-A692-0D4DA35C9A91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0EB1E967-572F-4529-A692-0D4DA35C9A91}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0EB1E967-572F-4529-A692-0D4DA35C9A91}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {0EB1E967-572F-4529-A692-0D4DA35C9A91}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {0EB1E967-572F-4529-A692-0D4DA35C9A91}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0EB1E967-572F-4529-A692-0D4DA35C9A91}.Release|Any CPU.Build.0 = Release|Any CPU + {4A381627-AA7E-41DF-AD07-ADB1DF84427D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A381627-AA7E-41DF-AD07-ADB1DF84427D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A381627-AA7E-41DF-AD07-ADB1DF84427D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {4A381627-AA7E-41DF-AD07-ADB1DF84427D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {4A381627-AA7E-41DF-AD07-ADB1DF84427D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A381627-AA7E-41DF-AD07-ADB1DF84427D}.Release|Any CPU.Build.0 = Release|Any CPU + {294755E1-B1FC-4A3D-935A-822244DBBBD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {294755E1-B1FC-4A3D-935A-822244DBBBD4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {294755E1-B1FC-4A3D-935A-822244DBBBD4}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {294755E1-B1FC-4A3D-935A-822244DBBBD4}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {294755E1-B1FC-4A3D-935A-822244DBBBD4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {294755E1-B1FC-4A3D-935A-822244DBBBD4}.Release|Any CPU.Build.0 = Release|Any CPU + {C638A7CA-5E7D-4D08-9913-EB47352B788C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C638A7CA-5E7D-4D08-9913-EB47352B788C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C638A7CA-5E7D-4D08-9913-EB47352B788C}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C638A7CA-5E7D-4D08-9913-EB47352B788C}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C638A7CA-5E7D-4D08-9913-EB47352B788C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C638A7CA-5E7D-4D08-9913-EB47352B788C}.Release|Any CPU.Build.0 = Release|Any CPU + {47F43756-4A5D-4371-8435-349376E804ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47F43756-4A5D-4371-8435-349376E804ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47F43756-4A5D-4371-8435-349376E804ED}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {47F43756-4A5D-4371-8435-349376E804ED}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {47F43756-4A5D-4371-8435-349376E804ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47F43756-4A5D-4371-8435-349376E804ED}.Release|Any CPU.Build.0 = Release|Any CPU + {26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22}.Release|Any CPU.Build.0 = Release|Any CPU + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D}.Release|Any CPU.Build.0 = Release|Any CPU + {FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84}.Release|Any CPU.Build.0 = Release|Any CPU + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B}.Release|Any CPU.Build.0 = Release|Any CPU + {75DE8955-BA8B-49F5-9FD2-4797EE418C3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75DE8955-BA8B-49F5-9FD2-4797EE418C3E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75DE8955-BA8B-49F5-9FD2-4797EE418C3E}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {75DE8955-BA8B-49F5-9FD2-4797EE418C3E}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {75DE8955-BA8B-49F5-9FD2-4797EE418C3E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75DE8955-BA8B-49F5-9FD2-4797EE418C3E}.Release|Any CPU.Build.0 = Release|Any CPU + {9B2CD357-F5BF-4620-A30D-1E64493C4727}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B2CD357-F5BF-4620-A30D-1E64493C4727}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B2CD357-F5BF-4620-A30D-1E64493C4727}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {9B2CD357-F5BF-4620-A30D-1E64493C4727}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {9B2CD357-F5BF-4620-A30D-1E64493C4727}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B2CD357-F5BF-4620-A30D-1E64493C4727}.Release|Any CPU.Build.0 = Release|Any CPU + {243A86B7-AB5C-41D5-BE20-5DBFC76AF922}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {243A86B7-AB5C-41D5-BE20-5DBFC76AF922}.Debug|Any CPU.Build.0 = Debug|Any CPU + {243A86B7-AB5C-41D5-BE20-5DBFC76AF922}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {243A86B7-AB5C-41D5-BE20-5DBFC76AF922}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {243A86B7-AB5C-41D5-BE20-5DBFC76AF922}.Release|Any CPU.ActiveCfg = Release|Any CPU + {243A86B7-AB5C-41D5-BE20-5DBFC76AF922}.Release|Any CPU.Build.0 = Release|Any CPU + {F8C8F889-FFA4-4472-B34A-A00A7642D63E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8C8F889-FFA4-4472-B34A-A00A7642D63E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8C8F889-FFA4-4472-B34A-A00A7642D63E}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {F8C8F889-FFA4-4472-B34A-A00A7642D63E}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {F8C8F889-FFA4-4472-B34A-A00A7642D63E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8C8F889-FFA4-4472-B34A-A00A7642D63E}.Release|Any CPU.Build.0 = Release|Any CPU + {E8697D3D-2124-4ADC-8DF6-124E934AACF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8697D3D-2124-4ADC-8DF6-124E934AACF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8697D3D-2124-4ADC-8DF6-124E934AACF2}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {E8697D3D-2124-4ADC-8DF6-124E934AACF2}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {E8697D3D-2124-4ADC-8DF6-124E934AACF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8697D3D-2124-4ADC-8DF6-124E934AACF2}.Release|Any CPU.Build.0 = Release|Any CPU + {6142C17E-AE40-4A3C-AD26-F75713260F54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6142C17E-AE40-4A3C-AD26-F75713260F54}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6142C17E-AE40-4A3C-AD26-F75713260F54}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6142C17E-AE40-4A3C-AD26-F75713260F54}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6142C17E-AE40-4A3C-AD26-F75713260F54}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6142C17E-AE40-4A3C-AD26-F75713260F54}.Release|Any CPU.Build.0 = Release|Any CPU + {476BE522-AEA4-468D-8A58-AA3B16EBDBED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {476BE522-AEA4-468D-8A58-AA3B16EBDBED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {476BE522-AEA4-468D-8A58-AA3B16EBDBED}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {476BE522-AEA4-468D-8A58-AA3B16EBDBED}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {476BE522-AEA4-468D-8A58-AA3B16EBDBED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {476BE522-AEA4-468D-8A58-AA3B16EBDBED}.Release|Any CPU.Build.0 = Release|Any CPU + {BD022297-AB3D-444B-A49E-455C6C1ED39E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD022297-AB3D-444B-A49E-455C6C1ED39E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD022297-AB3D-444B-A49E-455C6C1ED39E}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {BD022297-AB3D-444B-A49E-455C6C1ED39E}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {BD022297-AB3D-444B-A49E-455C6C1ED39E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD022297-AB3D-444B-A49E-455C6C1ED39E}.Release|Any CPU.Build.0 = Release|Any CPU + {3EFB3571-E1D5-4891-85A3-BAD4993DF91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EFB3571-E1D5-4891-85A3-BAD4993DF91F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EFB3571-E1D5-4891-85A3-BAD4993DF91F}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {3EFB3571-E1D5-4891-85A3-BAD4993DF91F}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {3EFB3571-E1D5-4891-85A3-BAD4993DF91F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EFB3571-E1D5-4891-85A3-BAD4993DF91F}.Release|Any CPU.Build.0 = Release|Any CPU + {9315093A-B6D1-46EE-82FC-E709DB3768BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9315093A-B6D1-46EE-82FC-E709DB3768BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9315093A-B6D1-46EE-82FC-E709DB3768BF}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {9315093A-B6D1-46EE-82FC-E709DB3768BF}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {9315093A-B6D1-46EE-82FC-E709DB3768BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9315093A-B6D1-46EE-82FC-E709DB3768BF}.Release|Any CPU.Build.0 = Release|Any CPU + {C1A88E11-9FC2-43FA-8147-05096AFB3519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1A88E11-9FC2-43FA-8147-05096AFB3519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1A88E11-9FC2-43FA-8147-05096AFB3519}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C1A88E11-9FC2-43FA-8147-05096AFB3519}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C1A88E11-9FC2-43FA-8147-05096AFB3519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1A88E11-9FC2-43FA-8147-05096AFB3519}.Release|Any CPU.Build.0 = Release|Any CPU + {FA376050-05BC-479F-8AA8-0DDF7843B174}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA376050-05BC-479F-8AA8-0DDF7843B174}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA376050-05BC-479F-8AA8-0DDF7843B174}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {FA376050-05BC-479F-8AA8-0DDF7843B174}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {FA376050-05BC-479F-8AA8-0DDF7843B174}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA376050-05BC-479F-8AA8-0DDF7843B174}.Release|Any CPU.Build.0 = Release|Any CPU + {08ABBFB2-1EE3-4A4F-B794-98298DC5288D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08ABBFB2-1EE3-4A4F-B794-98298DC5288D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08ABBFB2-1EE3-4A4F-B794-98298DC5288D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {08ABBFB2-1EE3-4A4F-B794-98298DC5288D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {08ABBFB2-1EE3-4A4F-B794-98298DC5288D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08ABBFB2-1EE3-4A4F-B794-98298DC5288D}.Release|Any CPU.Build.0 = Release|Any CPU + {79E3B202-0BF5-4113-8297-FCAE55774A30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79E3B202-0BF5-4113-8297-FCAE55774A30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79E3B202-0BF5-4113-8297-FCAE55774A30}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {79E3B202-0BF5-4113-8297-FCAE55774A30}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {79E3B202-0BF5-4113-8297-FCAE55774A30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79E3B202-0BF5-4113-8297-FCAE55774A30}.Release|Any CPU.Build.0 = Release|Any CPU + {0FDC7C29-F359-41E2-B069-0B64A59CE1BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FDC7C29-F359-41E2-B069-0B64A59CE1BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FDC7C29-F359-41E2-B069-0B64A59CE1BD}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {0FDC7C29-F359-41E2-B069-0B64A59CE1BD}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {0FDC7C29-F359-41E2-B069-0B64A59CE1BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0FDC7C29-F359-41E2-B069-0B64A59CE1BD}.Release|Any CPU.Build.0 = Release|Any CPU + {20802E22-C010-4F99-8A75-2904B5EC2FBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20802E22-C010-4F99-8A75-2904B5EC2FBF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20802E22-C010-4F99-8A75-2904B5EC2FBF}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {20802E22-C010-4F99-8A75-2904B5EC2FBF}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {20802E22-C010-4F99-8A75-2904B5EC2FBF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20802E22-C010-4F99-8A75-2904B5EC2FBF}.Release|Any CPU.Build.0 = Release|Any CPU + {CF288338-4B3F-4913-BD0E-9A741CED3023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF288338-4B3F-4913-BD0E-9A741CED3023}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF288338-4B3F-4913-BD0E-9A741CED3023}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {CF288338-4B3F-4913-BD0E-9A741CED3023}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {CF288338-4B3F-4913-BD0E-9A741CED3023}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF288338-4B3F-4913-BD0E-9A741CED3023}.Release|Any CPU.Build.0 = Release|Any CPU + {BB1C6133-FE01-40EA-9DB5-D5B8210F501B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB1C6133-FE01-40EA-9DB5-D5B8210F501B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB1C6133-FE01-40EA-9DB5-D5B8210F501B}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {BB1C6133-FE01-40EA-9DB5-D5B8210F501B}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {BB1C6133-FE01-40EA-9DB5-D5B8210F501B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB1C6133-FE01-40EA-9DB5-D5B8210F501B}.Release|Any CPU.Build.0 = Release|Any CPU + {92CC097C-A382-4B9A-9837-C6F3828F010F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92CC097C-A382-4B9A-9837-C6F3828F010F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92CC097C-A382-4B9A-9837-C6F3828F010F}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {92CC097C-A382-4B9A-9837-C6F3828F010F}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {92CC097C-A382-4B9A-9837-C6F3828F010F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92CC097C-A382-4B9A-9837-C6F3828F010F}.Release|Any CPU.Build.0 = Release|Any CPU + {756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A}.Release|Any CPU.Build.0 = Release|Any CPU + {8984D4F7-61D7-4762-BD19-7458F32DA02C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8984D4F7-61D7-4762-BD19-7458F32DA02C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8984D4F7-61D7-4762-BD19-7458F32DA02C}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {8984D4F7-61D7-4762-BD19-7458F32DA02C}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {8984D4F7-61D7-4762-BD19-7458F32DA02C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8984D4F7-61D7-4762-BD19-7458F32DA02C}.Release|Any CPU.Build.0 = Release|Any CPU + {B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC}.Release|Any CPU.Build.0 = Release|Any CPU + {50350EF8-9635-4FF3-90D3-55D41E495EC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {50350EF8-9635-4FF3-90D3-55D41E495EC4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {50350EF8-9635-4FF3-90D3-55D41E495EC4}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {50350EF8-9635-4FF3-90D3-55D41E495EC4}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {50350EF8-9635-4FF3-90D3-55D41E495EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {50350EF8-9635-4FF3-90D3-55D41E495EC4}.Release|Any CPU.Build.0 = Release|Any CPU + {267585A7-D290-43CF-9268-C3DED5999F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {267585A7-D290-43CF-9268-C3DED5999F00}.Debug|Any CPU.Build.0 = Debug|Any CPU + {267585A7-D290-43CF-9268-C3DED5999F00}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {267585A7-D290-43CF-9268-C3DED5999F00}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {267585A7-D290-43CF-9268-C3DED5999F00}.Release|Any CPU.ActiveCfg = Release|Any CPU + {267585A7-D290-43CF-9268-C3DED5999F00}.Release|Any CPU.Build.0 = Release|Any CPU + {6F66D13A-2347-4186-A98E-ADE59B7552ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F66D13A-2347-4186-A98E-ADE59B7552ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F66D13A-2347-4186-A98E-ADE59B7552ED}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6F66D13A-2347-4186-A98E-ADE59B7552ED}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6F66D13A-2347-4186-A98E-ADE59B7552ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F66D13A-2347-4186-A98E-ADE59B7552ED}.Release|Any CPU.Build.0 = Release|Any CPU + {A330F9A5-061F-44A2-B87E-FD2E3A65716D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A330F9A5-061F-44A2-B87E-FD2E3A65716D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A330F9A5-061F-44A2-B87E-FD2E3A65716D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {A330F9A5-061F-44A2-B87E-FD2E3A65716D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {A330F9A5-061F-44A2-B87E-FD2E3A65716D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A330F9A5-061F-44A2-B87E-FD2E3A65716D}.Release|Any CPU.Build.0 = Release|Any CPU + {FD580799-3D22-42F1-AA49-0AF82653DFFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD580799-3D22-42F1-AA49-0AF82653DFFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD580799-3D22-42F1-AA49-0AF82653DFFB}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {FD580799-3D22-42F1-AA49-0AF82653DFFB}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {FD580799-3D22-42F1-AA49-0AF82653DFFB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD580799-3D22-42F1-AA49-0AF82653DFFB}.Release|Any CPU.Build.0 = Release|Any CPU + {A51FE553-264E-43DE-BB1A-C95ECDDDB760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A51FE553-264E-43DE-BB1A-C95ECDDDB760}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A51FE553-264E-43DE-BB1A-C95ECDDDB760}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {A51FE553-264E-43DE-BB1A-C95ECDDDB760}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {A51FE553-264E-43DE-BB1A-C95ECDDDB760}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A51FE553-264E-43DE-BB1A-C95ECDDDB760}.Release|Any CPU.Build.0 = Release|Any CPU + {7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA}.Release|Any CPU.Build.0 = Release|Any CPU + {9BE7316F-AA0D-46C5-9AC4-1038697884A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BE7316F-AA0D-46C5-9AC4-1038697884A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BE7316F-AA0D-46C5-9AC4-1038697884A0}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {9BE7316F-AA0D-46C5-9AC4-1038697884A0}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {9BE7316F-AA0D-46C5-9AC4-1038697884A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BE7316F-AA0D-46C5-9AC4-1038697884A0}.Release|Any CPU.Build.0 = Release|Any CPU + {C402EA41-F756-4270-946C-D3DC4E1BAEB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C402EA41-F756-4270-946C-D3DC4E1BAEB5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C402EA41-F756-4270-946C-D3DC4E1BAEB5}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {C402EA41-F756-4270-946C-D3DC4E1BAEB5}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {C402EA41-F756-4270-946C-D3DC4E1BAEB5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C402EA41-F756-4270-946C-D3DC4E1BAEB5}.Release|Any CPU.Build.0 = Release|Any CPU + {FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {00896DC5-536A-4036-85A9-B9E7F9FB712E} = {4D2003A8-CBCB-498C-9186-355650A84D41} - {CDC73C19-53A6-47B3-9B53-54D99C551EC2} = {B966EB5E-29AF-4641-A4EF-EB77444FE06A} - {481E843F-3E5F-45E6-8CC9-2FE5D750038A} = {B966EB5E-29AF-4641-A4EF-EB77444FE06A} - {3484D84A-5374-422D-B087-D16F9911749B} = {2075F72F-BBE8-48A2-B7CA-4401FEDA5457} - {69413672-FD51-480A-B8D5-3E1C7B720929} = {2075F72F-BBE8-48A2-B7CA-4401FEDA5457} - {2CF1CAF6-8241-46A0-BC97-CF69F2F14C90} = {2075F72F-BBE8-48A2-B7CA-4401FEDA5457} - {4B168939-2EC4-4710-B7C9-E41F6E4C6A23} = {2CF1CAF6-8241-46A0-BC97-CF69F2F14C90} - {372502DE-CB7B-4DBB-A669-0639BDAB0CFC} = {B966EB5E-29AF-4641-A4EF-EB77444FE06A} - {2E6A9882-5CCD-4737-8170-2DF0943E5F3E} = {B966EB5E-29AF-4641-A4EF-EB77444FE06A} - {E43692A0-43F8-40EB-A5F4-0F5F15FC1055} = {69413672-FD51-480A-B8D5-3E1C7B720929} - {4FDBF1AB-19BE-419D-B2E6-B9D236F40914} = {69413672-FD51-480A-B8D5-3E1C7B720929} - {143332EA-D6A2-456E-991D-7710B911F2D5} = {C440909C-8430-4BFC-ADAD-2144BFFA050F} - {44C9E245-6152-4EC9-ACE4-577FE366FCBD} = {4D2003A8-CBCB-498C-9186-355650A84D41} + {FA7CB647-FC1A-444A-A3A4-198977F0ECC1} = {1D8C4DB7-A4CF-4F5A-BC8C-5D9A0C274E32} + {E2B39C3C-4DC9-45A6-B7AF-A9D62707F05A} = {1D8C4DB7-A4CF-4F5A-BC8C-5D9A0C274E32} + {1E41B47E-5728-43E5-8DD6-97323FAEEC91} = {E2B39C3C-4DC9-45A6-B7AF-A9D62707F05A} + {51A9B385-210C-4D8E-B7D7-78AB88E04F91} = {FA7CB647-FC1A-444A-A3A4-198977F0ECC1} + {B3B62B44-DC3F-4253-8EDB-BBAF16FDD508} = {51A9B385-210C-4D8E-B7D7-78AB88E04F91} + {FE5C86FF-63E9-432D-8CAE-B02E778FFE69} = {1D8C4DB7-A4CF-4F5A-BC8C-5D9A0C274E32} + {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} = {FE5C86FF-63E9-432D-8CAE-B02E778FFE69} + {86B281CC-685A-4AE8-8032-D6E8BCB82010} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {5F23BE1B-4E28-415A-8ECA-244DA0D020C5} = {86B281CC-685A-4AE8-8032-D6E8BCB82010} + {AC45C05E-41E4-4B21-8CB0-5342F0AB97A4} = {86B281CC-685A-4AE8-8032-D6E8BCB82010} + {3EE46DBC-DFDF-4B2F-A946-486FE1EA5EF6} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {0663A37A-7C4C-4D9C-8B88-CF574E2D28B2} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {8ED30995-03AD-4E9C-996E-3DC6820F78F9} = {1D8C4DB7-A4CF-4F5A-BC8C-5D9A0C274E32} + {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} = {8ED30995-03AD-4E9C-996E-3DC6820F78F9} + {725BD0C7-E20F-44C7-AB93-6B13AFDED524} = {FE5C86FF-63E9-432D-8CAE-B02E778FFE69} + {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {6320D476-BFFB-4053-8CB5-FC1D7529DB91} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {6FBB254A-EBF5-4BBE-B394-3150F84CB39D} = {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} + {D2E67674-00FA-463F-A184-93C8EA27F654} = {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} + {12657FFD-3306-4F86-8AC4-A002ABD5F4ED} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {7785F435-3E45-4F3E-974F-A56AB8439D94} = {FE5C86FF-63E9-432D-8CAE-B02E778FFE69} + {5834B614-FA20-46D7-BBDB-D0310351A5F2} = {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} + {B8C9F396-089A-4280-A26D-57A3472B717D} = {7785F435-3E45-4F3E-974F-A56AB8439D94} + {3BBA9856-1E71-4ECF-9A91-781B5861BA03} = {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} + {D3790203-AA88-435F-8249-80A7E4BFA841} = {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} + {8EB251DC-80E5-4334-A869-DC96929418CE} = {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} + {168F3B3F-46FC-42D7-806D-F7E6AB56EB9A} = {C5F530E1-F5AF-4D37-9250-A7506DAE86C6} + {197DBD10-4BFC-455B-A20C-74C56BF50114} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {88D00E0D-1FF5-410B-9C11-17CC98BFD3BE} = {197DBD10-4BFC-455B-A20C-74C56BF50114} + {0E3AAF01-A095-48A8-9C03-78B56D01EDC0} = {197DBD10-4BFC-455B-A20C-74C56BF50114} + {6AA94144-9108-4620-85ED-869BFE729303} = {197DBD10-4BFC-455B-A20C-74C56BF50114} + {4120F08F-0461-406D-88A4-B31E0984F2F4} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {43D621D9-7297-4444-8DE9-B6A0CEFAC079} = {4120F08F-0461-406D-88A4-B31E0984F2F4} + {0AFD4A07-0D47-460A-84AA-4E2968B8FC74} = {4120F08F-0461-406D-88A4-B31E0984F2F4} + {241110F0-E21B-45F0-A8AD-ACE945DDD44E} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {8A895158-9799-40C0-B63A-7F41E5F8FBA0} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {573097FA-7B92-4A4F-B7E9-817C09B4705F} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {524A9256-A9AE-488C-9012-BE3DFE01F7CB} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {6644E15D-7D66-4D6C-AA31-30CD97CD1A88} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {8EC8E495-4B07-4B69-A22A-4F18F19197EC} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {A8ADFB84-81D2-4F6E-9AAD-1E46FE0A5C90} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {5B8E150F-3078-45A2-A11F-100ABD6D269A} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {782F99C3-65B6-458F-B5CF-550137FDC54D} = {241110F0-E21B-45F0-A8AD-ACE945DDD44E} + {7B5E1542-1D9C-45A7-B241-66D69F5A2920} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {27200AEB-40FA-4CB7-9676-1FBE930B6D2A} = {7B5E1542-1D9C-45A7-B241-66D69F5A2920} + {6EDBAC17-1C27-4AA4-87F8-524A6A311F29} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {64C9B0B5-573E-4E7F-98C1-DDCF25E4FED3} = {7B5E1542-1D9C-45A7-B241-66D69F5A2920} + {7E9316B6-A386-43CD-ABAE-97D6E1DF7D06} = {7B5E1542-1D9C-45A7-B241-66D69F5A2920} + {EFBD0787-39B1-40F4-93EC-CE9F1BAA1340} = {7B5E1542-1D9C-45A7-B241-66D69F5A2920} + {C77DFB22-DCCD-40F9-A822-8115FDFA35C5} = {7B5E1542-1D9C-45A7-B241-66D69F5A2920} + {05A2A634-96E3-40EA-8527-10F547666FD0} = {7B5E1542-1D9C-45A7-B241-66D69F5A2920} + {8D3E2585-D2CE-4158-96B9-8B75CE8CC99F} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {98655D75-42ED-4A98-82E9-5115A17E65FF} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {EB3D4A0C-4022-4588-8A7F-DF2B30D3953B} = {98655D75-42ED-4A98-82E9-5115A17E65FF} + {0E74A4AC-BE82-4081-812B-30140DA44A34} = {98655D75-42ED-4A98-82E9-5115A17E65FF} + {4A006486-5DD7-4508-BE68-17126336A9D8} = {98655D75-42ED-4A98-82E9-5115A17E65FF} + {E2B2402C-4E23-468F-B87D-A4E20EEDFAC9} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {41CAC6F7-3754-4793-B6DD-546154AFECB0} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {C7F1C990-FEB2-455F-8049-FF49F17A1D2A} = {41CAC6F7-3754-4793-B6DD-546154AFECB0} + {5EB96A28-829A-440D-9607-8FAB07C4454B} = {41CAC6F7-3754-4793-B6DD-546154AFECB0} + {80E2A78C-7515-45E3-93EB-2EAD660495A3} = {41CAC6F7-3754-4793-B6DD-546154AFECB0} + {44A33964-A695-40E1-AE85-AC584D499C8B} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {D0CBE9EC-93F5-483E-8119-688B036F7B19} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {02E3B946-989E-4B21-AA73-1C94E869D1DA} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {FAC1EF7C-E59E-47F7-BBD6-A5A8A0CF2B4D} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {6CB5F73E-1DAF-4764-B85B-3007A08FADDB} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {697D54AD-03CE-48F5-9EA5-C48ECC158E1D} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {D6EB27CB-C5A9-4590-AAB6-0D4F0DE29C5A} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {3153FB67-9399-4B5E-84EB-56DEEB2DDBDF} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {A6F8FA83-9C79-43CE-93FD-B1BDD75DCA74} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {2F23D966-B489-42D3-B972-EC9E42EEC512} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {789A1184-DCBB-4CD1-BD0D-A136B0601631} = {44A33964-A695-40E1-AE85-AC584D499C8B} + {8C0B9533-E157-4A74-902B-0122E7AF27C2} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {C8230DC5-E03E-4D00-9ED7-843E24BCA99C} = {8C0B9533-E157-4A74-902B-0122E7AF27C2} + {C4D5E27E-6130-44E9-B756-1F320F15431E} = {8C0B9533-E157-4A74-902B-0122E7AF27C2} + {E5C8A941-CB64-47BC-AAEC-A59D3257B7FF} = {8C0B9533-E157-4A74-902B-0122E7AF27C2} + {C50C14C8-FEEB-45B7-9174-C79ED8F8876C} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {5F477C6B-1149-4A83-894B-1952218A1C1D} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {3205C1EF-A509-4CE9-83BB-A8E21D2F89D6} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {1C376A9E-5DEE-4937-91B0-2C70E0C3B54D} = {3205C1EF-A509-4CE9-83BB-A8E21D2F89D6} + {08A8EF58-1324-44EA-A107-FF8811081D76} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {5245DE6A-2EB9-4760-9DBC-C3DCEFF94F79} = {6320D476-BFFB-4053-8CB5-FC1D7529DB91} + {D7C27F0A-A942-4C14-BAAF-6729FCDAECA4} = {6320D476-BFFB-4053-8CB5-FC1D7529DB91} + {874AD6E7-E9E9-4DE7-9FFD-23FD109C6405} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {4666A155-B9AF-4D59-8667-03D8243A053A} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {FCD4AE32-1952-48F6-8B96-B72D71323C90} = {874AD6E7-E9E9-4DE7-9FFD-23FD109C6405} + {17AEB6D6-A495-438B-A718-F2DE2B129A69} = {874AD6E7-E9E9-4DE7-9FFD-23FD109C6405} + {DED5C187-0CF4-4B28-B3D0-16A3FAC71075} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {CC8B3270-F70A-42AF-8B50-DC3D5CAC106C} = {DED5C187-0CF4-4B28-B3D0-16A3FAC71075} + {D051CBF6-6FFE-4FFA-979B-6B3662A0D314} = {DED5C187-0CF4-4B28-B3D0-16A3FAC71075} + {750E3C80-3188-4CE3-B55A-8F3DE808C427} = {DED5C187-0CF4-4B28-B3D0-16A3FAC71075} + {344945A0-86FC-47D8-BC28-E885E143A051} = {DED5C187-0CF4-4B28-B3D0-16A3FAC71075} + {5C96AAA5-FB5D-4FCB-AE48-14DB643CD9C8} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {E4ADA2B9-CF19-4DA7-8F70-AA6D05C6EBC9} = {5C96AAA5-FB5D-4FCB-AE48-14DB643CD9C8} + {636D154F-827B-4116-806B-93FB79AF15AD} = {5C96AAA5-FB5D-4FCB-AE48-14DB643CD9C8} + {5B8A35B7-B8C6-4F05-837B-E87E960D23B7} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {9FE0FC5C-D97F-4127-8607-C420138301AB} = {08A8EF58-1324-44EA-A107-FF8811081D76} + {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {27E3003C-56DB-4AEB-9793-34202019638E} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {3CF79DF8-6637-4FA8-B6B0-191FF258B85F} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {61B161F9-60F2-4E59-9606-8953EB4F3EB4} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {62EDDCCC-9E4A-487C-A868-F5610AC81765} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {0EB1E967-572F-4529-A692-0D4DA35C9A91} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {4A381627-AA7E-41DF-AD07-ADB1DF84427D} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {294755E1-B1FC-4A3D-935A-822244DBBBD4} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {C638A7CA-5E7D-4D08-9913-EB47352B788C} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {47F43756-4A5D-4371-8435-349376E804ED} = {BE5FDAD0-2F5E-4194-8E3A-1132508FF3B0} + {38C1823D-66E4-4BA1-8805-DE03463EF575} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {26C1F9D8-BAC7-4B7F-B3F7-3545B1508F22} = {38C1823D-66E4-4BA1-8805-DE03463EF575} + {F3C16EA2-D71C-4DCB-8EA6-DA231001E51D} = {38C1823D-66E4-4BA1-8805-DE03463EF575} + {1EC9E282-82E3-4301-999A-653031B7931E} = {725BD0C7-E20F-44C7-AB93-6B13AFDED524} + {FF02EAF9-A82E-4EA7-AF12-ADA5479B5D84} = {1EC9E282-82E3-4301-999A-653031B7931E} + {6D332C2E-5CF3-4BFF-9D8F-D256E574033B} = {1EC9E282-82E3-4301-999A-653031B7931E} + {75DE8955-BA8B-49F5-9FD2-4797EE418C3E} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {9FF47FE0-9E1B-482D-B15C-AA714D9266A6} = {8ED30995-03AD-4E9C-996E-3DC6820F78F9} + {9B2CD357-F5BF-4620-A30D-1E64493C4727} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {0DC3D58C-E587-48C8-88D6-09C492696A70} = {8ED30995-03AD-4E9C-996E-3DC6820F78F9} + {243A86B7-AB5C-41D5-BE20-5DBFC76AF922} = {9FF47FE0-9E1B-482D-B15C-AA714D9266A6} + {F8C8F889-FFA4-4472-B34A-A00A7642D63E} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {E8697D3D-2124-4ADC-8DF6-124E934AACF2} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {6142C17E-AE40-4A3C-AD26-F75713260F54} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {476BE522-AEA4-468D-8A58-AA3B16EBDBED} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {BD022297-AB3D-444B-A49E-455C6C1ED39E} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {3EFB3571-E1D5-4891-85A3-BAD4993DF91F} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {9315093A-B6D1-46EE-82FC-E709DB3768BF} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {C1A88E11-9FC2-43FA-8147-05096AFB3519} = {0DC3D58C-E587-48C8-88D6-09C492696A70} + {FA376050-05BC-479F-8AA8-0DDF7843B174} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {08ABBFB2-1EE3-4A4F-B794-98298DC5288D} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {79E3B202-0BF5-4113-8297-FCAE55774A30} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {0FDC7C29-F359-41E2-B069-0B64A59CE1BD} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {20802E22-C010-4F99-8A75-2904B5EC2FBF} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {CF288338-4B3F-4913-BD0E-9A741CED3023} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {BB1C6133-FE01-40EA-9DB5-D5B8210F501B} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {92CC097C-A382-4B9A-9837-C6F3828F010F} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {756DDA27-5C7B-41A2-AA0C-E3F34E1AC28A} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {8984D4F7-61D7-4762-BD19-7458F32DA02C} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {B2DDAF63-D76E-4D8A-AE20-E1ACCFDD80EC} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {50350EF8-9635-4FF3-90D3-55D41E495EC4} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {267585A7-D290-43CF-9268-C3DED5999F00} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {6F66D13A-2347-4186-A98E-ADE59B7552ED} = {5B8A35B7-B8C6-4F05-837B-E87E960D23B7} + {A330F9A5-061F-44A2-B87E-FD2E3A65716D} = {5B8A35B7-B8C6-4F05-837B-E87E960D23B7} + {FD580799-3D22-42F1-AA49-0AF82653DFFB} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {A51FE553-264E-43DE-BB1A-C95ECDDDB760} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {7342A868-F69D-4BC5-BAEA-7CEEAA1AFCAA} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {9BE7316F-AA0D-46C5-9AC4-1038697884A0} = {22A60CBA-5ADA-47C6-95B4-EAEC014EC878} + {C402EA41-F756-4270-946C-D3DC4E1BAEB5} = {CE2D75B9-FC4A-41C6-84B8-AD838A70C1FF} + {FAFB2DB1-AF3A-4F78-8BBB-124C51C4D62A} = {4D2003A8-CBCB-498C-9186-355650A84D41} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CA9C7EC5-FDF7-444C-99C8-7BDBE8AF4EDB} diff --git a/Source/Program/Actions/UutPowerAction.cs b/Source/Program/Actions/UutPowerAction.cs index bf39aca..a32452d 100644 --- a/Source/Program/Actions/UutPowerAction.cs +++ b/Source/Program/Actions/UutPowerAction.cs @@ -15,22 +15,13 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ -using ProgramLib; using NLog; -using Raytheon.Common; -using Raytheon.Instruments; +using ProgramLib.GUI.Model; +using ProgramLib.GUI.View; +using ProgramLib.GUI.ViewModel; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; using System.Threading.Tasks; -using ProgramGui; -using ProgramGui.Model; -using ProgramGui.View; -using ProgramGui.ViewModel; using System.Windows; -using Raytheon; namespace ProgramLib { @@ -72,13 +63,13 @@ namespace ProgramLib if (Program.Instance()._isUutPwrOn) { - Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].OutputDisable(ProgramLib.PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V); + Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputDisable("STE_PVM_5V"); // enable front panel - Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].FrontPanelEnabled = true; + Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.DisplayEnable("STE_POWER_SUPPLY_SYSTEM"); - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Dispatcher.Invoke((Action)delegate { - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Hide(); + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Hide(); }); Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON].Reset(); @@ -112,7 +103,7 @@ namespace ProgramLib Task.Factory.StartNew(() => PerformSttoTask()); ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].Dispatcher.Invoke((Action)delegate { - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Hide(); + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Hide(); ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].ShowDialog(); }); @@ -123,13 +114,13 @@ namespace ProgramLib ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].Dispatcher.Invoke((Action)delegate { - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Show(); + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Show(); }); - Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].OutputEnable(ProgramLib.PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V); + Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputEnable("STE_PVM_5V"); // disable front panel - Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].FrontPanelEnabled = false; + Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.DisplayDisable("STE_POWER_SUPPLY_SYSTEM"); Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF].Reset(); Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON].Set(); @@ -166,7 +157,7 @@ namespace ProgramLib string measurementStatus = "PASSED"; ImpedanceCheckWindowViewModel.Images passFailImage = ImpedanceCheckWindowViewModel.Images.PASS_CHECK; - impedanceCheckWindow._viewModel.ClearData(); + impedanceCheckWindow.ViewModel.ClearData(); int MAX_ITERATION = 15; int cableNum = 17; int cablePin1 = 5; @@ -184,7 +175,7 @@ namespace ProgramLib _sttoSuccess = false; } - impedanceDataModel.PassFailImagePath = impedanceCheckWindow._viewModel._imageToResourcePathDict[passFailImage]; + impedanceDataModel.PassFailImagePath = impedanceCheckWindow.ViewModel.ImageToResourcePathDict[passFailImage]; impedanceDataModel.Description = $"{measurementName} Measured {measurement} Range [0,50]"; if (Program.Instance()._testStandSeqContext != null) @@ -192,7 +183,7 @@ namespace ProgramLib Program.Instance()._testStandSeqContext.Step.AdditionalResults.CustomResults.Insert($"\"{measurementName}\"", $"\"Measured: {measurement++} Range [0,50] - {measurementStatus}\""); } - impedanceCheckWindow._viewModel.AddData(impedanceDataModel); + impedanceCheckWindow.ViewModel.AddData(impedanceDataModel); if (!_sttoSuccess) { diff --git a/Source/Program/Common/BaseClass/BasicTest.cs b/Source/Program/Common/BaseClass/BasicTest.cs new file mode 100644 index 0000000..5a6f22e --- /dev/null +++ b/Source/Program/Common/BaseClass/BasicTest.cs @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using ProgramLib; +using Raytheon.Common; + +namespace ProgramLib +{ + internal abstract class BasicTest + { + protected abstract void CheckPrerequisite(); + + protected abstract void ExecuteTest(); + + public void RunTest() + { + CheckPrerequisite(); + ExecuteTest(); + } + } +} \ No newline at end of file diff --git a/Source/Program/Common/ConfigLogic/GeneralConstants.cs b/Source/Program/Common/Misc/GeneralConstants.cs similarity index 88% rename from Source/Program/Common/ConfigLogic/GeneralConstants.cs rename to Source/Program/Common/Misc/GeneralConstants.cs index 2eec039..8a59fb8 100644 --- a/Source/Program/Common/ConfigLogic/GeneralConstants.cs +++ b/Source/Program/Common/Misc/GeneralConstants.cs @@ -29,6 +29,7 @@ namespace ProgramLib internal static class GeneralConstants { public const string ProgramConfigFilename = "config.ini"; - public const string DefaultConfigValue = "NOTSET"; + public const string TestMethodConfigFolderName = "TestMethodConfig"; + public const string TestMethodConfigFileName = "Test_Method_Configuration.ini"; } } diff --git a/Source/Program/DataDef/PowerSupplyData.cs b/Source/Program/DataDef/PowerSupplyData.cs index 9b33e1e..42a6ea3 100644 --- a/Source/Program/DataDef/PowerSupplyData.cs +++ b/Source/Program/DataDef/PowerSupplyData.cs @@ -1,4 +1,5 @@ -using System; +using Raytheon.Instruments.PowerSupply; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -13,7 +14,7 @@ namespace ProgramLib { public double _voltage; public double _current; - public Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo _powerSupplyModuleInfo; + public PowerSupplyModuleInfo _powerSupplyModuleInfo; public bool _initialized; /// diff --git a/Source/Program/DataDef/PowerSupplySharedData.cs b/Source/Program/DataDef/PowerSupplySharedData.cs index 46db319..bfce90f 100644 --- a/Source/Program/DataDef/PowerSupplySharedData.cs +++ b/Source/Program/DataDef/PowerSupplySharedData.cs @@ -1,4 +1,5 @@ -using System; +using Raytheon.Instruments.PowerSupply; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -18,7 +19,7 @@ namespace ProgramLib /// /// Set data for a power supply module /// - public void SetData(string moduleName, double voltage, double current, Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo) + public void SetData(string moduleName, double voltage, double current, PowerSupplyModuleInfo powerSupplyModuleInfo) { lock (syncObj) { @@ -28,7 +29,7 @@ namespace ProgramLib syncObjDict[moduleName] = new object(); } } - + lock (syncObjDict[moduleName]) { if (!_powerSupplyDataDict.ContainsKey(moduleName)) diff --git a/Source/Program/FunctionalTests/GMA_ATP_001_UUT_STTO.cs b/Source/Program/FunctionalTests/GMA_ATP_001_UUT_STTO.cs new file mode 100644 index 0000000..3df2709 --- /dev/null +++ b/Source/Program/FunctionalTests/GMA_ATP_001_UUT_STTO.cs @@ -0,0 +1,206 @@ +/*------------------------------------------------------------------------- +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ +using NLog; +using ProgramLib.GUI.Model; +using ProgramLib.GUI.View; +using ProgramLib.GUI.ViewModel; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using static MeasurementManagerLib.SwitchMeasurementManager; + +namespace ProgramLib +{ + /// + /// GMA/AUR TRD GMA_ATP_001 - UUT STTO + /// + internal class GMA_ATP_001_UUT_STTO : BasicTest + { + private readonly Dictionary _dmmResistanceMeasurements = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + private List _relayExclusionList; + private static NLog.ILogger _logger; + + private bool _sttoSuccess = false; + private string fatalErrorMsg; + + public GMA_ATP_001_UUT_STTO() + { + _logger = LogManager.GetCurrentClassLogger(); + ParseMeasurementDef(); + } + + /// + /// Execute Test + /// + protected override void ExecuteTest() + { + Task.Factory.StartNew(() => PerformSttoTask()); + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].Dispatcher.Invoke((Action)delegate + { + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Hide(); + + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].ShowDialog(); + }); + + Program.Instance().SttoSuccess = _sttoSuccess; + + if (!_sttoSuccess) + { + throw new Exception(fatalErrorMsg); + } + } + + /// + /// Check Pre Conditions + /// + protected override void CheckPrerequisite() + { + // add pre req checks as needed + } + + /// + /// Perform Safe-to-turn-on checks + /// + private void PerformSttoTask() + { + ImpedanceDataModel impedanceDataModel; + ImpedanceCheckWindow impedanceCheckWindow = (ImpedanceCheckWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK]; + + try + { + _logger?.Debug($"{this.GetType().Name}::PerformSttoTask() running..."); + + _sttoSuccess = true; + string measurementStatus = "PASSED"; + + ImpedanceCheckWindowViewModel.Images passFailImage = ImpedanceCheckWindowViewModel.Images.PASS_CHECK; + impedanceCheckWindow.ViewModel.ClearData(); + + foreach (KeyValuePair measurement in _dmmResistanceMeasurements) + { + impedanceDataModel = new ImpedanceDataModel(); + double testResult = Program.Instance().MalMeasurementLibManager.SwitchMeasurementManager.DmmReadResistance(measurement.Key); + + if (testResult < measurement.Value._lowerLimit || testResult > measurement.Value._upperLimit) + { + passFailImage = ImpedanceCheckWindowViewModel.Images.FAIL_CHECK; + measurementStatus = "FAILED"; + _sttoSuccess = false; + } + + impedanceDataModel.PassFailImagePath = impedanceCheckWindow.ViewModel.ImageToResourcePathDict[passFailImage]; + impedanceDataModel.Description = $"{measurement.Value._cableAndPinId} Measured {testResult.ToString("0.00")} Range [{measurement.Value._lowerLimit},{measurement.Value._upperLimit}]"; + + if (Program.Instance()._testStandSeqContext != null) + { + Program.Instance()._testStandSeqContext.Step.AdditionalResults.CustomResults.Insert($"\"{measurement.Value._cableAndPinId}\"", $"\"Measured: {testResult.ToString("0.00")} Range [{measurement.Value._lowerLimit},{measurement.Value._upperLimit}] - {measurementStatus}\""); + } + + impedanceCheckWindow.ViewModel.AddData(impedanceDataModel); + + if (!_sttoSuccess) + { + fatalErrorMsg = impedanceDataModel.Description; + } + } + } + catch (Exception ex) + { + _logger.Error(ex.Message + "\n" + ex.StackTrace); + } + finally + { + if (!_sttoSuccess) + { + impedanceCheckWindow.Dispatcher.Invoke((Action)delegate + { + impedanceCheckWindow.btnClose.Visibility = Visibility.Visible; + }); + } + else + { + impedanceCheckWindow.Dispatcher.Invoke((Action)delegate + { + impedanceCheckWindow.Hide(); + }); + } + + _logger?.Debug($"{this.GetType().Name}::PerformSttoTask() exiting..."); + } + } + + /// + /// Parses the ini file for measurement definitions + /// Populates the Dictionaries with the enum names and ini file data + /// + private void ParseMeasurementDef() + { + const string MAIN_SECTION_NAME = "GMA_ATP_001_UUT_STTO"; + const string DMM_RESISTANCE_SECTION_NAME = $"{MAIN_SECTION_NAME}.DMM_RESISTANCE_MEASUREMENTS"; + const string RELAY_EXCLUSION_SECTION_NAME = $"{MAIN_SECTION_NAME}.RELAY_EXCLUSION_LIST"; + + const string EXCLUSION_LIST_KEY = "EXCLUSION_LIST"; + ConfigurationFile configurationFile = new ConfigurationFile(Program.Instance()._testMethodConfigFilePath); + + const char COMMA_DELIM = ','; + + // read in relay exclusion list + string relayExclusions = configurationFile.ReadValue(RELAY_EXCLUSION_SECTION_NAME, EXCLUSION_LIST_KEY); + _relayExclusionList = relayExclusions.Split(COMMA_DELIM).ToList(); + + for (int i = 0; i < _relayExclusionList.Count; ++i) + { + _relayExclusionList[i] = _relayExclusionList[i].TrimEnd(' '); + _relayExclusionList[i] = _relayExclusionList[i].TrimStart(' '); + } + + List keys = configurationFile.ReadAllKeys(DMM_RESISTANCE_SECTION_NAME); + foreach (string key in keys) + { + List valueList = configurationFile.ReadList(DMM_RESISTANCE_SECTION_NAME, key); + + int index = 0; + string pcode = valueList[index++]; + double range = Convert.ToDouble(valueList[index++]); + double res = Convert.ToDouble(valueList[index++]); + int delay = Convert.ToInt32(valueList[index++]); + double scaleFactor = Convert.ToDouble(valueList[index++]); + + List relayList = valueList[index++].Split(COMMA_DELIM).ToList(); + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + + string resistanceTypeStr = valueList[index++].Trim(); + DMMResistanceType type = (DMMResistanceType)Enum.Parse(typeof(DMMResistanceType), resistanceTypeStr, true); + string cableAndPinId = valueList[index++]; + double lowerLimit = Convert.ToDouble(valueList[index++]); + double upperLimit = Convert.ToDouble(valueList[index++]); + + _dmmResistanceMeasurements.Add(key.ToUpper(), new DMMResistanceMeasurementFields(pcode, range, res, delay, scaleFactor, relayList, type, cableAndPinId, lowerLimit, upperLimit)); + } + + Program.Instance().MalMeasurementLibManager.SwitchMeasurementManager.DmmResistanceMeasurements = _dmmResistanceMeasurements; + Program.Instance().MalMeasurementLibManager.SwitchMeasurementManager.RelayExclusionList = _relayExclusionList; + } + } +} diff --git a/Source/ProgramGUI/Model/ImpedanceDataModel.cs b/Source/Program/GUI/Model/ImpedanceDataModel.cs similarity index 66% rename from Source/ProgramGUI/Model/ImpedanceDataModel.cs rename to Source/Program/GUI/Model/ImpedanceDataModel.cs index 7b94feb..0442306 100644 --- a/Source/ProgramGUI/Model/ImpedanceDataModel.cs +++ b/Source/Program/GUI/Model/ImpedanceDataModel.cs @@ -1,8 +1,8 @@ using CommunityToolkit.Mvvm.ComponentModel; -namespace ProgramGui.Model +namespace ProgramLib.GUI.Model { - public partial class ImpedanceDataModel : ObservableObject + internal partial class ImpedanceDataModel : ObservableObject { [ObservableProperty] private string passFailImagePath; diff --git a/Source/ProgramGUI/Model/PassthroughData.Types.cs b/Source/Program/GUI/Model/PassthroughData.Types.cs similarity index 95% rename from Source/ProgramGUI/Model/PassthroughData.Types.cs rename to Source/Program/GUI/Model/PassthroughData.Types.cs index 00b0ebc..97d2e86 100644 --- a/Source/ProgramGUI/Model/PassthroughData.Types.cs +++ b/Source/Program/GUI/Model/PassthroughData.Types.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ProgramGui.Model +namespace ProgramLib.GUI.Model { - public partial class PassthroughData + internal partial class PassthroughData { private struct VariableInfo { diff --git a/Source/ProgramGUI/Model/PassthroughData.cs b/Source/Program/GUI/Model/PassthroughData.cs similarity index 97% rename from Source/ProgramGUI/Model/PassthroughData.cs rename to Source/Program/GUI/Model/PassthroughData.cs index df0f8b3..e98fb8c 100644 --- a/Source/ProgramGUI/Model/PassthroughData.cs +++ b/Source/Program/GUI/Model/PassthroughData.cs @@ -6,9 +6,9 @@ using System.Text; using System.Threading.Tasks; using System.Windows; -namespace ProgramGui.Model +namespace ProgramLib.GUI.Model { - public partial class PassthroughData + internal partial class PassthroughData { private int _datagridColumnCount = 0; // this dictionary stores variable and the info needed to locate it in the passthroughdatamodel dictionary which contains a 2-d array diff --git a/Source/ProgramGUI/Model/PowerModuleDataModel.cs b/Source/Program/GUI/Model/PowerModuleDataModel.cs similarity index 72% rename from Source/ProgramGUI/Model/PowerModuleDataModel.cs rename to Source/Program/GUI/Model/PowerModuleDataModel.cs index 7c369b5..2b05df3 100644 --- a/Source/ProgramGUI/Model/PowerModuleDataModel.cs +++ b/Source/Program/GUI/Model/PowerModuleDataModel.cs @@ -1,8 +1,8 @@ using CommunityToolkit.Mvvm.ComponentModel; -namespace ProgramGui.Model +namespace ProgramLib.GUI.Model { - public partial class PowerModuleDataModel : ObservableObject + internal partial class PowerModuleDataModel : ObservableObject { [ObservableProperty] private string expectedVoltage; diff --git a/Source/ProgramGUI/ProgramGuiManager.cs b/Source/Program/GUI/ProgramGuiManager.cs similarity index 93% rename from Source/ProgramGUI/ProgramGuiManager.cs rename to Source/Program/GUI/ProgramGuiManager.cs index 99a4e9f..bd033fe 100644 --- a/Source/ProgramGUI/ProgramGuiManager.cs +++ b/Source/Program/GUI/ProgramGuiManager.cs @@ -1,17 +1,15 @@ using NLog; -using ProgramGui.View; +using ProgramLib.GUI.View; using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; -namespace ProgramGui +namespace ProgramLib { - public class ProgramGuiManager : IDisposable + internal class ProgramGuiManager : IDisposable { #region Private Members private Thread _guiManagerThread; @@ -24,7 +22,7 @@ namespace ProgramGui #region Public Members public enum WINDOWS { - MAIN, + LIVE_DATA, IMPEDANCE_CHECK } #endregion @@ -68,7 +66,7 @@ namespace ProgramGui _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running..."); // instantiate all the windows here - _windowDict[WINDOWS.MAIN] = new MainWindow(); + _windowDict[WINDOWS.LIVE_DATA] = new LiveDataWindow(); _windowDict[WINDOWS.IMPEDANCE_CHECK] = new ImpedanceCheckWindow(); _allGuiInitializedEvent.Set(); diff --git a/Source/ProgramGUI/View/ImpedanceCheckWindow.xaml b/Source/Program/GUI/View/ImpedanceCheckWindow.xaml similarity index 89% rename from Source/ProgramGUI/View/ImpedanceCheckWindow.xaml rename to Source/Program/GUI/View/ImpedanceCheckWindow.xaml index f2ddae5..c73817b 100644 --- a/Source/ProgramGUI/View/ImpedanceCheckWindow.xaml +++ b/Source/Program/GUI/View/ImpedanceCheckWindow.xaml @@ -1,9 +1,10 @@ - - + @@ -53,12 +54,12 @@ - + Impedance Check diff --git a/Source/ProgramGUI/View/ImpedanceCheckWindow.xaml.cs b/Source/Program/GUI/View/ImpedanceCheckWindow.xaml.cs similarity index 74% rename from Source/ProgramGUI/View/ImpedanceCheckWindow.xaml.cs rename to Source/Program/GUI/View/ImpedanceCheckWindow.xaml.cs index e96a9ae..aa228b1 100644 --- a/Source/ProgramGUI/View/ImpedanceCheckWindow.xaml.cs +++ b/Source/Program/GUI/View/ImpedanceCheckWindow.xaml.cs @@ -1,26 +1,23 @@ -using ProgramGui.ViewModel; +using ProgramLib.GUI.ViewModel; using System; using System.Collections.Specialized; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; using System.Windows.Media.Imaging; -using System.Windows.Threading; -namespace ProgramGui.View +namespace ProgramLib.GUI.View { /// /// Interaction logic for ImpedanceCheckWindow.xaml /// - public partial class ImpedanceCheckWindow : Window + internal partial class ImpedanceCheckWindow : Window { - public ImpedanceCheckWindowViewModel _viewModel; + internal ImpedanceCheckWindowViewModel ViewModel { get; set; } public ImpedanceCheckWindow() { InitializeComponent(); - Uri iconUri = new Uri("pack://application:,,,/ProgramGui;component/Resources/Icons/app.ico"); + Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico"); this.Icon = BitmapFrame.Create(iconUri); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; @@ -29,8 +26,8 @@ namespace ProgramGui.View ((INotifyCollectionChanged)lvImpedanceCheck.Items).CollectionChanged += ListView_CollectionChanged; - _viewModel = new ImpedanceCheckWindowViewModel(this); - DataContext = _viewModel; + ViewModel = new ImpedanceCheckWindowViewModel(this); + DataContext = ViewModel; } protected override void OnContentRendered(EventArgs e) diff --git a/Source/ProgramGUI/MainWindow.xaml b/Source/Program/GUI/View/LiveDataWindow.xaml similarity index 96% rename from Source/ProgramGUI/MainWindow.xaml rename to Source/Program/GUI/View/LiveDataWindow.xaml index 1e4958e..796b7f4 100644 --- a/Source/ProgramGUI/MainWindow.xaml +++ b/Source/Program/GUI/View/LiveDataWindow.xaml @@ -1,9 +1,10 @@ - - + @@ -70,7 +71,7 @@ - + @@ -391,18 +392,18 @@ - + [App Title Here] @@ -522,41 +523,41 @@ @@ -598,11 +599,11 @@ @@ -652,47 +653,47 @@ diff --git a/Source/ProgramGUI/MainWindow.xaml.cs b/Source/Program/GUI/View/LiveDataWindow.xaml.cs similarity index 64% rename from Source/ProgramGUI/MainWindow.xaml.cs rename to Source/Program/GUI/View/LiveDataWindow.xaml.cs index eaca930..547b59e 100644 --- a/Source/ProgramGUI/MainWindow.xaml.cs +++ b/Source/Program/GUI/View/LiveDataWindow.xaml.cs @@ -1,40 +1,28 @@ -using ProgramGui.Model; -using ProgramGui.View; -using ProgramGui.ViewModel; +using ProgramLib.GUI.ViewModel; using System; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Media.Imaging; -using System.Windows.Threading; -namespace ProgramGui +namespace ProgramLib.GUI.View { /// /// Interaction logic for MainWindow.xaml /// - public partial class MainWindow : Window + internal partial class LiveDataWindow : Window { - public MainWindowViewModel _mainWindowViewModel; + internal LiveDataWindowViewModel LiveDataWindowViewModel { get; set; } - public ImpedanceCheckWindow _impedanceCheckWindow; - - public MainWindow() + public LiveDataWindow() { InitializeComponent(); - Uri iconUri = new Uri("pack://application:,,,/ProgramGui;component/Resources/Icons/app.ico"); + Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico"); this.Icon = BitmapFrame.Create(iconUri); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; - _mainWindowViewModel = new MainWindowViewModel(this); - DataContext = _mainWindowViewModel; + LiveDataWindowViewModel = new LiveDataWindowViewModel(this); + DataContext = LiveDataWindowViewModel; } private void btnClose_Click(object sender, RoutedEventArgs e) diff --git a/Source/ProgramGUI/ViewModel/ImpedanceCheckWindowViewModel.cs b/Source/Program/GUI/ViewModel/ImpedanceCheckWindowViewModel.cs similarity index 61% rename from Source/ProgramGUI/ViewModel/ImpedanceCheckWindowViewModel.cs rename to Source/Program/GUI/ViewModel/ImpedanceCheckWindowViewModel.cs index 6315b12..ac47987 100644 --- a/Source/ProgramGUI/ViewModel/ImpedanceCheckWindowViewModel.cs +++ b/Source/Program/GUI/ViewModel/ImpedanceCheckWindowViewModel.cs @@ -1,14 +1,14 @@ using CommunityToolkit.Mvvm.ComponentModel; -using ProgramGui.Model; +using ProgramLib.GUI.Model; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Threading; -namespace ProgramGui.ViewModel +namespace ProgramLib.GUI.ViewModel { - public class ImpedanceCheckWindowViewModel : ObservableObject + internal class ImpedanceCheckWindowViewModel : ObservableObject { private Window _window; public enum Images @@ -17,10 +17,20 @@ namespace ProgramGui.ViewModel FAIL_CHECK } - public Dictionary _imageToResourcePathDict = new Dictionary() + public Dictionary ImageToResourcePathDict + { + get + { + return _imageToResourcePathDict; + } + + private set { } + } + + private Dictionary _imageToResourcePathDict = new Dictionary() { - {Images.PASS_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-check-mark.png" }, - {Images.FAIL_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/red-cross-mark.png" } + {Images.PASS_CHECK, @"pack://application:,,,/Program;component/Resources/Images/green-check-mark.png" }, + {Images.FAIL_CHECK, @"pack://application:,,,/Program;component/Resources/Images/red-cross-mark.png" } }; #region Data Bindings diff --git a/Source/ProgramGUI/ViewModel/MainWindowViewModel.cs b/Source/Program/GUI/ViewModel/LiveDataWindowViewModel.cs similarity index 81% rename from Source/ProgramGUI/ViewModel/MainWindowViewModel.cs rename to Source/Program/GUI/ViewModel/LiveDataWindowViewModel.cs index 342a086..e5359c1 100644 --- a/Source/ProgramGUI/ViewModel/MainWindowViewModel.cs +++ b/Source/Program/GUI/ViewModel/LiveDataWindowViewModel.cs @@ -1,5 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; -using ProgramGui.Model; +using ProgramLib.GUI.Model; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -8,9 +8,9 @@ using System.Text; using System.Threading.Tasks; using System.Windows; -namespace ProgramGui.ViewModel +namespace ProgramLib.GUI.ViewModel { - public partial class MainWindowViewModel : ObservableObject + internal partial class LiveDataWindowViewModel : ObservableObject { public enum Images { @@ -20,7 +20,17 @@ namespace ProgramGui.ViewModel private Window _window; - public Dictionary _imageToResourcePathDict = new Dictionary() + public Dictionary ImageToResourcePathDict + { + get + { + return _imageToResourcePathDict; + } + + private set { } + } + + private Dictionary _imageToResourcePathDict = new Dictionary() { {Images.LED_ON, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" }, {Images.LED_OFF, @"pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" } @@ -42,7 +52,7 @@ namespace ProgramGui.ViewModel #endregion Data Bindings - public MainWindowViewModel(Window window) + public LiveDataWindowViewModel(Window window) { _window = window; _dataGridPowerDatatems = new ObservableCollection(); diff --git a/Source/Program/InstrumentConfigFile/Instruments.xml b/Source/Program/InstrumentConfigFile/Instruments.xml deleted file mode 100644 index 6369820..0000000 --- a/Source/Program/InstrumentConfigFile/Instruments.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - -
- -
-
- - - - TCP_CLIENT_1 - EthernetSocketsTcpClientFactory - - - STE_POWER_SUPPLY_SYSTEM - PowerSupplyKeysightN67xxFactory - - - -
\ No newline at end of file diff --git a/Source/Program/InstrumentConfigFile/STE_POWER_SUPPLY_SYSTEM.ini b/Source/Program/InstrumentConfigFile/STE_POWER_SUPPLY_SYSTEM.ini deleted file mode 100644 index 2752410..0000000 --- a/Source/Program/InstrumentConfigFile/STE_POWER_SUPPLY_SYSTEM.ini +++ /dev/null @@ -1,59 +0,0 @@ -[GENERAL] -ETHERNET_ADDRESS = localhost -ETHERNET_PORT = 5025 -MODULE_DEFINITION = UUT_REF_3_3V, STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V -; 0 means no coupled modules. -; couple means turning on/off any one of the module, turns on/off the others -COUPLED_MODULES = STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V -; 0 means no grouped modules. -; group means turning combining 2 or more modules thus acting as one module -GROUPED_MODULES = 0 -INTERFACE = ETHERNET - -; GU | KW | KWSIM | SELFTEST | ZERO VOLTAGE -[UUT_REF_3_3V] -INDEX = 1 -OCP = 2.0 -OVP = 4.0 -VOLTAGE_SETPOINT = 3.3 - -MIN_VOLTAGE = 3.0 -MAX_VOLTAGE = 3.75 -MAX_CURRENT = 2.0 -MIN_CURRENT = -0.25 - -[STE_PVM_5V] -INDEX = 2 -OCP = 2.0 -OVP = 8.0 -VOLTAGE_SETPOINT = 5.0 - -; STE Power (PVM and peripherals) supply settings -MIN_VOLTAGE = 4.0 -MAX_VOLTAGE = 5.5 -MAX_CURRENT = 1.5 -MIN_CURRENT = -.25 - -[STE_GU_INTERFACE_RELAYS_25V] -INDEX = 3 -OCP = 3.0 -OVP = 34.0 -VOLTAGE_SETPOINT = 25.0 - -; STE Power (GU interface and Relays) Supply settings -MIN_VOLTAGE = 22.0 -MAX_VOLTAGE = 30.0 -MAX_CURRENT = 3.0 -MIN_CURRENT = -0.25 - -[STE_GU_INTERFACE_RF_INTERFACE_5V] -INDEX = 4 -OCP = 5.0 -OVP = 6.5 -VOLTAGE_SETPOINT = 5.0 - -; STE Power (PVM and peripherals) supply settings -MIN_VOLTAGE = 4.0 -MAX_VOLTAGE = 6.3 -MAX_CURRENT = 4.5 -MIN_CURRENT = -.25 \ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/ADVANTECH_DIO_1.xml b/Source/Program/InstrumentConfigFiles/ADVANTECH_DIO_1.xml new file mode 100644 index 0000000..ba3c9a7 --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/ADVANTECH_DIO_1.xml @@ -0,0 +1,9 @@ + + + +
+ +
+
+ +
\ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/DIO_MODULES.ini b/Source/Program/InstrumentConfigFiles/DIO_MODULES.ini new file mode 100644 index 0000000..d362cd6 --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/DIO_MODULES.ini @@ -0,0 +1,45 @@ +; =============================================================================================================== +; This name must match the name specified in the Instrument.xml for an instrument of type DIO +[PICKERING_DIO_1] +PXI_CARD_SLOT_INDEX = 0 +SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION = false +; number channels per port +NUM_CHANNELS_PER_PORT=8 +; either 0 or 1 as the starting channel index +CHANNEL_START_INDEX=0 +NUM_OUTPUT_CHANNELS = 32 +NUM_INPUT_CHANNELS = 32 + +;format is = | +; is either 0 or 1 or 2(Logic Z) +[PICKERING_DIO_1.OUTPUT_SIGNALS] +SIGNAL_1 = 0|1 +SIGNAL_2 = 1|0 + +;format is = +[PICKERING_DIO_1.INPUT_SIGNALS] +SIGNAL_3 = 0 +SIGNAL_4 = 0 + +; =============================================================================================================== +; This name must match the name specified in the Instrument.xml for an instrument of type DIO +[ADVANTECH_DIO_1] +DEVICE_NUMBER = 0 +SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION = false +; number channels per port +NUM_CHANNELS_PER_PORT=8 +; either 0 or 1 as the starting channel index +CHANNEL_START_INDEX=0 +NUM_OUTPUT_CHANNELS = 32 +NUM_INPUT_CHANNELS = 32 + +;format is = | +; is either 0 or 1 or 2(Logic Z) +[ADVANTECH_DIO_1.OUTPUT_SIGNALS] +SIGNAL_5 = 0|1 +SIGNAL_6 = 1|0 + +;format is = +[ADVANTECH_DIO_1.INPUT_SIGNALS] +SIGNAL_7 = 0 +SIGNAL_8 = 0 \ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/Instruments.xml b/Source/Program/InstrumentConfigFiles/Instruments.xml new file mode 100644 index 0000000..d6a98ba --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/Instruments.xml @@ -0,0 +1,36 @@ + + + +
+ +
+
+ + + + STE_POWER_SUPPLY_SYSTEM + PowerSupplySystemKeysightFactory + + + UUT_POWER_SUPPLY_SYSTEM + PowerSupplySystemKeysightFactory + + + PICKERING_DIO_1 + DIOPickering40xFactory + + + ADVANTECH_DIO_1 + DIOAdvantechFactory + + + PICKERING_SWITCH_1 + SwitchPickeringPipx40Factory + + + KEYSIGHT_DMM_1 + DMMKeysightScpiFactory + + + +
\ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/KEYSIGHT_DMM_1.xml b/Source/Program/InstrumentConfigFiles/KEYSIGHT_DMM_1.xml new file mode 100644 index 0000000..1fe2192 --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/KEYSIGHT_DMM_1.xml @@ -0,0 +1,9 @@ + + + +
+ +
+
+ +
\ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/KEYSIGHT_SCPI_DEF.ini b/Source/Program/InstrumentConfigFiles/KEYSIGHT_SCPI_DEF.ini new file mode 100644 index 0000000..4ea80fd --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/KEYSIGHT_SCPI_DEF.ini @@ -0,0 +1,56 @@ +[SYSTEM] +;system commands +CLEAR_CMD = *CLS +RESET_CMD = *RST +SELFTEST_CMD = *TST? +READ_ERROR_CODE_CMD = SYST:ERR? +REBOOT_CMD = SYST:REB + +;panel disable/enable commands +SET_FRONTPANEL_DISABLE_CMD = SYST:COMM:RLST RWL +SET_FRONTPANEL_ENABLE_CMD = SYST:COMM:RLST REM + +;watchdog commands +SET_WATCHDOGDELAY_CMD = OUTP:PROT:WDOG:DEL +SET_WATCHDOGON_CMD = OUTP:PROT:WDOG ON +SET_WATCHDOGOFF_CMD = OUTP:PROT:WDOG OFF + +;coupling commands +SET_COUPLE_CHANNELS_CMD = OUTP:COUP:CHAN +SET_COUPLE_ON_CMD = OUTP:COUP ON +SET_COUPLE_OUTPUT_PROTECT_ON_CMD = OUTP:PROT:COUP ON +QUERY_COUPLE_CHANNELS = OUTP:COUP:CHAN? +QUERY_COUPLE_STATE = OUTP:COUP? + +; Grouping Commands +SET_GROUP_DEFINE_CMD = SYST:GRO:DEF +UNGROUP_ALL_CHANNELS_CMD = SYST:GRO:DEL:ALL +QUERY_GROUP_CHANNELS = SYST:GRO:CAT? + +[MODULE] +; current commands +SET_INRUSH_DELAY_CMD = CURR:PROT:DEL +READ_INRUSH_DELAY_CMD = CURR:PROT:DEL? +READ_CURRENT_CMD = MEAS:CURR? +SET_OCP_CMD = CURR:LEV +READ_OCP_CMD = CURR:LEV? +SET_OCP_ON_CMD = CURR:PROT:STAT ON + +; voltage commands +SET_OVP_CMD = VOLT:PROT +SET_VOLTAGE_SLEW_CMD = VOLT:SLEW +SET_VOLTAGE_SETPOINT_CMD = VOLT:LEV +SET_CONSTANT_VOLTAGE_CMD = STAT:OPER:ENAB 1 +READ_VOLTAGE_CMD = MEAS:VOLT? +READ_VOLTAGE_SETPOINT_CMD = VOLT? +READ_OVP_CMD = VOLT:PROT? +READ_VOLTAGE_SLEW_CMD = VOLT:SLEW? + +; set output commands +SET_OUTPUT_DISABLE_CMD = OUTP OFF +SET_OUTPUT_ENABLE_CMD = OUTP ON + +; query status +READ_OUTPUT_STATUS_CMD = OUTP? +READ_ERROR_STATUS_CMD = SYST:ERR? +READ_PROTECTION_STATUS_CMD = STAT:QUES:COND? \ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/PICKERING_DIO_1.xml b/Source/Program/InstrumentConfigFiles/PICKERING_DIO_1.xml new file mode 100644 index 0000000..d5836e8 --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/PICKERING_DIO_1.xml @@ -0,0 +1,9 @@ + + + +
+ +
+
+ +
\ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/PICKERING_SWITCH_1.xml b/Source/Program/InstrumentConfigFiles/PICKERING_SWITCH_1.xml new file mode 100644 index 0000000..feb5c18 --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/PICKERING_SWITCH_1.xml @@ -0,0 +1,9 @@ + + + +
+ +
+
+ +
\ No newline at end of file diff --git a/Source/Program/InstrumentConfigFiles/POWER_SUPPLY_SYSTEMS.ini b/Source/Program/InstrumentConfigFiles/POWER_SUPPLY_SYSTEMS.ini new file mode 100644 index 0000000..f5b6b3c --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/POWER_SUPPLY_SYSTEMS.ini @@ -0,0 +1,95 @@ +; =============================================================================================================== +; This name must match the name specified in the Instrument.xml that is associated with the power supply system +[STE_POWER_SUPPLY_SYSTEM] +SCPI_DEF_FILEPATH = .\InstrumentConfig\KEYSIGHT_SCPI_DEF.ini +ETHERNET_ADDRESS = localhost +ETHERNET_PORT = 5025 +MODULE_DEFINITION = UUT_REF_3_3V, STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V +; 0 means no coupled modules. +; couple means turning on/off any one of the module, turns on/off the others +COUPLED_MODULES = STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V +; 0 means no grouped modules. +; group means turning combining 2 or more modules thus acting as one module +GROUPED_MODULES = 0 +INTERFACE = ETHERNET + +[STE_POWER_SUPPLY_SYSTEM.UUT_REF_3_3V] +INDEX = 1 +OCP = 2.0 +OVP = 4.0 +VOLTAGE_SETPOINT = 3.3 + +MIN_VOLTAGE = 3.0 +MAX_VOLTAGE = 3.75 +MAX_CURRENT = 2.0 +MIN_CURRENT = -0.25 + +[STE_POWER_SUPPLY_SYSTEM.STE_PVM_5V] +INDEX = 2 +OCP = 2.0 +OVP = 8.0 +VOLTAGE_SETPOINT = 5.0 + +MIN_VOLTAGE = 4.0 +MAX_VOLTAGE = 5.5 +MAX_CURRENT = 1.5 +MIN_CURRENT = -.25 + +[STE_POWER_SUPPLY_SYSTEM.STE_GU_INTERFACE_RELAYS_25V] +INDEX = 3 +OCP = 3.0 +OVP = 34.0 +VOLTAGE_SETPOINT = 25.0 + +MIN_VOLTAGE = 22.0 +MAX_VOLTAGE = 30.0 +MAX_CURRENT = 3.0 +MIN_CURRENT = -0.25 + +[STE_POWER_SUPPLY_SYSTEM.STE_GU_INTERFACE_RF_INTERFACE_5V] +INDEX = 4 +OCP = 5.0 +OVP = 6.5 +VOLTAGE_SETPOINT = 5.0 + +MIN_VOLTAGE = 4.0 +MAX_VOLTAGE = 6.3 +MAX_CURRENT = 4.5 +MIN_CURRENT = -.25 + +; =============================================================================================================== +; This name must match the name specified in the Instrument.xml that is associated with the power supply system +[UUT_POWER_SUPPLY_SYSTEM] +SCPI_DEF_FILEPATH = .\InstrumentConfig\KEYSIGHT_SCPI_DEF.ini +ETHERNET_ADDRESS = localhost +ETHERNET_PORT = 5026 +MODULE_DEFINITION = UUT_P20V, UUT_N20V +; 0 means no coupled modules. +; couple means turning on/off any one of the module, turns on/off the others +COUPLED_MODULES = 0 +; 0 means no grouped modules. +; group means turning combining 2 or more modules thus acting as one module +GROUPED_MODULES = 0 +INTERFACE = ETHERNET + +[UUT_POWER_SUPPLY_SYSTEM.UUT_P20V] +INDEX = 1 +OCP = 1.5 +OVP = 22.0 +VOLTAGE_SETPOINT = 20.0 + +MIN_VOLTAGE = 19.0 +MAX_VOLTAGE = 22.75 +MAX_CURRENT = 2.3 +MIN_CURRENT = -0.25 + +[UUT_POWER_SUPPLY_SYSTEM.UUT_N20V] +INDEX = 2 +OCP = 1.8 +OVP = 22.5 +VOLTAGE_SETPOINT = 20.0 + +MIN_VOLTAGE = 18.0 +MAX_VOLTAGE = 23.0 +MAX_CURRENT = 2.5 +MIN_CURRENT = -.25 \ No newline at end of file diff --git a/Source/Program/InstrumentConfigFile/STE_POWER_SUPPLY_SYSTEM.xml b/Source/Program/InstrumentConfigFiles/STE_POWER_SUPPLY_SYSTEM.xml similarity index 65% rename from Source/Program/InstrumentConfigFile/STE_POWER_SUPPLY_SYSTEM.xml rename to Source/Program/InstrumentConfigFiles/STE_POWER_SUPPLY_SYSTEM.xml index 9daa01d..adf28d2 100644 --- a/Source/Program/InstrumentConfigFile/STE_POWER_SUPPLY_SYSTEM.xml +++ b/Source/Program/InstrumentConfigFiles/STE_POWER_SUPPLY_SYSTEM.xml @@ -2,7 +2,7 @@
- +
diff --git a/Source/Program/InstrumentConfigFiles/UUT_POWER_SUPPLY_SYSTEM.xml b/Source/Program/InstrumentConfigFiles/UUT_POWER_SUPPLY_SYSTEM.xml new file mode 100644 index 0000000..8c8d2fd --- /dev/null +++ b/Source/Program/InstrumentConfigFiles/UUT_POWER_SUPPLY_SYSTEM.xml @@ -0,0 +1,9 @@ + + + +
+ +
+
+ +
\ No newline at end of file diff --git a/Source/Program/MiscConfigFile/NLog.config b/Source/Program/MiscConfigFiles/NLog.config similarity index 100% rename from Source/Program/MiscConfigFile/NLog.config rename to Source/Program/MiscConfigFiles/NLog.config diff --git a/Source/Program/Program.Actions.cs b/Source/Program/Program.Actions.cs index 0e1728e..9b1cdb2 100644 --- a/Source/Program/Program.Actions.cs +++ b/Source/Program/Program.Actions.cs @@ -15,7 +15,7 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ -using ProgramGui; +using ProgramLib; using Raytheon.Instruments; using System; using System.Collections.Generic; @@ -27,13 +27,10 @@ using System.Threading.Tasks; namespace ProgramLib { /// - /// Methods to call into actions - /// + /// Partial class that define all the actions that can be executed + ///
public partial class Program { - /// - /// Power on UUT - /// public void UutPowerOn() { try @@ -47,17 +44,12 @@ namespace ProgramLib } catch (Exception ex) { - _logger.Error(ex.Message + "\n" + ex.StackTrace); - // DO NOT THROW in this block // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand TerminateTestOnMainThreadError(ex); } } - /// - /// Power off UUT - /// public void UutPowerOff() { try @@ -71,8 +63,6 @@ namespace ProgramLib } catch (Exception ex) { - _logger.Error(ex.Message + "\n" + ex.StackTrace); - // DO NOT THROW in this block // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand TerminateTestOnMainThreadError(ex); diff --git a/Source/Program/Program.FunctionalTests.cs b/Source/Program/Program.FunctionalTests.cs new file mode 100644 index 0000000..0f564f0 --- /dev/null +++ b/Source/Program/Program.FunctionalTests.cs @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ +using System; + +namespace ProgramLib +{ + /// + /// Partial class that define all the Functional Tests for all the Functional Test Requirements in the TRD + /// + public partial class Program + { + /// + /// GMA_ATP_001 - Perform UUT Safe-to-turn-on + /// + public void Perform_GMA_ATP_001_UUT_STTO() + { + try + { + BasicTest test = new GMA_ATP_001_UUT_STTO(); + test.RunTest(); + + } + catch (Exception ex) + { + // DO NOT THROW in this block + // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand + TerminateTestOnMainThreadError(ex); + } + } + } +} diff --git a/Source/Program/Program.MeasurementManager.cs b/Source/Program/Program.MeasurementManager.cs index f5f2b9c..14139ad 100644 --- a/Source/Program/Program.MeasurementManager.cs +++ b/Source/Program/Program.MeasurementManager.cs @@ -26,9 +26,10 @@ using Raytheon.Instruments; using Raytheon.Common; using NLog; using System.Windows.Interop; -using ProgramGui; +using ProgramLib; using NationalInstruments.TestStand.Interop.API; using System.Runtime.ExceptionServices; +using MeasurementManagerLib; namespace ProgramLib { @@ -37,8 +38,6 @@ namespace ProgramLib /// public partial class Program { - // Declare all the instrument managers here - private PowerSupplyMeasurementManager _psManager = null; private ProgramGuiManager _guiManager = null; internal bool _isUutPwrOn = false; @@ -53,13 +52,48 @@ namespace ProgramLib { try { - _psManager = new PowerSupplyMeasurementManager(_instrumentManager, _fileAndFolderManager.getFile(FileAndFolderManager.Files.POWER_SUPPLY_SELF_TEST_DATETIME)); - _psManager.Initialize(); + MalMeasurementLibManager.InitializePowerSupplyMeasurementManager(); } catch (Exception ex) { - _logger.Error(ex.Message + "\n" + ex.StackTrace); + // DO NOT THROW in this block + // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand + TerminateTestOnMainThreadError(ex); + } + } + /// + /// Initialize DIO measurement manager + /// + /// + /// + public void InitializeDioMeasurementManager() + { + try + { + MalMeasurementLibManager.InitializeDioMeasurementManager(); ; + } + catch (Exception ex) + { + // DO NOT THROW in this block + // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand + TerminateTestOnMainThreadError(ex); + } + } + + /// + /// Initialize switch measurement manager + /// + /// + /// + public void InitializeSwitchMeasurementManager() + { + try + { + MalMeasurementLibManager.InitializeSwitchMeasurementManager(); + } + catch (Exception ex) + { // DO NOT THROW in this block // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand TerminateTestOnMainThreadError(ex); @@ -80,8 +114,6 @@ namespace ProgramLib } catch (Exception ex) { - _logger.Error(ex.Message + "\n" + ex.StackTrace); - // DO NOT THROW in this block // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand TerminateTestOnMainThreadError(ex); @@ -104,11 +136,11 @@ namespace ProgramLib _threadList.Add(new FailureMonitorThread()); _threadList.Last().Start(); - ICollection psList = _instrumentManager.GetInstruments(typeof(PowerSupply)); + ICollection powerSystemList = _instrumentManager.GetInstruments(typeof(IPowerSupplySystem)); - foreach (PowerSupply ps in psList) + foreach (IPowerSupplySystem powerSystem in powerSystemList) { - _threadList.Add(new PowerSupplyReadThread(ps.Name)); + _threadList.Add(new PowerSupplyReadThread(powerSystem.Name)); _threadList.Last().Start(); } @@ -121,33 +153,18 @@ namespace ProgramLib } catch (Exception ex) { - _logger.Error(ex.Message + "\n" + ex.StackTrace); - // DO NOT THROW in this block // this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand TerminateTestOnMainThreadError(ex); } } - /// - /// Get power supply manager object - /// - /// - /// - public PowerSupplyMeasurementManager GetPowerSupplyMeasurementManager() - { - if (_psManager == null) - InitializePowerSupplyMeasurementManager(); - - return _psManager; - } - /// /// Get Gui manager object /// /// /// - public ProgramGuiManager GetGuiManager() + internal ProgramGuiManager GetGuiManager() { if (_guiManager == null) InitializeGuiManager(); diff --git a/Source/Program/Program.cs b/Source/Program/Program.cs index a46cfe6..74418be 100644 --- a/Source/Program/Program.cs +++ b/Source/Program/Program.cs @@ -15,15 +15,17 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ -using NationalInstruments.TestStand.Interop.API; -using NLog; -using Raytheon.Instruments; using System; using System.IO; using System.Reflection; using System.Collections.Generic; using System.Linq; + +using NationalInstruments.TestStand.Interop.API; +using NLog; +using Raytheon.Instruments; using Raytheon.Common; +using MeasurementManagerLib; namespace ProgramLib { @@ -31,7 +33,6 @@ namespace ProgramLib /// Class for interfacing with any Test Executive such as third party test executive such as Test Stand /// DO NOT implement IDisposable interface for this class. If there are unmanaged resources that need to be freed, /// do it in the destructor. - /// /// public partial class Program { @@ -65,15 +66,19 @@ namespace ProgramLib internal EventManager _eventManager = new EventManager(); internal FileAndFolderManager _fileAndFolderManager; internal IConfigurationFile _programConfig { get; private set; } + internal MalMeasurementLibManager MalMeasurementLibManager { get; private set; } + internal string _testMethodConfigFilePath; + + internal bool SttoSuccess { get; set; } /// - /// Create an instance of this class. Only one instance is allowed - /// - /// The UUT part number - /// The UUT serial number - /// false for simulation - /// - public static Program Instance(string partNumber = "", string serialNumber = "", bool isThereHardware = true, object testStandSeqContext = null) + /// Create an instance of this class. Only one instance is allowed + /// + /// The UUT part number + /// The UUT serial number + /// false for simulation + /// + public static Program Instance(string partNumber = "", string serialNumber = "", bool isThereHardware = true, object testStandSeqContext = null) { if (_program == null) { @@ -130,6 +135,8 @@ namespace ProgramLib string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _programConfig = new ConfigurationFile(Path.Combine(assemblyFolder, GeneralConstants.ProgramConfigFilename)); + _testMethodConfigFilePath = Path.Combine(assemblyFolder, GeneralConstants.TestMethodConfigFolderName, GeneralConstants.TestMethodConfigFileName); + _fileAndFolderManager = new FileAndFolderManager(_programConfig); if (testStandSeqContext != null) @@ -152,17 +159,22 @@ namespace ProgramLib _serialNumber = serialNumber; _isThereHardware = isThereHardware; + SttoSuccess = false; + // Initialze all other configuration that the program needs _uutInfo = new UutInfo(_partNumber, _serialNumber); try { - var configFolder = Path.Combine(assemblyFolder, Raytheon.Common.GeneralConstants.InstrumentConfigFolder); + var configFolder = Path.Combine(assemblyFolder, Raytheon.Common.Constants.InstrumentConfigFolder); _instrumentManager = new GeneralInstrumentManager(assemblyFolder, configFolder, _isThereHardware); _instrumentManager.Initialize(); + + MalMeasurementLibManager = new MalMeasurementLibManager(_instrumentManager); } catch (Exception) { + throw; } } @@ -211,6 +223,8 @@ namespace ProgramLib { if (_testStandSeqContext != null) { + _logger.Error(ex.Message + "\n" + ex.StackTrace); + lock (_terminateTestSyncObj) { if (!_terminateTestInitiated) diff --git a/Source/Program/Program.csproj b/Source/Program/Program.csproj index bbf14ae..022b275 100644 --- a/Source/Program/Program.csproj +++ b/Source/Program/Program.csproj @@ -1,73 +1,86 @@  - - - net472 - Library - Program - true - Program DLL serves as starting test point - Raytheon Technologies - NGSRI Program - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - true - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - + + + net472 + Library + Program + true + NGSRI Program + NGSRI Program GUI + true - - 1.0.0 - Debug;Release;Deploy - + + + 1.0.0 + Resources\Icons\app.ico + 10.0 + - - - + - - - + + + + + + - - - - - - - - - - - - - - - + ..\ProgramLib\Dependencies\NationalInstruments.TestStand.Interop.API.dll - - + + + + + + + + + + + + + + + + + + + + + True + True + Settings.settings + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + - - + + + - - - + + + + + diff --git a/Source/Program/ProgramConfigFile/config.ini b/Source/Program/ProgramConfigFiles/config.ini similarity index 100% rename from Source/Program/ProgramConfigFile/config.ini rename to Source/Program/ProgramConfigFiles/config.ini diff --git a/Source/ProgramGUI/Properties/Resources.Designer.cs b/Source/Program/Properties/Resources.Designer.cs similarity index 98% rename from Source/ProgramGUI/Properties/Resources.Designer.cs rename to Source/Program/Properties/Resources.Designer.cs index 22b0fd3..af88a35 100644 --- a/Source/ProgramGUI/Properties/Resources.Designer.cs +++ b/Source/Program/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace ProgramGui.Properties { +namespace ProgramLib.Properties { using System; diff --git a/Source/ProgramGUI/Properties/Resources.resx b/Source/Program/Properties/Resources.resx similarity index 100% rename from Source/ProgramGUI/Properties/Resources.resx rename to Source/Program/Properties/Resources.resx diff --git a/Source/ProgramGUI/Properties/Settings.Designer.cs b/Source/Program/Properties/Settings.Designer.cs similarity index 96% rename from Source/ProgramGUI/Properties/Settings.Designer.cs rename to Source/Program/Properties/Settings.Designer.cs index 0dbd834..5bbcb7b 100644 --- a/Source/ProgramGUI/Properties/Settings.Designer.cs +++ b/Source/Program/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace ProgramGui.Properties { +namespace Program.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/Source/ProgramGUI/Properties/Settings.settings b/Source/Program/Properties/Settings.settings similarity index 100% rename from Source/ProgramGUI/Properties/Settings.settings rename to Source/Program/Properties/Settings.settings diff --git a/Source/ProgramGUI/Resources/Icons/app.ico b/Source/Program/Resources/Icons/app.ico similarity index 100% rename from Source/ProgramGUI/Resources/Icons/app.ico rename to Source/Program/Resources/Icons/app.ico diff --git a/Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/close_black.png b/Source/Program/Resources/Images/Title_Bar_Buttons/close_black.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/close_black.png rename to Source/Program/Resources/Images/Title_Bar_Buttons/close_black.png diff --git a/Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/close_white.png b/Source/Program/Resources/Images/Title_Bar_Buttons/close_white.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/close_white.png rename to Source/Program/Resources/Images/Title_Bar_Buttons/close_white.png diff --git a/Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/maximize.png b/Source/Program/Resources/Images/Title_Bar_Buttons/maximize.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/maximize.png rename to Source/Program/Resources/Images/Title_Bar_Buttons/maximize.png diff --git a/Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/minimize.png b/Source/Program/Resources/Images/Title_Bar_Buttons/minimize.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/minimize.png rename to Source/Program/Resources/Images/Title_Bar_Buttons/minimize.png diff --git a/Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/restore.png b/Source/Program/Resources/Images/Title_Bar_Buttons/restore.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/Title_Bar_Buttons/restore.png rename to Source/Program/Resources/Images/Title_Bar_Buttons/restore.png diff --git a/Source/ProgramGUI/Resources/Images/black-led.png b/Source/Program/Resources/Images/black-led.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/black-led.png rename to Source/Program/Resources/Images/black-led.png diff --git a/Source/ProgramGUI/Resources/Images/green-check-mark.png b/Source/Program/Resources/Images/green-check-mark.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/green-check-mark.png rename to Source/Program/Resources/Images/green-check-mark.png diff --git a/Source/ProgramGUI/Resources/Images/green-led.png b/Source/Program/Resources/Images/green-led.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/green-led.png rename to Source/Program/Resources/Images/green-led.png diff --git a/Source/ProgramGUI/Resources/Images/missile.png b/Source/Program/Resources/Images/missile.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/missile.png rename to Source/Program/Resources/Images/missile.png diff --git a/Source/ProgramGUI/Resources/Images/red-cross-mark.png b/Source/Program/Resources/Images/red-cross-mark.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/red-cross-mark.png rename to Source/Program/Resources/Images/red-cross-mark.png diff --git a/Source/ProgramGUI/Resources/Images/red-led.png b/Source/Program/Resources/Images/red-led.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/red-led.png rename to Source/Program/Resources/Images/red-led.png diff --git a/Source/ProgramGUI/Resources/Images/yellow-led.png b/Source/Program/Resources/Images/yellow-led.png similarity index 100% rename from Source/ProgramGUI/Resources/Images/yellow-led.png rename to Source/Program/Resources/Images/yellow-led.png diff --git a/Source/Program/TestMethodConfigFiles/Test_Method_Configuration.ini b/Source/Program/TestMethodConfigFiles/Test_Method_Configuration.ini new file mode 100644 index 0000000..56066a5 --- /dev/null +++ b/Source/Program/TestMethodConfigFiles/Test_Method_Configuration.ini @@ -0,0 +1,73 @@ +[GMA_ATP_001_UUT_STTO] +PLACEHOLDER = PLACEHOLDER + +;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit +;Type is TWO or FOUR for two wire and four wire measurements +;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#] +; [Card_Name] - must match the name of the switch card defined in the Instrument.xml +;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id] +[GMA_ATP_001_UUT_STTO.DMM_RESISTANCE_MEASUREMENTS] +R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0 +R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0 + +; a list of relays that the software will reject if commanded.. +; cannot be empty, put "NONE" if there are no exclusions +[GMA_ATP_001_UUT_STTO.RELAY_EXCLUSION_LIST] +EXCLUSION_LIST = NONE + +;===================================================================================================================== + +[GMA_ATP_002_UUT_CI] +PLACEHOLDER = PLACEHOLDER + +;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit +;Type is TWO or FOUR for two wire and four wire measurements +;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#] +; [Card_Name] - must match the name of the switch card defined in the Instrument.xml +;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id] +[GMA_ATP_002_UUT_CI.DMM_RESISTANCE_MEASUREMENTS] +R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0 +R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0 + +; a list of relays that the software will reject if commanded.. +; cannot be empty, put "NONE" if there are no exclusions +[GMA_ATP_002_UUT_CI.RELAY_EXCLUSION_LIST] +EXCLUSION_LIST = NONE + +;===================================================================================================================== + +[AUR_ATP_001_UUT_STTO] +PLACEHOLDER = PLACEHOLDER + +;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit +;Type is TWO or FOUR for two wire and four wire measurements +;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#] +; [Card_Name] - must match the name of the switch card defined in the Instrument.xml +;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id] +[AUR_ATP_001_UUT_STTO.DMM_RESISTANCE_MEASUREMENTS] +R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1:-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0 +R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0 + +; a list of relays that the software will reject if commanded.. +; cannot be empty, put "NONE" if there are no exclusions +[AUR_ATP_001_UUT_STTO.RELAY_EXCLUSION_LIST] +EXCLUSION_LIST = NONE + +;===================================================================================================================== + +[AUR_ATP_002_UUT_CI] +PLACEHOLDER = PLACEHOLDER + +;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit +;Type is TWO or FOUR for two wire and four wire measurements +;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#] +; [Card_Name] - must match the name of the switch card defined in the Instrument.xml +;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id] +[AUR_ATP_002_UUT_CI.DMM_RESISTANCE_MEASUREMENTS] +R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1:-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0 +R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0 + +; a list of relays that the software will reject if commanded.. +; cannot be empty, put "NONE" if there are no exclusions +[AUR_ATP_002_UUT_CI.RELAY_EXCLUSION_LIST] +EXCLUSION_LIST = NONE \ No newline at end of file diff --git a/Source/Program/Threads/FailureMonitorThread.cs b/Source/Program/Threads/FailureMonitorThread.cs index 09317fa..10e0eed 100644 --- a/Source/Program/Threads/FailureMonitorThread.cs +++ b/Source/Program/Threads/FailureMonitorThread.cs @@ -16,15 +16,9 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ using NLog; -using ProgramGui.Model; -using ProgramGui; -using ProgramLib; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; namespace ProgramLib { diff --git a/Source/Program/Threads/PassthroughDataUpdateThread.cs b/Source/Program/Threads/PassthroughDataUpdateThread.cs index b473d25..220b7ee 100644 --- a/Source/Program/Threads/PassthroughDataUpdateThread.cs +++ b/Source/Program/Threads/PassthroughDataUpdateThread.cs @@ -16,16 +16,12 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ using NLog; -using ProgramGui; -using ProgramGui.Model; -using ProgramGui.ViewModel; -using ProgramLib; +using ProgramLib.GUI.Model; +using ProgramLib.GUI.View; +using ProgramLib.GUI.ViewModel; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; namespace ProgramLib { @@ -46,7 +42,7 @@ namespace ProgramLib } private ILogger _logger; - private MainWindow _mainWindow; + private LiveDataWindow _liveDataWindow; private PassthroughData _passthroughData = null; /// @@ -56,13 +52,13 @@ namespace ProgramLib { _logger = LogManager.GetCurrentClassLogger(); - _mainWindow = (MainWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN]; + _liveDataWindow = (LiveDataWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA]; - _passthroughData = new PassthroughData(_mainWindow.datagridPassthroughData.Columns.Count); + _passthroughData = new PassthroughData(_liveDataWindow.datagridPassthroughData.Columns.Count); - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Dispatcher.Invoke((Action)delegate { - _mainWindow._mainWindowViewModel.AddPassthroughData(_passthroughData.GetPassthroughDataModelDict()); + _liveDataWindow.LiveDataWindowViewModel.AddPassthroughData(_passthroughData.GetPassthroughDataModelDict()); }); } @@ -137,7 +133,7 @@ namespace ProgramLib if (id == Events.EVENT_TIMED_OUT) { rnd = new Random(); - _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_OFF]; + _liveDataWindow.LiveDataWindowViewModel.UutPowerLedImagePath = _liveDataWindow.LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF]; float num = 70.0f + GenerateRandomFraction(); _passthroughData.SetValue(PassthroughData.Variables.VAR1, num.ToString("0.00")); @@ -152,7 +148,7 @@ namespace ProgramLib num = 50.0f + GenerateRandomFraction(); _passthroughData.SetValue(PassthroughData.Variables.VAR4, num.ToString("0.00")); Thread.Sleep(100); - _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_ON]; + _liveDataWindow.LiveDataWindowViewModel.UutPowerLedImagePath = _liveDataWindow.LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON]; num = 60.0f + GenerateRandomFraction(); _passthroughData.SetValue(PassthroughData.Variables.VAR5, num.ToString("0.00")); Thread.Sleep(200); diff --git a/Source/Program/Threads/PowerSupplyReadThread.cs b/Source/Program/Threads/PowerSupplyReadThread.cs index 8b149eb..6a71431 100644 --- a/Source/Program/Threads/PowerSupplyReadThread.cs +++ b/Source/Program/Threads/PowerSupplyReadThread.cs @@ -20,6 +20,7 @@ using System.Collections; using System.Collections.Generic; using System.Threading; using NLog; +using Raytheon.Instruments.PowerSupply; namespace ProgramLib { @@ -44,7 +45,8 @@ namespace ProgramLib private string _powerSupplySystemName; private List _powerModuleNameList; - Dictionary _powerSupplyModuleInfoDict; + + Dictionary _powerSupplyModuleInfoDict; /// /// Constructor @@ -80,8 +82,8 @@ namespace ProgramLib EventGroup eventGroup = new EventGroup(eventDict); - _powerModuleNameList = Program.Instance().GetPowerSupplyMeasurementManager()[_powerSupplySystemName].GetModuleNames(); - _powerSupplyModuleInfoDict = Program.Instance().GetPowerSupplyMeasurementManager()[_powerSupplySystemName].GetPowerSupplyModuleInfoDict(); + _powerModuleNameList = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetPowerSupplyList(_powerSupplySystemName); + _powerSupplyModuleInfoDict = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetPowerSupplyModuleInfoDict(_powerSupplySystemName); while (true) { @@ -123,12 +125,6 @@ namespace ProgramLib EventGroup eventGroup = new EventGroup(eventDict); - double voltage; - double current; - double voltageSetPoint; - bool isOn; - int faultStatus; - while (true) { Events id = eventGroup.WaitAny(pollRateMs); @@ -137,22 +133,16 @@ namespace ProgramLib { foreach (string moduleName in _powerModuleNameList) { - Program.Instance().GetPowerSupplyMeasurementManager()[_powerSupplySystemName].ReadPowerSupplyData(moduleName, out voltage, out current, out voltageSetPoint, out isOn, out faultStatus); + PowerData data = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.ReadPowerData(moduleName); - BitArray statusReg = new BitArray(new int[] { faultStatus }); + BitArray statusReg = new BitArray(new int[] { data.FaultStatus }); bool ovpTriggeredInPowerSupply = statusReg[0]; bool ocpTriggeredInPowerSupply = statusReg[1]; if (!ovpTriggeredInPowerSupply && !ocpTriggeredInPowerSupply) { - if (IsCurrentWithinLimits(moduleName, current)) - break; - - if (IsVoltageWithinLimits(moduleName, voltage)) - break; - - Program.Instance()._powerSupplySharedData.SetData(moduleName, voltage, current, _powerSupplyModuleInfoDict[moduleName]); + Program.Instance()._powerSupplySharedData.SetData(moduleName, data.Voltage, data.Current, _powerSupplyModuleInfoDict[moduleName]); } else { @@ -193,14 +183,16 @@ namespace ProgramLib private bool IsCurrentWithinLimits(string moduleName, double current) { bool outOfLimits = false; - Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName]; - if ((current < powerSupplyModuleInfo.currentLowerLimit_ || current > powerSupplyModuleInfo.currentUpperLimit_) && powerSupplyModuleInfo.isOn_) - { - outOfLimits = true; - string errorMsg = moduleName + "'s current is out of limits (" + powerSupplyModuleInfo.currentLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.currentUpperLimit_.ToString("0.00") + "). Current reading: " + current.ToString("0.00"); - HandleOutOfToleranceCondition(errorMsg); - } + // Duc - is this function needed? + //Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName]; + + //if ((current < powerSupplyModuleInfo.currentLowerLimit_ || current > powerSupplyModuleInfo.currentUpperLimit_) && powerSupplyModuleInfo.isOn_) + //{ + // outOfLimits = true; + // string errorMsg = moduleName + "'s current is out of limits (" + powerSupplyModuleInfo.currentLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.currentUpperLimit_.ToString("0.00") + "). Current reading: " + current.ToString("0.00"); + // HandleOutOfToleranceCondition(errorMsg); + //} return outOfLimits; } @@ -213,14 +205,15 @@ namespace ProgramLib private bool IsVoltageWithinLimits(string moduleName, double voltage) { bool outOfLimits = false; - Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName]; + // Duc - is this function needed? + //Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName]; - if ((voltage < powerSupplyModuleInfo.voltageLowerLimit_ || voltage > powerSupplyModuleInfo.voltageUpperLimit_) && powerSupplyModuleInfo.isOn_) - { - outOfLimits = true; - string errorMsg = moduleName + "'s voltage is out of limits (" + powerSupplyModuleInfo.voltageLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.voltageUpperLimit_.ToString("0.00") + "). Voltage reading: " + voltage.ToString("0.00"); - HandleOutOfToleranceCondition(errorMsg); - } + //if ((voltage < powerSupplyModuleInfo.voltageLowerLimit_ || voltage > powerSupplyModuleInfo.voltageUpperLimit_) && powerSupplyModuleInfo.isOn_) + //{ + // outOfLimits = true; + // string errorMsg = moduleName + "'s voltage is out of limits (" + powerSupplyModuleInfo.voltageLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.voltageUpperLimit_.ToString("0.00") + "). Voltage reading: " + voltage.ToString("0.00"); + // HandleOutOfToleranceCondition(errorMsg); + //} return outOfLimits; } diff --git a/Source/Program/Threads/PowerSupplyUpdateThread.cs b/Source/Program/Threads/PowerSupplyUpdateThread.cs index 15797a2..0cbbe6e 100644 --- a/Source/Program/Threads/PowerSupplyUpdateThread.cs +++ b/Source/Program/Threads/PowerSupplyUpdateThread.cs @@ -16,16 +16,11 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ using NLog; -using ProgramGui; -using ProgramGui.Model; -using ProgramGui.ViewModel; -using ProgramLib; +using ProgramLib.GUI.Model; +using ProgramLib.GUI.View; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; namespace ProgramLib { @@ -46,7 +41,7 @@ namespace ProgramLib } private ILogger _logger; - private MainWindow _mainWindow; + private LiveDataWindow _mainWindow; private Dictionary _powerModuleToPowerDataModelDict = new Dictionary(); @@ -57,14 +52,14 @@ namespace ProgramLib { _logger = LogManager.GetCurrentClassLogger(); - _mainWindow = (MainWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN]; + _mainWindow = (LiveDataWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA]; _powerModuleToPowerDataModelDict["UUT_P20V"] = new PowerModuleDataModel(); _powerModuleToPowerDataModelDict["UUT_N20V"] = new PowerModuleDataModel(); - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Dispatcher.Invoke((Action)delegate { - _mainWindow._mainWindowViewModel.AddPowerData(_powerModuleToPowerDataModelDict); + _mainWindow.LiveDataWindowViewModel.AddPowerData(_powerModuleToPowerDataModelDict); }); } @@ -137,7 +132,7 @@ namespace ProgramLib if (id == Events.EVENT_TIMED_OUT) { - PowerSupplyData data = Program.Instance()._powerSupplySharedData.GetData(PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V.ToString()); + PowerSupplyData data = Program.Instance()._powerSupplySharedData.GetData("STE_PVM_5V"); if (data != null && data._initialized) { diff --git a/Source/ProgramGUI/ProgramGui.csproj b/Source/ProgramGUI/ProgramGui.csproj deleted file mode 100644 index be777e1..0000000 --- a/Source/ProgramGUI/ProgramGui.csproj +++ /dev/null @@ -1,68 +0,0 @@ - - - - net472 - Library - ProgramGui - true - NGSRI Program GUI - Raytheonn Technologies - NGSRI Program GUI - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - false - - - - - 1.0.0 - Debug;Release;Deploy - Resources\Icons\app.ico - 8.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/Raytheon.Common/Raytheon.Common.csproj b/Source/Raytheon.Common/Raytheon.Common.csproj deleted file mode 100644 index dda7df4..0000000 --- a/Source/Raytheon.Common/Raytheon.Common.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net472 - Library - Raytheon.Common - Raytheon Technologies - Raytheon Common Library - Raytheon Common Library - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - - 1.0.0 - Debug;Release;Deploy - - - \ No newline at end of file diff --git a/Source/Solution.props b/Source/Solution.props new file mode 100644 index 0000000..27591c5 --- /dev/null +++ b/Source/Solution.props @@ -0,0 +1,57 @@ + + + + + $([System.DateTime]::get_now().ToString("yyyy")) + + $(Year) + $([System.DateTime]::get_now().ToString("MM")) + $([System.DateTime]::get_now().ToString("dd")) + $([MSBuild]::Divide($([System.DateTime]::get_Now().get_TimeOfDay().get_TotalMinutes()), 2).ToString('F0')) + + $(Major).$(Minor).$(Build).$(Revision) + + Raytheon Technologies + TEEC + Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) + true + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + README.md + Debug;Release;Deploy + + + true + + + true + + $(SolutionDir)HalTempFolder + + + + + + + + + + + + + + _Project_Items\readme.md + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/AutomationMessages/AutomationMessage.cs b/Source/TSRealLib/Common/Raytheon.Common/AutomationMessages/AutomationMessage.cs new file mode 100644 index 0000000..19894c8 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/AutomationMessages/AutomationMessage.cs @@ -0,0 +1,192 @@ +// ********************************************************************************************************** +// AutomationMessage.cs +// 1/8/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Common +{ + /// + /// An abstract base class for AutomationMessages that go between the client and server + /// + public abstract class AutomationMessage : ICloneable + { + #region PrivateClassMembers + private string _description; + protected AutomationMessageHeader _header; + #endregion + + #region PrivateClassFunctions + + /// + /// The constructor + /// + /// The AutomationMessage id + /// The AutomationMessage description + /// The number of bytes in the payload of the AutomationMessage. (The number of bytes in the child class) + protected AutomationMessage(uint messageId, string description, uint messageLength) + { + _description = description; + _header = new AutomationMessageHeader(messageId, messageLength); + } + + /// + /// Copy Constructor + /// + /// The AutomationMessage to copy from + protected AutomationMessage(AutomationMessage message) + { + _header = new AutomationMessageHeader(message._header); + _description = message._description; + } + + + + /// + /// Sets the number of bytes in the entire AutomationMessage, including header. + /// Some times when receiving a AutomationMessage, you must instantiate the object before you know how many bytes the AutomationMessage is + /// + /// The number of bytes in the entire AutomationMessage + protected void SetMessageLen(uint messageLength) + { + _header.SetMessageLen(messageLength); + } + + /// + /// abstract function for children to implement a clone of their object + /// + /// + protected abstract object CloneSelf(); + + /// + /// abstract function for children to implement the function that they serve + /// + public abstract void ExecuteMsg(); + + /// + /// abstract function for children to implement the formatting of their parameters + /// + /// + protected abstract void FormatData(IntPtr pData); + + /// + /// abstract function for children to implement the parsing of their parameters + /// + /// + protected abstract void ParseData(IntPtr pData); + #endregion + + #region PublicClassFunctions + + /// + /// Get a copy of the AutomationMessage object + /// + /// + public object Clone() + { + // tell the child to clone itself + return this.CloneSelf(); + } + + /// + /// Encode the AutomationMessage into a byte array for sending + /// + /// The buffer to put the AutomationMessage items + public void Format(IntPtr pData) + { + _header.Format(pData); + + IntPtr pPayload = IntPtr.Add(pData, (int)GetHeaderLength()); + + // ask child class to format its data + FormatData(pPayload); + } + + /// + /// Getter + /// + /// The description + public string GetDescription() + { + return _description; + } + + /// + /// Getter + /// + /// The number of bytes in the AutomationMessage, including header + public uint GetEntireMsgLength() + { + return _header.GetEntireMsgLength(); + } + + /// + /// getter + /// + /// The id + public uint GetMessageId() + { + return _header.GetMessageId(); + } + + /// + /// getter + /// + /// The number of bytes in the head + public uint GetHeaderLength() + { + return _header.GetHeaderLength(); + } + + /// + /// Takes an array of bytes and populates the AutomationMessage object + /// + /// The AutomationMessage in byte form + public void Parse(IntPtr pData) + { + _header.Parse(pData); + + IntPtr pPayLoad = IntPtr.Add(pData, (int)GetHeaderLength()); + + ParseData(pPayLoad); + } + + /// + /// Convert this AutomationMessage into string form + /// + /// The AutomationMessage in string form + public override string ToString() + { + return "Description: " + GetDescription() + "\n" + _header.ToString(); + } + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/AutomationMessages/AutomationMessageHeader.cs b/Source/TSRealLib/Common/Raytheon.Common/AutomationMessages/AutomationMessageHeader.cs new file mode 100644 index 0000000..e5ea2d4 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/AutomationMessages/AutomationMessageHeader.cs @@ -0,0 +1,160 @@ +// ********************************************************************************************************** +// AutomationMessageHeader.cs +// 1/8/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Common +{ + /// + /// The header for all messages + /// + public class AutomationMessageHeader + { + #region PublicClassMembers + public const int HEADER_EXPECTED_SIZE = 8; + #endregion + + #region PrivateClassMembers + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct HeaderStruct + { + public uint messageId; + public uint messageLength;// total msg size in bytes..Including the header. + }; + + private HeaderStruct _headerStruct; + #endregion + + #region PublicClassFunctions + + /// + /// Copy constructor + /// + /// The header to copy + public AutomationMessageHeader(AutomationMessageHeader header) + { + _headerStruct = new HeaderStruct(); + _headerStruct = header._headerStruct; + } + + /// + /// Constructor for when receiving data. + /// Use this constructor and then parse to populate it + /// + public AutomationMessageHeader() + { + _headerStruct = new HeaderStruct(); + } + + /// + /// Constructor for sending + /// + /// the message id + /// The number of bytes in the message, not including the header + public AutomationMessageHeader(uint msgId, uint messageLength) + { + _headerStruct = new HeaderStruct + { + messageId = msgId, + messageLength = messageLength + GetHeaderLength() + }; + } + + /// + /// Encode the header into a byte array for sending + /// + /// The buffer to put the message items + public void Format(IntPtr pData) + { + Marshal.StructureToPtr(_headerStruct, pData, true); + } + + /// + /// Getter + /// + /// The number of bytes in the message, including header + public uint GetEntireMsgLength() + { + return _headerStruct.messageLength; + } + + /// + /// getter + /// + /// The id + public uint GetMessageId() + { + return _headerStruct.messageId; + } + + /// + /// getter + /// + /// The header length in bytes + public uint GetHeaderLength() + { + return (uint)Marshal.SizeOf(_headerStruct); + } + + /// + /// Takes an array of bytes and populates the header object + /// + /// The header in byte form + public void Parse(IntPtr pData) + { + _headerStruct = (HeaderStruct)Marshal.PtrToStructure(pData, typeof(HeaderStruct)); + } + + /// + /// + /// + /// + public void SetMessageLen(uint messageLength) + { + _headerStruct.messageLength = messageLength + GetHeaderLength(); + } + + /// + /// Creates a string version of the header members + /// + /// A string containing the header data + public override string ToString() + { + string msg = "Header Data:\r\n"; + msg += "msg id: " + Convert.ToString(_headerStruct.messageId) + "\r\n"; + msg += "msg len: " + Convert.ToString(_headerStruct.messageLength) + "\r\n"; + return msg; + } + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Json/JsonConfigurationFile.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Json/JsonConfigurationFile.cs new file mode 100644 index 0000000..06a3f1d --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Json/JsonConfigurationFile.cs @@ -0,0 +1,198 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json; + +namespace Raytheon.Common +{ + /// + /// Implementation of the IConfigurationFile interface for Json file format + /// + public class JsonConfigurationFile : ConfigurationFileBase + { + + private Dictionary> _data; + + /// + /// constructor + /// + /// + /// + public JsonConfigurationFile(string fileName) + : base(fileName) + { + if (_configurationType != ConfigurationFileType.JSON) + { + throw new ArgumentException("Expecting JSON file configuration type"); + } + + if (!_fileInfo.Exists) + { + using (File.Create(_fileInfo.FullName)) { } + } + } + + /// + /// reads all available keys from given section from current configuration file + /// + /// + /// + public override List ReadAllKeys(string section) + { + string json = File.ReadAllText(_fileName); + if (!string.IsNullOrEmpty(json)) + { + _data = JsonConvert.DeserializeObject>>(json); + } + else + { + _data = new Dictionary>(); + } + return _data.ContainsKey(section) ? _data[section].Keys.ToList() : new List(); + } + + /// + /// reads all available sections from current configuration file + /// + /// list of sections + public override List ReadAllSections() + { + string json = File.ReadAllText(_fileName); + if (!string.IsNullOrEmpty(json)) + { + _data = JsonConvert.DeserializeObject>>(json); + } + else + { + _data = new Dictionary>(); + } + return _data.Keys.ToList(); + } + + public override List ReadList(string section, string key, IList defList = null) + { + return ReadValue(section, key, defList).ToList(); + } + + /// + /// reads a single value in json format + /// + /// + /// + /// + /// + /// configuration value + /// + public override T ReadValue(string section, string key, T defValue = default) + { + string json = File.ReadAllText(_fileName); + if (!string.IsNullOrEmpty(json)) + { + _data = JsonConvert.DeserializeObject>>(json); + } + else + { + _data = new Dictionary>(); + } + + if (_data.ContainsKey(section) && _data[section].ContainsKey(key)) + { + return JsonConvert.DeserializeObject(_data[section][key]); + } + else + { + WriteValue(section, key, defValue); + return defValue; + } + } + + /// + /// reads a single value in json format + /// + /// + /// + /// configuration value + /// + public override string ReadValue(string section, string key) + { + throw new NotImplementedException(); + } + + /// + /// writes a list of values of any generic type + /// + /// + /// + /// + /// + public override void WriteList(string section, string key, IList listToWrite) + { + WriteValue(section, key, listToWrite); + } + + /// + /// writes a single value + /// + /// + /// + /// + /// + public override void WriteValue(string section, string key, T lineToWrite) + { + string json = File.ReadAllText(_fileName); + if (!string.IsNullOrEmpty(json)) + { + _data = JsonConvert.DeserializeObject>>(json); + } + else + { + _data = new Dictionary>(); + } + + if (!_data.ContainsKey(section)) + { + _data[section] = new Dictionary(); + } + + _data[section][key] = JsonConvert.SerializeObject(lineToWrite); + + using (StreamWriter writer = new StreamWriter(_fileName, false)) + { + writer.WriteLine(JsonConvert.SerializeObject(_data)); + } + } + + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Yaml/YamlConfigurationFile.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Yaml/YamlConfigurationFile.cs new file mode 100644 index 0000000..8a0dfa7 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Yaml/YamlConfigurationFile.cs @@ -0,0 +1,139 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +// Ignore Spelling: Yaml + +using System; +using System.Collections.Generic; +using System.IO; + +namespace Raytheon.Common +{ + public class YamlConfigurationFile : ConfigurationFileBase + { + + //private Dictionary> _data; + + /// + /// constructor + /// + /// + /// + public YamlConfigurationFile(string fileName) + : base(fileName) + { + if (_configurationType != ConfigurationFileType.OTHER) + { + throw new ArgumentException("Expecting YAML file configuration type"); + } + + if (!_fileInfo.Exists) + { + using (File.Create(_fileInfo.FullName)) { } + } + } + + /// + /// reads all available keys from given section from current configuration file + /// + /// + /// + public override List ReadAllKeys(string section) + { + throw new NotImplementedException(); + } + + /// + /// reads all available sections from current configuration file + /// + /// list of sections + public override List ReadAllSections() + { + throw new NotImplementedException(); + } + + public override List ReadList(string section, string key, IList defList = null) + { + throw new NotImplementedException(); + } + + /// + /// reads a single value in yaml format + /// + /// + /// + /// + /// + /// configuration value + /// + public override T ReadValue(string section, string key, T defValue = default) + { + throw new NotImplementedException(); + } + + /// + /// reads a single value in json format + /// + /// + /// + /// configuration value + /// + public override string ReadValue(string section, string key) + { + throw new NotImplementedException(); + } + + /// + /// writes a list of values of any generic type + /// + /// + /// + /// + /// + public override void WriteList(string section, string key, IList listToWrite) + { + throw new NotImplementedException(); + } + + /// + /// writes a single value + /// + /// + /// + /// + /// + public override void WriteValue(string section, string key, T lineToWrite) + { + throw new NotImplementedException(); + } + + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Yaml/YamlConfigurationFileFactory.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Yaml/YamlConfigurationFileFactory.cs new file mode 100644 index 0000000..ea13f62 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration.Yaml/YamlConfigurationFileFactory.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Raytheon.Common +{ + public class YamlConfigurationFileFactory : ConfigurationFileFactoryBase + { + /// + /// + /// + /// + /// + public override IConfigurationFile CreateConfigurationFile(string fileName) + { + return new YamlConfigurationFile(fileName); + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationFile.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationFile.cs new file mode 100644 index 0000000..d547702 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationFile.cs @@ -0,0 +1,197 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; +using System.Collections.Generic; + +namespace Raytheon.Common +{ + + /// + /// main class to be instantiated when working with configuration files + /// + public class ConfigurationFile : ConfigurationFileBase + { + /// + /// concrete implementation reference + /// + protected IConfigurationFile _configurationFile; + + /// + /// Raytheon.Configuration will support INI and XML file formats. + /// For other formats have to use designated constructor + /// + /// + /// + public ConfigurationFile(string fileName) + : base(fileName) + { + if (!_fileInfo.Exists) + { + throw new Exception($"Can't find file: {fileName}"); + } + var factory = GetFactory(); + _configurationFile = factory.GetConfigurationFile(fileName); + } + + /// + /// extension constructor, for other types based on the provided factory + /// + /// + /// + public ConfigurationFile(string fileName, ConfigurationFileFactoryBase factory) + : base(fileName) + { + if (!_fileInfo.Exists) + { + throw new Exception($"Can't find file: {fileName}"); + } + _configurationFile = factory.GetConfigurationFile(fileName); + } + + /// + /// extension constructor, for other types based on provided type + /// + /// + /// + public ConfigurationFile(string fileName, string type) + : base(fileName) + { + if (!_fileInfo.Exists) + { + throw new Exception($"Can't find file: {fileName}"); + } + ConfigurationFileFactory factory = new(type); + _configurationFile = factory.GetConfigurationFile(fileName); + } + + /// + /// returns a factory based on file extension + /// + /// + /// + private static ConfigurationFileFactoryBase GetFactory() + { + ConfigurationFileType configurationType = ConfigurationTypeFromFileExtension(_fileInfo.Extension); + + ConfigurationFileFactoryBase factory = configurationType switch + { + ConfigurationFileType.INI => new IniConfigurationFileFactory(), + ConfigurationFileType.XML => new XmlConfigurationFileFactory(), + ConfigurationFileType.JSON => new JsonConfigurationFileFactory(), + ConfigurationFileType.TOML => new TomlConfigurationFileFactory(), + _ => throw new ArgumentException($"Configuration Type ({configurationType}) not supported by Configuration Manager"), + }; + return factory; + } + + /// + /// Reads all keys from a section of an ini file. + /// + /// + /// + public override List ReadAllKeys(string section) + { + return _configurationFile.ReadAllKeys(section); + } + + /// + /// Returns a list of all of the sections in the ini file. + /// + /// + public override List ReadAllSections() + { + return _configurationFile.ReadAllSections(); + } + + /// + /// reads a list of values from configuration file + /// + /// + /// + /// + /// + /// + public override List ReadList(string section, string key, IList defList = null) + { + return _configurationFile.ReadList(section, key, defList); + } + + /// + /// reads a value from configuration file + /// + /// + /// + /// + /// + /// + public override T ReadValue(string section, string key, T defValue = default) + { + return _configurationFile.ReadValue(section, key, defValue); + } + + /// + /// reads a single value in json format + /// + /// + /// + /// configuration value + /// + public override string ReadValue(string section, string key) + { + return _configurationFile.ReadValue(section, key); + } + + /// + /// writes a list of values to configuration file + /// + /// + /// + /// + /// + public override void WriteList(string section, string key, IList listToWrite) + { + _configurationFile.WriteList(section, key, listToWrite); + } + + /// + /// Write string value + /// + /// + /// + /// + /// + public override void WriteValue(string section, string key, T lineToWrite) + { + _configurationFile.WriteValue(section, key, lineToWrite); + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationFileBase.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationFileBase.cs new file mode 100644 index 0000000..f45f66f --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationFileBase.cs @@ -0,0 +1,174 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; +using System.Collections.Generic; +using System.IO; + +namespace Raytheon.Common +{ + /// + /// + /// + public abstract class ConfigurationFileBase : IConfigurationFile + { + /// + /// configuration file info + /// + protected static FileInfo _fileInfo; + + /// + /// configuration file name + /// + protected string _fileName; + + /// + /// returns file name + /// + public string FileName => _fileName; + + /// + /// configuration type derived based on file extension + /// or by the type of the IConfigurationFile implementation + /// + protected ConfigurationFileType _configurationType; + + /// + /// returns configuration type + /// + public ConfigurationFileType ConfigurationFileType => _configurationType; + + /// + /// constructor that takes file name + /// + /// + /// + public ConfigurationFileBase(string fileName) + { + _fileInfo = new FileInfo(fileName); + _fileName = _fileInfo.FullName; + _configurationType = ConfigurationTypeFromFileExtension(_fileInfo.Extension); + } + + /// + /// returns supported configuration type enum based on the file type + /// + /// + /// + protected static ConfigurationFileType ConfigurationTypeFromFileExtension(string fileExtension) + { + if (string.IsNullOrEmpty(fileExtension)) + { + return ConfigurationFileType.OTHER; + } + return fileExtension.ToLower() switch + { + ".ini" => ConfigurationFileType.INI, + ".xml" => ConfigurationFileType.XML, + ".json" => ConfigurationFileType.JSON, + ".toml" => ConfigurationFileType.TOML, + ".yaml" => ConfigurationFileType.YAML, + _ => ConfigurationFileType.OTHER, + }; + } + + /// + /// Reads all keys from a section of configuration file. + /// + /// + /// + public abstract List ReadAllKeys(string section); + + /// + /// Returns a list of all of the sections in the configuration file. + /// + /// + public abstract List ReadAllSections(); + + /// + /// reads a list of values from configuration file + /// + /// + /// + /// + /// + /// + public abstract List ReadList(string section, string key, IList defList = null); + + /// + /// reads a single value from configuration file by section and key + /// + /// + /// + /// + /// + /// + public abstract T ReadValue(string section, string key, T defValue = default); + + /// + /// reads a single value from configuration file by section and key + /// + /// + /// + /// + public abstract string ReadValue(string section, string key); + + /// + /// writes a list of values to configuration file + /// + /// + /// + /// + /// + public abstract void WriteList(string section, string key, IList listToWrite); + + /// + /// Write a single value to a given section by key + /// + /// + /// + /// + /// + public abstract void WriteValue(string section, string key, T lineToWrite); + + /// + /// checks if the value exists in configuration file + /// + /// + /// + /// + /// + virtual public bool ValueExists(string section, string key) + { + return ReadAllKeys(section).Contains(key); + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationHelper.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationHelper.cs new file mode 100644 index 0000000..f4b074b --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/ConfigurationHelper.cs @@ -0,0 +1,472 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +// Ignore Spelling: Deserialize + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Serialization; +using System.Xml.XPath; + +namespace Raytheon.Common +{ + /// + /// for serializing and deserializing class types + /// + internal static class XmlSerializerExtensions + { + /// + /// deserializes XML type into an object + /// + /// + /// + /// + public static T Deserialize(this string value) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + using(StringReader reader = new StringReader(value)) + { + return (T)serializer.Deserialize(reader); + } + } + + /// + /// extension method to serialize XML type + /// + /// + /// + /// + public static string Serialize(this T value) + { + if(value == null) + { + return string.Empty; + } + + XmlSerializer xmlSerializer = new(typeof(T)); + + using(StringWriter stringWriter = new()) + { + using(XmlWriter xmlWriter = XmlWriter.Create(stringWriter, new XmlWriterSettings { Indent = true })) + { + xmlSerializer.Serialize(xmlWriter, value); + return stringWriter.ToString(); + } + } + } + + /// + /// extension method to serialize XML type without a namespace + /// + /// + /// + /// + public static string SerializeNoNamespace(this T value) + { + if(value == null) + { + return string.Empty; + } + + XmlSerializerNamespaces emptyNamespaces = new(new[] { XmlQualifiedName.Empty }); + XmlSerializer serializer = new(value.GetType()); + XmlWriterSettings settings = new() + { + Indent = true, + OmitXmlDeclaration = true + }; + + using(StringWriter stream = new()) + { + using(XmlWriter writer = XmlWriter.Create(stream, settings)) + { + serializer.Serialize(writer, value, emptyNamespaces); + return stream.ToString(); + } + } + } + } + + /// + /// type conversion utility with a special case for enums + /// + public static class TypeConverter + { + /// + /// special rule for enumeration when converting a type + /// + /// + /// + /// + public static T ChangeType(object value) + { + return typeof(T).IsEnum ? (T)Enum.Parse(typeof(T), value.ToString()) : (T)ChangeType(typeof(T), value); + } + + /// + /// convert type with TypeDescriptor + /// + /// + /// + /// + public static object ChangeType(Type t, object value) + { + System.ComponentModel.TypeConverter tc = TypeDescriptor.GetConverter(t); + return tc.ConvertFrom(value); + } + /// + /// register type with the type descriptor for later conversion + /// + /// + /// + public static void RegisterTypeConverter() where TC : System.ComponentModel.TypeConverter + { + TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC))); + } + } + + /// + /// Helper class contains extension functions for reading types other than strings from configuration, + /// as well as reading lists of values + /// + public static class ConfigurationHelper + { + /// + /// template function for reading different types from configuration + /// + /// + /// + /// + /// + /// + /// + public static T GetConfigurationValue(this IConfiguration configuration, string section, string key, T defaultValue) + { + Type defaultType = typeof(T); + if(!defaultType.IsValueType && defaultType != typeof(string)) + { + string tmpResult = configuration.GetConfigurationValue(section, key, string.Empty); + + if(!string.IsNullOrEmpty(tmpResult)) + { + return tmpResult.Deserialize(); + } + else + { + configuration.SetConfigurationValue(section, key, defaultValue); + return defaultValue; + } + } + else + { + string tmpResult = configuration.GetConfigurationValue(section, key, defaultValue.ToString()); + return !string.IsNullOrEmpty(tmpResult) ? TypeConverter.ChangeType(tmpResult) : default; + } + } + + /// + /// Sets configuration value. + /// + /// + /// + /// + /// + /// + public static void SetConfigurationValue(this IConfiguration configuration, string section, string key, T valueToWrite) + { + Type defaultType = typeof(T); + if(!defaultType.IsValueType && defaultType != typeof(string)) + { + configuration.SetConfigurationValue(section, key, valueToWrite.SerializeNoNamespace()); + } + else + { + configuration.SetConfigurationValue(section, key, valueToWrite.ToString()); + } + } + + /// + /// returns multi-value result (list of T) from configuration + /// + /// + /// + /// + /// + /// + /// + public static List GetConfigurationListValue(this IConfiguration configuration, string section, string key, IList defaultValue) + { + string tmpResult = configuration.GetXmlConfiguration(section); + if(string.IsNullOrEmpty(tmpResult) || !ContainsSection(tmpResult, key)) + { + SetConfigurationListValue(configuration, section, key, defaultValue); + return new List(defaultValue); + } + else + { + var stringRes = BuildElementListFromXml(tmpResult, key); + + XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); + + List result = new List(); + + foreach(string item in stringRes) + { + if(string.IsNullOrEmpty(item)) + { + continue; + } + + if(item.TrimStart().StartsWith("<")) + { + result.Add(item.Deserialize()); + } + else + { + result.Add(TypeConverter.ChangeType(item)); + } + } + + return result; + } + } + + /// + /// Writes configuration list of values. + /// + /// + /// + /// + /// + /// + public static void SetConfigurationListValue(this IConfiguration configuration, string section, string key, IList listToWrite) + { + StringBuilder xmlStr = new(); + string data = configuration.GetXmlConfiguration(section); + if(ContainsSection(data, $"{key}s")) + { + xmlStr.Append($"<{key}s>"); + foreach(var item in listToWrite) + { + xmlStr.Append($"<{key}>"); + xmlStr.Append(item.ToString()); + xmlStr.Append($""); + } + xmlStr.Append($""); + configuration.SetXmlConfiguration(section, xmlStr.ToString()); + } + else + { + xmlStr.Append($"<{key}>"); + foreach(var item in listToWrite) + { + xmlStr.Append(item.SerializeNoNamespace()); + } + xmlStr.Append($""); + + XElement xElement = new XElement(key, XElement.Parse(xmlStr.ToString())); + + if(string.IsNullOrEmpty(data)) + { + data = $""; + } + + XDocument doc = XDocument.Parse(data); + XElement existing = doc.Descendants(key).FirstOrDefault(); + + if(existing != null) + { + existing.ReplaceWith(xElement); + + var reader = doc.CreateReader(); + reader.MoveToContent(); + string innerXml = reader.ReadInnerXml(); + + configuration.SetXmlConfiguration(section, innerXml); + + } + else + { + doc.Root.Add(xElement.FirstNode); + var reader = doc.CreateReader(); + reader.MoveToContent(); + string outerXml = reader.ReadOuterXml(); + + configuration.SetXmlConfiguration(section, outerXml); + } + + + } + } + + /// + /// returns values from XML section converted to string list + /// + /// + /// + /// + private static List BuildElementListFromXml(string data, string key) + { + XElement doc = XElement.Parse(data); + IEnumerable xmlMessages; + + if(ContainsSection(data, $"{key}s")) + { + xmlMessages = from m in doc.Elements($"{key}s").Elements(key) + select m; + + var messages = xmlMessages.Select(x => x.Value); + return messages?.ToList(); + + } + else + { + xmlMessages = from m in doc.Elements($"{key}").Elements() + select m; + + List result = new(); + + foreach(var item in xmlMessages) + { + var reader = item.CreateReader(); + reader.MoveToContent(); + result.Add(reader.ReadOuterXml()); + } + return result; + } + } + + private static bool ContainsSection(string xmlString, string sectionName) + { + if(string.IsNullOrEmpty(xmlString)) + { + return false; + } + + try + { + XDocument doc = XDocument.Parse(xmlString); + return doc.Descendants(sectionName).Any(); + } + catch + { + return false; + } + } + + /// + /// From XML configuration file reads all sections under IniConfiguration root + /// + /// + public static List GetAvailableConfigSections(string fileName) + { + List sections = new(); + + FileInfo fileInfo = new(fileName); + if(!fileInfo.Exists) + { + return null; + } + + XDocument xdocument = XDocument.Load(fileInfo.FullName); + if(xdocument != null) + { + var configurationSection = xdocument.Root.Element("IniConfiguration"); + if(configurationSection != null && configurationSection.HasElements) + { + var sectionElements = configurationSection.Elements(); + sections.AddRange(from item in sectionElements + let name = item?.FirstAttribute?.Value + where !string.IsNullOrEmpty(name) + select name); + } + + configurationSection = xdocument.Root.Element("XmlConfigurations"); + if(configurationSection != null && configurationSection.HasElements) + { + var sectionElements = configurationSection.Elements(); + sections.AddRange(from item in sectionElements + let name = item?.FirstAttribute?.Value + where !string.IsNullOrEmpty(name) + select name); + } + } + + return sections; + } + + /// + /// From XML configuration file reads all keys from config sections under IniConfiguration root + /// + /// + public static List GetAvailableConfigSectionKeys(string fileName, string sectionName) + { + List sections = new(); + + FileInfo fileInfo = new(fileName); + if(!fileInfo.Exists) + { + return null; + } + + XDocument xdocument = XDocument.Load(fileInfo.FullName); + if(xdocument != null) + { + var configurationSection = xdocument.XPathSelectElement($"//IniConfiguration//section[@name='{sectionName}']"); + if(configurationSection != null && configurationSection.HasElements) + { + var sectionElements = configurationSection.Elements(); + sections.AddRange(from item in sectionElements + let name = item?.FirstAttribute?.Value + where !string.IsNullOrEmpty(name) + select name); + } + + configurationSection = xdocument.XPathSelectElement($"//XmlConfigurations//XmlConfiguration[@name='{sectionName}']"); + if(configurationSection != null && configurationSection.HasElements) + { + var sectionElements = configurationSection.Elements(); + sections.AddRange(from item in sectionElements + let name = item?.Name + where name != null + select name.ToString()); + } + } + return sections; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/ConfigurationFileFactory.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/ConfigurationFileFactory.cs new file mode 100644 index 0000000..1a730fe --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/ConfigurationFileFactory.cs @@ -0,0 +1,72 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; + +namespace Raytheon.Common +{ + + /// + /// Generic configuration factory based on the type + /// + public class ConfigurationFileFactory : ConfigurationFileFactoryBase + { + private readonly string _type; + + /// + /// + /// + /// + public ConfigurationFileFactory(string type) + { + _type = type; + } + /// + /// + /// + /// + /// + /// + public override IConfigurationFile CreateConfigurationFile(string fileName) + { + Type type = Type.GetType(_type); + if (type == null) + { + throw new InvalidOperationException($"File format not supported with {_type} package."); + } + else + { + return (IConfigurationFile)Activator.CreateInstance(type, fileName); + } + } + } + +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/ConfigurationFileFactoryBase.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/ConfigurationFileFactoryBase.cs new file mode 100644 index 0000000..fb2351c --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/ConfigurationFileFactoryBase.cs @@ -0,0 +1,59 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +namespace Raytheon.Common +{ + /// + /// Configuration file factory base class for the Factory Method pattern + /// + public abstract class ConfigurationFileFactoryBase + { + /// + /// template method for creating configuration file + /// + /// + /// + public abstract IConfigurationFile CreateConfigurationFile(string fileName); + + /// + /// creates configuration file based on the overwrite of the + /// concrete implementation of the CreateConfigurationFile method + /// + /// + /// + public IConfigurationFile GetConfigurationFile(string fileName) + { + IConfigurationFile configurationFile = CreateConfigurationFile(fileName); + return configurationFile; + } + } + +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/IniConfigurationFileFactory.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/IniConfigurationFileFactory.cs new file mode 100644 index 0000000..69f5ec6 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/IniConfigurationFileFactory.cs @@ -0,0 +1,50 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +namespace Raytheon.Common +{ + /// + /// IniConfigurationFile factory class + /// + public class IniConfigurationFileFactory : ConfigurationFileFactoryBase + { + /// + /// IniConfigurationFile factory method + /// + /// + /// + public override IConfigurationFile CreateConfigurationFile(string fileName) + { + return new IniConfigurationFile(fileName); + } + } + +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/JsonConfigurationFileFactory.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/JsonConfigurationFileFactory.cs new file mode 100644 index 0000000..145bdad --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/JsonConfigurationFileFactory.cs @@ -0,0 +1,61 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; + +namespace Raytheon.Common +{ + /// + /// JsonConfigurationFile factory class + /// + public class JsonConfigurationFileFactory : ConfigurationFileFactoryBase + { + /// + /// JsonConfigurationFile factory method + /// + /// + /// + /// + public override IConfigurationFile CreateConfigurationFile(string fileName) + { + Type jsonType = Type.GetType("Raytheon.Common.JsonConfigurationFile, Raytheon.Configuration.Json"); + if (jsonType == null) + { + throw new InvalidOperationException($"JSON file format supported with Raytheon.Configuration.Json package."); + } + else + { + return (IConfigurationFile)Activator.CreateInstance(jsonType, fileName); + } + } + } + +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/TomlConfigurationFileFactory.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/TomlConfigurationFileFactory.cs new file mode 100644 index 0000000..5f1caef --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/TomlConfigurationFileFactory.cs @@ -0,0 +1,60 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; + +namespace Raytheon.Common +{ + /// + /// TomlConfigurationFile factory class + /// + public class TomlConfigurationFileFactory : ConfigurationFileFactoryBase + { + /// + /// TomlConfigurationFile factory method + /// + /// + /// + /// + public override IConfigurationFile CreateConfigurationFile(string fileName) + { + Type tomlType = Type.GetType("Raytheon.Common.TomlConfigurationFile, Raytheon.Configuration.Toml"); + if (tomlType == null) + { + throw new InvalidOperationException($"TOML file format supported with Raytheon.Configuration.Toml package."); + } + else + { + return (IConfigurationFile)Activator.CreateInstance(tomlType, fileName); + } + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/XmlConfigurationFileFactory.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/XmlConfigurationFileFactory.cs new file mode 100644 index 0000000..77cf67c --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/Factories/XmlConfigurationFileFactory.cs @@ -0,0 +1,50 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +namespace Raytheon.Common +{ + /// + /// XmlConfigurationFile factory class + /// + public class XmlConfigurationFileFactory : ConfigurationFileFactoryBase + { + /// + /// XmlConfigurationFile factory method + /// + /// + /// + public override IConfigurationFile CreateConfigurationFile(string fileName) + { + return new XmlConfigurationFile(fileName); + } + } + +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/IniConfigurationFile.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/IniConfigurationFile.cs new file mode 100644 index 0000000..294cdc6 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/IniConfigurationFile.cs @@ -0,0 +1,261 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; + +namespace Raytheon.Common +{ + /// + /// Read/Write to an ini file. + /// + public class IniConfigurationFile : ConfigurationFileBase + { + #region PrivateMemberVariables + + internal static class NativeMethods + { + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + internal static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, string lpReturnedstring, int nSize, string lpFileName); + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string line, string lpFileName); + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool WritePrivateProfileSection(string lpAppName, string line, string lpFileName); + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + internal static extern int GetPrivateProfileSectionNames(byte[] sections, int bufferSize, string filename); + } + + #endregion + + /// + /// The constructor. It will check to make sure the file exists and throw an exception it if does not + /// + /// The ini file name (path). + public IniConfigurationFile(string fileName) + : base(fileName) + { + if (ConfigurationFileType != ConfigurationFileType.INI) + { + throw new ArgumentException("Expecting INI file configuration type"); + } + + if (!_fileInfo.Exists) + { + throw new Exception($"Can't find file: {fileName}"); + } + } + + #region PublicFunctions + + /// + /// reads a value from configuration file + /// + /// + /// + /// + /// + /// + public override T ReadValue(string section, string key, T defaultValue = default) + { + const int BUFFER_SIZE = 1024; + string temp = new string('\0', BUFFER_SIZE); + int numBytes = NativeMethods.GetPrivateProfileString(section, key, "", temp, BUFFER_SIZE, _fileName); + if (numBytes == 0) + { + WriteValue(section, key, defaultValue); + return defaultValue; + } + else + { + temp = temp.TrimEnd('\0'); + return TypeConverter.ChangeType(temp); + } + } + + /// + /// reads a value from configuration file + /// + /// + /// + /// + /// + /// + public override string ReadValue(string section, string key) + { + const int BUFFER_SIZE = 1024; + string temp = new string('\0', BUFFER_SIZE); + + if (!ReadAllSections().Contains(section)) + throw new Exception($"Section '{section}' doesn't exist in {_fileName}"); + + if (!ReadAllKeys(section).Contains(key)) + throw new Exception($"Key '{key}' doesn't exist under section '{section}' in {_fileName}"); + + int numBytes = NativeMethods.GetPrivateProfileString(section, key, "", temp, BUFFER_SIZE, _fileName); + if (numBytes > 0) + { + return temp.TrimEnd('\0'); + } + else + { + throw new Exception($"The value associated with key '{key}' under section '{section}' is empty in {_fileName}"); + } + } + + /// + /// Write string value + /// + /// + /// + /// + public override void WriteValue(string section, string key, T lineToWrite) + { + if (!NativeMethods.WritePrivateProfileString(section, key, $"{lineToWrite}", _fileName)) + { + throw new Exception($"IniFile::WriteValue() - WritePrivateProfileString returned false for section: {section}, key {key}, line {lineToWrite}"); + } + } + + /// + /// reads a list of values from INI configuration file + /// + /// + /// + /// + /// + /// + public override List ReadList(string section, string key, IList defaultList = null) + { + List resultList = new(); + + string stringResult = ReadValue(section, key, string.Empty); + + if (string.IsNullOrEmpty(stringResult)) + { + WriteList(section, key, defaultList); + return new List(defaultList); + } + + foreach (string item in stringResult.Split('|')) + { + resultList.Add(TypeConverter.ChangeType(item)); + } + + return resultList; + } + + /// + /// writes a list of values to INI configuration file + /// + /// + /// + /// + /// + public override void WriteList(string section, string key, IList listToWrite) + { + List stringListToWrite = new(listToWrite.Select(a => a.ToString())); + WriteValue(section, key, string.Join("|", stringListToWrite)); + } + + /// + /// Reads all keys from a section of an ini file. + /// + /// The section. + /// A list of all keys. + public override List ReadAllKeys(string section) + { + const int BUFFER_SIZE = 2500; + string temp = new('\0', BUFFER_SIZE); + int numBytes = NativeMethods.GetPrivateProfileString(section, null, "", temp, BUFFER_SIZE, _fileName); + + List keyList = new List(); + + if (numBytes == 0) + { + return keyList; + } + + temp = temp.TrimEnd('\0'); + keyList.AddRange(temp.Split('\0')); + + return keyList; + } + + /// + /// Returns a list of all of the sections in the ini file. + /// + /// A list of all sections. + public override List ReadAllSections() + { + List sectionList = new(); + + // allocate a 10K buffer. + const int BUFFER_SIZE = 10240; + // allocate a 10K buffer. Should be enough to handle plenty of power systems + byte[] buffer = new byte[BUFFER_SIZE]; + int numBytesReturned = NativeMethods.GetPrivateProfileSectionNames(buffer, BUFFER_SIZE, _fileName); + + if (numBytesReturned == BUFFER_SIZE) + { + throw new Exception("IniFile::ReadAllSections() - returned the max buffer size. Probably have more items in config file than we can handle"); + } + else if (numBytesReturned == 0) + { + return sectionList; + } + + // convert the buffer to a string + string result = System.Text.Encoding.Unicode.GetString(buffer); + // trim the end of the string + result = result.TrimEnd('\0'); + // split the string + string[] sectionListTemp = result.Split('\0'); + // ass the sections to a list + + for (int i = 0; i < sectionListTemp.Length; ++i) + { + sectionList.Add(sectionListTemp[i]); + } + + return sectionList; + } + + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/RaytheonConfiguration.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/RaytheonConfiguration.cs new file mode 100644 index 0000000..1bbb352 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/RaytheonConfiguration.cs @@ -0,0 +1,385 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// + +using System; +using System.IO; +using System.Linq; +using System.Xml.Linq; + +namespace Raytheon.Common +{ + /// + /// Implementation of the IConfiguration interface + /// + public class RaytheonConfiguration : IConfiguration + { + /// + /// returns configuration file path + /// + private string configFilePath + { + get + { + return Path.Combine(OutputPath, string.Concat(Name, ".xml")); + } + } + + /// + /// configuration file name + /// + public string Name + { + get; + internal set; + } + + /// + /// configuration file location + /// + public string OutputPath + { + get; + internal set; + } + + /// + /// default constructor + /// + public RaytheonConfiguration() + { + OutputPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Raytheon", "Configuration"); + IsValidPath(OutputPath); + } + + /// + /// constructor that takes configuration file name + /// + /// + public RaytheonConfiguration(string name) : this() + { + Name = name; + } + + /// + /// constructor that takes file name and location + /// + /// + /// + public RaytheonConfiguration(string name, string outputPath) : this(name) + { + if (IsValidPath(outputPath)) + { + OutputPath = outputPath; + } + } + + private static void CreateConfigurationFile(FileInfo file) + { + XDocument xDocument = new XDocument(); + xDocument.Add(new XElement("Configurations")); + xDocument.Root.Add(new XElement("IniConfiguration")); + xDocument.Root.Add(new XElement("XmlConfigurations")); + xDocument.Save(file.FullName); + } + + private FileInfo CreateFileIfMissing() + { + FileInfo fileInfo = new FileInfo(configFilePath); + if (!fileInfo.Exists) + { + throw new Exception($"Can't find file: {configFilePath}"); + } + return fileInfo; + } + + private static XElement GetConfigSection(string section, XElement iniConfiguration, string configFilePath) + { + XElement xElement = ( + from s in iniConfiguration.Descendants("section") + where (string)s.Attribute("name") == section + select s).FirstOrDefault(); + if (xElement == null) + { + throw new Exception($"There is no
tag with 'name={section}' in {configFilePath}"); + } + return xElement; + } + + /// + /// reads single string value from XML configuration file by section name and a key + /// + /// + /// + /// + /// + public string GetConfigurationValue(string section, string key, string defaultValue) + { + FileInfo fileInfo = CreateFileIfMissing(); + XDocument xDocument = XDocument.Load(fileInfo.FullName); + XElement xElement = xDocument.Root.Element("IniConfiguration"); + XElement configSection = GetConfigSection(section, xElement, configFilePath); + XElement xElement1 = ( + from k in configSection.Descendants("key") + where (string)k.Attribute("name") == key + select k).FirstOrDefault(); + if (xElement1 == null) + { + XName xName = "key"; + object[] xAttribute = new object[] { new XAttribute("name", key), new XAttribute("value", defaultValue) }; + xElement1 = new XElement(xName, xAttribute); + configSection.Add(xElement1); + xDocument.Save(fileInfo.FullName); + } + XAttribute xAttribute1 = xElement1.Attribute("value"); + if (xAttribute1 == null) + { + xAttribute1 = new XAttribute("value", defaultValue); + xElement1.Add(xAttribute1); + xDocument.Save(fileInfo.FullName); + } + if (xAttribute1 == null) + { + return null; + } + return xAttribute1.Value; + } + + /// + /// reads single string value from XML configuration file by section name and a key + /// + /// + /// + /// + /// + public string GetConfigurationValue(string section, string key) + { + FileInfo fileInfo = CreateFileIfMissing(); + XDocument xDocument = XDocument.Load(fileInfo.FullName); + XElement xElement = xDocument.Root.Element("IniConfiguration"); + XElement configSection = GetConfigSection(section, xElement, configFilePath); + XElement xElement1 = ( + from k in configSection.Descendants("key") + where (string)k.Attribute("name") == key + select k).FirstOrDefault(); + if (xElement1 == null) + { + throw new Exception($"There is no tag with 'name={key}' under section {section} in {configFilePath}"); + } + XAttribute xAttribute1 = xElement1.Attribute("value"); + if (xAttribute1 == null) + { + throw new Exception($"Attribute 'value' is missing for tag with 'name={key}' under section {section} in {configFilePath}"); + } + return xAttribute1.Value; + } + + private static XElement GetConfigXml(string name, XElement xmlConfigurations) + { + XElement xElement = ( + from s in xmlConfigurations.Descendants("XmlConfiguration") + where (string)s.Attribute("name") == name + select s).FirstOrDefault(); + return xElement; + } + + /// + /// reads XML configuration from a file + /// + /// + /// + public string GetXmlConfiguration(string name) + { + XDocument xDocument = XDocument.Load(CreateFileIfMissing().FullName); + XElement xElement = xDocument.Root.Element("XmlConfigurations"); + XElement configXml = GetConfigXml(name, xElement); + if (configXml == null) + { + return string.Empty; + } + return configXml.ToString(); + } + + internal void Initialize() + { + Directory.CreateDirectory(OutputPath); + CreateFileIfMissing(); + } + + private static bool IsValidPath(string outputPath) + { + bool flag; + try + { + Directory.CreateDirectory(outputPath); + flag = true; + } + catch (PathTooLongException) + { + flag = false; + } + catch (UnauthorizedAccessException) + { + flag = false; + } + catch (ArgumentException) + { + flag = false; + } + catch (DirectoryNotFoundException) + { + flag = false; + } + catch (Exception) + { + throw; + } + return flag; + } + + private static void SetConfigKey(string key, string value, XElement configSection) + { + XElement xElement = ( + from k in configSection.Descendants("key") + where (string)k.Attribute("name") == key + select k).FirstOrDefault(); + if (xElement != null) + { + xElement.SetAttributeValue("value", value); + return; + } + XName xName = "key"; + object[] xAttribute = new object[] { new XAttribute("name", key), null }; + xAttribute[1] = new XAttribute("value", value ?? string.Empty); + xElement = new XElement(xName, xAttribute); + configSection.Add(xElement); + } + + /// + /// writes configuration value by section name and by key + /// + /// + /// + /// + public void SetConfigurationValue(string section, string key, string value) + { + FileInfo fileInfo = CreateFileIfMissing(); + XDocument xDocument = XDocument.Load(fileInfo.FullName); + XElement xElement = xDocument.Root.Element("IniConfiguration"); + SetConfigKey(key, value, GetConfigSection(section, xElement, configFilePath)); + xDocument.Save(fileInfo.FullName); + } + + /// + /// saves XML string into XML file + /// + /// + /// + public void SetXmlConfiguration(string name, string xml) + { + FileInfo fileInfo = CreateFileIfMissing(); + XElement xElement = XElement.Parse(xml); + int elementCount = xElement.Elements().Count(); + + XDocument xDocument = XDocument.Load(fileInfo.FullName); + XElement xmlConfigurations = xDocument.Root.Element("XmlConfigurations"); + XElement sectionXml = GetConfigXml(name, xmlConfigurations); + + XName xName = "XmlConfiguration"; + object[] xAttribute = new object[1 + elementCount]; + xAttribute[0] = new XAttribute("name", name); + if (elementCount == 1) + { + xAttribute[1] = xElement.FirstNode; + } + else + { + int i = 1; + foreach (var item in xElement.Elements()) + { + xAttribute[i++] = item; + } + } + + if (sectionXml == null) + { + xmlConfigurations.Add(new XElement(xName, xAttribute)); + } + else + { + sectionXml.ReplaceWith(new XElement(xName, xAttribute)); + } + + xDocument.Save(fileInfo.FullName); + } + + /// + /// tries reading enumeration value by section and key name + /// + /// + /// + /// + /// + /// + /// + public bool TryGetEnumValue(string section, string key, out T value) + where T : struct + { + if (string.IsNullOrWhiteSpace(section)) + { + throw new ArgumentException("'section' cannot be Null or Whitespace", "section"); + } + if (string.IsNullOrWhiteSpace(key)) + { + throw new ArgumentException("'key' cannot be Null or Whitespace", "key"); + } + if (!typeof(T).IsEnum) + { + throw new ArgumentException("T must be an enumerated type"); + } + bool flag = Enum.TryParse(GetConfigurationValue(section, key, string.Concat("NOT_A_VALID_", key.ToUpper())), out value); + if (!flag) + { + int num = 0; + string[] names = Enum.GetNames(typeof(T)); + for (int i = 0; i < names.Length; i++) + { + string str = names[i]; + int num1 = num + 1; + num = num1; + int num2 = num1; + SetConfigurationValue(string.Concat("Valid_", key), num2.ToString(), str); + } + } + return flag; + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/RaytheonConfigurationManager.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/RaytheonConfigurationManager.cs new file mode 100644 index 0000000..7da8496 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/RaytheonConfigurationManager.cs @@ -0,0 +1,161 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// + +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.Configuration; +using System.Diagnostics; +using System.IO; + +namespace Raytheon.Common +{ + /// + /// implementation of the Raytheon Configuration Manager + /// + [Export(typeof(IConfigurationManager))] + public class RaytheonConfigurationManager : IConfigurationManager + { + private object _configLock = new(); + + private Dictionary _configurations = new(); + + private static readonly string DefaultStoragePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Raytheon", "InstrumentManagerService"); + + private string _storagePath; + + /// + /// gets or sets configuration storage path + /// when setting the path and it does not exist will use the default value instead + /// + public string ConfigurationStoragePath + { + get + { + return _storagePath; + } + set + { + string item = value; + + if(string.IsNullOrWhiteSpace(item)) + { + item = ConfigurationManager.AppSettings["ConfigurationPath"]; + } + + if(!IsValidPath(item, true)) + { + Trace.WriteLine(string.Format("The Application Setting [ConfigurationPath] '{0}' is invalid.", item)); + _storagePath = DefaultStoragePath; + } + else + { + _storagePath = item; + } + } + } + + /// + /// if path not provided will be using either app settings value or default + /// + public RaytheonConfigurationManager() + { + ConfigurationStoragePath = string.Empty; + } + + /// + /// constructor that takes configuration file path + /// + /// + public RaytheonConfigurationManager(string defaultPath) => ConfigurationStoragePath = defaultPath; + + /// + /// returns RaytheonConfiguration instance + /// + /// + /// + public IConfiguration GetConfiguration(string configurationName) + { + RaytheonConfiguration item = null; + lock(_configLock) + { + if(_configurations.ContainsKey(configurationName)) + { + item = _configurations[configurationName]; + } + else + { + item = new RaytheonConfiguration(configurationName, ConfigurationStoragePath); + item.Initialize(); + _configurations.Add(configurationName, item); + } + } + return item; + } + + /// + /// checks if the configuration storage path for config file is valid + /// + /// + /// + /// + private bool IsValidPath(string path, bool allowRelativePaths = false) + { + if(string.IsNullOrEmpty(path)) + { + return false; + } + + bool isValid; + try + { + string fullPath = Path.GetFullPath(path); + + if(allowRelativePaths) + { + isValid = Path.IsPathRooted(path); + } + else + { + string root = Path.GetPathRoot(path); + isValid = string.IsNullOrEmpty(root.Trim(new char[] { '\\', '/' })) == false; + } + } + catch(Exception) + { + isValid = false; + } + + return isValid; + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/XmlConfigurationFile.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/XmlConfigurationFile.cs new file mode 100644 index 0000000..79405fd --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/Configuration/XmlConfigurationFile.cs @@ -0,0 +1,156 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// +using System; +using System.Collections.Generic; +using System.IO; + +namespace Raytheon.Common +{ + /// + /// Read/Write to an XML file. + /// + public class XmlConfigurationFile : ConfigurationFileBase + { + #region PrivateMemberVariables + + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PublicFunctions + + /// + /// The constructor. It will check to make sure the file exists and throw an exception it if does not + /// + /// The ini file name (path). + public XmlConfigurationFile(string fileName) + : base(fileName) + { + if (ConfigurationFileType != ConfigurationFileType.XML) + { + throw new ArgumentException("Expecting XML file configuration type"); + } + + _configurationManager = new RaytheonConfigurationManager(_fileInfo.DirectoryName); + _configuration = _configurationManager.GetConfiguration(NameWithoutExtension(_fileInfo)); + } + private static string NameWithoutExtension(FileInfo fileInfo) + { + return fileInfo.Name.Remove(fileInfo.Name.LastIndexOf(".")); + } + + /// + /// reads a value from configuration file + /// + /// + /// + /// + /// + /// + public override T ReadValue(string section, string key, T defaultValue = default) + { + return _configuration.GetConfigurationValue(section, key, defaultValue); + } + + /// + /// reads a value from configuration file + /// + /// + /// + /// + public override string ReadValue(string section, string key) + { + return _configuration.GetConfigurationValue(section, key); + } + + /// + /// Write string value + /// + /// + /// + /// + public override void WriteValue(string section, string key, T lineToWrite) + { + _configuration.SetConfigurationValue(section, key, lineToWrite); + } + + /// + /// reads a list of values from configuration file + /// + /// + /// + /// + /// + /// + public override List ReadList(string section, string key, IList defaultList = null) + { + return _configuration.GetConfigurationListValue(section, key, defaultList); + } + + /// + /// writes a list of values to configuration file + /// + /// + /// + /// + /// + public override void WriteList(string section, string key, IList listToWrite) + { + _configuration.SetConfigurationListValue(section, key, listToWrite); + } + + /// + /// Reads all keys from a section of an ini file. + /// + /// The section. + /// A list of all keys. + public override List ReadAllKeys(string section) + { + return ConfigurationHelper.GetAvailableConfigSectionKeys(_fileName, section); + } + + /// + /// Returns a list of all of the sections in the ini file. + /// + /// A list of all sections. + public override List ReadAllSections() + { + return ConfigurationHelper.GetAvailableConfigSections(_fileName); + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/ConfigurationException.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/ConfigurationException.cs new file mode 100644 index 0000000..6f6e1c6 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/ConfigurationException.cs @@ -0,0 +1,65 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// + +using System; +using System.Runtime.Serialization; + +namespace Raytheon.Common +{ + [DataContract] + public class ConfigurationException : Exception + { + public ConfigurationException() + :base() + { + + } + + public ConfigurationException(string message) + :base(message) + { + + } + + public ConfigurationException(string message, Exception innerException) + :base(message, innerException) + { + + } + + public ConfigurationException(SerializationInfo info, StreamingContext context) + :base(info, context) + { + + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurable.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurable.cs new file mode 100644 index 0000000..d40fb70 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurable.cs @@ -0,0 +1,43 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// + +namespace Raytheon.Common +{ + /// + /// interface for flaging the moment when configurable object is done with configuration + /// restored from the previous version of Raytheon.Configuration package + /// + public interface IConfigurable + { + void OnConfigured(); + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfiguration.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfiguration.cs new file mode 100644 index 0000000..4a058ce --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfiguration.cs @@ -0,0 +1,92 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// + +namespace Raytheon.Common +{ + /// + /// Configuration interface + /// restored from the previous version of Raytheon.Configuration package + /// + public interface IConfiguration + { + /// + /// Sets the configuration value. + /// + /// The section. + /// The key. + /// The value. + void SetConfigurationValue(string section, string key, string value); + + /// + /// Gets the configuration value. + /// + /// The section. + /// The key. + /// The default value. + /// + string GetConfigurationValue(string section, string key, string defaultValue); + + /// + /// Gets the configuration value. + /// + /// The section. + /// The key. + /// + string GetConfigurationValue(string section, string key); + + /// + /// Sets the XML configuration. + /// + /// The name. + /// The XML. + void SetXmlConfiguration(string name, string xml); + + /// + /// Gets the XML configuration. + /// + /// The name. + /// + string GetXmlConfiguration(string name); + + /// + /// Attempts to get the enumerated configuration value. + /// If it does not exist or cannot be parsed to a valid value, + /// it will create a new section called Valid_{key} and list the valid enumeration values. + /// + /// The section. + /// The key. + /// The default value. + /// + bool TryGetEnumValue(string section, string key, out T value) where T : struct; + + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurationFile.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurationFile.cs new file mode 100644 index 0000000..9c8fd12 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurationFile.cs @@ -0,0 +1,137 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// + +using System.Collections.Generic; + +namespace Raytheon.Common +{ + /// + /// supported file types + /// + public enum ConfigurationFileType + { + INI, + XML, + TOML, + JSON, + YAML, + OTHER + } + + /// + /// updated version of IConfiguration interface + /// allows reading and writing generic types as well as lists + /// + public interface IConfigurationFile + { + /// + /// reads a single generic type value from the file section + /// if value or section does not exist, will create one and will add the default value + /// + /// + /// + /// + /// + /// + T ReadValue(string section, string key, T defValue = default); + + /// + /// reads a single generic type value from the file section + /// if value doesn't exist, throw exception + /// + /// + /// + /// + string ReadValue(string section, string key); + + /// + /// reads a list of generic type values from the file section + /// if list or section does not exist, will create one and will populate with the default list + /// + /// + /// + /// + /// + /// + List ReadList(string section, string key, IList defList = null); + + /// + /// reads all available keys from the given section of configuration file + /// + /// + /// + List ReadAllKeys(string section); + + /// + /// reads all available sections from configuration file + /// + /// + List ReadAllSections(); + + /// + /// writes a single value of a generic type + /// + /// + /// + /// + /// + void WriteValue(string section, string key, T lineToWrite); + + /// + /// writes a list of generic values + /// + /// + /// + /// + /// + void WriteList(string section, string key, IList listToWrite); + + /// + /// checks if the value exists in the given section and given key + /// + /// + /// + /// + bool ValueExists(string section, string key); + + /// + /// configuration file name + /// + string FileName { get; } + + /// + /// configuration file type + /// + ConfigurationFileType ConfigurationFileType { get; } + } + +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurationManager.cs b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurationManager.cs new file mode 100644 index 0000000..241da25 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Configuration/ConfigurationContracts/IConfigurationManager.cs @@ -0,0 +1,52 @@ +// ******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY''S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +// ****************************************************************************// + +namespace Raytheon.Common +{ + /// + /// Configuration Manager interface + /// + public interface IConfigurationManager + { + /// + /// Gets the configuration by name. + /// + /// Name of the configuration. + /// + IConfiguration GetConfiguration(string configurationName); + + /// + /// Gets or sets the configuration storage path or the location of the configuration files + /// + string ConfigurationStoragePath { get; set; } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssUtilSs.cs b/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssUtilSs.cs new file mode 100644 index 0000000..77b7e1f --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssUtilSs.cs @@ -0,0 +1,54 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Text; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// A collection of utilities. + /// + public static class HssUtilSs + { + #region PublicFuctions + + /// + /// + /// + /// + /// + /// + /// + public static string BuildErrorString(uint chassisHandle, int errorCode, string moduleName) + { + StringBuilder errorStrTemp = new StringBuilder(512); + + int ret = HssubNativeMethods.terHsi_error_message(chassisHandle, errorCode, errorStrTemp); + + if (ret != 0) + { + throw new Exception("HssUtilSs::BuildErrorString() - terHsi_error_message returned an error(" + ret + ")"); + } + + string errorMsg = errorStrTemp.ToString(); + + return errorMsg += "(" + moduleName + ")"; + } + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssUtilTs.cs b/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssUtilTs.cs new file mode 100644 index 0000000..c2974ab --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssUtilTs.cs @@ -0,0 +1,119 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// A collection of utilities. + /// + public static class HssUtilTs + { + + public struct LocalBusParams + { + public int cardHandle; + public int address; + public int data; + } + + #region PublicFuctions + + /// + /// + /// + /// + /// + /// + /// + public static string BuildErrorString(uint chassisHandle, int errorCode, string moduleName) + { + StringBuilder errorStrTemp = new StringBuilder(512); + + int ret = HssubNativeMethods.terHss_error_message(chassisHandle, errorCode, errorStrTemp); + + if (ret != 0) + { + throw new Exception("HssUtilTs::BuildErrorString() - terHss_error_message returned an error(" + ret + ")"); + } + + string errorMsg = errorStrTemp.ToString(); + + return errorMsg += "(" + moduleName + ")"; + } + + /// + /// + /// + /// + /// + public static LocalBusParams ByteArrayToLocalBusParms(byte[] data) + { + GCHandle rxPinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned); + IntPtr pBytePtr = rxPinnedArray.AddrOfPinnedObject(); + LocalBusParams lbParams = (LocalBusParams)(Marshal.PtrToStructure(pBytePtr, typeof(LocalBusParams))); + rxPinnedArray.Free(); + + return lbParams; + } + + /// + /// + /// + /// + /// + public static byte[] LocalBusParmsToByteArray(LocalBusParams lbParams) + { + // get the size of the structure + int structureSize = Marshal.SizeOf(lbParams); + + // allocate a byte array + byte[] dataToSend = new byte[structureSize]; + + // convert structure to byte array + IntPtr pBytePtr = Marshal.AllocHGlobal(structureSize); + Marshal.StructureToPtr(lbParams, pBytePtr, true); + Marshal.Copy(pBytePtr, dataToSend, 0, structureSize); + Marshal.FreeHGlobal(pBytePtr); + + return dataToSend; + } + + /// + /// + /// + /// + /// + /// + public static void WaitForSync(uint chassisHandle, int hssubSubSystemAppSync, string name) + { + //0 is VI_FALSE, 1 is VI_TRUE + int hssubSyncData = 0; + int ret = HssubNativeMethods.terHss_Application_WaitForSyncObject(chassisHandle, hssubSubSystemAppSync, HssubNativeMethods.TERHSS_TIMEOUT_10SEC, 1, ref hssubSyncData); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(chassisHandle, ret, name); + + throw new Exception("HssUtilTs::WaitForSync() - terHss_Application_WaitForSyncObject() returned an error(" + ret + ")" + ": " + errorStr); + } + } + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssubNativeMethods.cs b/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssubNativeMethods.cs new file mode 100644 index 0000000..34b5d20 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssubNativeMethods.cs @@ -0,0 +1,126 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System.Runtime.InteropServices; +using System.Text; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// + /// + public unsafe static class HssubNativeMethods + { + public const int TERHSI_FPGA_TEST_DEFINED = 1; + + // timeouts + public const int TERHSS_TIMEOUT_INDEFINITE = 0; + public const int TERHSS_TIMEOUT_60SEC = 60; + public const int TERHSS_TIMEOUT_10SEC = 10; + + // + public const int TERHSS_OPTION_ALLOW_OVERWRITE = 1; + public const int TERHSS_OPTION_NONE = 0; + + // callback codes + public const int MESSAGE_CONTEXT_INIT_INSTRUMENT = 0; + public const int MESSAGE_CONTEXT_LOAD_INSTRUMENT = 1; + public const int MESSAGE_CONTEXT_LB_WRITE32 = 2; + public const int MESSAGE_CONTEXT_LB_READ32 = 3; + public const int MESSAGE_CONTEXT_PAM_BLOCK_CREATE = 4; + public const int MESSAGE_CONTEXT_PAM_BLOCK_READ = 5; + public const int MESSAGE_CONTEXT_NBLOCK_WRITE = 6; + public const int MESSAGE_CONTEXT_NBLOCK_READ = 7; + public const int MESSAGE_CONTEXT_RUN_EXE = 8; + public const int MESSAGE_CONTEXT_RUN_JTAG = 9; + public const int MESSAGE_CONTEXT_DMA_CREATE_PAM_BLOCK = 10; + public const int MESSAGE_CONTEXT_DMA_READ_PAM_BLOCK = 11; + public const int MESSAGE_CONTEXT_DMA_WRITE_PAM_BLOCK = 12; + public const int MESSAGE_CONTEXT_DMA_MEMORY_MOVE = 13; + public const int MESSAGE_CONTEXT_DMA_PAM_CLEAR = 14; + public const int MESSAGE_CONTEXT_UCLK_SET = 20; + + // HSS imports (running on the remote test station) + public delegate void MessageCallbackDelagate(uint chassisHandle, int applicationHandle, int messageContext, uint messageSize, byte* message); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_error_message(uint chassisHandle, int errorCode, StringBuilder errorMessage); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_init(string resourceName, ushort idQuery, ushort reset, ref uint pdwVi); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Application_CreateSyncObject(uint chassisHandle, string syncName, ref int syncObjectHandle); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Application_RegisterMessageCallback(uint chassisHandle, MessageCallbackDelagate callback); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Subsystem_SendFile(uint chassisHandle, string sourceFile, string destinationFile, int options); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Application_Load(uint chassisHandle, string applicationName, string remotePath, ref int applicationHandle); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Application_Start(uint chassisHandle, int applicationHandle, string cmdLineArgs, double timeout); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Application_WaitForSyncObject(uint chassisHandle, int syncHandle, double timeout, ushort autoReset, ref int contextValue); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Application_SendMessage(uint chassisHandle, int applicationHandle, int messageContext, int messageArraySize, byte[] message, double timeout); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_Subsystem_DeleteFile(uint chassisHandle, string file, int options); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_close(uint chassisHandle); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHss_self_test(uint chassisHandle, ref short result, StringBuilder message); + + + // HSI imports (running on the local sub system) + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_error_message(uint chassisHandle, int errorCode, StringBuilder errorMessage); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_init(string resourceName, ushort idQuery, ushort reset, ref uint pdwVi); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_Firmware_Load(uint chassisHandle, int fpga, string fwFileName, ref ushort customerId, ref ushort applicationID, ref uint revisionID); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_LB_Read32(uint chassisHandle, uint offset, ref uint data); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_LB_ReadBlock32(uint chassisHandle, uint offset, uint numberWordsToRead, uint* data); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_LB_Write32(uint chassisHandle, uint offset, uint data); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_LB_WriteBlock32(uint chassisHandle, uint offset, uint numberWordsToWrite, uint[] data); + //public static extern int terHsi_LB_WriteBlock32(uint chassisHandle, uint offset, uint numberWordsToWrite, uint* data); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_close(uint chassisHandle); + + [DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)] + public static extern int terHsi_reset(uint chassisHandle); + } +} \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IDisplay.cs b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IDisplay.cs new file mode 100644 index 0000000..7e57307 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IDisplay.cs @@ -0,0 +1,123 @@ +// ********************************************************************************************************** +// IDisplay.cs +// 2/17/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using System.Collections.Generic; + +namespace Raytheon.Common +{ + /// + /// Enum for tagging the logged data. + /// + public enum LogLevel + { + /// + /// (Ordinal = 0) : Most verbose level. Used for development and seldom enabled in production. + /// + TRACE, + /// + /// (Ordinal = 1) : Debugging the application behavior from internal events of interest. + /// + DEBUG, + /// + /// An informational log statement. + /// (Ordinal = 2) : Information that highlights progress or application lifetime events. + /// + INFO, + /// + /// (Ordinal = 3) : Warnings about validation issues or temporary failures that can be recovered. + /// + WARN, + /// + /// (Ordinal = 4) : Errors where functionality has failed or have been caught. + /// an error log statement. + /// + ERROR, + /// + /// (Ordinal = 5) : Most critical level. Application is about to abort. + /// + FATAL, + /// + /// Off log level (Ordinal = 6) + /// + OFF + } + + public interface IDisplay + { + /// + /// user interface capability with error logger + /// + /// + /// + void ShowMessage(string message, LogLevel logLevel = LogLevel.INFO); + } + + public interface IChillerDisplay + { + void ChillerMonitorUiUpdate(ActiveHealthMonitorData data, int errorCode); + } + + public interface IDioDisplay + { + void DioControlUiUpdate(List inputNames, List outputNames); + } + + public interface IFpgaDisplay + { + void FpgaControlUiUpdate(List fpgaNames); + } + + public interface IPowerControlDisplay + { + void PowerControlUiUpdate(List powerFormNames); + } + + public interface IPowerMonitorDisplay + { + void PowerMonitorUiUpdate(List callBackDataList, int errorCode); + } + + public interface IHealthMonitorDisplay + { + void HealthMonitorControlUiUpdate(List callBackDataList); + } + + public interface INGIDisplay : IDisplay, IChillerDisplay, IDioDisplay, IFpgaDisplay, IPowerControlDisplay, IPowerMonitorDisplay, IHealthMonitorDisplay + { + } + + public interface IHandleCriticalError + { + void HandleCriticalError(string message, bool shallWeStopThreads = true); + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IMsgParser.cs b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IMsgParser.cs new file mode 100644 index 0000000..61983db --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IMsgParser.cs @@ -0,0 +1,39 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; + +namespace Raytheon.Common +{ + /// + /// Defines an interface for specific message parsing routines + /// used in conjunction with MsgDevice + /// + public interface IMsgParser + { + /// + /// Will parse data looking for a complete message + /// + /// The data to parse + /// The number of bytes in pData + /// The data to remove once the parse job is complete + /// The ID of the message that was parsed + /// optional error codes for a child parser to user + /// true if a complete message was found, false otherwise + bool Run(IntPtr pData, uint numBytesInPdata, ref uint bytesToRemove, ref uint messageId, ref uint errorCode); + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Interfaces/ISerialPort.cs b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/ISerialPort.cs new file mode 100644 index 0000000..67ffbdd --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/ISerialPort.cs @@ -0,0 +1,52 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; + +namespace Raytheon.Common +{ + /// + /// An interface to a serial port device + /// + public interface ISerialPort : IDisposable + { + /// + /// Close the communication interface + /// + void Close(); + + /// + /// + /// + void Open(); + + /// + /// + /// + /// + /// + UInt32 Read(ref byte[] dataRead); + + /// + /// + /// + /// + void Write(byte[] dataToWrite); + + void Write(String dataToWrite); + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IWorkerInterface.cs b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IWorkerInterface.cs new file mode 100644 index 0000000..83127be --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/IWorkerInterface.cs @@ -0,0 +1,53 @@ +// ********************************************************************************************************** +// IWorkerInterface.cs +// 2/17/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Common +{ + /// + /// An interface that defines required functions for a worker. + /// Typically a worker is invoked as a thread. + /// + public interface IWorkerInterface : IDisposable + { + /// + /// The function that is passed into the thread. + /// + void DoWork(); + + /// + /// Commands the worker to quit. + /// + void QuitWork(); + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Interfaces/MsgDevice.cs b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/MsgDevice.cs new file mode 100644 index 0000000..573db13 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Interfaces/MsgDevice.cs @@ -0,0 +1,215 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; + +namespace Raytheon.Common +{ + /// + /// Base class for handling incoming messages + /// + public abstract class MsgDevice : IDisposable + { + /// + /// A callback def for a completed message + /// + /// + /// + /// + /// + unsafe public delegate void CompleteMessageCallback(uint msgId, IntPtr pData, uint numBytes, uint errorCode); + + private DataBuffer _dataBuffer; + private AutoResetEvent _dataInBufferEvent; + private IWorkerInterface _msgProcessorWorker; + private bool _isProcessorThreadRunning; + private Thread _msgProcessorThread; + + /// + /// The constructor + /// + /// + /// + public MsgDevice(IMsgParser msgParser, uint bufferSize) + { + try + { + _isProcessorThreadRunning = false; + _dataBuffer = new DataBuffer(bufferSize); + _dataInBufferEvent = new AutoResetEvent(false); + _msgProcessorWorker = new MsgProcessorWorker(msgParser, ref _dataBuffer, ref _dataInBufferEvent); + _msgProcessorThread = new Thread(_msgProcessorWorker.DoWork); + } + catch (Exception) + { + throw; + } + } + + /// + /// The finalizer + /// + ~MsgDevice() + { + Dispose(false); + } + + /// + /// The public dispose function. Necessary for commanding threads to quit + /// + public void Dispose() + { + Dispose(true); + + GC.SuppressFinalize(this); + } + + /// + /// Add data to the buffer + /// + /// The data to add + /// the number of bytes to add + protected void AddToBuffer(byte[] data, uint numBytes) + { + try + { + _dataBuffer.Add(data, numBytes); + + _dataInBufferEvent.Set(); + } + catch (Exception) + { + throw; + } + } + + /// + /// Clear all data from the buffer + /// + protected void ClearBuffer() + { + try + { + _dataBuffer.RemoveAll(); + } + catch (Exception) + { + throw; + } + } + + /// + /// The local dispose function. Necessary for commanding threads to quit + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + try + { + _msgProcessorWorker.QuitWork(); + + Thread.Sleep(500); + + _msgProcessorThread.Abort(); + + if (_msgProcessorThread.IsAlive) + { + _msgProcessorThread.Join(); + } + + _dataInBufferEvent.Dispose(); + + _msgProcessorWorker.Dispose(); + + _dataBuffer.Dispose(); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + } + } + + /// + /// Run the message processor thread + /// + protected void RunThread() + { + try + { + _msgProcessorThread.Start(); + } + catch (Exception) + { + throw; + } + } + + /// + /// Set the callback that will be invoked when a complete message is parsed out + /// + /// The callback function + protected void SetCompleteMessageCallback(CompleteMessageCallback callback) + { + try + { + ((MsgProcessorWorker)_msgProcessorWorker).SetCallback(callback); + + // now that the callback is set, we can run the thread + if (_isProcessorThreadRunning == false) + { + _msgProcessorThread.Start(); + _isProcessorThreadRunning = true; + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Stop the message processor thread + /// + protected void QuitThread() + { + try + { + _msgProcessorWorker.QuitWork(); + + if (_msgProcessorThread.IsAlive) + { + _msgProcessorThread.Join(); + } + } + catch (Exception) + { + throw; + } + } + + /// + /// abstract function for the children to implement + /// + /// The data to add + /// The number of bytes to add + public abstract void AddData(byte[] data, uint numBytes); + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/AutomationRxMsgBuffer.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/AutomationRxMsgBuffer.cs new file mode 100644 index 0000000..f55fdf3 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/AutomationRxMsgBuffer.cs @@ -0,0 +1,227 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using System.Collections.Generic; + +namespace Raytheon.Common +{ + /// + /// Singleton for holding onto message objects + /// + public class AutomationRxMsgBuffer + { + // class variables + private static AutomationRxMsgBuffer _AutomationRxMsgBufferInstance; + private static object _syncObj = new object(); + private Dictionary> _msgList; + private Dictionary _receivedMsgEvents; + private List _msgIds; + + /// + /// The way to get access to this singleton + /// + /// the instance to this class + public static AutomationRxMsgBuffer Instance(List msgIds = null) + { + if (_AutomationRxMsgBufferInstance == null) + { + _AutomationRxMsgBufferInstance = new AutomationRxMsgBuffer(msgIds); + } + + return _AutomationRxMsgBufferInstance; + } + + /// + /// Add a message to this buffer + /// + /// The message to add + /// flag for if the other messages of this type should be deleted from the buffer + public void AddMsg(AutomationMessage msg, bool shouldWeDeleteOthers = true) + { + lock (_syncObj) + { + uint msgId = msg.GetMessageId(); + + if (shouldWeDeleteOthers == true) + { + ClearList(msgId); + } + + if (_msgList.ContainsKey(msgId) == false) + { + _msgList[msgId] = new List(); + } + + _msgList[msgId].Add(msg); + + _receivedMsgEvents[msgId].Set(); + } + } + + /// + /// Remove all messages from the buffer + /// + public void ClearAllMsgs() + { + lock (_syncObj) + { + foreach (uint id in _msgList.Keys) + { + ClearList(id); + } + } + } + + /// + /// Remove all messages of the command type from the buffer + /// + /// The message id to remove + public void ClearList(uint id) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id) == true) + { + _msgList[id].Clear(); + + _msgList.Remove(id); + } + } + } + + /// + /// Gets the oldest message in the buffer + /// + /// The id of the message to get + /// The oldest message in the buffer + public AutomationMessage GetOldestMessage(uint id) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id)) + { + List list = _msgList[id]; + + AutomationMessage oldestMsg = list[0]; + + list.RemoveAt(0); + + return oldestMsg; + } + else + { + throw new Exception("no message exists with id: " + id.ToString()); + } + } + } + + /// + /// Gets the most recent message from the buffer + /// + /// The id of the message to get + /// flag controlling if the other messages of this type should be deleted + /// The message + public AutomationMessage GetNewestMessage(uint id, bool shouldWeDeleteOthers = true) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id)) + { + List list = _msgList[id]; + + AutomationMessage newestMsg = list[list.Count - 1]; + + list.RemoveAt(list.Count - 1); + + if (shouldWeDeleteOthers == true) + { + ClearList(id); + } + + return newestMsg; + } + else + { + throw new Exception("no message exists with id: " + id.ToString()); + } + } + } + + /// + /// Get the number of messages of this type in the buffer + /// + /// The id of the message to get + /// the number of messages of this type in the buffer + public int GetNumMsgsInQueue(uint id) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id) == true) + { + return _msgList[id].Count; + } + else + { + return 0; + } + } + } + + /// + /// + /// + /// + public void ResetRxEvent(uint id) + { + lock (_syncObj) + { + _receivedMsgEvents[id].Reset(); + } + } + + /// + /// Wait for a message to get added to the buffer + /// + /// The message id to wait for + /// The amount of time in ms to wait + /// true if the message arrived, false if it did not + public bool WaitForRspMsg(uint id, int timeoutMs) + { + return _receivedMsgEvents[id].WaitOne(timeoutMs); + } + + /// + /// The constructor + /// + private AutomationRxMsgBuffer(List msgIds) + { + _msgList = new Dictionary>(); + + _msgIds = msgIds; + + // create an event for each msg. + _receivedMsgEvents = new Dictionary(); + + foreach (uint id in _msgIds) + { + _receivedMsgEvents[id] = new AutoResetEvent(false); + } + } + } +} diff --git a/Source/Raytheon.Common/GeneralConstants.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/Constants.cs similarity index 72% rename from Source/Raytheon.Common/GeneralConstants.cs rename to Source/TSRealLib/Common/Raytheon.Common/Lib/Constants.cs index 0f30524..f5a07c8 100644 --- a/Source/Raytheon.Common/GeneralConstants.cs +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/Constants.cs @@ -1,5 +1,4 @@ -/*------------------------------------------------------------------------- -// UNCLASSIFIED +// UNCLASSIFIED /*------------------------------------------------------------------------- RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS @@ -15,17 +14,15 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Raytheon.Common { - public static class GeneralConstants + /// + /// A spot to hold application constants + /// + public static class Constants { public const string InstrumentConfigFolder = "InstrumentConfig"; - public const string DefaultConfigValue = "NOTSET"; } } + diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/DataBuffer.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/DataBuffer.cs new file mode 100644 index 0000000..10ecd25 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/DataBuffer.cs @@ -0,0 +1,324 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Common +{ + /// + /// this class is a container. It acts like an array that allows bytes to be removed from its + /// front. When bytes are removed, the beginning of the buffer moves to the byte following + /// those which were removed. A typical use of this is to AddData(), then use CheckOutStartOfData()/CheckInStartOfData to get + /// a pointer to the data and the amount of bytes that the pointer points to. + /// + public class DataBuffer: IDisposable + { + #region PrivateClassMembers + private unsafe byte[] _buffer; + private uint _endOfDataIndex; // index of last used byte + private uint _startOfDataIndex = uint.MaxValue; // index of first used byte, MaxValue means that buffer is empty + private uint _startOfCheckedOutDataIndex = uint.MaxValue; // index of first used byte, MaxValue means that buffer is empty + + private static object _syncObj = new Object(); + private IntPtr _pStartOfBuffer; + private IntPtr _pStartOfCheckedOutData; + private GCHandle _pinnedArray; + #endregion + + #region PublicFuctions + + /// + /// The constructor which allocates a byte array and pins it so we can return byte*s in StartOfData() + /// + /// The number of bytes in the data buffer + public DataBuffer(uint bufferSize) + { + _buffer = new byte[bufferSize]; + _pinnedArray = GCHandle.Alloc(_buffer, GCHandleType.Pinned); + _pStartOfBuffer = _pinnedArray.AddrOfPinnedObject(); + _pStartOfCheckedOutData = IntPtr.Zero; + } + + /// + /// The finalizer + /// + ~DataBuffer() + { + Dispose(false); + } + + /// + /// adds bytes to the buffer + /// throws exception if requesting to add more bytes than entire buffer will hold. + /// throws an exception if data is checked out and this call attempts to overwrite the checked out data + /// + /// array from which to add bytes to buffer + /// # if bytes from array to add to buffer + public void Add(byte[] data, uint numBytesToAdd) + { + // get exclusive access to array, indexes... + lock (_syncObj) + { + uint numBytesCurrentlyUsed = BytesUsed; + + // not enough room in entire buffer? + if (numBytesToAdd > (_buffer.Length - numBytesCurrentlyUsed)) + { + throw new Exception("DataBuffer::Add() - Not enough room in buffer for data - need to increase size of buffer"); + } + + // empty buffer? + if (_startOfDataIndex == UInt32.MaxValue) + { + Array.Copy(data, _buffer, numBytesToAdd); + _startOfDataIndex = 0; + _endOfDataIndex = numBytesToAdd - 1; + } + else // not empty + { + // not enough room at end? + if (numBytesToAdd > (_buffer.Length - _endOfDataIndex - 1)) + { + // make sure not overwritting checked out data + ulong afterShiftEndOfDataAddy = (ulong)_pStartOfBuffer + numBytesCurrentlyUsed - 1 + numBytesToAdd; + + if (_pStartOfCheckedOutData != IntPtr.Zero && + afterShiftEndOfDataAddy >= (ulong)_pStartOfCheckedOutData) + { + throw new Exception("DataBuffer::Add() - attempting to overwrite data that is checked out (when shifting data to beginning)"); + } + + // shuffle to front of buffer + Array.Copy(_buffer, _startOfDataIndex, _buffer, 0, BytesUsed); + _endOfDataIndex = BytesUsed - 1; + _startOfDataIndex = 0; + } + else if (_pStartOfCheckedOutData != IntPtr.Zero) + { + // make sure not trying to overwrite data when it is checked out + ulong endOfDataAddress = (ulong)_pStartOfBuffer + _endOfDataIndex; + + if (endOfDataAddress < (ulong)_pStartOfCheckedOutData && + endOfDataAddress + numBytesToAdd >= (ulong)_pStartOfCheckedOutData) + { + throw new Exception("DataBuffer::Add() - attempting to overwrite data that is checked out"); + } + } + + Array.Copy(data, 0, _buffer, _endOfDataIndex + 1, numBytesToAdd); + _endOfDataIndex += numBytesToAdd; + } + } + } + + /// + /// returns # of bytes used in buffer + /// + public uint BytesUsed + { + get + { + lock (_syncObj) + { + // is buffer empty? + if (_startOfDataIndex == uint.MaxValue) + { + return 0; + } + else + { + return _endOfDataIndex - _startOfDataIndex + 1; + } + } + } + } + + /// + /// Checks in the data. This should be used after a call to CheckOutStartOfData() + /// + public void CheckInStartOfData() + { + lock (_syncObj) + { + _pStartOfCheckedOutData = IntPtr.Zero; + } + } + + /// + /// This returns a pointer to the start of the new data + /// + /// The number of bytes that the returned pointer contains + /// A pointer to the data + public IntPtr CheckOutStartOfData(ref uint numBytesInReturnedBuffer) + { + lock (_syncObj) + { + // hold onto the start index of the checked out data + _startOfCheckedOutDataIndex = _startOfDataIndex; + + numBytesInReturnedBuffer = 0; + + // if nothing is in the buffer, _startOfCheckedOutDataIndex will be MaxValue + if (_startOfCheckedOutDataIndex != uint.MaxValue) + { + // wrap around condition + if (_endOfDataIndex < _startOfCheckedOutDataIndex) + { + // set the number of bytes from start of data to the end of the buffer + numBytesInReturnedBuffer = (uint)_buffer.Length - _startOfCheckedOutDataIndex + 1; + } + else + { + numBytesInReturnedBuffer = _endOfDataIndex - _startOfCheckedOutDataIndex + 1; + } + } + + _pStartOfCheckedOutData = IntPtr.Add(_pStartOfBuffer, (int)_startOfCheckedOutDataIndex); + + return _pStartOfCheckedOutData; + } + } + + /// + /// Copies data into specified array from buffer + /// Throws exception if asking to copy more bytes than buffer contains + /// + /// array into which to copy data from buffer + /// # bytes to copy from buffer to array + public void Copy(ref byte[] data, uint numBytesToCopy) + { + lock (_syncObj) + { + // asking to copy more bytes than we have? + if (numBytesToCopy > BytesUsed) + { + throw new Exception("DataBuffer::Copy() - Asking to copy more bytes than exist in buffer"); + } + + Array.Copy(_buffer, _startOfDataIndex, data, 0, numBytesToCopy); + } + } + + /// + /// Disposes of resources + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Gets the size of the buffer + /// + /// returns the number of bytes of the buffer. + public uint GetSize() + { + lock (_syncObj) + { + return (uint)(_buffer.Length); + } + } + + /// + /// Removes data from the buffer + /// + /// The number of bytes to remove + public void Remove(uint numBytesToRemove) + { + lock (_syncObj) + { + // asking to remove more bytes than we have? + if (numBytesToRemove > BytesUsed) + { + throw new Exception("DataBuffer::Remove() - Requested to remove more bytes than exist in buffer"); + } + + // remove all bytes? + if (numBytesToRemove == BytesUsed) + { + _startOfDataIndex = UInt32.MaxValue; + + // all of the data is gone, need to set the _pStartOfCheckedOutData back to zero to prevent a race condition between adding data and the host checking the data back in + _pStartOfCheckedOutData = IntPtr.Zero; + } + else + { + _startOfDataIndex += numBytesToRemove; + } + } + } + + /// + /// Removes all data from the buffer + /// + public void RemoveAll() + { + lock (_syncObj) + { + Remove(BytesUsed); + } + } + + /// + /// Disposes of resources + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _pinnedArray.Free(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/ErrorLogger.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/ErrorLogger.cs new file mode 100644 index 0000000..3c9aa87 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/ErrorLogger.cs @@ -0,0 +1,123 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ +using System; +using System.IO; +using NLog; +using System.Reflection; + +namespace Raytheon.Common +{ + /// + /// Singleton for logging debug information and errors. + /// + public class ErrorLogger : IDisposable + { + #region PublicClassMembers + + /// + /// Enum for tagging the logged data. + /// + public enum LogLevel + { + /// + /// (Ordinal = 0) : Most verbose level. Used for development and seldom enabled in production. + /// + TRACE, + /// + /// (Ordinal = 1) : Debugging the application behavior from internal events of interest. + /// + DEBUG, + /// + /// An informational log statement. + /// (Ordinal = 2) : Information that highlights progress or application lifetime events. + /// + INFO, + /// + /// (Ordinal = 3) : Warnings about validation issues or temporary failures that can be recovered. + /// + WARN, + /// + /// (Ordinal = 4) : Errors where functionality has failed or have been caught. + /// an error log statement. + /// + ERROR, + /// + /// (Ordinal = 5) : Most critical level. Application is about to abort. + /// + FATAL + } + + private readonly ILogger _logger; + + #endregion + + #region PrivateClassMembers + private static ErrorLogger _errorLoggerInstance; + #endregion + + #region PublicClassFunctions + + /// + /// Getter for this singleton. + /// + /// File location for Log. + /// The instance of this class. + public static ErrorLogger Instance(string loggername = "CTS") + { + if (_errorLoggerInstance == null) + { + _errorLoggerInstance = new ErrorLogger(loggername); + } + + return _errorLoggerInstance; + } + + /// + /// + /// + /// The logger destination + /// The location of the file to write to. + /// + private ErrorLogger(string logname) + { + _logger = LogManager.GetLogger(logname); + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + //TODO: Unhandled exception if no nlog.config + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + } + + /// + /// Write data to the log file. + /// + /// The data to write. + public void Write(string message, LogLevel logLevel = LogLevel.ERROR) + { + _logger.Log(NLog.LogLevel.FromOrdinal((int)logLevel), message); + } + + public void Dispose() + { + } + + #endregion + + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/ExcelReader.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/ExcelReader.cs new file mode 100644 index 0000000..388a431 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/ExcelReader.cs @@ -0,0 +1,450 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Microsoft.Office.Interop.Excel; +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; + +namespace Raytheon.Common +{ + /// + /// An interface to an excel workbook + /// + public class ExcelReader : IDisposable + { + #region PublicClassMembers + public struct CellRowInfo + { + public int _colNumber; + public string _cellValue; + + internal CellRowInfo(int colNumber, string cellValue) + { + _colNumber = colNumber; + _cellValue = cellValue; + } + }; + #endregion + + #region PrivateClassMembers + private readonly string _fileName; + private Application _excelApp; + private _Workbook _excelWorkBook; + #endregion + + #region PublicFuctions + + /// + /// The constructor. + /// + /// The excel file name (full path) + public ExcelReader(string fileName) + { + _fileName = System.IO.Path.GetFullPath(fileName); + + bool doesFileExist = File.Exists(_fileName); + + if (doesFileExist == false) + { + throw new Exception("ExcelReader::ExcelReader() - File: " + fileName + " Does not exist"); + } + + //Start Excel and get Application object. + _excelApp = new Application(); + _excelApp.Visible = false; + + _excelWorkBook = _excelApp.Workbooks.Open(_fileName); + } + + /// + /// + /// + ~ExcelReader() + { + Dispose(false); + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + public void AddRows(string sheetName, List> rows) + { + _Worksheet sheet = null; + Range excelRange = null; + + try + { + sheet = _excelWorkBook.Sheets[sheetName]; + sheet.Select(Type.Missing); + excelRange = sheet.UsedRange; + + int rowCount = excelRange.Rows.Count; + int colCount = excelRange.Columns.Count; + int newRowNumber = rowCount + 1; + + // insert the new rows + string insertCommand = newRowNumber.ToString() + ":" + (newRowNumber + rows.Count).ToString(); + + sheet.Range[insertCommand].Insert(); + + // fill the cell values + foreach (List cellInfoList in rows) + { + foreach (CellRowInfo cellInfo in cellInfoList) + { + Range cell = sheet.Cells[newRowNumber, cellInfo._colNumber]; + cell.Value = cellInfo._cellValue; + } + + newRowNumber++; + } + } + catch (Exception) + { + throw; + } + finally + { + Marshal.ReleaseComObject(excelRange); + Marshal.ReleaseComObject(sheet); + } + } + + /// + /// + /// + /// + /// + /*public void AddRow(string sheetName, List rowValues) + { + _Worksheet sheet = null; + Range excelRange = null; + + try + { + sheet = _excelWorkBook.Sheets[sheetName]; + sheet.Select(Type.Missing); + excelRange = sheet.UsedRange; + + int rowCount = excelRange.Rows.Count; + int colCount = excelRange.Columns.Count; + int newRowNumber = rowCount + 1; + + // insert the new row + sheet.Rows[rowCount].Insert(newRowNumber); + + // set each cell to empty string + int col = 1; + while (col < colCount) + { + Range cell = sheet.Cells[newRowNumber, col]; + cell.Value = ""; + col++; + } + + // fill the cell values + foreach (CellRowInfo cellInfo in rowValues) + { + Range cell = sheet.Cells[newRowNumber, cellInfo.colNumber]; + cell.Value = cellInfo.cellValue; + col++; + } + } + catch (Exception e) + { + throw; + } + finally + { + Marshal.ReleaseComObject(excelRange); + Marshal.ReleaseComObject(sheet); + } + } + + /// + /// + /// + /// + /// + public void AddRow(string sheetName, List rowValues) + { + _Worksheet sheet = null; + Range excelRange = null; + + try + { + sheet = _excelWorkBook.Sheets[sheetName]; + sheet.Select(Type.Missing); + excelRange = sheet.UsedRange; + + int rowCount = excelRange.Rows.Count; + int colCount = excelRange.Columns.Count; + int newRowNumber = rowCount + 1; + + // insert the new row + sheet.Rows[rowCount].Insert(newRowNumber); + + // set each cell to empty string + int col = 1; + while (col < colCount) + { + Range cell = sheet.Cells[newRowNumber, col]; + cell.Value = ""; + col++; + } + + // fill the cell values + foreach (string cellValue in rowValues) + { + Range cell = sheet.Cells[newRowNumber, col]; + cell.Value = cellValue; + col++; + } + } + catch (Exception e) + { + throw; + } + finally + { + Marshal.ReleaseComObject(excelRange); + Marshal.ReleaseComObject(sheet); + } + }*/ + + public void ColorCell(string sheetName, int row, int col, System.Drawing.Color color) + { + _Worksheet sheet = null; + Range excelRange = null; + + try + { + if (row < 1 || col < 1) + { + throw new Exception("ExcelReader::ColorCell() - row and col inputs must be greater than 0"); + } + + sheet = _excelWorkBook.Sheets[sheetName]; + sheet.Select(Type.Missing); + excelRange = sheet.UsedRange; + + Range cell = sheet.Cells[row, col]; + + cell.Interior.Color = color; + } + catch (Exception) + { + throw; + } + finally + { + Marshal.ReleaseComObject(excelRange); + Marshal.ReleaseComObject(sheet); + } + } + + /// + /// + /// + /// + public List ReadAllSheetNames() + { + List sheetList = new List(); + + foreach (_Worksheet temp in _excelWorkBook.Sheets) + { + sheetList.Add(temp.Name.ToUpper()); + } + + return sheetList; + } + + /// + /// + /// + /// + /// + /// + /// + public string ReadAllRows(string sheetName, int startingRow, int startingCol) + { + _Worksheet sheet = null; + Range excelRange = null; + + try + { + ErrorLogger.Instance().Write("ExcelReader::ReadAllRows() - for sheet " + sheetName, ErrorLogger.LogLevel.INFO); + + if (startingRow < 1 || startingCol < 1) + { + throw new Exception("ExcelReader::ReadAllRows() - startingRow and startingCol inputs must be greater than 0"); + } + + // check to see if the requested sheet exists. + bool doesSheetExist = false; + foreach (_Worksheet temp in _excelWorkBook.Sheets) + { + if (temp.Name.ToUpper() == sheetName.ToUpper()) + { + doesSheetExist = true; + break; + } + } + + // give a nice error if it doesnt exist + if (doesSheetExist == false) + { + throw new Exception("ExcelReader::ReadAllRows() - sheet: " + sheetName + " does not exist in file: " + _fileName); + } + + sheet = _excelWorkBook.Sheets[sheetName]; + sheet.Select(Type.Missing); + excelRange = sheet.UsedRange; + + string allRows = ""; + + int rowCount = excelRange.Rows.Count; + int colCount = excelRange.Columns.Count; + + for (int currentRowIndex = startingRow; currentRowIndex <= rowCount; currentRowIndex++) + { + string currentRowData = ""; + for (int currentColIndex = startingCol; currentColIndex <= colCount; currentColIndex++) + { + if (excelRange.Cells[currentRowIndex, currentColIndex] != null) + { + if (excelRange.Cells[currentRowIndex, currentColIndex].Value2 == null) + { + currentRowData += ","; + } + else + { + string cellValue = excelRange.Cells[currentRowIndex, currentColIndex].Value2.ToString(); + cellValue = cellValue.Replace(',', ' '); + currentRowData += cellValue + ","; + } + } + } + + // remove any newlines + currentRowData = currentRowData.Replace('\n', ' '); + + // strip off the last comma and add the newline + currentRowData = currentRowData.TrimEnd(','); + allRows += currentRowData + "\n"; + } + + // remove the \n at the end of the string + allRows = allRows.TrimEnd('\n'); + + return allRows; + } + catch (Exception) + { + throw; + } + finally + { + if (excelRange != null) + { + Marshal.ReleaseComObject(excelRange); + } + + if (sheet != null) + { + Marshal.ReleaseComObject(sheet); + } + } + } + + /// + /// + /// + /// + public void SaveAs(string fileName) + { + _excelWorkBook.SaveAs(fileName); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + //close and release + if (_excelWorkBook != null) + { + _excelWorkBook.Close(); + Marshal.ReleaseComObject(_excelWorkBook); + } + + //quit and release + if (_excelApp != null) + { + _excelApp.Quit(); + Marshal.ReleaseComObject(_excelApp); + } + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/IniFile.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/IniFile.cs new file mode 100644 index 0000000..f9ab6db --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/IniFile.cs @@ -0,0 +1,183 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.IO; + +namespace Raytheon.Common +{ + /// + /// Read/Write to an ini file. + /// + public class IniFile + { + #region PrivateMemberVariables + + /// + /// + /// + internal static class NativeMethods + { + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + internal static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, string lpReturnedstring, int nSize, string lpFileName); + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string line, string lpFileName); + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + internal static extern int GetPrivateProfileSectionNames(byte[] sections, int bufferSize, string filename); + } + + private readonly string _fileName; + + #endregion + + #region PublicFunctions + + /// + /// The constructor. It will check to make sure the file exists and throw an exception it if does not + /// + /// The ini file name (path). + public IniFile(string fileName) + { + _fileName = fileName; + + if (File.Exists(_fileName) == false) + { + throw new Exception("IniFile::IniFile() - The file does not exist: " + _fileName); + } + } + + /// + /// Reads from the ini file. + /// + /// The section. + /// The key. + /// The value. + public string ReadValue(string section, string key) + { + // just a swag + const int BUFFER_SIZE = 10240; + + string temp = new string('\0', BUFFER_SIZE); + + int numBytes = NativeMethods.GetPrivateProfileString(section, key, "", temp, BUFFER_SIZE, _fileName); + + if (numBytes == 0) + { + throw new Exception("IniFile::ReadValue() - GetPrivateProfilestring returned 0 bytes for section: " + section + ", key: " + key); + } + + temp = temp.TrimEnd('\0'); + + return temp; + } + + /// + /// Reads all keys from a section of an ini file. + /// + /// The section. + /// A list of all keys. + public List ReadAllKeys(string section) + { + // just a swag + const int BUFFER_SIZE = 102400; + + string temp = new string('\0', BUFFER_SIZE); + + int numBytes = NativeMethods.GetPrivateProfileString(section, null, "", temp, BUFFER_SIZE, _fileName); + + if (numBytes == 0) + { + List keyList = new List(); + return keyList; + } + else + { + temp = temp.TrimEnd('\0'); + + List keyList = new List(temp.Split('\0')); + + return keyList; + } + } + + /// + /// Returns a list of all of the sections in the ini file. + /// + /// A list of all sections. + public List ReadAllSections() + { + // just a swag + const int BUFFER_SIZE = 102040; + + // allocate a 10K buffer. Should be enough to handle plenty of power systems + byte[] buffer = new byte[BUFFER_SIZE]; + + int numBytesReturned = NativeMethods.GetPrivateProfileSectionNames(buffer, BUFFER_SIZE, _fileName); + + if (numBytesReturned == BUFFER_SIZE) + { + throw new Exception("IniFile::ReadAllSections() - returned the max buffer size. Probably have more items in config file than we can handle"); + } + else if (numBytesReturned == 0) + { + throw new Exception("IniFile::ReadAllSections() - GetPrivateProfileSectionNames returned 0 bytes"); + } + + // convert the buffer to a string + string result = System.Text.Encoding.Unicode.GetString(buffer); + + // trim the end of the string + result = result.TrimEnd('\0'); + + // split the string + string[] sectionListTemp = result.Split('\0'); + + // ass the sections to a list + List sectionList = new List(); + + for (int i = 0; i < sectionListTemp.Length; ++i) + { + sectionList.Add(sectionListTemp[i]); + } + + return sectionList; + } + + /// + /// + /// + /// + /// + /// + public void WriteValue(string section, string key, string lineToWrite) + { + bool success = NativeMethods.WritePrivateProfileString(section, key, lineToWrite, _fileName); + + if (success == false) + { + throw new Exception("IniFile::WriteValue() - WritePrivateProfileString returned false for section: " + section + ", key: " + key + " , line: " + lineToWrite); + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/MemoryMap.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/MemoryMap.cs new file mode 100644 index 0000000..e7b1035 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/MemoryMap.cs @@ -0,0 +1,316 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; + +namespace Raytheon.Common +{ + /// + /// A class that reads a memory map upon construction and then serves up the fields of an entry upon request + /// + public class MemoryMap + { + #region PrivateClassMembers + public struct MemoryMapFields + { + public readonly uint _page; + public readonly uint _address; + public readonly int _startBit; + public readonly int _numBits; + public readonly uint _regDefault; + public readonly double _scaleFactor; + + public MemoryMapFields(uint page, uint address, int startBit, int numBits, uint regDefault, double scaleFactor) + { + _page = page; + _address = address; + _startBit = startBit; + _numBits = numBits; + _regDefault = regDefault; + _scaleFactor = scaleFactor; + } + } + + private struct BitInfo + { + public int _start; + public int _numOfBits; + } + + private const string _NEWLINE = "\r\n"; + private Dictionary _mapData; + private double _scaleFactor = 1.0; + #endregion + + #region PrivateFuctions + + /// + /// + /// + /// + /// + private Dictionary CreateMemoryMapDictionary(string fileLocation) + { + Dictionary temp = new Dictionary(); + + //Open file for processing (read-only) + using (FileStream readStream = new FileStream(fileLocation, FileMode.Open, FileAccess.Read)) + { + //Process the memmap + ProcessFile(readStream, temp); + } + + return temp; + } + + /// + /// Processes the memory map files into a data structure + /// + /// + /// + private void ProcessFile(FileStream fs, Dictionary memoryMap) + { + uint page = 0; + uint address = 0; + uint regDefault = 0; + char[] delimit = { ' ' }; + + uint prevPage = 0; + uint prevAddress = 0; + uint parentRegDefault = 0; + + using (StreamReader reader = new StreamReader(fs)) + { + while (!reader.EndOfStream) + { + //Read a line from the file + string line = reader.ReadLine(); + + //Parse the line by spaces (remove empty entries) + string[] fields = line.Split(delimit, StringSplitOptions.RemoveEmptyEntries); + + //If nothing to read, stop processing + if (fields.Length == 0) + { + break; + } + + //Get the key (Register Name) + string key = fields[0].ToUpper(); + + //Check for duplicates + if (memoryMap.ContainsKey(key)) + { + throw new Exception("Duplicate item found in file: " + fs.Name + ", Item key: " + key); + } + + //Check if the register is a parent or child + //A child will use its parent address and gets it default value from its parent + if (line.StartsWith(" ")) + { + regDefault = parentRegDefault; + page = prevPage; + address = prevAddress; + } + else + { + //Get the page number + page = ProcessPageNum(fields[1]); + + //Get register address + address = ProcessDecimalHex(fields[1]); + + //Get register default values + regDefault = ProcessDecimalHex(fields[5]); + + //Get scale factor + _scaleFactor = ProcessScaleFactor(line); + } + + //Process bits + BitInfo bitInfo = ProcessBitInfo(fields[3]); + + double scaleFactor = _scaleFactor; + + // parse out the default value for this child item + if (bitInfo._numOfBits < 32) + { + // clear the upper bits + int numBitsToClear = 32 - (bitInfo._start + bitInfo._numOfBits); + regDefault = regDefault << numBitsToClear; + + // clear lower bits and place into position + int numBitsForPosition = bitInfo._start + numBitsToClear; + regDefault = regDefault >> numBitsForPosition; + } + else + { + parentRegDefault = regDefault; + } + + memoryMap.Add(key, new MemoryMapFields(page, address, bitInfo._start, bitInfo._numOfBits, regDefault, scaleFactor)); + + // hold onto previous values for child items + prevPage = page; + prevAddress = address; + } + } + } + + /// + /// + /// + /// + /// + private uint ProcessPageNum(string pageNumber) + { + //Delimiter used to parse string + char[] delimit = { '.' }; + + //Array of parsed string + string[] strPageValues = pageNumber.Split(delimit); + + //Convert first array element + uint value = uint.Parse(strPageValues[0]); + + //Return conversion + return value; + } + + /// + /// + /// + /// + /// + private uint ProcessDecimalHex(string address) + { + //Delimiter used to parse string + char[] delimit = { '.' }; + + //Array of parsed string + string[] strValues = address.Split(delimit); + + string strCombined = ""; + + //Address = 0.XXXX.XXXX, register values = XXXX.XXXX + if (strValues.Length == 3) + { + strCombined = strValues[1] + strValues[2]; + } + else + { + strCombined = strValues[0] + strValues[1]; + } + + //Convert hex number to UInt + uint value = uint.Parse(strCombined, System.Globalization.NumberStyles.HexNumber); + + //Return value + return value; + } + + /// + /// + /// + /// + /// + private BitInfo ProcessBitInfo(string bits) + { + //Structure for bit information + BitInfo temp; + + //Delimiter used to parse string + char[] delimit = { ':' }; + char[] trimChar = { '(', ')' }; + + string trimBits = bits.Trim(trimChar); + string[] values = trimBits.Split(delimit); + + if (values.Length == 2) + { + //values represents a range of bits + int start = int.Parse(values[1]); + int end = int.Parse(values[0]); + + //Add one for zero offset + temp._start = start; + temp._numOfBits = end - start + 1; + } + else + { + //Only a single bit + temp._numOfBits = 1; + temp._start = int.Parse(values[0]); + } + + return temp; + } + + /// + /// + /// + /// + /// + private double ProcessScaleFactor(string scaleFactor) + { + const string PATTERN = @"[+-]?[0-9]{1,}\.[0-9]{1,}[e][+-]?[0-9]{1,}"; + + //Find Scale Factor (default = 1) + string sf = "1"; + + foreach (Match match in Regex.Matches(scaleFactor, PATTERN)) + { + sf = match.Value; + } + + double value = double.Parse(sf); + + return value; + } + #endregion + + #region PublicFuctions + + /// + /// The constructor + /// + /// The memory map file + public MemoryMap(string memMapLocation) + { + _mapData = CreateMemoryMapDictionary(memMapLocation); + } + + /// + /// + /// + /// The name of the register + /// + public MemoryMapFields GetRegisterInfoByString(string registerName) + { + if (_mapData.ContainsKey(registerName.ToUpper()) == false) + { + throw new Exception("The requested register: " + registerName + " is not in the memory map"); + } + + return _mapData[registerName.ToUpper()]; + } + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/Util.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/Util.cs new file mode 100644 index 0000000..6d968aa --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/Util.cs @@ -0,0 +1,418 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.IO; +using System.Linq; +using System.Text; + +namespace Raytheon.Common +{ + /// + /// A collection of utilities. + /// + public static class Util + { + #region PublicFunctions + + /// + /// + /// + /// + /// + /// + /// + /// + public static uint ApplyBitMask(uint registerContents, int startBit, int numOfBitsToMask, bool inverseFlag = false) + { + uint mask = 1; + for (int i = 0; i < numOfBitsToMask - 1; i++) + { + mask = mask << 1; + mask = mask + 1; + } + + //left shift to startbit position + mask = mask << startBit; + + //Inverse the mask + if (inverseFlag) + { + mask = ~mask; + } + + //Apply Mask and return + return (registerContents & mask); + } + + /// + /// + /// + /// + /// + public static string ByteArrayToHexString(byte[] ba) + { + StringBuilder hex = new StringBuilder(ba.Length * 2); + + foreach (byte b in ba) + { + hex.AppendFormat("{0:x2}", b); + } + + return hex.ToString(); + } + + /// + /// + /// + /// + /// + /// + public static int ByteArraySearch(byte[] src, int srcStartIndex, byte[] pattern) + { + int maxFirstCharSlot = src.Length - pattern.Length + 1; + for (int i = srcStartIndex; i < maxFirstCharSlot; i++) + { + if (src[i] != pattern[0]) // compare only first byte + { + continue; + } + + // found a match on first byte, now try to match rest of the pattern + for (int j = pattern.Length - 1; j >= 1; j--) + { + if (src[i + j] != pattern[j]) break; + if (j == 1) return i; + } + } + return -1; + } + + /// + /// + /// + /// + /// + public static double ConvertStringToDouble(string stringToConvert) + { + try + { + double rsp = Convert.ToDouble(stringToConvert); + + return rsp; + } + catch (Exception err) + { + throw new Exception("Util::ConvertStringToDouble() - " + err.Message + ". Faulty String: " + stringToConvert); + } + } + + /// + /// Converts a string to a ushort + /// + /// + /// + public static ushort ConvertStringToUInt16(string stringToConvert) + { + try + { + ushort rsp = Convert.ToUInt16(stringToConvert); + + return rsp; + } + catch (Exception err) + { + throw new Exception("Util::ConvertStringToUInt16() - " + err.Message + ". Faulty String: " + stringToConvert); + } + } + + /// + /// + /// + /// + /// + public static int ConvertStringToInt32(string stringToConvert) + { + try + { + int rsp = Convert.ToInt32(stringToConvert); + + return rsp; + } + catch (Exception err) + { + throw new Exception("Util::ConvertStringToInt32() - " + err.Message + ". Faulty String: " + stringToConvert); + } + } + + /// + /// + /// + /// + /// + /// + public static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) + { + // Get the subdirectories for the specified directory. + DirectoryInfo dir = new DirectoryInfo(sourceDirName); + + if (!dir.Exists) + { + throw new DirectoryNotFoundException( + "Source directory does not exist or could not be found: " + + sourceDirName); + } + + DirectoryInfo[] dirs = dir.GetDirectories(); + // If the destination directory doesn't exist, create it. + if (!Directory.Exists(destDirName)) + { + Directory.CreateDirectory(destDirName); + } + + // Get the files in the directory and copy them to the new location. + FileInfo[] files = dir.GetFiles(); + foreach (FileInfo file in files) + { + string temppath = Path.Combine(destDirName, file.Name); + file.CopyTo(temppath, false); + } + + // If copying subdirectories, copy them and their contents to new location. + if (copySubDirs) + { + foreach (DirectoryInfo subdir in dirs) + { + string temppath = Path.Combine(destDirName, subdir.Name); + DirectoryCopy(subdir.FullName, temppath, copySubDirs); + } + } + } + + /// + /// Compares the contents of two files + /// + /// + /// + /// + public static bool FileEquals(string fileName1, string fileName2) + { + using (var file1 = new FileStream(fileName1, FileMode.Open)) + using (var file2 = new FileStream(fileName2, FileMode.Open)) + return FileStreamEquals(file1, file2); + } + + /// + /// Compares the contents of two file streams + /// + /// + /// + /// + public static bool FileStreamEquals(Stream stream1, Stream stream2) + { + const int BUFFER_SIZE = 2048; + byte[] buffer1 = new byte[BUFFER_SIZE]; //buffer size + byte[] buffer2 = new byte[BUFFER_SIZE]; + + while (true) + { + int count1 = stream1.Read(buffer1, 0, BUFFER_SIZE); + int count2 = stream2.Read(buffer2, 0, BUFFER_SIZE); + + if (count1 != count2) + { + return false; + } + + if (count1 == 0) + { + return true; + } + + // You might replace the following with an efficient "memcmp" + if (!buffer1.Take(count1).SequenceEqual(buffer2.Take(count2))) + { + return false; + } + } + } + + /// + /// Get a timestamp in string form. + /// + /// The timestamp string. + public static string GetTimeString() + { + DateTime nowTime = DateTime.Now; + string time = nowTime.Year.ToString("0000") + "_" + nowTime.Month.ToString("00") + "_" + nowTime.Day.ToString("00") + "_" + nowTime.Hour.ToString("00") + "_" + nowTime.Minute.ToString("00") + "_" + nowTime.Second.ToString("00") + "_" + nowTime.Millisecond.ToString("000"); + return time; + } + + /// + /// + /// + /// + /// + /// + public static bool IsIpAddressReachable(string address, int pingTimeOutInMs = 1000) + { + bool isReachable = false; + + System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping(); + + System.Net.NetworkInformation.PingReply reply = p.Send(address, pingTimeOutInMs); + + if (reply.Status == System.Net.NetworkInformation.IPStatus.Success) + { + isReachable = true; + } + + return isReachable; + } + + /// + /// + /// + /// + /// + /// + /// + public static uint ParseRegisterItem(uint registerContents, int startBit, int numOfBitsToMask) + { + uint mask = 1; + for (int i = 0; i < numOfBitsToMask - 1; i++) + { + mask = mask << 1; + mask = mask + 1; + } + + //left shift to startbit position + mask = mask << startBit; + + uint dataToReturn = (registerContents & mask); + + dataToReturn = dataToReturn >> startBit; + + //Apply Mask and return + return dataToReturn; + } + + /// + /// + /// + /// + /// + public static ushort ReverseBits16(ushort data) + { + ushort reversedData = 0; + + for (int i = 0; i < 16; ++i) + { + reversedData <<= 1; + reversedData |= (ushort)(data & 1); + data >>= 1; + } + + return reversedData; + } + + /// + /// + /// + /// + /// + public static byte[] Swap(byte[] input) + { + Array.Reverse(input); + return input; + } + + /// + /// + /// + /// + /// + public static double Swap(double input) + { + byte[] byteArray = BitConverter.GetBytes(input); + Array.Reverse(byteArray); + return BitConverter.ToDouble(byteArray, 0); + } + + /// + /// + /// + /// + /// + public static ulong Swap(ulong input) + { + byte[] byteArray = BitConverter.GetBytes(input); + Array.Reverse(byteArray); + return BitConverter.ToUInt64(byteArray, 0); + } + + /// + /// Reverse the byte order of the input parameter (16bit). + /// + /// 16bit data. + /// Reversed 16bit data. + public static ushort Swap(ushort input) + { + byte[] byteArray = BitConverter.GetBytes(input); + Array.Reverse(byteArray); + return BitConverter.ToUInt16(byteArray, 0); + } + + /// + /// Reverse the byte order of the input parameter (32bit). + /// + /// 32bit data. + /// Reversed 32bit data. + public static uint Swap(uint input) + { + byte[] byteArray = BitConverter.GetBytes(input); + Array.Reverse(byteArray); + return BitConverter.ToUInt32(byteArray, 0); + } + + /// + /// + /// + /// + /// + public static float Swap(float input) + { + byte[] byteArray = BitConverter.GetBytes(input); + Array.Reverse(byteArray); + return BitConverter.ToSingle(byteArray, 0); + } + + /// + /// + /// + /// + /// + public static uint SwapHighAndLowBytes(uint dataBeingSwapped) + { + //Using a 16-bit shift to move around four hex values at a time + dataBeingSwapped = ((dataBeingSwapped & 0xFFFF) << 16) | ((uint)(dataBeingSwapped & 0xFFFF0000) >> 16); + return dataBeingSwapped; + } + + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Lib/WinApi.cs b/Source/TSRealLib/Common/Raytheon.Common/Lib/WinApi.cs new file mode 100644 index 0000000..0f04d36 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Lib/WinApi.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Win_API +{ + public static class NativeMethods + { + // The following GitHub link was very helpful in understanding how some of the WinApi calls work together, as well as + // for certain const values like DIGCF_PRESENT. https://github.com/mikeobrien/HidLibrary/tree/dc9026067dd0c511574c8ce726682ece4f45939e + + //https://docs.microsoft.com/en-us/windows-hardware/drivers/install/setupapi + + //https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/introduction-to-hid-concepts + + + public const uint GENERIC_READ = 0x80000000; + public const uint GENERIC_WRITE = 0x40000000; + public const int FILE_FLAG_OVERLAPPED = 0x40000000; + public const int FILE_ATTRIBUTE_NORMAL = 0x128; + + public const short DIGCF_PRESENT = 0x2; + public const short DIGCF_DEVICEINTERFACE = 0x10; + public const int DIGCF_ALLCLASSES = 0x4; + + public static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); + + /// + /// Zero prevents other processes from opening a file or device if they request delete, read, or write access. + /// + public enum FileShareMode + { + Zero = 0x00000000, + FILE_SHARE_DELETE = 0x00000004, + FILE_SHARE_READ = 0x00000001, + FILE_SHARE_WRITE = 0x00000002 + } + + public struct SECURITY_ATTRIBUTES + { + public int nLength; + public IntPtr lpSecurityDescriptor; + public bool bInheritHandle; + } + [DllImport("kernel32.dll")] + public static extern bool CancelIo(IntPtr hFile); + + [DllImport("kernel32.dll")] + public static extern IntPtr CreateFileA( + string lpFileName, + uint dwDesiredAccess, + int dwShareMode, + ref SECURITY_ATTRIBUTES lpSecurityAttributes, + int dwCreationDisposition, + int dwFlagsAndAttributes, + IntPtr hTemplateFile); + + [DllImport("kernel32.dll")] + public static extern bool ReadFile( + IntPtr hFile, + IntPtr lpBuffer, + uint nNumberOfBytesToRead, + out uint lpNumberOfBytesRead, + [In] ref System.Threading.NativeOverlapped lpOverlapped); + + [DllImport("kernel32.dll")] + public static extern bool WriteFile( + IntPtr hFile, + byte[] lpBuffer, + uint nNumberOfBytesToWrite, + out uint lpNumberOfBytesWritten, + [In] ref System.Threading.NativeOverlapped lpOverlapped); + + [DllImport("kernel32.dll")] + public static extern bool CloseHandle(IntPtr hHandle); + + /// + /// The caller of this function must delete the returned device information set when it is no longer needed by calling SetupDiDestroyDeviceInfoList. + /// + /// + /// + /// + [DllImport("Setupapi.dll")] + public static extern IntPtr SetupDiCreateDeviceInfoList(Guid Guid, IntPtr HwndParent); + + [DllImport("setupapi.dll")] + public static extern bool SetupDiCreateDeviceInfo(IntPtr DeviceInfoSet, string DeviceName, Guid ClassGuid, string DeviceDescription, uint CreationFlags, IntPtr DeviceInfoData); + + [DllImport("setupapi.dll")] + public static extern bool SetupDiEnumDeviceInfo(IntPtr DeviceInfoSet, uint MemberIndex, ref SP_DEVINFO_DATA DeviceInfoData); + + [DllImport("setupapi.dll")] + public static extern bool SetupDiEnumDeviceInterfaces(IntPtr DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, Guid InterfaceClassGuid, uint MemberIndex, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData); + + [DllImport("setupapi.dll")] + public static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr DeviceInfoSet, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, IntPtr DeviceInterfaceDetailData, uint DeviceInterfaceDetailDataSize, ref uint RequiredSize, IntPtr DeviceInfoData); + + [DllImport("setupapi.dll")] + public static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr DeviceInfoSet, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, ref SP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData, uint DeviceInterfaceDetailDataSize, ref uint RequiredSize, IntPtr DeviceInfoData); + + [DllImport("setupapi.dll")] + public static extern bool SetupDiGetClassDevs(Guid ClassGuid, IntPtr Enumerator, IntPtr hwndParent, uint Flags); + + [DllImport("setupapi.dll")] + public static extern bool SetupDiDestroyDeviceInfoList(IntPtr DeviceInfoSet); + + /// + /// HidD_GetAttributes returns TRUE if succeeds; otherwise, it returns FALSE. + /// + /// + /// + /// + [DllImport("hid.dll")] + public static extern bool HidD_GetAttributes(IntPtr HidDeviceObject, HIDD_ATTRIBUTES Attributes); + /// + /// [out] Pointer to a caller-allocated GUID buffer that the routine uses to return the device interface GUID for HIDClass devices. + /// + /// + [DllImport("hid.dll")] + public static extern void HidD_GetHidGuid(out Guid HidGuid); + + [DllImport("hid.dll")] + public static extern bool HidD_GetIndexString(IntPtr HidDeviceObject, ulong StringIndex, out string Buffer, ulong BufferLength); + /// + /// The maximum possible number of characters in an embedded string is device specific. For USB devices, the maximum string length is 126 wide characters (not including the terminating NULL character). + /// If the supplied buffer is not <= 4093 bytes(2^12 – 3) the call may fail(depending on the underlying protocol, HID/Bluetooth/SPI) with error code ERROR_GEN_FAILURE(0x0000001f). + /// + /// + /// + /// + /// bool + [DllImport("hid.dll")] + public static extern bool HidD_GetManufacturerString(IntPtr HidDeviceObject, out string Buffer, ulong BufferLength); + + /// + /// HidD_GetPhysicalDescriptor returns TRUE if it succeeds; otherwise, it returns FALSE. Use GetLastError to get extended error information. + /// + /// + /// + /// + /// + [DllImport("hid.dll")] + public static extern bool HidD_GetPhysicalDescriptor(IntPtr HidDeviceObject, out string Buffer, [In] ulong BufferLength); + + [DllImport("hid.dll")] + public static extern bool HidD_GetPreparsedData(IntPtr HidDeviceObject, out HID_COLLECTION_INFORMATION PreparsedData); + + /// + /// The supplied buffer must be <= 4093 bytes (2^12 – 3). + /// + /// + /// + /// + /// + [DllImport("hid.dll")] + public static extern bool HidD_GetProductString(IntPtr HidDeviceObject, out string Buffer, ulong BufferLength); + + [DllImport("hid.dll")] + public static extern bool HidD_GetSerialNumberString(IntPtr HidDeviceObject, out string Buffer, ulong BufferLength); + + [DllImport("hid.dll")] + public static extern bool HidD_GetNumInputBuffers(IntPtr HidDeviceObject, out ulong NumberBuffers); + [DllImport("hid.dll")] + public static extern bool HidD_SetNumInputBuffers(IntPtr HidDeviceObject, ulong NumberBuffers); + + /// + /// A caller of HidD_GetAttributes, uses this structure to obtain a device's vendor information. + /// Before using a HIDD_ATTRIBUTES structure with HIDClass support routines, the caller must set the Size member. + /// + public struct HIDD_ATTRIBUTES + { + public ulong Size; + public ushort VendorID; + public ushort ProductID; + public ushort VersionNumber; + } + + public struct HID_COLLECTION_INFORMATION + { + public ulong DescriptorSize; + public bool Polled; + public char[] Reserved1; + public ushort VendorID; + public ushort ProductID; + public ushort VersionNumber; + } + + [StructLayout(LayoutKind.Sequential)] + public struct SP_DEVICE_INTERFACE_DATA + { + public uint cbSize; + public Guid InterfaceClassGuid; + public uint Flags; + public IntPtr Reserved; + } + + [StructLayout(LayoutKind.Sequential)] + public struct SP_DEVINFO_DATA + { + public uint cbSize; + public Guid ClassGuid; + public uint DevInst; + public IntPtr Reserved; + } + + [StructLayout(LayoutKind.Sequential)] + public struct SP_DEVICE_INTERFACE_DETAIL_DATA + { + public uint cbSize; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string DevicePath; + } + + + + + + public static SECURITY_ATTRIBUTES InitWithDefaultAttributes() + { + SECURITY_ATTRIBUTES attributes = new SECURITY_ATTRIBUTES + { + bInheritHandle = false, + lpSecurityDescriptor = IntPtr.Zero + }; + attributes.nLength = Marshal.SizeOf(attributes); + return attributes; + } + public static IntPtr CreateNonManagedBuffer(byte[] buffer) + { + return Marshal.AllocHGlobal(buffer.Length); + } + + public static byte[] CopyUnManagedBufferToManagedBuffer(IntPtr unManagedBuffer, int bytesRead) + { + var buffer = new byte[] { }; + Marshal.Copy(unManagedBuffer, buffer, 0, bytesRead); + return buffer; + } + public static void DisposeNonManagedObject(IntPtr nonManagedObj) + { + Marshal.FreeHGlobal(nonManagedObj); + } + } + +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Misc/ActiveHealthMonitorData.cs b/Source/TSRealLib/Common/Raytheon.Common/Misc/ActiveHealthMonitorData.cs new file mode 100644 index 0000000..952f724 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Misc/ActiveHealthMonitorData.cs @@ -0,0 +1,49 @@ +// ********************************************************************************************************** +// ActiveHealthMonitorData.cs +// 2/17/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +namespace Raytheon.Common +{ + public enum MonitorStatus + { + NOMINAL, + WARNING, + ABORT + } + + public struct ActiveHealthMonitorData + { + public string itemName; + public double dataValue; + public MonitorStatus status; + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Misc/PowerMonitorCallbackData.cs b/Source/TSRealLib/Common/Raytheon.Common/Misc/PowerMonitorCallbackData.cs new file mode 100644 index 0000000..d210972 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Misc/PowerMonitorCallbackData.cs @@ -0,0 +1,55 @@ +// ********************************************************************************************************** +// PowerMonitorCallbackData.cs +// 2/17/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + + +namespace Raytheon.Common +{ + public struct PowerMonitorCallbackData + { + public string powerModule; + + public double overVoltageProtectionValue; + + public double overCurrentProtectionValue; + + public double voltage; + + public double voltageSetpoint; + + public double current; + + public bool outputStatus; + + public int ovpocpStatus; + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Raytheon.Common.csproj b/Source/TSRealLib/Common/Raytheon.Common/Raytheon.Common.csproj new file mode 100644 index 0000000..0d7c9d3 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Raytheon.Common.csproj @@ -0,0 +1,61 @@ + + + + net472 + 9.0 + Library + Raytheon.Common + Raytheon Common Library + Raytheon Common Library + + + + 1.0.0 + true + + + + CS0649 + + + + + + + + + + + + + + + {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} + 2 + 8 + 0 + primary + False + True + + + {00020813-0000-0000-C000-000000000046} + 1 + 9 + 0 + primary + False + True + + + {0002E157-0000-0000-C000-000000000046} + 5 + 3 + 0 + primary + False + True + + + + \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/ThreadWorkers/MsgProcessorWorker.cs b/Source/TSRealLib/Common/Raytheon.Common/ThreadWorkers/MsgProcessorWorker.cs new file mode 100644 index 0000000..e3ebdaa --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/ThreadWorkers/MsgProcessorWorker.cs @@ -0,0 +1,247 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; + +namespace Raytheon.Common +{ + /// + /// Processes messages from a buffer + /// + public class MsgProcessorWorker : IWorkerInterface + { + #region PrivateClassMembers + private IMsgParser _msgParser; + private DataBuffer _dataBuffer; + private AutoResetEvent _dataInBufferEvent; + private AutoResetEvent _quitEvent; + private bool _threadQuitControl; + private MsgDevice.CompleteMessageCallback _completeMsgCallback; + #endregion + + #region PrivateFunctions + /// + /// Dispose of this objects resources + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _quitEvent.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// Constructor + /// + /// Parses out the messages + /// The buffer to parse from + /// A singal to let us know that data has arrived + public MsgProcessorWorker(IMsgParser msgParser, ref DataBuffer dataBuffer, ref AutoResetEvent dataInBufferEvent) + { + _msgParser = msgParser; + _dataBuffer = dataBuffer; + _dataInBufferEvent = dataInBufferEvent; + _threadQuitControl = false; + _quitEvent = new AutoResetEvent(false); + } + + /// + /// The finalizer for cleaing up resources + /// + ~MsgProcessorWorker() + { + Dispose(false); + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Parses out messages from the data buffer and then issues callback to the handler with the completed message + /// + unsafe public void DoWork() + { + try + { + if (_completeMsgCallback == null) + { + throw new Exception("MsgProcessorWorker::DoWork() - Callback not set"); + } + + WaitHandle[] waithandles = new WaitHandle[2]; + waithandles[0] = _dataInBufferEvent; + waithandles[1] = _quitEvent; + + bool isTheWorkDone = false; + + uint numBytesProcessedInLastIteration = 0; + + while (isTheWorkDone == false) + { + int eventIndex = 0; + + eventIndex = WaitHandle.WaitAny(waithandles, 100); + _dataInBufferEvent.Reset(); + + uint dataBufferBytesUsed = _dataBuffer.BytesUsed; + if (eventIndex == 0 || dataBufferBytesUsed > 0) // _dataInBufferEvent + { + uint numBytesToProcess = 0; + + IntPtr pStartOfData = _dataBuffer.CheckOutStartOfData(ref numBytesToProcess); + + bool isThisRoundOfProcessingDone = false; + + uint ourCopyOfDataIndex = 0; + + numBytesProcessedInLastIteration = 0; + + while (isThisRoundOfProcessingDone == false) + { + uint numBytesLeftInTempBuffer = numBytesToProcess - ourCopyOfDataIndex; + + if (numBytesLeftInTempBuffer == 0) + { + isThisRoundOfProcessingDone = true; + } + else + { + uint numBytesToRemove = 0; + uint msgId = 0; + uint errorCode = 0; + + IntPtr payLoadPtr = IntPtr.Add(pStartOfData, (int)ourCopyOfDataIndex); + + if (_msgParser.Run(payLoadPtr, numBytesLeftInTempBuffer, ref numBytesToRemove, ref msgId, ref errorCode) == true) + { + string msg = "MsgProcessorWorker::DoWork() - removing " + numBytesToRemove.ToString() + " bytes, for msg id: " + msgId.ToString("X8"); + + ErrorLogger.Instance().Write(msg, ErrorLogger.LogLevel.INFO); + + // we have a complete message, invoke the call back + _completeMsgCallback(msgId, payLoadPtr, numBytesToRemove, errorCode); + } + + if (numBytesToRemove == 0) + { + isThisRoundOfProcessingDone = true; + } + else + { + ourCopyOfDataIndex += numBytesToRemove; + _dataBuffer.Remove(numBytesToRemove); + numBytesProcessedInLastIteration += ourCopyOfDataIndex; + } + + // were we signaled to quit? + if (_threadQuitControl == true) + { + ErrorLogger.Instance().Write("MsgProcessorWorker::DoWork() - in the midst of procesing data, the quit event was detected, exiting", ErrorLogger.LogLevel.INFO); + isTheWorkDone = true; + } + } + } + + //Check start of data back in since we are done with it + _dataBuffer.CheckInStartOfData(); + } + else if (eventIndex == 1) // _quitEvent + { + ErrorLogger.Instance().Write("MsgProcessorWorker::DoWork() - quit event was detected, exiting", ErrorLogger.LogLevel.INFO); + isTheWorkDone = true; + } + else if (eventIndex == WaitHandle.WaitTimeout) + { + // expected, continue + } + else + { + ErrorLogger.Instance().Write("MsgProcessorWorker::DoWork() - Unhandled return from WaitHandle.WaitAny(): " + eventIndex.ToString()); + } + } + + ErrorLogger.Instance().Write("MsgProcessorWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Sets the call back function + /// + /// The call back function + public void SetCallback(MsgDevice.CompleteMessageCallback callback) + { + _completeMsgCallback = callback; + } + + /// + /// Command the worker to stop + /// + public void QuitWork() + { + _threadQuitControl = true; + _quitEvent.Set(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Acceleration.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Acceleration.cs new file mode 100644 index 0000000..9640d46 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Acceleration.cs @@ -0,0 +1,382 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; + +namespace Raytheon.Units +{ + /// + /// This class represents an acceleration. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. + /// FromMetersPerSecSqrd). + /// + /// Properties (e.g. FeetPerSecSqrd) are provided to convert the value to other units and return + /// as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Velocity, Length). + /// + [Serializable] + [DataContract] + public class Acceleration + { + public enum Unit + { + FeetPerSecSqrd, + MetersPerSecSqrd, + Gs + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.FeetPerSecSqrd, new List(){ "ft/sec^2" } }, + {Unit.MetersPerSecSqrd, new List(){ "m/sec^2" } }, + {Unit.Gs, new List(){ "g" } } + }; + + private const Unit DefaultUnits = Unit.MetersPerSecSqrd; + private const double FeetPerMeter = 3.280839895013123; + private const double Gravity = 9.80665; // m/sec^2 + + [DataMember(Name = "Acceleration", IsRequired = true)] + private double _acceleration; // meters/seconds^2 + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.FeetPerSecSqrd, new UnitInfo(UnitAbbreviations[Unit.FeetPerSecSqrd], FromFeetPerSecSqrd, typeof(Acceleration).GetProperty("FeetPerSecSqrd").GetGetMethod()) }, + { Unit.MetersPerSecSqrd, new UnitInfo(UnitAbbreviations[Unit.MetersPerSecSqrd], FromMetersPerSecSqrd, typeof(Acceleration).GetProperty("MetersPerSecSqrd").GetGetMethod()) }, + { Unit.Gs, new UnitInfo(UnitAbbreviations[Unit.Gs], FromGs, typeof(Acceleration).GetProperty("Gs").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Acceleration() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The acceleration - m/sec^2. + private Acceleration(double acceleration) + { + _acceleration = acceleration; + } + + #region conversion properties + + /// + /// Returns feet/sec^2 as type double + /// + /// + /// feet/sec^2 + /// + public double FeetPerSecSqrd + { + get { return _acceleration * FeetPerMeter; } + } + + /// + /// returns Gs as type double + /// + public double Gs + { + get { return _acceleration / Gravity; } + } + + /// + /// Returns m/sec^2 as type double + /// + /// + /// m/sec^2 + /// + public double MetersPerSecSqrd + { + get { return _acceleration; } + } + + #endregion + + #region creation methods + + /// + /// Returns Acceleration object interpreting passed value as ft/sec^2 + /// + /// ft/sec^2 + /// + public static Acceleration FromFeetPerSecSqrd(double feetPerSecSqrd) + { + return new Acceleration(feetPerSecSqrd / FeetPerMeter); + } + + /// + /// Returns Acceleration object interpreting passed value as m/sec^2 + /// + /// m/sec^2 + /// + public static Acceleration FromMetersPerSecSqrd(double metersPerSecSqrd) + { + return new Acceleration(metersPerSecSqrd); + } + + /// + /// Returns Acceleration object interpreting passed value as m/sec^2 + /// + /// m/sec^2 + /// + public static Acceleration FromGs(double g) + { + return FromMetersPerSecSqrd(g * Gravity); + } + + #endregion + + #region parsing + + public static Acceleration Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Acceleration value) + { + try + { + value = Acceleration.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + public override bool Equals(object obj) + { + Acceleration c = obj as Acceleration; + + return (c == null) ? false : (this._acceleration == c._acceleration); + } + + public override int GetHashCode() + { + return _acceleration.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Acceleration operator +(Acceleration left, Acceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Acceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Acceleration"); + + return new Acceleration(left._acceleration + right._acceleration); + } + + + public static Acceleration operator -(Acceleration left, Acceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Acceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Acceleration"); + + return new Acceleration(left._acceleration - right._acceleration); + } + + + public static Acceleration operator *(Acceleration acceleration, double scalar) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply a null Acceleration"); + + return new Acceleration(acceleration._acceleration * scalar); + } + + + public static Acceleration operator *(double scalar, Acceleration acceleration) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply a null Acceleration"); + + return new Acceleration(scalar * acceleration._acceleration); + } + + + public static Acceleration operator /(Acceleration acceleration, double scalar) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot divide a null Acceleration"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Acceleration by 0"); + + return new Acceleration(acceleration._acceleration / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Acceleration left, Acceleration right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._acceleration == right._acceleration; + } + } + return bReturn; + } + + public static bool operator !=(Acceleration left, Acceleration right) + { + return !(left == right); + } + + + public static bool operator <(Acceleration left, Acceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Acceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Acceleration"); + + return left._acceleration < right._acceleration; + } + + + public static bool operator >(Acceleration left, Acceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Acceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Acceleration"); + + return left._acceleration > right._acceleration; + } + + + public static bool operator <=(Acceleration left, Acceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Acceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Acceleration"); + + return left._acceleration <= right._acceleration; + } + + + public static bool operator >=(Acceleration left, Acceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Acceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Acceleration"); + + return left._acceleration >= right._acceleration; + } + + #endregion + + #region operators with other classes + + /// + /// Implements the operator * for Velocity = Acceleration * Time + /// + /// The acceleration. + /// The time. + /// + /// Velocity + /// + + public static Velocity operator *(Acceleration acceleration, PrecisionTimeSpan time) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply with null Acceleration"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot multiply with null PrecisionTimeSpan"); + + return Velocity.FromMetersPerSec(acceleration.MetersPerSecSqrd * time.Seconds); + } + + /// + /// Implements the operator * for Velocity = Time * Acceleration + /// + /// The acceleration. + /// The time. + /// + /// Velocity + /// + + public static Velocity operator *(PrecisionTimeSpan time, Acceleration acceleration) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply with null Acceleration"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot multiply with null PrecisionTimeSpan"); + + return Velocity.FromMetersPerSec(acceleration.MetersPerSecSqrd * time.Seconds); + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Angle.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Angle.cs new file mode 100644 index 0000000..a67c41e --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Angle.cs @@ -0,0 +1,392 @@ +using System; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents an angle. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. + /// FromDegrees). + /// + /// Properties (e.g. Radians) are provided to convert the value to other units and return + /// as type double. + /// + [Serializable] + [DataContract] + public class Angle + { + public enum Unit + { + Degrees, + Radians, + Milliradians + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Degrees, new List(){ "deg" } }, + {Unit.Radians, new List(){ "rad" } }, + {Unit.Milliradians, new List(){ "mrad" } } + }; + + private const Unit DefaultUnits = Unit.Degrees; + private const double DegreesPerRadian = 180 / Math.PI; + private const int MilliradiansPerRadian = 1000; + + [DataMember(Name = "Angle", IsRequired = true)] + private double _angle; // radians + + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Degrees, new UnitInfo(UnitAbbreviations[Unit.Degrees], FromDegrees, typeof(Angle).GetProperty("Degrees").GetGetMethod()) }, + { Unit.Radians, new UnitInfo(UnitAbbreviations[Unit.Radians], FromRadians, typeof(Angle).GetProperty("Radians").GetGetMethod()) }, + { Unit.Milliradians, new UnitInfo(UnitAbbreviations[Unit.Milliradians], FromMilliradians, typeof(Angle).GetProperty("Milliradians").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Angle() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The angle - radians. + private Angle(double angle) + { + _angle = angle; + } + + #region conversion properties + + /// + /// Returns degrees as type double + /// + /// + /// degrees + /// + public double Degrees + { + get + { + return _angle * DegreesPerRadian; + } + } + + /// + /// Returns milliradians as type double + /// + /// + /// milliradians + /// + public double Milliradians + { + get + { + return _angle * MilliradiansPerRadian; + } + } + + /// + /// Returns radians as type double + /// + /// + /// radians + /// + public double Radians + { + get + { + return _angle; + } + } + + #endregion + + #region creation methods + + /// + /// Returns Angle object interpreting passed value as degrees + /// + /// degrees + /// + public static Angle FromDegrees(double degrees) + { + return new Angle(degrees / DegreesPerRadian); + } + + /// + /// Returns Angle object interpreting passed value as milliradians + /// + /// milliradians + /// + public static Angle FromMilliradians(double milliradians) + { + return new Angle(milliradians / MilliradiansPerRadian); + } + + /// + /// Returns Angle object interpreting passed value as radians + /// + /// radians + /// + public static Angle FromRadians(double radians) + { + return new Angle(radians); + } + + #endregion + + public override bool Equals(object obj) + { + Angle a = obj as Angle; + + return (a == null) ? false : (this._angle == a._angle); + } + + public override int GetHashCode() + { + return _angle.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Angle operator +(Angle left, Angle right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Angle"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Angle"); + + return new Angle(left._angle + right._angle); + } + + + public static Angle operator -(Angle left, Angle right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Angle"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Angle"); + + return new Angle(left._angle - right._angle); + } + + + public static Angle operator *(Angle angle, double scalar) + { + if (null == angle) + throw new ArgumentNullException("angle", "Cannot multiply a null Angle"); + + return new Angle(angle._angle * scalar); + } + + + public static Angle operator *(double scalar, Angle angle) + { + if (null == angle) + throw new ArgumentNullException("angle", "Cannot multiply a null Angle"); + + return new Angle(scalar * angle._angle); + } + + + public static Angle operator /(Angle angle, double scalar) + { + if (null == angle) + throw new ArgumentNullException("angle", "Cannot divide a null Angle"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Angle by 0"); + + return new Angle(angle._angle / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Angle left, Angle right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._angle == right._angle; + } + } + return bReturn; + } + + public static bool operator !=(Angle left, Angle right) + { + return !(left == right); + } + + public static bool operator <(Angle left, Angle right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Angle"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Angle"); + + return (left._angle < right._angle); + } + + public static bool operator >(Angle left, Angle right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Angle"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Angle"); + + return (left._angle > right._angle); + } + + public static bool operator <=(Angle left, Angle right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Angle"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Angle"); + + return (left._angle <= right._angle); + } + + public static bool operator >=(Angle left, Angle right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Angle"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Angle"); + + return (left._angle >= right._angle); + } + + #endregion + + #region operators with other classes + + /// + /// Implements the operator / for AngularVelocity = Angle / PrecisionTimeSpan + /// + /// The angle. + /// The time. + /// + /// AngularVelocity + /// + + public static AngularVelocity operator /(Angle angle, PrecisionTimeSpan time) + { + if (null == angle) + throw new ArgumentNullException("angle", "Cannot divide with null Angle"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot divide with null PrecisionTimeSpan"); + + if (0.0 == time.Milliseconds) + throw new DivideByZeroException("Cannot divide angle by 0 time"); + + return AngularVelocity.FromRadiansPerSec(angle.Radians / time.Seconds); + } + + /// + /// Implements the operator / for PrecisionTimeSpan = Angle / AngularVelocity + /// + /// The angle. + /// The velocity. + /// + /// PrecisionTimeSpan + /// + + public static PrecisionTimeSpan operator /(Angle angle, AngularVelocity velocity) + { + if (null == angle) + throw new ArgumentNullException("angle", "Cannot divide with null Angle"); + + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide with null AngularVelocity"); + + if (0.0 == velocity.RadiansPerSec) + throw new DivideByZeroException("Cannot divide angle by 0 angular velocity"); + + return PrecisionTimeSpan.FromSeconds(angle.Radians / velocity.RadiansPerSec); + } + + #endregion + + #region parsing + + public static Angle Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Angle value) + { + try + { + value = Angle.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/AngularAcceleration.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/AngularAcceleration.cs new file mode 100644 index 0000000..4ea9d4f --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/AngularAcceleration.cs @@ -0,0 +1,383 @@ +using System; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents a velocity. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromRadiansPerSecSqrd). + /// + /// Properties (e.g. RadiansPerSecSqrd) are provided to convert the value to other units and + /// return as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Angle, AngularVelocity). + /// + [Serializable] + [DataContract] + public class AngularAcceleration + { + public enum Unit + { + DegreesPerSecSqrd, + RadiansPerSecSqrd, + MilliradiansPerSecSqrd + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.DegreesPerSecSqrd, new List(){ "deg/sec^2" } }, + {Unit.MilliradiansPerSecSqrd, new List(){ "mrad/sec^2" } }, + {Unit.RadiansPerSecSqrd, new List(){ "rad/sec^2" } } + }; + + private const Unit DefaultUnits = Unit.RadiansPerSecSqrd; + private const double DegreesPerRadian = 180 / Math.PI; + + [DataMember(Name = "AngularAcceleration", IsRequired = true)] + private double _acceleration; // radians/seconds^2 + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.DegreesPerSecSqrd, new UnitInfo(UnitAbbreviations[Unit.DegreesPerSecSqrd], FromDegreesPerSecSqrd, typeof(AngularAcceleration).GetProperty("DegreesPerSecSqrd").GetGetMethod()) }, + { Unit.MilliradiansPerSecSqrd, new UnitInfo(UnitAbbreviations[Unit.MilliradiansPerSecSqrd], FromMilliradiansPerSecSqrd, typeof(AngularAcceleration).GetProperty("MilliradiansPerSecSqrd").GetGetMethod()) }, + { Unit.RadiansPerSecSqrd, new UnitInfo(UnitAbbreviations[Unit.RadiansPerSecSqrd], FromRadiansPerSecSqrd, typeof(AngularAcceleration).GetProperty("RadiansPerSecSqrd").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private AngularAcceleration() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The acceleration - radians/sec^2. + private AngularAcceleration(double acceleration) + { + _acceleration = acceleration; + } + + #region conversion properties + + /// + /// Returns degrees/sec^2 as type double + /// + /// + /// degrees/sec^2 + /// + public double DegreesPerSecSqrd + { + get { return _acceleration * DegreesPerRadian; } + } + + /// + /// Returns milliradians/sec^2 as type double + /// + /// + /// milliradians/sec^2 + /// + public double MilliradiansPerSecSqrd + { + get { return _acceleration * 1000; } + } + + /// + /// Returns radians/sec^2 as type double + /// + /// + /// radians/sec^2 + /// + public double RadiansPerSecSqrd + { + get { return _acceleration; } + } + + #endregion + + #region creation methods + + /// + /// Returns AngularAcceleration object interpreting passed value as degrees/sec + /// + /// degrees/sec + /// + public static AngularAcceleration FromDegreesPerSecSqrd(double degreesPerSecSqrd) + { + return new AngularAcceleration(degreesPerSecSqrd / DegreesPerRadian); + } + + /// + /// Returns AngularAcceleration object interpreting passed value as radians/sec^2 + /// + /// radians/sec^2 + /// + public static AngularAcceleration FromMilliradiansPerSecSqrd(double milliradiansPerSecSqrd) + { + return new AngularAcceleration(milliradiansPerSecSqrd / 1000); + } + + /// + /// Returns AngularAcceleration object interpreting passed value as radians/sec^2 + /// + /// radians/sec^2 + /// + public static AngularAcceleration FromRadiansPerSecSqrd(double radiansPerSecSqrd) + { + return new AngularAcceleration(radiansPerSecSqrd); + } + + #endregion + + public override bool Equals(object obj) + { + AngularAcceleration a = obj as AngularAcceleration; + + return (a == null) ? false : (this._acceleration == a._acceleration); + } + + public override int GetHashCode() + { + return _acceleration.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static AngularAcceleration operator +(AngularAcceleration left, AngularAcceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null AngularAcceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null AngularAcceleration"); + + return new AngularAcceleration(left._acceleration + right._acceleration); + } + + + public static AngularAcceleration operator -(AngularAcceleration left, AngularAcceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null AngularAcceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract null AngularAcceleration"); + + return new AngularAcceleration(left._acceleration - right._acceleration); + } + + + public static AngularAcceleration operator *(AngularAcceleration acceleration, double scalar) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply a null AngularAcceleration"); + + return new AngularAcceleration(acceleration._acceleration * scalar); + } + + + public static AngularAcceleration operator *(double scalar, AngularAcceleration acceleration) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply a null AngularAcceleration"); + + return new AngularAcceleration(scalar * acceleration._acceleration); + } + + + public static AngularAcceleration operator /(AngularAcceleration acceleration, double scalar) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot divide a null AngularAcceleration"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Angular Acceleration by 0"); + + return new AngularAcceleration(acceleration._acceleration / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(AngularAcceleration left, AngularAcceleration right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._acceleration == right._acceleration; + } + } + return bReturn; + } + + public static bool operator !=(AngularAcceleration left, AngularAcceleration right) + { + return !(left == right); + } + + + public static bool operator <(AngularAcceleration left, AngularAcceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularAcceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularAcceleration"); + + return left._acceleration < right._acceleration; + } + + + public static bool operator >(AngularAcceleration left, AngularAcceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularAcceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularAcceleration"); + + return left._acceleration > right._acceleration; + } + + + public static bool operator <=(AngularAcceleration left, AngularAcceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularAcceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularAcceleration"); + + return left._acceleration <= right._acceleration; + } + + + public static bool operator >=(AngularAcceleration left, AngularAcceleration right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularAcceleration"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularAcceleration"); + + return left._acceleration >= right._acceleration; + } + + #endregion + + #region operators with other classes + + /// + /// Implements the operator * for AngularVelocity = AngularAcceleration * PrecisionTimeSpan + /// + /// The velocity. + /// The time. + /// + /// Angle + /// + + public static AngularVelocity operator *(AngularAcceleration acceleration, PrecisionTimeSpan time) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply with null AngularAcceleration"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot multiply with null PrecisionTimeSpan"); + + return AngularVelocity.FromRadiansPerSec(acceleration.RadiansPerSecSqrd * time.Seconds); + } + + /// + /// Implements the operator * for AngularVelocity = PrecisionTimeSpan * AngularAcceleration + /// + /// The acceleration. + /// The time. + /// + /// AngularVelocity + /// + + public static AngularVelocity operator *(PrecisionTimeSpan time, AngularAcceleration acceleration) + { + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot multiply with null AngularAcceleration"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot multiply with null PrecisionTimeSpan"); + + return AngularVelocity.FromRadiansPerSec(time.Seconds * acceleration.RadiansPerSecSqrd); + } + + #endregion + + #region parsing + + public static AngularAcceleration Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out AngularAcceleration value) + { + try + { + value = AngularAcceleration.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 deg/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 deg/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/AngularVelocity.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/AngularVelocity.cs new file mode 100644 index 0000000..ffae63c --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/AngularVelocity.cs @@ -0,0 +1,430 @@ +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents a velocity. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromRadiansPerSec). + /// + /// Properties (e.g. RadiansPerSec) are provided to convert the value to other units and return + /// as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Angle, AngularAcceleration). + /// + [Serializable] + [DataContract] + public class AngularVelocity + { + public enum Unit + { + DegreesPerSec, + RadiansPerSec, + MilliradiansPerSec + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.DegreesPerSec, new List(){ "deg/sec" } }, + {Unit.RadiansPerSec, new List(){ "rad/sec" } }, + {Unit.MilliradiansPerSec, new List(){ "mrad/sec" } }, + }; + + private const Unit DefaultUnits = Unit.RadiansPerSec; + private const double DegreesPerRadian = 180 / Math.PI; + + [DataMember(Name = "AngularVelocity", IsRequired = true)] + private double _velocity; // radians/second + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.DegreesPerSec, new UnitInfo(UnitAbbreviations[Unit.DegreesPerSec], FromDegreesPerSec, typeof(AngularVelocity).GetProperty("DegreesPerSec").GetGetMethod()) }, + { Unit.MilliradiansPerSec, new UnitInfo(UnitAbbreviations[Unit.MilliradiansPerSec], FromMilliradiansPerSec, typeof(AngularVelocity).GetProperty("MilliradiansPerSec").GetGetMethod()) }, + { Unit.RadiansPerSec, new UnitInfo(UnitAbbreviations[Unit.RadiansPerSec], FromRadiansPerSec, typeof(AngularVelocity).GetProperty("RadiansPerSec").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private AngularVelocity() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The velocity - radians/sec. + private AngularVelocity(double velocity) + { + _velocity = velocity; + } + + #region conversion properties + + /// + /// Returns degrees/sec as type double + /// + /// + /// degrees/sec + /// + public double DegreesPerSec + { + get { return _velocity * DegreesPerRadian; } + } + + /// + /// Returns degrees/sec as type double + /// + /// + /// degrees/sec + /// + public double MilliradiansPerSec + { + get { return _velocity * 1000; } + } + + /// + /// Returns radians/sec as type double + /// + /// + /// radians/sec + /// + public double RadiansPerSec + { + get { return _velocity; } + } + + #endregion + + #region creation methods + + /// + /// Returns AngularVelocity object interpreting passed value as degrees/sec + /// + /// degrees/sec + /// + public static AngularVelocity FromDegreesPerSec(double degreesPerSec) + { + return new AngularVelocity(degreesPerSec / DegreesPerRadian); + } + + /// + /// Returns AngularVelocity object interpreting passed value as milliradians/sec + /// + /// milliradians/sec + /// + public static AngularVelocity FromMilliradiansPerSec(double milliradiansPerSec) + { + return new AngularVelocity(milliradiansPerSec / 1000); + } + + /// + /// Returns AngularVelocity object interpreting passed value as radians/sec + /// + /// radians/sec + /// + public static AngularVelocity FromRadiansPerSec(double radiansPerSec) + { + return new AngularVelocity(radiansPerSec); + } + + #endregion + + public override bool Equals(object obj) + { + AngularVelocity v = obj as AngularVelocity; + + return (v == null) ? false : (this._velocity == v._velocity); + } + + public override int GetHashCode() + { + return _velocity.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static AngularVelocity operator +(AngularVelocity left, AngularVelocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null AngularVelocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null AngularVelocity"); + + return new AngularVelocity(left._velocity + right._velocity); + } + + + public static AngularVelocity operator -(AngularVelocity left, AngularVelocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null AngularVelocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null AngularVelocity"); + + return new AngularVelocity(left._velocity - right._velocity); + } + + + public static AngularVelocity operator *(AngularVelocity velocity, double scalar) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot multiply a null AngularVelocity"); + + return new AngularVelocity(velocity._velocity * scalar); + } + + + public static AngularVelocity operator *(double scalar, AngularVelocity velocity) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot multiply a null AngularVelocity"); + + return new AngularVelocity(scalar * velocity._velocity); + } + + + public static AngularVelocity operator /(AngularVelocity velocity, double scalar) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide a null AngularVelocity"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Angular Velocity by 0"); + + return new AngularVelocity(velocity._velocity / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(AngularVelocity left, AngularVelocity right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._velocity == right._velocity; + } + } + return bReturn; + } + + public static bool operator !=(AngularVelocity left, AngularVelocity right) + { + return !(left == right); + } + + + public static bool operator <(AngularVelocity left, AngularVelocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularVelocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularVelocity"); + + return (left._velocity < right._velocity); + } + + + public static bool operator >(AngularVelocity left, AngularVelocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularVelocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularVelocity"); + + return (left._velocity > right._velocity); + } + + + public static bool operator <=(AngularVelocity left, AngularVelocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularVelocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularVelocity"); + + return (left._velocity <= right._velocity); + } + + + public static bool operator >=(AngularVelocity left, AngularVelocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null AngularVelocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null AngularVelocity"); + + return (left._velocity >= right._velocity); + } + + #endregion + + #region operators with other classes + + /// + /// Implements the operator * for Angle = AngularVelocity * PrecisionTimeSpan + /// + /// The velocity. + /// The time. + /// + /// Angle + /// + + public static Angle operator *(AngularVelocity velocity, PrecisionTimeSpan time) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot multiply with null AngularVelocity"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot multiply with null PrecisionTimeSpan"); + + return Angle.FromRadians(velocity.RadiansPerSec * time.Seconds); + } + + /// + /// Implements the operator * for Angle = PrecisionTimeSpan * AngularVelocity + /// + /// The time. + /// The velocity. + /// + /// Angle + /// + + public static Angle operator *(PrecisionTimeSpan time, AngularVelocity velocity) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot multiply with null AngularVelocity"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot multiply with null PrecisionTimeSpan"); + + return Angle.FromRadians(time.Seconds * velocity.RadiansPerSec); + } + + /// + /// Implements the operator / for AngularAcceleration = AngularVelocity / PrecisionTimeSpan + /// + /// The velocity. + /// The time. + /// + /// AngularAcceleration + /// + + public static AngularAcceleration operator /(AngularVelocity velocity, PrecisionTimeSpan time) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide with null AngularVelocity"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot divide with null PrecisionTimeSpan"); + + if (0.0 == time.Milliseconds) + throw new DivideByZeroException("Cannot divide Angular Velocity by 0 time"); + + return AngularAcceleration.FromRadiansPerSecSqrd(velocity.RadiansPerSec / time.Seconds); + } + + /// + /// Implements the operator / for PrecisionTimeSpan = AngularVelocity / AngularAcceleration + /// + /// The velocity. + /// The acceleration. + /// + /// Angle + /// + + public static PrecisionTimeSpan operator /(AngularVelocity velocity, AngularAcceleration acceleration) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide with null AngularVelocity"); + + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot divide with null AngularAcceleration"); + + if (0.0 == acceleration.RadiansPerSecSqrd) + throw new DivideByZeroException("Cannot divide Angular Velocity by 0 Angular Acceleration"); + + return PrecisionTimeSpan.FromSeconds(velocity.RadiansPerSec / acceleration.RadiansPerSecSqrd); + } + + #endregion + + #region parsing + + public static AngularVelocity Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out AngularVelocity value) + { + try + { + value = AngularVelocity.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Common.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Common.cs new file mode 100644 index 0000000..e6c80cc --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Common.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text.RegularExpressions; + +namespace Raytheon.Units +{ + /// + /// Contains info related to a unit: to parse, print, and convert values + /// + internal class UnitInfo + { + public UnitInfo( List abbreviation, + Func conversionMethod, + MethodInfo propertyGetter ) + { + Abbreviation = abbreviation; + ConversionMethod = conversionMethod; + PropertyGetter = propertyGetter; + } + + /// + /// standard text abbreviation for this unit + /// + public List Abbreviation { get; private set; } + + /// + /// method for converting string to this unit + /// + public Func ConversionMethod { get; private set; } + + /// + /// get method for the property associated with this unit + /// + public MethodInfo PropertyGetter { get; set; } + } + + internal class Common + { + /// + /// Converts a string that represents a number with a unit to the actual + /// unit type. + /// + /// Enumeration of the Unit abbreviation + /// The actual unit type, i.e Current + /// String that represents a unit value, i.e 1.23 Amps + /// Look up table for how to convert the units + /// + /// The converted number to the correct unit type. If unable to parse, will return the first + /// with a value of + /// + public static T Parse( string s, IDictionary> unitInfo ) + { + const string FloatingPointPattern = @"([-+]?[0-9]+(\.[0-9]+)?([Ee][+-][0-9]+)?)"; + const string AbbreviationPattern = @"([\w/\^]*)"; + string pattern = FloatingPointPattern + @"\s*" + AbbreviationPattern; + + Regex regEx = new Regex( pattern ); + Match match = regEx.Match( s ); + + if(!match.Success || match.Groups.Count == 0 ) + { + throw new FormatException( $"UUnknown value : {s}" ); + } + + string abbreviation = match.Groups[match.Groups.Count - 1].Value; + + IEnumerable> x = unitInfo.Where( kvp => kvp.Value.Abbreviation.Contains( abbreviation, StringComparer.CurrentCultureIgnoreCase ) ) + .Select( kvp => kvp.Value ); + + // abbreviation not found? + if ( x.Count( ) == 0 ) + { + throw new FormatException( $"Unknown units: '{abbreviation}'" ); + } + + double value = double.Parse( match.Groups[1].Value ); + + return x.First( ).ConversionMethod( value ); + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Constants.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Constants.cs new file mode 100644 index 0000000..d302c0e --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Constants.cs @@ -0,0 +1,14 @@ +namespace Raytheon.Units +{ + public class Constants + { + // SI Prefixes decimal value + public const double GIGA = 1e9; + public const double MEGA = 1e6; + public const double KILO = 1e3; + public const double CENTI = 1e-2; + public const double MILLI = 1e-3; + public const double MICRO = 1e-6; + public const double NANO = 1e-9; + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Current.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Current.cs new file mode 100644 index 0000000..df4d02f --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Current.cs @@ -0,0 +1,342 @@ +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents an electrical current. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. + /// FromAmps). + /// + /// Properties (e.g. Amps) are provided to convert the value to other units and return as type + /// double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Voltage, Resistance). + /// + [Serializable] + [DataContract] + public class Current + { + public enum Unit + { + Amps, + Milliamps + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Amps, new List(){ "A" } }, + {Unit.Milliamps, new List(){ "mA" } }, + }; + + private const Unit DefaultUnits = Unit.Amps; + private const int MilliampsPerAmp = 1000; + + [DataMember(Name = "Current", IsRequired = true)] + private double _current; // amps + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Amps, new UnitInfo(UnitAbbreviations[Unit.Amps], FromAmps, typeof(Current).GetProperty("Amps").GetGetMethod()) }, + { Unit.Milliamps, new UnitInfo(UnitAbbreviations[Unit.Milliamps], FromMilliamps, typeof(Current).GetProperty("Milliamps").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Current() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The current - amps. + private Current(double current) + { + _current = current; + } + + #region conversion properties + + /// + /// Returns amps as type double + /// + /// + /// amps + /// + public double Amps + { + get { return _current; } + } + + /// + /// Returns milliamps as type double + /// + /// + /// milliamps + /// + public double Milliamps + { + get { return _current * MilliampsPerAmp; } + } + + #endregion + + #region creation methods + + /// + /// Returns Current object interpreting passed value as amps + /// + /// amps + /// + public static Current FromAmps(double amps) + { + return new Current(amps); + } + + /// + /// Returns Current object interpreting passed value as milliamps + /// + /// milliamps + /// + public static Current FromMilliamps(double milliamps) + { + return new Current(milliamps / MilliampsPerAmp); + } + + #endregion + + public override bool Equals(object obj) + { + Current c = obj as Current; + + return (c == null) ? false : (this._current == c._current); + } + + public override int GetHashCode() + { + return _current.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Current operator +(Current left, Current right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Current"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Current"); + + return new Current(left._current + right._current); + } + + + public static Current operator -(Current left, Current right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Current"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Current"); + + return new Current(left._current - right._current); + } + + + public static Current operator *(Current current, double scalar) + { + if (null == current) + throw new ArgumentNullException("current", "Cannot multiply a null Current"); + + return new Current(current._current * scalar); + } + + + public static Current operator *(double scalar, Current current) + { + if (null == current) + throw new ArgumentNullException("current", "Cannot multiply a null Current"); + + return new Current(scalar * current._current); + } + + + public static Current operator /(Current current, double scalar) + { + if (null == current) + throw new ArgumentNullException("current", "Cannot divide a null Current"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Current by 0"); + + return new Current(current._current / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Current left, Current right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._current == right._current; + } + } + return bReturn; + } + + public static bool operator !=(Current left, Current right) + { + return !(left == right); + } + + + public static bool operator <(Current left, Current right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Current"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Current"); + + return (left._current < right._current); + } + + + public static bool operator >(Current left, Current right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Current"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Current"); + + return (left._current > right._current); + } + + + public static bool operator <=(Current left, Current right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Current"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Current"); + + return (left._current <= right._current); + } + + + public static bool operator >=(Current left, Current right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Current"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Current"); + + return (left._current >= right._current); + } + + #endregion + + #region operators with other classes + + /// + /// Implements the operator * for Voltage = Current * Resistance + /// + /// The current. + /// The resistance. + /// + /// Voltage + /// + + public static Voltage operator *(Current current, Resistance resistance) + { + if (null == current) + throw new ArgumentNullException("current", "Cannot multiply a null Current"); + + if (null == resistance) + throw new ArgumentNullException("resistance", "Cannot multiply null Resistance"); + + return Voltage.FromVolts(current.Amps * resistance.Ohms); + } + + #endregion + + + #region parsing + + public static Current Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Current value) + { + try + { + value = Current.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Energy.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Energy.cs new file mode 100644 index 0000000..e920cb6 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Energy.cs @@ -0,0 +1,322 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; +using System.Text; + +namespace Raytheon.Units +{ + /// + /// This class represents energy. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromJoulesPerCmSqrd). + /// + /// Properties (e.g. JoulesPerCmSqrd) are provided to convert the value to other units and return + /// as type double. + /// + [Serializable] + [DataContract] + public class Energy + { + public enum Unit + { + JoulesPerCmSqrd, + MillijoulesPerCmSqrd + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.JoulesPerCmSqrd, new List(){ "J/cm^2" } }, + {Unit.MillijoulesPerCmSqrd, new List(){ "mJ/cm^2" } }, + }; + + private const Unit DefaultUnits = Unit.JoulesPerCmSqrd; + + [DataMember(Name = "Energy", IsRequired = true)] + private double _energy; // joules/centimeter^2 + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.JoulesPerCmSqrd, new UnitInfo(UnitAbbreviations[Unit.JoulesPerCmSqrd], FromJoulesPerCmSqrd, typeof(Energy).GetProperty("JoulesPerCmSqrd").GetGetMethod()) }, + { Unit.MillijoulesPerCmSqrd, new UnitInfo(UnitAbbreviations[Unit.MillijoulesPerCmSqrd], FromMillijoulesPerCmSqrd, typeof(Energy).GetProperty("MillijoulesPerCmSqrd").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Energy() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The energy - joules/cm^2. + private Energy(double energy) + { + _energy = energy; + } + + #region conversion properties + + /// + /// Returns joules/cm^2 as type double + /// + /// + /// joules/cm^2 + /// + + public double JoulesPerCmSqrd + { + get { return _energy; } + } + + /// + /// Returns joules/cm^2 as type double + /// + /// + /// joules/cm^2 + /// + + public double MillijoulesPerCmSqrd + { + get { return _energy * 1000; } + } + + #endregion + + #region creation methods + + /// + /// Returns Energy object interpreting passed value as joules/cm^2 + /// + /// joules/cm^2 + /// + + public static Energy FromJoulesPerCmSqrd(double joulesPerCmSqrd) + { + return new Energy(joulesPerCmSqrd); + } + + /// + /// Returns Energy object interpreting passed value as joules/cm^2 + /// + /// joules/cm^2 + /// + + public static Energy FromMillijoulesPerCmSqrd(double joulesPerCmSqrd) + { + return new Energy(joulesPerCmSqrd / 1000); + } + + #endregion + + public override bool Equals(object obj) + { + Energy e = obj as Energy; + + return (e == null) ? false : (this._energy == e._energy); + } + + public override int GetHashCode() + { + return _energy.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Energy operator +(Energy left, Energy right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Energy"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Energy"); + + return new Energy(left._energy + right._energy); + } + + + public static Energy operator -(Energy left, Energy right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Energy"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Energy"); + + return new Energy(left._energy - right._energy); + } + + + public static Energy operator *(Energy energy, double scalar) + { + if (null == energy) + throw new ArgumentNullException("energy", "Cannot multiply a null Energy"); + + return new Energy(energy._energy * scalar); + } + + + public static Energy operator *(double scalar, Energy energy) + { + if (null == energy) + throw new ArgumentNullException("energy", "Cannot multiply a null Energy"); + + return new Energy(scalar * energy._energy); + } + + + public static Energy operator /(Energy energy, double scalar) + { + if (null == energy) + throw new ArgumentNullException("energy", "Cannot divide a null Energy"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Energy by 0"); + + return new Energy(energy._energy / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Energy left, Energy right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._energy == right._energy; + } + } + return bReturn; + } + + public static bool operator !=(Energy left, Energy right) + { + return !(left == right); + } + + + public static bool operator <(Energy left, Energy right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Energy"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Energy"); + + return (left._energy < right._energy); + } + + + public static bool operator >(Energy left, Energy right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Energy"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Energy"); + + return (left._energy > right._energy); + } + + + public static bool operator <=(Energy left, Energy right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Energy"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Energy"); + + return (left._energy <= right._energy); + } + + + public static bool operator >=(Energy left, Energy right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Energy"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Energy"); + + return (left._energy >= right._energy); + } + + #endregion + + #region operators with other classes + + // no operators right now + + #endregion + + #region parsing + + public static Energy Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Energy value) + { + try + { + value = Energy.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/FlowRate.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/FlowRate.cs new file mode 100644 index 0000000..6627935 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/FlowRate.cs @@ -0,0 +1,356 @@ +//############################################################################// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +//############################################################################// + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; +using System.Text; + +namespace Raytheon.Units +{ + /// + /// This class represents a Flow Rate. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromCubicMetersPerSecond). + /// + /// Properties (e.g. CubicMetersPerSecond) are provided to convert the value to other units and return + /// as type double. + /// + [Serializable] + [DataContract] + public class FlowRate + { + public enum Unit + { + CubicMetersPerSecond, + CubicMetersPerMinute, + CubicMetersPerHour, + GallonsPerMinute + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.CubicMetersPerSecond, new List(){ "m^3/s" } }, + {Unit.CubicMetersPerMinute, new List(){ "m^3/min" } }, + {Unit.CubicMetersPerHour, new List(){ "m^3/h" } }, + {Unit.GallonsPerMinute, new List(){ "gal/min" } }, + }; + + private const Unit DefaultUnits = Unit.CubicMetersPerSecond; + private const double CubicMetersToGalPerSecMultipler = 15850; + private const int SecondsPerMinute = 60; + private const int SecondsPerHour = 3600; + + [DataMember(Name = "CubicMetersPerSecond", IsRequired = true)] + private readonly double _flowRate; + + // map: unit => abbreviation, conversion method and property + private static readonly IDictionary> _unitInfo = new Dictionary>() + { + { Unit.CubicMetersPerSecond, new UnitInfo(UnitAbbreviations[Unit.CubicMetersPerSecond], FromCubicMetersPerSecond, typeof(FlowRate).GetProperty("CubicMetersPerSecond").GetGetMethod()) }, + { Unit.CubicMetersPerMinute, new UnitInfo(UnitAbbreviations[Unit.CubicMetersPerMinute], FromCubicMetersPerMinute, typeof(FlowRate).GetProperty("CubicMetersPerMinute").GetGetMethod()) }, + { Unit.CubicMetersPerHour, new UnitInfo(UnitAbbreviations[Unit.CubicMetersPerHour], FromCubicMetersPerHour, typeof(FlowRate).GetProperty("CubicMetersPerHour").GetGetMethod()) }, + { Unit.GallonsPerMinute, new UnitInfo(UnitAbbreviations[Unit.GallonsPerMinute], FromGallonsPerMinute, typeof(FlowRate).GetProperty("GallonsPerMinute").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created + /// Use FromXXX methods to create objects of this type. + /// + private FlowRate() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// Constructor used by this class to create objects in FromXXX methods. + /// + /// The flow rate - Cubic Meters per second + private FlowRate(double cubicMetersPerSecond) + { + _flowRate = cubicMetersPerSecond; + } + + #region conversion properties + /// + /// Returns Cubic Meters Per Second as type double + /// + public double CubicMetersPerSecond { get { return _flowRate; } } + + /// + /// Returns Cubic Meters Per Minutes as type double + /// + public double CubicMetersPerMinute { get { return _flowRate * SecondsPerMinute; } } + + /// + /// Returns Cubic Meters Per Hour as type double + /// + public double CubicMetersPerHour { get { return _flowRate * SecondsPerHour; } } + + /// + /// Returns Gallons Per Minute + /// + public double GallonsPerMinute { get { return _flowRate * CubicMetersToGalPerSecMultipler; } } + #endregion + + #region Creation Methods + /// + /// Returns FlowRate object interpreting passed value as Cubic Meters Per Second + /// + /// Cubic Meters Per Second + /// + public static FlowRate FromCubicMetersPerSecond(double m3PerSec) + { + return new FlowRate(m3PerSec); + } + + public static FlowRate FromCubicMetersPerMinute(double m3PerMin) + { + return new FlowRate(m3PerMin / SecondsPerMinute); + } + + public static FlowRate FromCubicMetersPerHour(double m3PerHr) + { + return new FlowRate(m3PerHr / SecondsPerHour); + } + + public static FlowRate FromGallonsPerMinute(double gallonPerMin) + { + return new FlowRate(gallonPerMin / CubicMetersToGalPerSecMultipler); + } + #endregion + + public override bool Equals(object obj) + { + FlowRate flowRate = obj as FlowRate; + + return (flowRate == null) ? false : (this._flowRate == flowRate._flowRate); + } + + public override int GetHashCode() + { + return _flowRate.GetHashCode(); + } + + #region Binary Operators + // not implementing %, &, |, ^, <<, >> + + public static FlowRate operator +(FlowRate left, FlowRate right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot add a null Flow Rate"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot add null Flow Rate"); + } + + return new FlowRate(left._flowRate + right._flowRate); + } + + public static FlowRate operator *(FlowRate flowRate, double scalar) + { + if (null == flowRate) + { + throw new ArgumentNullException("flowRate", "Cannot multiply a null Flow Rate"); + } + + return new FlowRate(flowRate._flowRate * scalar); + } + + public static FlowRate operator *(double scalar, FlowRate flowRate) + { + if (null == flowRate) + { + throw new ArgumentNullException("flowRate", "Cannot multiply a null Flow Rate"); + } + + return new FlowRate(scalar * flowRate._flowRate); + } + + public static FlowRate operator /(FlowRate flowRate, double scalar) + { + if (null == flowRate) + { + throw new ArgumentNullException("flowRate", "Cannot divide a null Flow Rate"); + } + + if (0.0 == scalar) + { + throw new DivideByZeroException("Cannot divide Flow Rate by 0"); + } + + return new FlowRate(flowRate._flowRate / scalar); + } + #endregion + + #region comparison operators + public static bool operator ==(FlowRate left, FlowRate right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._flowRate == right._flowRate; + } + } + return bReturn; + } + + public static bool operator !=(FlowRate left, FlowRate right) + { + return !(left == right); + } + + public static bool operator <(FlowRate left, FlowRate right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Flow Rate"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Flow Rate"); + } + + return (left._flowRate < right._flowRate); + } + + public static bool operator >(FlowRate left, FlowRate right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Flow Rate"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Flow Rate"); + } + + return (left._flowRate > right._flowRate); + } + + public static bool operator <=(FlowRate left, FlowRate right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Flow Rate"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Flow Rate"); + } + + return (left._flowRate <= right._flowRate); + } + + public static bool operator >=(FlowRate left, FlowRate right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Flow Rate"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Flow Rate"); + } + + return (left._flowRate >= right._flowRate); + } + + #endregion + + #region parsing + + public static FlowRate Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out FlowRate value) + { + try + { + value = FlowRate.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a appended with units symbol (e.g. "1.23 M^3/s"). + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Frequency.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Frequency.cs new file mode 100644 index 0000000..0329c8e --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Frequency.cs @@ -0,0 +1,340 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Raytheon.Units +{ + /// + /// This class represents energy. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromHertz). + /// + /// Properties (e.g. Hertz) are provided to convert the value to other units and return as type + /// double. + /// + [Serializable] + [DataContract] + public class Frequency + { + public enum Unit + { + Hertz, + KiloHertz, + MegaHertz, + GigaHertz + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Hertz, new List(){ "Hz" } }, + {Unit.KiloHertz, new List(){ "kHz" } }, + {Unit.MegaHertz, new List(){ "MHz" } }, + {Unit.GigaHertz, new List(){ "GHz" } }, + }; + + private const Unit DefaultUnits = Unit.Hertz; + + [DataMember(Name = "Frequency", IsRequired = true)] + private double _frequency; // Hertz + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Hertz, new UnitInfo(UnitAbbreviations[Unit.Hertz], FromHertz, typeof(Frequency).GetProperty("Hertz").GetGetMethod()) }, + { Unit.KiloHertz, new UnitInfo(UnitAbbreviations[Unit.KiloHertz], FromKiloHertz, typeof(Frequency).GetProperty("KiloHertz").GetGetMethod()) }, + { Unit.MegaHertz, new UnitInfo(UnitAbbreviations[Unit.MegaHertz], FromMegaHertz, typeof(Frequency).GetProperty("MegaHertz").GetGetMethod()) }, + { Unit.GigaHertz, new UnitInfo(UnitAbbreviations[Unit.GigaHertz], FromGigaHertz, typeof(Frequency).GetProperty("GigaHertz").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Frequency() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The frequency - Hertz. + private Frequency(double frequency) + { + _frequency = frequency; + } + + #region conversion properties + + public double GigaHertz + { + get { return _frequency / Constants.GIGA; } + } + + public double Hertz + { + get { return _frequency; } + } + + public double KiloHertz + { + get { return _frequency / Constants.KILO; } + } + + public double MegaHertz + { + get { return _frequency / Constants.MEGA; } + } + + #endregion + + #region creation methods + + /// + /// Returns Frequency object interpreting passed value as Hertz + /// + /// Hertz + /// + public static Frequency FromGigaHertz(double frequency) + { + return new Frequency(frequency * Constants.GIGA); + } + + /// + /// Returns Frequency object interpreting passed value as Hertz + /// + /// Hertz + /// + public static Frequency FromHertz(double frequency) + { + return new Frequency(frequency); + } + + /// + /// Returns Frequency object interpreting passed value as Hertz + /// + /// Hertz + /// + public static Frequency FromKiloHertz(double frequency) + { + return new Frequency(frequency * Constants.KILO); + } + + /// + /// Returns Frequency object interpreting passed value as Hertz + /// + /// Hertz + /// + public static Frequency FromMegaHertz(double frequency) + { + return new Frequency(frequency * Constants.MEGA); + } + + #endregion + + public override bool Equals(object obj) + { + Frequency e = obj as Frequency; + + return (e == null) ? false : (this._frequency == e._frequency); + } + + public override int GetHashCode() + { + return _frequency.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Frequency operator +(Frequency left, Frequency right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Frequency"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Frequency"); + + return new Frequency(left._frequency + right._frequency); + } + + + public static Frequency operator -(Frequency left, Frequency right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Frequency"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Frequency"); + + return new Frequency(left._frequency - right._frequency); + } + + + public static Frequency operator *(Frequency frequency, double scalar) + { + if (null == frequency) + throw new ArgumentNullException("frequency", "Cannot multiply a null Frequency"); + + return new Frequency(frequency._frequency * scalar); + } + + + public static Frequency operator *(double scalar, Frequency frequency) + { + if (null == frequency) + throw new ArgumentNullException("frequency", "Cannot multiply a null Frequency"); + + return new Frequency(scalar * frequency._frequency); + } + + + public static Frequency operator /(Frequency frequency, double scalar) + { + if (null == frequency) + throw new ArgumentNullException("frequency", "Cannot divide a null Frequency"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Frequency by 0"); + + return new Frequency(frequency._frequency / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Frequency left, Frequency right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._frequency == right._frequency; + } + } + return bReturn; + } + + public static bool operator !=(Frequency left, Frequency right) + { + return !(left == right); + } + + + public static bool operator <(Frequency left, Frequency right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Frequency"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Frequency"); + + return (left._frequency < right._frequency); + } + + + public static bool operator >(Frequency left, Frequency right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Frequency"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Frequency"); + + return (left._frequency > right._frequency); + } + + + public static bool operator <=(Frequency left, Frequency right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Frequency"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Frequency"); + + return (left._frequency <= right._frequency); + } + + + public static bool operator >=(Frequency left, Frequency right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Frequency"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Frequency"); + + return (left._frequency >= right._frequency); + } + + #endregion + + #region operators with other classes + + // no operators right now + + #endregion + + #region parsing + + public static Frequency Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Frequency value) + { + try + { + value = Frequency.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Length.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Length.cs new file mode 100644 index 0000000..054b139 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Length.cs @@ -0,0 +1,412 @@ +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents a length. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromMeters). + /// + /// Properties (e.g. Meters) are provided to convert the value to other units and return + /// as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Velocity). + /// + [Serializable] + [DataContract] + public class Length + { + public enum Unit + { + Meters, + Centimeters, + Millimeters, + Micrometers, + Nanometers, + Inches, + Feet + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Meters, new List(){ "m" } }, + {Unit.Centimeters, new List(){ "cm" } }, + {Unit.Millimeters, new List(){ "mm" } }, + {Unit.Micrometers, new List(){ "um" } }, + {Unit.Nanometers, new List(){ "nm" } }, + {Unit.Inches, new List(){ "in" } }, + {Unit.Feet, new List(){ "ft" } }, + }; + + private const Unit DefaultUnits = Unit.Meters; + private const double FeetPerMeter = 3.280839895013123; + private const double InchesPerMeter = 12 * FeetPerMeter; + private const double MilesPerMeter = FeetPerMeter / 5280; + + [DataMember(Name = "Length", IsRequired = true)] + private double _length; // meters + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Meters, new UnitInfo(UnitAbbreviations[Unit.Meters], FromMeters, typeof(Length).GetProperty("Meters").GetGetMethod()) }, + { Unit.Centimeters, new UnitInfo(UnitAbbreviations[Unit.Centimeters], FromCentimeters, typeof(Length).GetProperty("Centimeters").GetGetMethod()) }, + { Unit.Millimeters, new UnitInfo(UnitAbbreviations[Unit.Millimeters], FromMillimeters, typeof(Length).GetProperty("Millimeters").GetGetMethod()) }, + { Unit.Micrometers, new UnitInfo(UnitAbbreviations[Unit.Micrometers], FromMicrometers, typeof(Length).GetProperty("Micrometers").GetGetMethod()) }, + { Unit.Nanometers, new UnitInfo(UnitAbbreviations[Unit.Nanometers], FromNanometers, typeof(Length).GetProperty("Nanometers").GetGetMethod()) }, + { Unit.Feet, new UnitInfo(UnitAbbreviations[Unit.Feet], FromFeet, typeof(Length).GetProperty("Feet").GetGetMethod()) }, + { Unit.Inches, new UnitInfo(UnitAbbreviations[Unit.Inches], FromInches, typeof(Length).GetProperty("Inches").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Length() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The length - meters + private Length(double length) + { + _length = length; + } + + #region conversion properties + + public double Centimeters + { + get { return _length * 100; } + } + + public double Feet + { + get { return _length * FeetPerMeter; } + } + + public double Inches + { + get { return _length * InchesPerMeter; } + } + + public double Meters + { + get { return _length; } + } + + public double Micrometers + { + get { return _length * 1000000; } + } + + public double Millimeters + { + get { return _length * 1000; } + } + + public double Nanometers + { + get { return _length * 1000000000; } + } + + #endregion + + #region creation methods + + public static Length FromCentimeters(double centimeters) + { + return new Length(centimeters / 100); + } + + public static Length FromFeet(double feet) + { + return new Length(feet / FeetPerMeter); + } + + public static Length FromInches(double inches) + { + return new Length(inches / InchesPerMeter); + } + + public static Length FromMeters(double meters) + { + return new Length(meters); + } + + public static Length FromMicrometers(double micrometers) + { + return new Length(micrometers / 1000000); + } + + public static Length FromMillimeters(double millimeters) + { + return new Length(millimeters / 1000); + } + + public static Length FromNanometers(double nanometers) + { + return new Length(nanometers / 1000000000); + } + + #endregion + + public override bool Equals(object obj) + { + Length l = obj as Length; + + return (l == null) ? false : (this._length == l._length); + } + + public override int GetHashCode() + { + return _length.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Length operator +(Length left, Length right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Length"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Length"); + + return new Length(left._length + right._length); + } + + + public static Length operator -(Length left, Length right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Length"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Length"); + + return new Length(left._length - right._length); + } + + + public static Length operator *(Length length, double scalar) + { + if (null == length) + throw new ArgumentNullException("length", "Cannot multiply a null Length"); + + return new Length(length._length * scalar); + } + + + public static Length operator *(double scalar, Length length) + { + if (null == length) + throw new ArgumentNullException("length", "Cannot multiply a null Length"); + + return new Length(scalar * length._length); + } + + + public static Length operator /(Length length, double scalar) + { + if (null == length) + throw new ArgumentNullException("length", "Cannot divide a null Length"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Length by 0"); + + return new Length(length._length / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Length left, Length right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._length == right._length; + } + } + return bReturn; + } + + public static bool operator !=(Length left, Length right) + { + return !(left == right); + } + + + public static bool operator <(Length left, Length right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Length"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Length"); + + return (left._length < right._length); + } + + + public static bool operator >(Length left, Length right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Length"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Length"); + + return (left._length > right._length); + } + + + public static bool operator <=(Length left, Length right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Length"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Length"); + + return (left._length <= right._length); + } + + + public static bool operator >=(Length left, Length right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Length"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Length"); + + return (left._length >= right._length); + } + + #endregion + + #region operators with non-length classes + + /// + /// Implements the operator / for Velocity = Length / PrecisionTimeSpan + /// + /// The length. + /// The time. + /// + /// Velocity + /// + + public static Velocity operator /(Length length, PrecisionTimeSpan time) + //public static Velocity operator /(Length length, TimeSpan time) + { + if (null == length) + throw new ArgumentNullException("length", "Cannot divide a null Length"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot divide by a null PrecisionTimeSpan"); + + if (0.0 == time.Milliseconds) + throw new DivideByZeroException("Cannot divide Length by 0 time"); + + return Velocity.FromMetersPerSec(length.Meters / time.Seconds); + } + + /// + /// Implements the operator / for PrecisionTimeSpan = Length / Velocity + /// + /// The length. + /// The velocity. + /// + /// PrecisionTimeSpan + /// + + public static PrecisionTimeSpan operator /(Length length, Velocity velocity) + { + if (null == length) + throw new ArgumentNullException("length", "Cannot divide a null Length"); + + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide by a null Velocity"); + + if (0.0 == velocity.MetersPerSec) + throw new DivideByZeroException("Cannot divide Length by 0 velocity"); + + return PrecisionTimeSpan.FromSeconds(length.Meters / velocity.MetersPerSec); + } + + #endregion + + #region parsing + + public static Length Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Length value) + { + try + { + value = Length.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Power.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Power.cs new file mode 100644 index 0000000..1802a0e --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Power.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents energy. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromWatts). + /// + /// Properties (e.g. Watts) are provided to convert the value to other units and return + /// as type double. + /// + [Serializable] + [DataContract] + public class Power + { + public enum Unit + { + Watts, + Milliwatts, + DecibelMilliWatt + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Watts, new List(){ "W", "Watts", "Watt" } }, + {Unit.Milliwatts, new List(){ "mW", "MilliWatt", "MilliWatts" } }, + {Unit.DecibelMilliWatt, new List(){ "dBm", "DecibelMilliWatt", "DecibelMilliWatts" } } + }; + + private const Unit DefaultUnits = Unit.Watts; + + [DataMember(Name = "Power", IsRequired = true)] + private readonly double _power; // watts + + // map: unit => abbreviation, conversion method and property + private static readonly IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Watts, new UnitInfo(UnitAbbreviations[Unit.Watts], FromWatts, typeof(Power).GetProperty("Watts").GetGetMethod()) }, + { Unit.Milliwatts, new UnitInfo(UnitAbbreviations[Unit.Milliwatts], FromMilliwatts, typeof(Power).GetProperty("Milliwatts").GetGetMethod()) }, + { Unit.DecibelMilliWatt, new UnitInfo(UnitAbbreviations[Unit.DecibelMilliWatt], FromDBM, typeof(Power).GetProperty("DBM").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Power() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The energy - watts/cm^2. + private Power(double energy) + { + _power = energy; + } + + #region conversion properties + public double Milliwatts + { + get { return _power * 1000; } + } + + public double Watts + { + get { return _power; } + } + + public double DBM + { + get { return (10 * Math.Log10(Math.Abs(_power))) + 30; } + } + + /// + /// Returns watts/cm^2 as type double + /// + /// + /// watts/cm^2 + /// + + [Obsolete("WattsPerCmSqrd is deprecated, please use Watts instead. This will be removed in a future version.", false)] + public double WattsPerCmSqrd + { + get + { + return Double.NaN; + } + } + #endregion + + #region creation methods + + ///
+ /// watts/cm^2 + /// + + [Obsolete("FromWattsPerCmSqrd is deprecated, please use FromWatts instead. This will be removed in a future version.", false)] + public static Power FromWattsPerCmSqrd(double wattsPerCmSqrd) + { + return new Power(Double.NaN); + } + + /// + /// Returns Power object interpreting passed value as milliwatts + /// + /// milliwatts + /// + public static Power FromMilliwatts(double milliwatts) + { + return new Power(milliwatts / 1000); + } + + /// + /// Returns Power object interpreting passed value as watts + /// + /// watts + /// + public static Power FromWatts(double watts) + { + return new Power(watts); + } + + public static Power FromDBM(double dbm) + { + return new Power(Math.Pow(10, (dbm - 30) / 10)); + } + #endregion + + public override bool Equals(object obj) + { + Power e = obj as Power; + + return (e == null) ? false : (this._power == e._power); + } + + public override int GetHashCode() + { + return _power.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + public static Power operator +(Power left, Power right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Power"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Power"); + + return new Power(left._power + right._power); + } + + public static Power operator -(Power left, Power right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Power"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Power"); + + return new Power(left._power - right._power); + } + + public static Power operator *(Power power, double scalar) + { + if (null == power) + throw new ArgumentNullException("power", "Cannot multiply a null Power"); + + return new Power(power._power * scalar); + } + + public static Power operator *(double scalar, Power power) + { + if (null == power) + throw new ArgumentNullException("power", "Cannot multiply a null Power"); + + return new Power(scalar * power._power); + } + + public static Power operator /(Power power, double scalar) + { + if (null == power) + throw new ArgumentNullException("power", "Cannot divide a null Power"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Power by 0"); + + return new Power(power._power / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Power left, Power right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._power == right._power; + } + } + return bReturn; + } + + public static bool operator !=(Power left, Power right) + { + return !(left == right); + } + + public static bool operator <(Power left, Power right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Power"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Power"); + + return (left._power < right._power); + } + + public static bool operator >(Power left, Power right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Power"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Power"); + + return (left._power > right._power); + } + + public static bool operator <=(Power left, Power right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Power"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Power"); + + return (left._power <= right._power); + } + + public static bool operator >=(Power left, Power right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Power"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Power"); + + return (left._power >= right._power); + } + + #endregion + + #region operators with other classes + + // no operators right now + + #endregion + + #region parsing + + public static Power Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Power value) + { + try + { + value = Power.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/PrecisionTimeSpan.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/PrecisionTimeSpan.cs new file mode 100644 index 0000000..31638a6 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/PrecisionTimeSpan.cs @@ -0,0 +1,357 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Raytheon.Units +{ + /// + /// This class represents precision time spans where the .NET TimeSpan class just does + /// not cut the mustard + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromSeconds). + /// + /// Properties (e.g. Seconds) are provided to convert the value to other units and return + /// as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types + /// + [Serializable] + [DataContract] + public class PrecisionTimeSpan + { + public enum Unit + { + Seconds, + Milliseconds, + Microseconds, + Nanoseconds + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Seconds, new List(){ "sec" } }, + {Unit.Milliseconds, new List(){ "msec" } }, + {Unit.Microseconds, new List(){ "usec" } }, + {Unit.Nanoseconds, new List(){ "nsec" } }, + }; + + private const Unit DefaultUnits = Unit.Seconds; + + [DataMember(Name = "BaseTimeSpan", IsRequired = true)] + private Decimal _totalns; //base will be nano seconds... max will be double.MaxValue + //min will be 0 + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Seconds, new UnitInfo(UnitAbbreviations[Unit.Seconds], FromSeconds, typeof(PrecisionTimeSpan).GetProperty("Seconds").GetGetMethod()) }, + { Unit.Milliseconds, new UnitInfo(UnitAbbreviations[Unit.Milliseconds], FromMilliseconds, typeof(PrecisionTimeSpan).GetProperty("Milliseconds").GetGetMethod()) }, + { Unit.Microseconds, new UnitInfo(UnitAbbreviations[Unit.Microseconds], FromMicroseconds, typeof(PrecisionTimeSpan).GetProperty("Microseconds").GetGetMethod()) }, + { Unit.Nanoseconds, new UnitInfo(UnitAbbreviations[Unit.Nanoseconds], FromNanoseconds, typeof(PrecisionTimeSpan).GetProperty("Nanoseconds").GetGetMethod()) } + }; + + internal const Decimal _nanoPerMicro = 1e3M; + internal const Decimal _nanoPerMilli = 1e6M; + internal const Decimal _nanoPerSec = 1e9M; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private PrecisionTimeSpan() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// total number of nanoseconds. + private PrecisionTimeSpan(Decimal totalns) + { + if (totalns < 0.0M) + throw new ArgumentOutOfRangeException("totalns", "Cannot create a negative timespan"); + + _totalns = totalns; + } + + #region conversion properties + + public double Nanoseconds + { + get { return (double)_totalns; } + } + + public double Microseconds + { + get { return (double)(_totalns / _nanoPerMicro); } + } + + public double Milliseconds + { + get { return (double)(_totalns / _nanoPerMilli); } + } + + public double Seconds + { + get { return (double)(_totalns / _nanoPerSec); } + } + + #endregion + + #region creation methods + + /// + /// Returns PrecisionTimeSpan object interpreting passed value as nanoseconds + /// + /// total nanoseconds in the desired timespan + /// the precision time span object + public static PrecisionTimeSpan FromNanoseconds(double nanoseconds) + { + return new PrecisionTimeSpan((Decimal)nanoseconds); + } + + /// + /// Returns PrecisionTimeSpan object interpreting passed value as microseconds + /// + /// total microseconds in the desired timespan + /// the precision time span object + public static PrecisionTimeSpan FromMicroseconds(double microseconds) + { + return new PrecisionTimeSpan((Decimal)microseconds * _nanoPerMicro); + } + + /// + /// Returns PrecisionTimeSpan object interpreting passed value as milliseconds + /// + /// total milliseconds in the desired timespan + /// the precision time span object + public static PrecisionTimeSpan FromMilliseconds(double milliseconds) + { + return new PrecisionTimeSpan((Decimal)milliseconds * _nanoPerMilli); + } + + /// + /// Returns PrecisionTimeSpan object interpreting passed value as seconds + /// + /// total seconds in the desired timespan + /// the precision time span object + public static PrecisionTimeSpan FromSeconds(double seconds) + { + return new PrecisionTimeSpan((Decimal)seconds * _nanoPerSec); + } + + #endregion + + public override bool Equals(object obj) + { + PrecisionTimeSpan ts = obj as PrecisionTimeSpan; + + return (ts == null) ? false : (this._totalns == ts._totalns); + } + + public override int GetHashCode() + { + return _totalns.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static PrecisionTimeSpan operator +(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null PrecisionTimeSpan"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null PrecisionTimeSpan"); + + return new PrecisionTimeSpan(left._totalns + right._totalns); + } + + + public static PrecisionTimeSpan operator -(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null PrecisionTimeSpan"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null PrecisionTimeSpan"); + + if (right > left) + throw new ArgumentOutOfRangeException("right", "Cannot subtract a larger span from a smaller one"); + + return new PrecisionTimeSpan(left._totalns - right._totalns); + } + + + public static PrecisionTimeSpan operator *(PrecisionTimeSpan precisionTimeSpan, double scalar) + { + if (null == precisionTimeSpan) + throw new ArgumentNullException("precisionTimeSpan", "Cannot multiply a null PrecisionTimeSpan"); + + return new PrecisionTimeSpan(precisionTimeSpan._totalns * (Decimal)scalar); + } + + + public static PrecisionTimeSpan operator *(double scalar, PrecisionTimeSpan precisionTimeSpan) + { + if (null == precisionTimeSpan) + throw new ArgumentNullException("precisionTimeSpan", "Cannot multiply a null PrecisionTimeSpan"); + + return new PrecisionTimeSpan((Decimal)scalar * precisionTimeSpan._totalns); + } + + + public static PrecisionTimeSpan operator /(PrecisionTimeSpan precisionTimeSpan, double scalar) + { + if (null == precisionTimeSpan) + throw new ArgumentNullException("precisionTimeSpan", "Cannot divide a null PrecisionTimeSpan"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Precision Time Span by 0"); + + return new PrecisionTimeSpan(precisionTimeSpan._totalns / (Decimal)scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._totalns == right._totalns; + } + } + return bReturn; + } + + public static bool operator !=(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + return !(left == right); + } + + + public static bool operator <(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null PrecisionTimeSpan"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null PrecisionTimeSpan"); + + return (left._totalns < right._totalns); + } + + + public static bool operator >(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null PrecisionTimeSpan"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null PrecisionTimeSpan"); + + return (left._totalns > right._totalns); + } + + + public static bool operator <=(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null PrecisionTimeSpan"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null PrecisionTimeSpan"); + + return (left._totalns <= right._totalns); + } + + + public static bool operator >=(PrecisionTimeSpan left, PrecisionTimeSpan right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null PrecisionTimeSpan"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null PrecisionTimeSpan"); + + return (left._totalns >= right._totalns); + } + + #endregion + + #region operators with other classes + + // no operators right now + + #endregion + + #region parsing + + public static PrecisionTimeSpan Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out PrecisionTimeSpan value) + { + try + { + value = PrecisionTimeSpan.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Pressure.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Pressure.cs new file mode 100644 index 0000000..21b4da3 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Pressure.cs @@ -0,0 +1,367 @@ +//############################################################################// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +//############################################################################// + + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; + +namespace Raytheon.Units +{ + /// + /// This class represents a Pressure + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. Pascal). + /// + /// Properties (e.g. Pascal) are provided to convert the value to other units and return + /// as type double. + /// + [Serializable] + [DataContract] + public class Pressure + { + public enum Unit + { + Bar, + Millibar, + Pascal, + PSI + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Bar, new List(){ "bar" } }, + {Unit.Millibar, new List(){ "mbar" } }, + {Unit.Pascal, new List(){ "Pa" } }, + {Unit.PSI, new List(){ "PSI" } }, + }; + + private const Unit DefaultUnits = Unit.PSI; + private const int PascalPerBar = 100000; + private const double PascalPerPSI = 6894.75729; + + [DataMember(Name = "Pascal", IsRequired = true)] + private double _pressure; // Pascal + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Bar, new UnitInfo(UnitAbbreviations[Unit.Bar], FromBar, typeof(Pressure).GetProperty("Bar").GetGetMethod()) }, + { Unit.Millibar, new UnitInfo(UnitAbbreviations[Unit.Millibar], FromMillibar, typeof(Pressure).GetProperty("Millibar").GetGetMethod()) }, + { Unit.Pascal, new UnitInfo(UnitAbbreviations[Unit.Pascal], FromPascal, typeof(Pressure).GetProperty("Pascal").GetGetMethod()) }, + { Unit.PSI, new UnitInfo(UnitAbbreviations[Unit.PSI], FromPSI, typeof(Pressure).GetProperty("PSI").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created + /// Use FromXXX methods to create objects of this type. + /// + private Pressure() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods. + /// + /// The pressure - pascal + private Pressure(double pressure) + { + this._pressure = pressure; + } + + #region conversion properties + public double Bar { get { return _pressure / PascalPerBar; } } + + public double Millibar { get { return _pressure / PascalPerBar * 1000; } } + + public double Pascal { get { return _pressure; } } + + public double PSI { get { return _pressure / PascalPerPSI; } } + #endregion + + #region Creation Methods + public static Pressure FromBar(double bars) + { + return new Pressure(bars * PascalPerBar); + } + + public static Pressure FromMillibar(double millibars) + { + return new Pressure(millibars * PascalPerBar / 1000); + } + + /// + /// Returns Pressure object interpreting passed value as Pascal + /// + /// Pascal + /// + public static Pressure FromPascal(double pascal) + { + return new Pressure(pascal); + } + + public static Pressure FromPSI(double psi) + { + return new Pressure(psi * PascalPerPSI); + } + #endregion + + public override bool Equals(object obj) + { + Pressure pressure = obj as Pressure; + + return (pressure == null) ? false : (this._pressure == pressure._pressure); + } + + public override int GetHashCode() + { + return _pressure.GetHashCode(); + } + + #region Binary Operators + // not implementing %, &, |, ^, <<, >> + + + public static Pressure operator +(Pressure left, Pressure right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot add a null Pressure"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot add null Pressure"); + } + + return new Pressure(left._pressure + right._pressure); + } + + + public static Pressure operator -(Pressure left, Pressure right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot add a null Pressure"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot add null Pressure"); + } + + return new Pressure(left._pressure - right._pressure); + } + + + public static Pressure operator *(Pressure pressure, double scalar) + { + if (null == pressure) + { + throw new ArgumentNullException("pressure", "Cannot multiply a null Pressure"); + } + + return new Pressure(pressure._pressure * scalar); + } + + + public static Pressure operator *(double scalar, Pressure pressure) + { + if (null == pressure) + { + throw new ArgumentNullException("pressure", "Cannot multiply a null Pressure"); + } + + return new Pressure(scalar * pressure._pressure); + } + + + public static Pressure operator /(Pressure pressure, double scalar) + { + if (null == pressure) + { + throw new ArgumentNullException("pressure", "Cannot divide a null Pressure"); + } + + if (0.0 == scalar) + { + throw new DivideByZeroException("Cannot divide Pressure by 0"); + } + + return new Pressure(pressure._pressure / scalar); + } + #endregion + + #region comparison operators + public static bool operator ==(Pressure left, Pressure right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._pressure == right._pressure; + } + } + return bReturn; + } + + public static bool operator !=(Pressure left, Pressure right) + { + return !(left == right); + } + + + public static bool operator <(Pressure left, Pressure right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Pressure"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Pressure"); + } + + return (left._pressure < right._pressure); + } + + + public static bool operator >(Pressure left, Pressure right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Pressure"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Pressure"); + } + + return (left._pressure > right._pressure); + } + + + public static bool operator <=(Pressure left, Pressure right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Pressure"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Pressure"); + } + + return (left._pressure <= right._pressure); + } + + + public static bool operator >=(Pressure left, Pressure right) + { + if (null == left) + { + throw new ArgumentNullException("left", "Cannot compare null Pressure"); + } + + if (null == right) + { + throw new ArgumentNullException("right", "Cannot compare null Pressure"); + } + + return (left._pressure >= right._pressure); + } + + #endregion + + #region parsing + + public static Pressure Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Pressure value) + { + try + { + value = Pressure.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Resistance.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Resistance.cs new file mode 100644 index 0000000..d0c4e1b --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Resistance.cs @@ -0,0 +1,369 @@ +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents electrical resistance. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromOhms). + /// + /// Properties (e.g. KiloOhms) are provided to convert the value to other units and return + /// as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Current, Voltage). + /// + [Serializable] + [DataContract] + public class Resistance + { + public enum Unit + { + Ohms, + KiloOhms, + MegaOhms + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Ohms, new List(){ "Ohm" } }, + {Unit.KiloOhms, new List(){ "kOhm" } }, + {Unit.MegaOhms, new List(){ "MOhm" } }, + }; + + private const Unit DefaultUnits = Unit.Ohms; + private const int KiloOhmsPerOhm = 1000; + private const int MegaOhmsPerOhm = 1000000; + + [DataMember(Name = "Resistance", IsRequired = true)] + private double _resistance; // ohms + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Ohms, new UnitInfo(UnitAbbreviations[Unit.Ohms], FromOhms, typeof(Resistance).GetProperty("Ohms").GetGetMethod()) }, + { Unit.KiloOhms, new UnitInfo(UnitAbbreviations[Unit.KiloOhms], FromKiloOhms, typeof(Resistance).GetProperty("KiloOhms").GetGetMethod()) }, + { Unit.MegaOhms, new UnitInfo(UnitAbbreviations[Unit.MegaOhms], FromMegaOhms, typeof(Resistance).GetProperty("MegaOhms").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Resistance() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The resistance - ohms + private Resistance(double resistance) + { + _resistance = resistance; + } + + #region conversion properties + + /// + /// Returns ohms as type double + /// + /// + /// ohms + /// + public double Ohms + { + get { return _resistance; } + } + + /// + /// Returns kiloohms as type double + /// + /// + /// kiloohms + /// + public double KiloOhms + { + get { return _resistance / KiloOhmsPerOhm; } + } + + /// + /// Returns megaohms as type double + /// + /// + /// megaohms + /// + public double MegaOhms + { + get { return _resistance / MegaOhmsPerOhm; } + } + + #endregion + + #region creation methods + + /// + /// Returns Resistance object interpreting passed value as kiloohms + /// + /// kiloohms + /// + public static Resistance FromKiloOhms(double kiloOhms) + { + return new Resistance(kiloOhms * KiloOhmsPerOhm); + } + + /// + /// Returns Resistance object interpreting passed value as megaohms + /// + /// megaohms + /// + public static Resistance FromMegaOhms(double megaOhms) + { + return new Resistance(megaOhms * MegaOhmsPerOhm); + } + + /// + /// Returns Resistance object interpreting passed value as ohms + /// + /// ohms + /// + public static Resistance FromOhms(double ohms) + { + return new Resistance(ohms); + } + + #endregion + + public override bool Equals(object obj) + { + Resistance r = obj as Resistance; + + return (r == null) ? false : (this._resistance == r._resistance); + } + + public override int GetHashCode() + { + return _resistance.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Resistance operator +(Resistance left, Resistance right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Resistance"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Resistance"); + + return new Resistance(left._resistance + right._resistance); + } + + + public static Resistance operator -(Resistance left, Resistance right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Resistance"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Resistance"); + + return new Resistance(left._resistance - right._resistance); + } + + + public static Resistance operator *(Resistance resistance, double scalar) + { + if (null == resistance) + throw new ArgumentNullException("resistance", "Cannot multiply a null Resistance"); + + return new Resistance(resistance._resistance * scalar); + } + + + public static Resistance operator *(double scalar, Resistance resistance) + { + if (null == resistance) + throw new ArgumentNullException("resistance", "Cannot multiply a null Resistance"); + + return new Resistance(scalar * resistance._resistance); + } + + + public static Resistance operator /(Resistance resistance, double scalar) + { + if (null == resistance) + throw new ArgumentNullException("resistance", "Cannot divide a null Resistance"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Resistance by 0"); + + return new Resistance(resistance._resistance / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Resistance left, Resistance right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._resistance == right._resistance; + } + } + return bReturn; + } + + public static bool operator !=(Resistance left, Resistance right) + { + return !(left == right); + } + + + public static bool operator <(Resistance left, Resistance right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Resistance"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Resistance"); + + return (left._resistance < right._resistance); + } + + + public static bool operator >(Resistance left, Resistance right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Resistance"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Resistance"); + + return (left._resistance > right._resistance); + } + + + public static bool operator <=(Resistance left, Resistance right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Resistance"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Resistance"); + + return (left._resistance <= right._resistance); + } + + + public static bool operator >=(Resistance left, Resistance right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Resistance"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Resistance"); + + return (left._resistance >= right._resistance); + } + + #endregion + + #region operators with non-resistance classes + + /// + /// Implements the operator * for Voltage = Resistance / Current + /// + /// The resistance. + /// The current. + /// + /// Voltage + /// + + public static Voltage operator *(Resistance resistance, Current current) + { + if (null == resistance) + throw new ArgumentNullException("resistance", "Cannot divide a null Resistance"); + + if (null == current) + throw new ArgumentNullException("current", "Cannot divide by a null Current"); + + if (0.0 == current.Amps) + throw new DivideByZeroException("Cannot divide Resistance by 0 Current"); + + return Voltage.FromVolts(resistance.Ohms * current.Amps); + } + + #endregion + + #region parsing + + public static Resistance Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Resistance value) + { + try + { + value = Resistance.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Temperature.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Temperature.cs new file mode 100644 index 0000000..1a4cf73 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Temperature.cs @@ -0,0 +1,325 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; + +namespace Raytheon.Units +{ + [Serializable] + [DataContract] + public class Temperature + { + public enum Unit + { + DegreesC, + DegreesF, + DegreesK + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.DegreesC, new List(){ "C" } }, + {Unit.DegreesF, new List(){ "F" } }, + {Unit.DegreesK, new List(){ "K" } }, + }; + + private const Unit DefaultUnits = Unit.DegreesC; + private const double CdegreesPerFdegree = 5.0 / 9.0; + private const double CtoF_Offset = 32.0; + private const double KtoC_Offset = 273.15; + + [DataMember(Name = "Temperature", IsRequired = true)] + private double _temperature; // degrees C + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.DegreesC, new UnitInfo(UnitAbbreviations[Unit.DegreesC], FromDegreesC, typeof(Temperature).GetProperty("DegreesC").GetGetMethod()) }, + { Unit.DegreesF, new UnitInfo(UnitAbbreviations[Unit.DegreesF], FromDegreesF, typeof(Temperature).GetProperty("DegreesF").GetGetMethod()) }, + { Unit.DegreesK, new UnitInfo(UnitAbbreviations[Unit.DegreesK], FromDegreesK, typeof(Temperature).GetProperty("DegreesK").GetGetMethod()) } + }; + + private Temperature() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + private Temperature(double temperature) + { + _temperature = temperature; + } + + #region output properties + + public double DegreesC + { + get + { + return _temperature; + } + } + + public double DegreesF + { + get + { + return (_temperature / CdegreesPerFdegree) + CtoF_Offset; + } + } + + public double DegreesK + { + get + { + return DegreesC + KtoC_Offset; + } + } + + #endregion + + #region creation methods + + public static Temperature FromDegreesC(double temperature) + { + return new Temperature(temperature); + } + + public static Temperature FromDegreesF(double temperature) + { + return new Temperature((temperature - CtoF_Offset) * CdegreesPerFdegree); + } + + public static Temperature FromDegreesK(double temperature) + { + return FromDegreesC(temperature - KtoC_Offset); + } + + #endregion + + #region add delta methods + + public void Add(TemperatureDelta delta) + { + if (delta == null) + { + throw new ArgumentNullException("delta"); + } + + _temperature += delta.DegreesC; + } + + public void AddDegreesC(double delta) + { + _temperature += TemperatureDelta.FromDegreesC(delta).DegreesC; + } + + public void AddDegreesF(double delta) + { + _temperature += TemperatureDelta.FromDegreesF(delta).DegreesC; + } + + public void AddDegreesK(double delta) + { + _temperature += TemperatureDelta.FromDegreesK(delta).DegreesC; + } + + #endregion + + #region binary operators + + + public static Temperature operator +(Temperature left, TemperatureDelta right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Temperature"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null TemperatureDelta"); + + return new Temperature(left.DegreesC + right.DegreesC); + } + + + public static Temperature operator +(TemperatureDelta left, Temperature right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null TemperatureDelta"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Temperature"); + + return new Temperature(left.DegreesC + right.DegreesC); + } + + + public static TemperatureDelta operator -(Temperature left, Temperature right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Temperature"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Temperature"); + + return TemperatureDelta.FromDegreesC(left.DegreesC - right.DegreesC); + } + + + public static Temperature operator -(Temperature left, TemperatureDelta right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Temperature"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null TemperatureDelta"); + + return Temperature.FromDegreesC(left.DegreesC - right.DegreesC); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Temperature left, Temperature right) + { + bool bReturn = false; + + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._temperature == right._temperature; + } + } + + return bReturn; + } + + public static bool operator !=(Temperature left, Temperature right) + { + return !(left == right); + } + + + public static bool operator <(Temperature left, Temperature right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Temperature"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Temperature"); + + return (left._temperature < right._temperature); + } + + + public static bool operator >(Temperature left, Temperature right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Temperature"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Temperature"); + + return (left._temperature > right._temperature); + } + + + public static bool operator <=(Temperature left, Temperature right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Temperature"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Temperature"); + + return (left._temperature <= right._temperature); + } + + + public static bool operator >=(Temperature left, Temperature right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Temperature"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Temperature"); + + return (left._temperature >= right._temperature); + } + + #endregion + + #region parsing + + public static Temperature Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Temperature value) + { + try + { + value = Temperature.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + #region Object overrides + + public override bool Equals(object obj) + { + Temperature t = obj as Temperature; + + return (t == null) ? false : (this._temperature == t._temperature); + } + + public override int GetHashCode() + { + return _temperature.GetHashCode(); + } + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/TemperatureDelta.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/TemperatureDelta.cs new file mode 100644 index 0000000..d3b1cc8 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/TemperatureDelta.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; + +namespace Raytheon.Units +{ + [Serializable] + [DataContract] + public class TemperatureDelta + { + public enum Unit + { + DegreesC, + DegreesF, + DegreesK + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.DegreesC, new List(){ "C" } }, + {Unit.DegreesF, new List(){ "F" } }, + {Unit.DegreesK, new List(){ "K" } }, + }; + + private const Unit DefaultUnits = Unit.DegreesC; + private const double CdegreesPerFdegree = 5.0 / 9.0; + + [DataMember(Name = "Delta", IsRequired = true)] + private double _delta; // degrees C or K + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.DegreesC, new UnitInfo(UnitAbbreviations[Unit.DegreesC], FromDegreesC, typeof(TemperatureDelta).GetProperty("DegreesC").GetGetMethod()) }, + { Unit.DegreesF, new UnitInfo(UnitAbbreviations[Unit.DegreesF], FromDegreesF, typeof(TemperatureDelta).GetProperty("DegreesF").GetGetMethod()) }, + { Unit.DegreesK, new UnitInfo(UnitAbbreviations[Unit.DegreesK], FromDegreesK, typeof(TemperatureDelta).GetProperty("DegreesK").GetGetMethod()) } + }; + + private TemperatureDelta() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + private TemperatureDelta(double delta) + { + _delta = delta; + } + + #region output properties + + public double DegreesC + { + get + { + return _delta; + } + } + + public double DegreesF + { + get + { + return _delta / CdegreesPerFdegree; + } + } + + public double DegreesK + { + get + { + return _delta; + } + } + + #endregion + + #region creation methods + + public static TemperatureDelta FromDegreesC(double temperature) + { + return new TemperatureDelta(temperature); + } + + public static TemperatureDelta FromDegreesF(double temperature) + { + return new TemperatureDelta(temperature * CdegreesPerFdegree); + } + + public static TemperatureDelta FromDegreesK(double temperature) + { + return new TemperatureDelta(temperature); + } + + #endregion + + // binary operators are in Temperature class + + #region comparison operators + + + public static bool operator <(TemperatureDelta left, TemperatureDelta right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null TemperatureDelta"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null TemperatureDelta"); + + return (left._delta < right._delta); + } + + + public static bool operator >(TemperatureDelta left, TemperatureDelta right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null TemperatureDelta"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null TemperatureDelta"); + + return (left._delta > right._delta); + } + + + public static bool operator <=(TemperatureDelta left, TemperatureDelta right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null TemperatureDelta"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null TemperatureDelta"); + + return (left._delta <= right._delta); + } + + + public static bool operator >=(TemperatureDelta left, TemperatureDelta right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null TemperatureDelta"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null TemperatureDelta"); + + return (left._delta >= right._delta); + } + + #endregion + + #region parsing + + public static TemperatureDelta Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out TemperatureDelta value) + { + try + { + value = TemperatureDelta.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + #region Object overrides + + public override bool Equals(object obj) + { + TemperatureDelta d = obj as TemperatureDelta; + + return (d == null) ? false : (this._delta == d._delta); + } + + public override int GetHashCode() + { + return _delta.GetHashCode(); + } + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + + #endregion + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Velocity.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Velocity.cs new file mode 100644 index 0000000..679c9b1 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Velocity.cs @@ -0,0 +1,409 @@ +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents a velocity. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromMetersPerSec). + /// + /// Properties (e.g. FeetPerSec) are provided to convert the value to other units and return + /// as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Acceleration, Length). + /// + [Serializable] + [DataContract] + public class Velocity + { + public enum Unit + { + FeetPerSecond, + MetersPerSecond, + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.FeetPerSecond, new List(){ "ft/sec" } }, + {Unit.MetersPerSecond, new List(){ "m/sec" } }, + }; + + private const Unit DefaultUnits = Unit.MetersPerSecond; + private const double FeetPerMeter = 3.280839895013123; + + [DataMember(Name = "Velocity", IsRequired = true)] + private double _velocity; // meters/second + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.FeetPerSecond, new UnitInfo(UnitAbbreviations[Unit.FeetPerSecond], FromFeetPerSec, typeof(Velocity).GetProperty("FeetPerSec").GetGetMethod()) }, + { Unit.MetersPerSecond, new UnitInfo(UnitAbbreviations[Unit.MetersPerSecond], FromMetersPerSec, typeof(Velocity).GetProperty("MetersPerSec").GetGetMethod()) }, + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Velocity() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The velocity - m/sec. + private Velocity(double velocity) + { + _velocity = velocity; + } + + #region conversion properties + + /// + /// Returns feet/sec as type double + /// + /// + /// feet/sec + /// + public double FeetPerSec + { + get { return _velocity * FeetPerMeter; } + } + + /// + /// Returns meters/sec as type double + /// + /// + /// meters/sec + /// + public double MetersPerSec + { + get { return _velocity; } + } + + #endregion + + #region creation methods + + /// + /// Returns Velocity object interpreting passed value as ft/sec + /// + /// ft/sec + /// + public static Velocity FromFeetPerSec(double feetPerSec) + { + return new Velocity(feetPerSec / FeetPerMeter); + } + + /// + /// Returns Velocity object interpreting passed value as meters/sec + /// + /// meters/sec + /// + public static Velocity FromMetersPerSec(double metersPerSec) + { + return new Velocity(metersPerSec); + } + + #endregion + + public override bool Equals(object obj) + { + Velocity v = obj as Velocity; + + return (v == null) ? false : (this._velocity == v._velocity); + } + + public override int GetHashCode() + { + return _velocity.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Velocity operator +(Velocity left, Velocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Velocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Velocity"); + + return new Velocity(left._velocity + right._velocity); + } + + + public static Velocity operator -(Velocity left, Velocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Velocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Velocity"); + + return new Velocity(left._velocity - right._velocity); + } + + + public static Velocity operator *(Velocity velocity, double scalar) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot multiply a null Velocity"); + + return new Velocity(velocity._velocity * scalar); + } + + + public static Velocity operator *(double scalar, Velocity velocity) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot multiply a null Velocity"); + + return new Velocity(scalar * velocity._velocity); + } + + + public static Velocity operator /(Velocity velocity, double scalar) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide a null Velocity"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Velocity by 0"); + + return new Velocity(velocity._velocity / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Velocity left, Velocity right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._velocity == right._velocity; + } + } + return bReturn; + } + + public static bool operator !=(Velocity left, Velocity right) + { + return !(left == right); + } + + + public static bool operator <(Velocity left, Velocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Velocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Velocity"); + + return (left._velocity < right._velocity); + } + + + public static bool operator >(Velocity left, Velocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Velocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Velocity"); + + return (left._velocity > right._velocity); + } + + + public static bool operator <=(Velocity left, Velocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Velocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Velocity"); + + return (left._velocity <= right._velocity); + } + + + public static bool operator >=(Velocity left, Velocity right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Velocity"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Velocity"); + + return (left._velocity >= right._velocity); + } + + #endregion + + #region operators with other classes + + /// + /// Implements the operator * for Length = Velocity * PrecisionTimeSpan + /// + /// The velocity. + /// The time. + /// + /// Length + /// + + public static Length operator *(Velocity velocity, PrecisionTimeSpan time) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot multiply a null Velocity"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot multiply a null PrecisionTimeSpan"); + + return Length.FromMeters(velocity.MetersPerSec * time.Seconds); + } + + /// + /// Implements the operator * for Length = PrecisionTimeSpan * Velocity + /// + /// The time. + /// The velocity. + /// + /// Length + /// + + public static Length operator *(PrecisionTimeSpan time, Velocity velocity) + { + if (null == time) + throw new ArgumentNullException("time", "Cannot divide a null PrecisionTimeSpan"); + + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide by a null Velocity"); + + if (0.0 == velocity.MetersPerSec) + throw new DivideByZeroException("Cannot divide Time Span by 0 Velocity"); + + return Length.FromMeters(time.Seconds * velocity.MetersPerSec); + } + + /// + /// Implements the operator * for Acceleration = Velocity / PrecisionTimeSpan + /// + /// The velocity. + /// The time. + /// + /// Acceleration + /// + + public static Acceleration operator /(Velocity velocity, PrecisionTimeSpan time) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide a null Velocity"); + + if (null == time) + throw new ArgumentNullException("time", "Cannot divide by a null PrecisionTimeSpan"); + + if (0.0 == time.Milliseconds) + throw new DivideByZeroException("Cannot divide Velocity by 0 Time Span"); + + return Acceleration.FromMetersPerSecSqrd(velocity.MetersPerSec / time.Seconds); + } + + /// + /// Implements the operator * for PrecisionTimeSpan = Velocity / Acceleration + /// + /// The velocity. + /// The acceleration. + /// + /// PrecisionTimeSpan + /// + + public static PrecisionTimeSpan operator /(Velocity velocity, Acceleration acceleration) + { + if (null == velocity) + throw new ArgumentNullException("velocity", "Cannot divide a null Velocity"); + + if (null == acceleration) + throw new ArgumentNullException("acceleration", "Cannot divide by a null Acceleration"); + + if (0.0 == acceleration.MetersPerSecSqrd) + throw new DivideByZeroException("Cannot divide Velocity by 0 Acceleration"); + + return PrecisionTimeSpan.FromSeconds(velocity.MetersPerSec / acceleration.MetersPerSecSqrd); + } + + #endregion + + #region parsing + + public static Velocity Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Velocity value) + { + try + { + value = Velocity.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/Common/Raytheon.Common/Units/Voltage.cs b/Source/TSRealLib/Common/Raytheon.Common/Units/Voltage.cs new file mode 100644 index 0000000..cfa92d0 --- /dev/null +++ b/Source/TSRealLib/Common/Raytheon.Common/Units/Voltage.cs @@ -0,0 +1,356 @@ +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; + +namespace Raytheon.Units +{ + /// + /// This class represents a voltage. + /// + /// It has no constructors. Instead, it provides multiple methods for creating objects of this + /// type. Those methods are of the form FromXXX, where XXX is a unit (e.g. FromVolts). + /// + /// Properties (e.g. Volts) are provided to convert the value to other units and return + /// as type double. + /// + /// Methods (operator overloads) are provided to perform calculations with related types (e.g. + /// Current, Resistance). + /// + [Serializable] + [DataContract] + public class Voltage + { + public enum Unit + { + Volts, + Millivolts + } + + public static IDictionary> UnitAbbreviations = new Dictionary>() + { + {Unit.Volts, new List(){ "V" } }, + {Unit.Millivolts, new List(){ "mV" } }, + }; + + private const Unit DefaultUnits = Unit.Volts; + + [DataMember(Name = "Voltage", IsRequired = true)] + private double _voltage; // volts + + // map: unit => abbreviation, conversion method and property + private static IDictionary> _unitInfo = new Dictionary>() + { + { Unit.Volts, new UnitInfo(UnitAbbreviations[Unit.Volts], FromVolts, typeof(Voltage).GetProperty("Volts").GetGetMethod()) }, + { Unit.Millivolts, new UnitInfo(UnitAbbreviations[Unit.Millivolts], FromMillivolts, typeof(Voltage).GetProperty("Millivolts").GetGetMethod()) } + }; + + /// + /// Prevents a default instance of the class from being created. + /// Use FromXXX methods to create objects of this type. + /// + /// No one should be calling this, it is only here to prevent users from creating default object + private Voltage() + { + throw new InvalidOperationException("No one should be calling this, it is only here to prevent users from creating default object"); + } + + /// + /// ctor used by this class to create objects in FromXXX methods + /// + /// The voltage - volts. + private Voltage(double voltage) + { + _voltage = voltage; + } + + #region conversion properties + + public double Volts + { + get { return _voltage; } + } + + + public double Millivolts + { + get { return _voltage * 1000; } + } + + #endregion + + #region creation methods + + /// + /// Returns Voltage object interpreting passed value as volts + /// + /// volts + /// + public static Voltage FromVolts(double volts) + { + return new Voltage(volts); + } + + /// + /// Returns Voltage object interpreting passed value as millivolts + /// + /// millivolts + /// + + + public static Voltage FromMillivolts(double millivolts) + { + return new Voltage(millivolts / 1000); + } + + #endregion + + public override bool Equals(object obj) + { + Voltage v = obj as Voltage; + + return (v == null) ? false : (this._voltage == v._voltage); + } + + public override int GetHashCode() + { + return _voltage.GetHashCode(); + } + + #region binary operators + + // not implementing %, &, |, ^, <<, >> + + + public static Voltage operator +(Voltage left, Voltage right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot add a null Voltage"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot add null Voltage"); + + return new Voltage(left._voltage + right._voltage); + } + + + public static Voltage operator -(Voltage left, Voltage right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot subtract a null Voltage"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot subtract a null Voltage"); + + return new Voltage(left._voltage - right._voltage); + } + + + public static Voltage operator *(Voltage voltage, double scalar) + { + if (null == voltage) + throw new ArgumentNullException("voltage", "Cannot multiply a null Voltage"); + + return new Voltage(voltage._voltage * scalar); + } + + + public static Voltage operator *(double scalar, Voltage voltage) + { + if (null == voltage) + throw new ArgumentNullException("voltage", "Cannot multiply a null Voltage"); + + return new Voltage(scalar * voltage._voltage); + } + + + public static Voltage operator /(Voltage voltage, double scalar) + { + if (null == voltage) + throw new ArgumentNullException("voltage", "Cannot divide a null Voltage"); + + if (0.0 == scalar) + throw new DivideByZeroException("Cannot divide Voltage by 0"); + + return new Voltage(voltage._voltage / scalar); + } + + #endregion + + #region comparison operators + + public static bool operator ==(Voltage left, Voltage right) + { + bool bReturn = false; + if (object.ReferenceEquals(left, null)) + { + if (object.ReferenceEquals(right, null)) + { + //both are null, so we are == + bReturn = true; + } + } + else + { + if (!object.ReferenceEquals(left, null) && + !object.ReferenceEquals(right, null)) + { + bReturn = left._voltage == right._voltage; + } + } + return bReturn; + } + + public static bool operator !=(Voltage left, Voltage right) + { + return !(left == right); + } + + + public static bool operator <(Voltage left, Voltage right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Voltage"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Voltage"); + + return (left._voltage < right._voltage); + } + + + public static bool operator >(Voltage left, Voltage right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Voltage"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Voltage"); + + return (left._voltage > right._voltage); + } + + + public static bool operator <=(Voltage left, Voltage right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Voltage"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Voltage"); + + return (left._voltage <= right._voltage); + } + + + public static bool operator >=(Voltage left, Voltage right) + { + if (null == left) + throw new ArgumentNullException("left", "Cannot compare null Voltage"); + + if (null == right) + throw new ArgumentNullException("right", "Cannot compare null Voltage"); + + return (left._voltage >= right._voltage); + } + + #endregion + + #region operators with non-Voltage classes + + /// + /// Implements the operator * for Current = Voltage / Resistance + /// + /// The voltage. + /// The resistance. + /// + /// Current + /// + + public static Current operator /(Voltage voltage, Resistance resistance) + { + if (null == voltage) + throw new ArgumentNullException("voltage", "Cannot divide a null Voltage"); + + if (null == resistance) + throw new ArgumentNullException("resistance", "Cannot divide by a null Resistance"); + + if (0.0 == resistance.Ohms) + throw new DivideByZeroException("Cannot divide Voltage by 0 Resistance"); + + return Current.FromAmps(voltage.Volts / resistance.Ohms); + } + + /// + /// Implements the operator * for Resistance = Voltage / Current + /// + /// The voltage. + /// The current. + /// + /// Resistance + /// + + public static Resistance operator /(Voltage voltage, Current current) + { + if (null == voltage) + throw new ArgumentNullException("voltage", "Cannot divide a null Voltage"); + + if (null == current) + throw new ArgumentNullException("current", "Cannot divide by a null Current"); + + if (0.0 == current.Amps) + throw new DivideByZeroException("Cannot divide Voltage by 0 Current"); + + return Resistance.FromOhms(voltage.Volts / current.Amps); + } + + #endregion + + #region parsing + + public static Voltage Parse(string s) + { + return Common.Parse(s, _unitInfo); + } + + public static bool TryParse(string s, out Voltage value) + { + try + { + value = Voltage.Parse(s); + return true; + } + catch (Exception) + { + value = null; + return false; + } + } + + #endregion + + /// + /// Returns a string appended with default units (e.g. "1.23 m/sec^2"). + /// + /// + /// A string that represents this instance + /// + public override string ToString() + { + return ToString(DefaultUnits); + } + + /// + /// overload that returns a string appended with specified units (e.g. "1.23 ft/sec^2"). + /// + /// + /// + public string ToString(Unit units) + { + double value = (double)_unitInfo[units].PropertyGetter.Invoke(this, null); + + return $"{value} {_unitInfo[units].Abbreviation[0]}"; + } + } +} diff --git a/Source/TSRealLib/HAL/ImplementationMaster/Raytheon.Instruments.Implementation/Raytheon.Instruments.Implementation.csproj b/Source/TSRealLib/HAL/ImplementationMaster/Raytheon.Instruments.Implementation/Raytheon.Instruments.Implementation.csproj new file mode 100644 index 0000000..2ef8391 --- /dev/null +++ b/Source/TSRealLib/HAL/ImplementationMaster/Raytheon.Instruments.Implementation/Raytheon.Instruments.Implementation.csproj @@ -0,0 +1,35 @@ + + + + net472 + Library + Raytheon.Instruments.Implementation + Implementation Master + Packages all instrument implementation assemlbies into one package + + + + + + 1.0.0 + + + + NU1603 + + + + + + + true + lib\$(TargetFramework) + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/ImplementationMaster/Raytheon.Instruments.Implementation/readme.txt b/Source/TSRealLib/HAL/ImplementationMaster/Raytheon.Instruments.Implementation/readme.txt new file mode 100644 index 0000000..eb6b635 --- /dev/null +++ b/Source/TSRealLib/HAL/ImplementationMaster/Raytheon.Instruments.Implementation/readme.txt @@ -0,0 +1,6 @@ +This implementation master project will create a nuget package that includes all the assemblies of all the instrument implementations. +So by including this package, one has access to all assemblies of all instrument implementations. No need to include individual package of each instrument implementation. + +When creating a new implementation for an instrument, make sure that this project depends on that new project so that it builds before this project builds by going to the project dependencies and select all the Implementations that this project depends on. + +No need to depend on Sim instrument. Since each instrument implementation must reference the appropriate Sim instrument. \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceInstrument.cs b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceInstrument.cs new file mode 100644 index 0000000..f8bd962 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceInstrument.cs @@ -0,0 +1,1113 @@ +// ********************************************************************************************************** +// BITCOEDeviceInstrument.cs +// 6/21/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using Raytheon.Instruments.MessagingUtilities; +using System.Xml.XPath; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Linq; +using System.Threading; +using Raytheon.Common; +using Raytheon.Instruments.coeCSharp; +using Raytheon.Instruments.Exceptions; +using System.Collections.Concurrent; +using static Raytheon.Instruments.MessagingUtilities.Message; +using System.IO; +using System.Reflection; +using System.Globalization; +using System.Runtime.CompilerServices; +using NLog; + +[assembly: InternalsVisibleTo("BITCOEDeviceNode.Tests")] +namespace Raytheon.Instruments +{ + /// + /// This device supports different ways of communicating with other COE nodes + /// TCP + /// UDP + /// Serial + /// + public enum DriverType + { + Undefined, + TCP, + UDP, + Serial + }; + + /// + /// Implementation of the IBit interface + /// + public class BITCOEDeviceInstrument : IBit + { + /// + /// Nlog logger + /// + private readonly ILogger _logger; + + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + /// + /// reference to the main wrapper class for Common Operating Environment + /// + private readonly coe _coe; + + /// + /// COE endpoint + /// + private coeEndpoint _endpoint; + + /// + /// cancellation token for stopping reading thread + /// + private CancellationTokenSource _cancellationTokenSource = null; + + /// + /// collection of the messages received + /// + private readonly Dictionary>> _messages; + + /// + /// UDP, TCP, Serial or Undefined + /// + private DriverType _driverType; + + /// + /// dictionary of options when initializing COE endpoint and router + /// + private readonly Dictionary>> _options = new Dictionary>>(); + + /// + /// used for initialization of the endpoint + /// + private uint _maxMessageSize; + private uint _epQueueDepth; + + /// + /// Number of milliseconds to wake up and check the message when receiving + /// + private int _checkForMessageIntervalMs; + + /// + /// collection of all labels with message names per every XML file + /// + private readonly Dictionary> _icds = new Dictionary>(); + + /// + /// collection of response labels or messages that COE endpoint should be registered for + /// + private readonly List _responseLabels = new List(); + + /// + /// collection of message XML documents (processed XML files) used in COE communications + /// + private readonly Dictionary _xmlDocs = new Dictionary(); + + /// + /// when set to true the instrument will check every value and if empty + /// will populate it with the default value + /// + private bool _alwaysSendDefaults; + + /// + /// instrument constructor + /// + public BITCOEDeviceInstrument(string name, IConfigurationManager configurationManager, DriverType driverType = DriverType.Undefined, ILogger logger = null) + { + Info = new InstrumentMetadata + { + ModelNumber = "COECommDevice" + }; + + if (logger == null) + logger = LogManager.GetCurrentClassLogger(); + + _logger = logger; + + Status = State.Uninitialized; + DetailedStatus = "COE Uninitialized"; + + Name = name; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + if (configurationManager == null) + { + _logger.Error($"Cannot create {Name} without a configuration manager"); + return; + } + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _messages = new Dictionary>>(); + + _driverType = driverType; + + _coe = new coe(); + } + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + + public bool ClearErrors() + { + return true; + } + + /// + /// Initializes COE instrument + /// + public void Initialize() + { + _logger.Trace($"{Name}({_driverType}) Initializing..."); + + if (_driverType == DriverType.Undefined) + _driverType = _configuration.GetConfigurationValue("Parameters", "DriverType", "TCP"); + + _alwaysSendDefaults = _configuration.GetConfigurationValue("Parameters", "AlwaysSendDefaults", false); + + _options.Clear(); + _options.Add("ROUTER_CONFIG", new List> + { + { new KeyValuePair("NODE_ID", _configuration.GetConfigurationValue("ROUTER_CONFIG", "NODE_ID", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_STATE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_STATE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_LABEL_MESSAGE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_LABEL_MESSAGE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_BRIDGE_REGISTRATION", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_BRIDGE_REGISTRATION", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_ROUTER_DATABASE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_ROUTER_DATABASE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("BUFFER_SIZE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "BUFFER_SIZE", "256")) }, + { new KeyValuePair("ENABLE_REGISTRATION_MESSAGES", _configuration.GetConfigurationValue("ROUTER_CONFIG", "ENABLE_REGISTRATION_MESSAGES", "1")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + }); + + _options.Add("ROUTER_PROTOCOL_CONFIG", new List> + { + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("ROUTER_PROTOCOL_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("ROUTER_PROTOCOL_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("ROUTER_PROTOCOL_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + }); + + var poolEntry = _configuration.GetConfigurationValue("ROUTER_BUFFER_POOLS", "POOL_ENTRY", "100,32|50,128|100,384|150,1536|10,65535"); + if (!string.IsNullOrEmpty(poolEntry)) + { + var poolEntries = poolEntry.Split('|'); + if (poolEntries.Any()) + { + var entries = new List>(); + foreach (var entry in poolEntries) + { + entries.Add(new KeyValuePair("POOL_ENTRY", entry)); + } + _options.Add("ROUTER_BUFFER_POOLS", entries); + } + } + + _options.Add("BASIC_REGISTRATION_CONFIG", new List> + { + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND_BUFFER", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_SEND_BUFFER", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV_BUFFER", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_RECV_BUFFER", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_STATE", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_STATE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_PING_SEND", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_PING_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_PING_RECV", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_PING_RECV", "0")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + }); + + switch (_driverType) + { + case DriverType.UDP: + _options.Add("UDP_MEDIA_BINDING_CONFIG", new List> + { + { new KeyValuePair("LOCAL_IP_ADDRESS", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "LOCAL_IP_ADDRESS", "127.0.0.1")) }, + { new KeyValuePair("REMOTE_IP_ADDRESS", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "REMOTE_IP_ADDRESS", "127.0.0.1")) }, + { new KeyValuePair("LOCAL_SEND_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "LOCAL_SEND_PORT", "32010")) }, + { new KeyValuePair("LOCAL_RECV_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "LOCAL_RECV_PORT", "32020")) }, + { new KeyValuePair("REMOTE_SEND_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "REMOTE_SEND_PORT", "32011")) }, + { new KeyValuePair("REMOTE_RECV_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "REMOTE_RECV_PORT", "32021")) }, + { new KeyValuePair("RECV_TIMEOUT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "RECV_TIMEOUT", "200")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("MTU_SIZE", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "MTU_SIZE", "1472")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + { new KeyValuePair("THREAD_NAME", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "THREAD_NAME", "UDP_MB_RCV")) }, + }); + break; + + case DriverType.TCP: + _options.Add("TCP_MEDIA_BINDING_CONFIG", new List> + { + { new KeyValuePair("LOCAL_PORT", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "LOCAL_PORT", "9990")) }, + { new KeyValuePair("NUM_PORTS", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "NUM_PORTS", "32")) }, + { new KeyValuePair("NUM_DYNAMIC_NODES", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "NUM_DYNAMIC_NODES", "32")) }, + { new KeyValuePair("SERVER_ADDRESS", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "SERVER_ADDRESS", "127.0.0.1:9990")) }, + { new KeyValuePair("UDP_TX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "UDP_TX_BUFFER_SIZE", "5000")) }, + { new KeyValuePair("UDP_RX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "UDP_RX_BUFFER_SIZE", "32768")) }, + { new KeyValuePair("TCP_TX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TCP_TX_BUFFER_SIZE", "5000")) }, + { new KeyValuePair("TCP_RX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TCP_RX_BUFFER_SIZE", "4096")) }, + { new KeyValuePair("PACKET_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "PACKET_SIZE", "5128")) }, + { new KeyValuePair("TCP_SELECT_VALUE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TCP_SELECT_VALUE", "1")) }, + { new KeyValuePair("DISABLE_NAG_DELAY", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISABLE_NAG_DELAY", "1")) }, + { new KeyValuePair("TIMER_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TIMER_RATE", "1000")) }, + { new KeyValuePair("CONNECT_KA_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "CONNECT_KA_RATE", "1")) }, + { new KeyValuePair("RECV_KA_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_KA_RATE", "1")) }, + { new KeyValuePair("SERVER_CONNECT_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "SERVER_CONNECT_RATE", "1")) }, + { new KeyValuePair("RECV_THREAD_STACK_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_STACK_SIZE", "4096")) }, + { new KeyValuePair("RECV_THREAD_PRIORITY", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_PRIORITY", "0")) }, + { new KeyValuePair("RECV_THREAD_AFFINITY", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_AFFINITY", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND_BUFFER", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_UDP_RECV", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_UDP_RECV", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_UDP_RECV_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_UDP_RECV_BUFFER", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_TCP_RECV", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_TCP_RECV", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_TCP_RECV_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_TCP_RECV_BUFFER", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV_BUFFER", "1")) }, + }); + break; + + case DriverType.Serial: + _options.Add("SERIAL_MEDIA_BINDING_CONFIG", new List> + { + { new KeyValuePair("DEVICE_NAME", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DEVICE_NAME", "\\\\.\\COM1")) }, + { new KeyValuePair("BAUD_RATE", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "BAUD_RATE", "9600")) }, + { new KeyValuePair("DATA_BITS", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DATA_BITS", "8")) }, + { new KeyValuePair("STOP_BITS", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "STOP_BITS", "1")) }, + { new KeyValuePair("PARITY", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "PARITY", "0")) }, + { new KeyValuePair("FLOW_CONTROL", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "FLOW_CONTROL", "0")) }, + { new KeyValuePair("MTU_SIZE", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "MTU_SIZE", "256")) }, + { new KeyValuePair("RECV_PROCESSING_DELAY", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "RECV_PROCESSING_DELAY", "100")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + }); + break; + + default: + _logger.Error($"{Name}({_driverType}) Configured driver type not valid"); + break; + } + + _maxMessageSize = _configuration.GetConfigurationValue("Parameters", "MaxMessageSize", "5000"); + _epQueueDepth = _configuration.GetConfigurationValue("Parameters", "EPQueueDepth", "5000"); + _checkForMessageIntervalMs = _configuration.GetConfigurationValue("Parameters", "CheckForMessageIntervalMs", "100"); + + var responseLabels = _configuration.GetConfigurationListValue("ResponseMessageIds", "ResponseLabel", new List { "1", "2" }); + + var bitFilePaths = _configuration.GetConfigurationListValue("BitFilePaths", "FilePath", new List { "File1", "File2" }); + + _xmlDocs.Clear(); + foreach (var path in bitFilePaths) + { + _xmlDocs.Add(path, new MessageXmlDocument(path, _logger)); + } + + _icds.Clear(); + foreach (var path in bitFilePaths) + { + _icds.Add(path, ProcessFileForNamesAndLabels(path)); + } + + foreach (var strLabel in responseLabels) + { + uint label = GetLabelFromMessageId(strLabel); + if (label > 0) + _responseLabels.Add(label); + } + + DetailedStatus = "COE Initialized"; + Status = State.Ready; + } + + /// + /// performs self-test + /// + /// + public SelfTestResult PerformSelfTest() + { + _logger.Trace($"{Name}({_driverType}) Performing Self Test..."); + + // TODO implement method + return SelfTestResult.Pass; + } + + /// + /// Resets COE device comms + /// + /// + public void Reset() + { + _logger.Trace($"{Name}({_driverType}) Resetting..."); + + Close(); + + Open(); + } + + /// + /// Shuts down COE device + /// + public void Shutdown() + { + _logger.Trace($"{Name}({_driverType}) Shutting Down..."); + try + { + Close(); + //coe.UnloadImportedDll("coeWindows-shared.dll"); + } + catch (Exception ex) + { + _logger.Error(ex, $"{Name}({_driverType}) Error while closing"); + } + } + + #region IBit functions + /// + /// Opens COE connection + /// + /// + public void Open() + { + _logger.Trace($"{Name}({_driverType}) Opening..."); + + try + { + switch (_driverType) + { + case DriverType.TCP: + + if (_coe.tcp_media_binding_configure(_options, _logger) != coe.Status.SUCCESS) + { + _logger.Error($"{Name}({_driverType}) COE TCP media binding initialization failure.\nTry checking your connection configuration.\nYou could have a port collision."); + Status = State.CommunicationFailure; + throw new BitNotConnectedException($"{Name}({_driverType}) COE TCP media binding initialization failure"); + } + _logger.Trace($"{Name}({_driverType}) COE TCP media binding initialization, {_coe.ProtocolCmitName}"); + break; + case DriverType.UDP: + if (_coe.udp_media_binding_configure(_options, _logger) != coe.Status.SUCCESS) + { + _logger.Error($"{Name}({_driverType}) COE UDP media binding initialization failure.\nTry checking your connection configuration.\nYou could have a port collision."); + Status = State.CommunicationFailure; + throw new BitNotConnectedException($"{Name}({_driverType}) COE UDP media binding initialization failure"); + } + _logger.Trace($"{Name}({_driverType}) COE UDP media binding initialization, Local: {_coe.ProtocolCmitName} Remote: {_coe.ProtocolName}"); + break; + case DriverType.Serial: + if (_coe.serial_media_binding_configure(_options, _logger) != coe.Status.SUCCESS) + { + _logger.Error($"{Name}({_driverType}) COE Serial media binding initialization failure.\nTry checking your connection configuration.\nYou could have a port collision."); + Status = State.CommunicationFailure; + throw new BitNotConnectedException($"{Name}({_driverType}) COE Serial media binding initialization failure"); + } + _logger.Trace($"{Name}({_driverType}) COE Serial media binding initialization, {_coe.ProtocolCmitName}"); + break; + default: + _logger.Error($"{Name}({_driverType}) Configured driver type not valid"); + throw new BitNotConnectedException($"{Name}({_driverType}) Configured driver type not valid"); + } + + foreach (var item in _options) + { + _logger.Trace($"{item.Key}:"); + foreach (var pair in item.Value) + { + _logger.Trace(string.Format("{0,-50} {1, -40}", pair.Key, pair.Value)); + } + } + + } + catch (Exception ex) + { + _logger.Error(ex); + Status = State.CommunicationFailure; + DetailedStatus = "Unable to Open"; + throw; + } + + try + { + _coe.SetConnected(true); + + //_endpoint = new coeEndpoint(_maxMessageSize, _epQueueDepth, _coe.Router); + _endpoint = new coeEndpoint(_maxMessageSize, _epQueueDepth); + + _logger.Info($"{Name}({_driverType}) Endpoint Created, Max Message Size: {_maxMessageSize}, Queue Depth: {_epQueueDepth}"); + + foreach (var item in _responseLabels) + { + var fileName = WhichFileContainsTheLabel(item); + if (!string.IsNullOrEmpty(fileName)) + { + var msgName = _icds[fileName][item]; + if (!string.IsNullOrEmpty(msgName)) + { + _endpoint.Register(item); + _logger.Debug($"{Name}({_driverType}) Registering new message with the endpoint, {item}: {msgName}"); + } + else + { + _logger.Warn($"{Name}({_driverType}) Message with label {item} is not located in file {fileName}"); + } + } + else + { + _logger.Warn($"{Name}({_driverType}) Unable to locate label {item} in any of the XML files registered for COE device"); + } + } + + _cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => ReadMessages(_cancellationTokenSource.Token)); + + Status = State.Ready; + DetailedStatus = "Opened"; + } + catch (Exception ex) + { + Status = State.CommunicationFailure; + DetailedStatus = "Unable to Open"; + _logger.Error(ex); + throw; + } + } + + /// + /// Close COE endpoint + /// + /// + public void Close() + { + _logger.Trace($"{Name}({_driverType}) Closing ..."); + + Status = State.Uninitialized; + + _cancellationTokenSource?.Cancel(); + + Thread.Sleep(1000); + + if (_messages.Any()) + { + foreach (var queue in _messages) + { + while (queue.Value.TryDequeue(out Tuple throwAway)) + { + _logger.Warn($"Message {throwAway.Item2.Label} ({throwAway.Item2.XmlMessage.Name}) received at {throwAway.Item1:hh.mm.ss.fff} was unclaimed"); + } + } + } + + _messages.Clear(); + + _coe.SetConnected(false); + var status = _driverType == DriverType.TCP ? + _coe.TCP_media_binding_shutdown(_logger) : _driverType == DriverType.UDP ? + _coe.UDP_media_binding_shutdown(_logger) : _coe.SERIAL_media_binding_shutdown(_logger); + + if (status != coe.Status.SUCCESS) + { + _logger.Error($"{_driverType} media binding shutdown failure, status {status}"); + } + else + { + _logger.Debug($"{_driverType} shutdown was successful"); + } + + _endpoint?.Dispose(); + + _cancellationTokenSource?.Dispose(); + _cancellationTokenSource = null; + + DetailedStatus = "Closed"; + } + + /// + /// runs single BIT test request, no waiting for response + /// expecting user to run + /// + /// + /// + /// + /// + /// + public bool RunBIT(string messageId, uint timeoutInMs, IEnumerable> messageParams) + { + _logger.Trace($"{Name}({_driverType}) Running BIT for {messageId} with timeout {timeoutInMs} ..."); + + if (!_coe.IsConnected) + { + _logger.Error("Error sending COE message, COE not connected"); + throw new BitNotConnectedException(); + } + if (Status != State.Ready) + { + _logger.Warn("Exiting RunBIT due to status"); + throw new BitNotConnectedException(); + } + + var label = GetLabelFromMessageId(messageId); + + var path = WhichFileContainsTheLabel(label); + if (string.IsNullOrEmpty(path)) + { + var msg = $"Message Id {messageId} not found in any of the BIT files"; + _logger.Error(msg); + throw new BitParseException(msg); + } + + try + { + var message = GetOeMessageWithParameters(label, messageParams, path); + + _logger.Info("Sending ..."); + message.XmlMessage.SendToLog(EnumerationType.EXPANDED_FIELDS, MessageDirection.Out); + + var status = _endpoint.Send(message); + + if (status != coe.Status.SUCCESS) + { + _logger.Error($"Error sending COE message, error code: {status}"); + } + + return true; + } + catch (Exception ex) + { + _logger.Error(ex); + return false; + } + } + + /// + /// Runs a BIT and expects a result + /// + /// + /// + /// + /// + /// + /// + public BitTestResults RunBITWaitForResults(string messageIdOut, string messageIdIn, uint timeoutInMs, IEnumerable> messageParams) + { + _logger.Trace($"{Name}({_driverType}) Running BIT for {messageIdOut} and waiting for result {messageIdIn} with timeout {timeoutInMs}..."); + + if (!_coe.IsConnected) + { + _logger.Error("Error sending COE message, COE not connected"); + throw new BitNotConnectedException(); + } + + if (Status != State.Ready) + { + _logger.Warn("Exiting RunBITWaitForResults due to status"); + throw new BitNotConnectedException(); + } + + if (RunBIT(messageIdOut, timeoutInMs, messageParams)) + { + if (string.IsNullOrEmpty(messageIdIn)) + { + messageIdIn = "0"; + } + + string[] multipleIds = messageIdIn.Split(','); + + var totalWaitTimeMs = 0; + + BitTestResults results = null; + do + { + foreach (var id in multipleIds) + { + results = GetBITResults(id); + + if (results != null) + { + break; + } + } + + if (results != null || Status != State.Ready) + { + break; + } + else + { + Thread.Sleep(_checkForMessageIntervalMs); + totalWaitTimeMs += _checkForMessageIntervalMs; + } + + } while (results == null && totalWaitTimeMs < timeoutInMs); + + if (results != null) + { + _logger.Debug($"-- Successfully retrieved result message, totalWaitTimeMs = {totalWaitTimeMs}"); + return results; + } + else + throw new BitTimeoutException(); + } + else + { + return null; + } + } + + /// + /// Reads BIT results + /// + /// + /// + /// + public BitTestResults GetBITResults(string messageId) + { + if (!_coe.IsConnected) + { + _logger.Error("Error reading COE message, COE not connected"); + throw new BitNotConnectedException(); + } + + uint label = 0; + // empty string or zero means first available message from the top + if (!string.IsNullOrEmpty(messageId) && messageId != "0") + { + label = GetLabelFromMessageId(messageId); + if (label == 0) + { + _logger.Error($"{Name}({_driverType}) Unable to match message {messageId} with anything in the dictionary. Check your configuration"); + return null; + } + } + + string strLabel = label.ToString(); + + ConcurrentQueue> queue; + + lock (this) + { + queue = label == 0 ? + _messages.Any() ? _messages.FirstOrDefault().Value : null : + _messages.ContainsKey(strLabel) ? _messages[strLabel] : null; + } + + if (queue != null && queue.TryDequeue(out Tuple message)) + { + var oeMessage = message.Item2; + + if (queue.IsEmpty) + { + lock (this) + { + _messages.Remove(oeMessage.Label); + } + } + + // make a copy of the buffer + var xmlMessage = oeMessage.XmlMessage; + if (xmlMessage != null) + { + var results = new BitTestResults + { + Label = oeMessage.Label, + Time = message.Item1, + + // parse message result into list of results + Results = FromXmlToBitTestResults(xmlMessage) + }; + + return results; + } + else + { + var msg = $"Found a message with label {label}, but the Buffer is empty"; + _logger.Error(msg); + throw new BitParseException(msg); + } + } + else + { + // message not found + return null; + } + } + + #endregion + + #region Private Functions + + /// + /// keep reading messages and stash them in _messages dictionary with label and timestamp as a key + /// + /// + /// + private void ReadMessages(CancellationToken cancellationToken) + { + _logger.Debug($"{Name}({_driverType}) Starting to read messages."); + + try + { + while (!cancellationToken.IsCancellationRequested) + { + //_logger.Debug($"{Name}({_driverType}) Checking for messages..."); + var status = _endpoint.Wait(1000); + + if (status == coe.Status.SUCCESS) + { + _logger.Debug("Message Received..."); + + while (_endpoint.Peek(out uint label, out uint size, out int priority) == coe.Status.SUCCESS) + { + var hexLabel = $"0x{label:X}"; + _logger.Debug($"{Name}({_driverType}) Identified message by peeking... {label} ({hexLabel})"); + + var xmlDoc = WhichFileContainsTheLabel(label); + + var message = new OeMessage((int)size + 1) + { + XmlMessage = new Message(_xmlDocs[xmlDoc], label.ToString()) + }; + + status = _endpoint.Receive(message); + + if (status == coe.Status.SUCCESS) + { + _logger.Debug($"{Name}({_driverType}) Successfully read message... Label: {hexLabel} ({message.XmlMessage?.Name})"); + + message.XmlMessage.SendToLog(EnumerationType.EXPANDED_FIELDS, MessageDirection.In); + + ConcurrentQueue> queue; + + lock (this) + { + if (!_messages.ContainsKey(message.Label)) + { + _messages.Add(message.Label, new ConcurrentQueue>()); + } + queue = _messages[message.Label]; + } + + queue.Enqueue(new Tuple(DateTime.Now, message)); + } + else + { + _logger.Error($"{Name}({_driverType}) Endpoint Receive Failed. Status = {status}"); + } + } + } + // If not timeout and no cancellation requested + else if (status != coe.Status.FAILED_TIMEOUT && !cancellationToken.IsCancellationRequested) + { + _logger.Error($"{Name}({_driverType}) Event Flag Wait Failed. Status = {status}"); + } + } + _logger.Debug($"{Name}({_driverType}) Stopping to read messages. Cancellation was requested."); + } + catch (Exception ex) + { + _logger.Error(ex); + } + } + + /// + /// if message id can be converted to uint returns the value + /// otherwise returns the related label from the message id by dictionary lookup + /// + /// + /// + private uint GetLabelFromMessageId(string messageId) + { + uint labelId = FromStringToUint(messageId); + + if (labelId == 0) + { + foreach (var file in _icds) + { + var item = file.Value.FirstOrDefault(l => l.Value == messageId); + if (!string.IsNullOrEmpty(item.Value)) + return item.Key; + } + } + + return labelId; + } + /// + /// return file path for the file that contains the label + /// + /// + /// + private string WhichFileContainsTheLabel(uint label) + { + foreach (var item in _icds) + { + if (item.Value.Keys.Contains(label)) + { + return item.Key; + } + } + return string.Empty; + } + + /// + /// convert from Message to list of BItTestResult fields + /// + /// + /// + private IList FromXmlToBitTestResults(Message message) + { + if (message == null) + return null; + + var result = FromMessageArrayToBitResult(message.MessageDataArray); + + return result; + } + + /// + /// recursive function for getting results out + /// + /// + /// + private IList FromMessageArrayToBitResult(MessageData[] messages) + { + if (messages == null || messages.Length == 0) + return null; + + var result = new List(); + + foreach (var item in messages) + { + result.Add(FromMessageDataToBitTestResult(item)); + + if (item.MessageArray != null && item.MessageArray.Length > 0) + { + var moreResults = FromMessageArrayToBitResult(item.MessageArray); + result.AddRange(moreResults); + } + } + + return result; + } + + /// + /// copy message data fields to BitTestResult + /// + /// + /// + private static BitTestResult FromMessageDataToBitTestResult(MessageData from) + { + if (from == null) + return null; + + return new BitTestResult + { + FieldArrayValue = from.FieldArrayValue, + FieldBitValue = from.FieldBitValue, + FieldDefaultValue = from.FieldDefaultValue, + FieldInstruType = from.FieldInstruType, + FieldMaxValue = from.FieldMaxValue, + FieldMinValue = from.FieldMinValue, + FieldName = from.FieldName, + FieldType = from.FieldType, + FieldValue = from.FieldValue, + Variable = from.Variable, + MaxOffset = from.MaxOffset, + MinOffset = from.MinOffset, + VerifyType = from.VerifyType, + IsSelected = from.isSelected, + IsArray = from.isArray, + IsStructure = from.isStructure, + IsArrayOfStructures = from.isArrayOfStructures, + IsEnum = from.isEnum, + UsesRegister = from.usesRegister, + IsValid = from.isValid, + UseRange = from.useRange, + ArrayLength = from.arrayLength, + ImageWidth = from.imageWidth, + ImageHeight = from.imageHeight, + ImagePixelSize = from.imagePixelSize, + BitMask = from.bitMask, + Expanded = from.expanded, + Depth = from.depth, + ImageBuffer = from.imageBuffer?.ToArray(), + ImageBufferSize = from.imageBufferSize, + }; + } + + /// + /// Build OeMessage from messageId and provided parameters + /// + /// + /// + /// + private OeMessage GetOeMessageWithParameters(uint messageId, IEnumerable> messageParams, string bitFilePath) + { + var messageName = _icds[bitFilePath][messageId]; + var message = new OeMessage(new Message(messageName, new MessageXmlDocument(bitFilePath, _logger))); + + if (messageParams != null) + { + message.XmlMessage.MessageDataArray = PopulateParameters(message.XmlMessage.MessageDataArray, 0, messageParams); + } + + return message; + } + + /// + /// recursive function to populate parameters + /// + /// message data array + /// indicates how deep in the tree we are populating parameters + /// message parameters + /// + internal MessageData[] PopulateParameters(MessageData[] data, int level, IEnumerable> messageParams) + { + // only get parameters from the same level + var levelParams = messageParams.Where(m => m.Key.Where(c => c == '.' || c == ']').Count() == level); + + foreach (var item in data) + { + if (item.FieldName.StartsWith("$")) + continue; + + var messageParam = levelParams.FirstOrDefault(m => m.Key.EndsWith(item.FieldName)); + if (!string.IsNullOrEmpty(messageParam.Key) && !string.IsNullOrEmpty(messageParam.Value)) + { + item.FieldValue = messageParam.Value; + } + // always send defaults means that even if parameter was not provided use the default value to populate field value + else if (_alwaysSendDefaults) + { + item.FieldValue = item.FieldDefaultValue; + } + + // if there are more levels, update recursively + if (item.MessageArray != null && item.MessageArray.Length > 0) + item.MessageArray = PopulateParameters(item.MessageArray, level + 1, messageParams); + } + + return data; + } + + /// + /// reads xml file and extracts all message names with associated labels + /// + /// + /// + private Dictionary ProcessFileForNamesAndLabels(string filePath) + { + var doc = new XPathDocument(filePath); + + XPathNavigator node = doc.CreateNavigator(); + XPathNodeIterator nodeset = node.Select("interface/message"); + + var result = new Dictionary(); + + while (nodeset.MoveNext()) + { + var children = nodeset.Current.SelectChildren(XPathNodeType.Element); + if (children.Count > 0) + { + string strName = string.Empty; + string strLabel = string.Empty; + + while (children.MoveNext()) + { + if (children.Current.Name == "name") + { + strName = children.Current.Value; + if (!string.IsNullOrEmpty(strName)) + strName = strName.Trim(); + } + else if (children.Current.Name == "label") + { + strLabel = children.Current.Value; + if (!string.IsNullOrEmpty(strLabel)) + strLabel = strLabel.Trim(); + } + } + + uint iLabel = FromStringToUint(strLabel); + + if (!string.IsNullOrEmpty(strName) && iLabel > 0) + { + result.Add(iLabel, strName); + } + } + } + return result; + } + + /// + /// converts from string representation of a label to uint value + /// + /// + /// + private uint FromStringToUint(string data) + { + if (!string.IsNullOrEmpty(data)) + { + if (data.StartsWith("0x", StringComparison.CurrentCultureIgnoreCase) || data.StartsWith("&H", StringComparison.CurrentCultureIgnoreCase)) + { + if (uint.TryParse(data.Substring(2), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out uint uiValue)) + return uiValue; + } + else + { + if (uint.TryParse(data, out uint uiValuel)) + return uiValuel; + } + } + return 0; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceInstrumentFactory.cs b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceInstrumentFactory.cs new file mode 100644 index 0000000..b06fd25 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceInstrumentFactory.cs @@ -0,0 +1,143 @@ +// ********************************************************************************************************** +// BITCOEDeviceInstrumentFactory.cs +// 6/21/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "BITCOEDeviceInstrumentFactory")] + public class BITCOEDeviceInstrumentFactory : IInstrumentFactory + { + /// + /// + /// + private ILogger _logger; + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + private readonly DriverType _driverType; + + public BITCOEDeviceInstrumentFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public BITCOEDeviceInstrumentFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null, + [Import(AllowDefault = true)] DriverType driverType = DriverType.TCP) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _driverType = driverType; + _supportedInterfaces.Add(typeof(IBit)); + } + /// + /// + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new BITCOEDeviceInstrument(name, _configurationManager, _driverType, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new BITCOEDeviceInstrument(name, _configurationManager, _driverType, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceNode.csproj b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceNode.csproj new file mode 100644 index 0000000..1650624 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/BITCOEDeviceNode.csproj @@ -0,0 +1,39 @@ + + + + + net472 + Raytheon.Instruments.BITCOEDeviceNode + Specialized instrument implementation of IBit interface for running real time Build In Tests via COE + + + + 1.0.0 + true + + + + False + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/ConfigurationHelper.cs b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/ConfigurationHelper.cs new file mode 100644 index 0000000..3a82796 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/BITCOEDeviceNode/ConfigurationHelper.cs @@ -0,0 +1,135 @@ +// ********************************************************************************************************** +// ConfigurationHelper.cs +// 7/5/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Raytheon.Instruments +{ + /// + /// type conversion utility with a special case for enums + /// + public static class TypeConverter + { + public static T ChangeType(object value) + { + return typeof(T).IsEnum ? (T)Enum.Parse(typeof(T), value.ToString()) : (T)ChangeType(typeof(T), value); + } + + public static object ChangeType(Type t, object value) + { + System.ComponentModel.TypeConverter tc = TypeDescriptor.GetConverter(t); + return tc.ConvertFrom(value); + } + + public static void RegisterTypeConverter() where TC : System.ComponentModel.TypeConverter + { + TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC))); + } + } + + /// + /// Helper class contains extention fuctions for reading types other than strings from configuration, + /// as well as reading lists of values + /// + public static class ConfigurationHelper + { + /// + /// template function for reading different types from configuration + /// + /// + /// + /// + /// + /// + public static T GetConfigurationValue(this IConfiguration configuration, string section, string key, string defaultValue) + { + var tmpResult = configuration.GetConfigurationValue(section, key, defaultValue); + return !string.IsNullOrEmpty(tmpResult) ? TypeConverter.ChangeType(tmpResult) : default; + } + + /// + /// returns multivalue result (list of T) from configuration + /// + /// + /// + /// + /// + /// + public static List GetConfigurationListValue(this IConfiguration configuration, string section, string key, List defaultValue) + { + var tmpResult = configuration.GetXmlConfiguration(section); + if (string.IsNullOrEmpty(tmpResult)) + { + var xmlStr = new StringBuilder(); + xmlStr.Append($"<{key}s>"); + foreach (var item in defaultValue) + { + xmlStr.Append($"<{key}>"); + xmlStr.Append(item.ToString()); + xmlStr.Append($""); + } + xmlStr.Append($""); + + configuration.SetXmlConfiguration(section, xmlStr.ToString()); + return defaultValue; + } + else + { + var stringRes = BuildElementListFromXml(tmpResult, key); + return new List(stringRes.Select(x => TypeConverter.ChangeType(x))); + } + } + + /// + /// returns values from XML section converted to string list + /// + /// + /// + /// + private static List BuildElementListFromXml(string data, string key) + { + XElement doc = XElement.Parse(data); + IEnumerable xmlMessages = from m + in doc.Elements($"{key}s").Elements(key) + select m; + var messages = xmlMessages.Select(x => x.Value); + return messages?.ToList(); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/COEComm.csproj b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/COEComm.csproj new file mode 100644 index 0000000..e983530 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/COEComm.csproj @@ -0,0 +1,56 @@ + + + + + net472 + Raytheon.Instruments.COEComm + C# wrapper for the COE Windows, integrated real-time software operating environment designed for use in embedded systems + + + + 1.0.0 + true + + + + 1701;1702;NU1803 + + + + + + + + $(PrepareForRunDependsOn);CopyFilesTargetName + + + + build\R04.$(Configuration)\x86\coeWindows-shared.dll + build\R04.06.05.02\x86\coeWindows-shared.dll;build\R04.06.05.02\x86\coeWindows-sharedd.dll + + + + + lib\$(TargetFramework) + + PreserveNewest + PreserveNewest + True + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/BitFieldGeneric.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/BitFieldGeneric.cs new file mode 100644 index 0000000..384cb7c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/BitFieldGeneric.cs @@ -0,0 +1,218 @@ +// ********************************************************************************************************** +// BitFieldGeneric.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Instruments.MessagingUtilities +{ + // This is a generic class used to apply a bitfield to + // a value to get the desired value + class BitFieldGeneric where T : IConvertible + { + protected long m_Value; // This is the value being operated on + protected ulong m_Mask; + + public char ToChar() + { + return (char)m_Value; + } + + public sbyte ToSByte() + { + return (sbyte)m_Value; + } + + public short ToShort() + { + return (short)m_Value; + } + + public int ToInt() + { + return (int)m_Value; + } + + public long ToLong() + { + return (long)m_Value; + } + + public ushort ToUShort() + { + return (ushort)m_Value; + } + + public uint ToUInt() + { + return (uint)m_Value; + } + + public ulong ToULong() + { + return (ulong)m_Value; + } + + public BitFieldGeneric(T value, ulong bitMask) + { + m_Mask = bitMask; + try + { + m_Value = ApplyBitMask((ulong)value.ToInt64(null), bitMask); + } + catch + { + m_Value = ApplyBitMask(value.ToUInt64(null), bitMask); + } + } + + public BitFieldGeneric(string value, ulong bitMask) + { + m_Mask = bitMask; + + if(string.IsNullOrEmpty(value)) + { + value = "0"; + } + + if (Parse.Try(value, out m_Value) == true) + { + m_Value = PrepareWithBitMask(m_Value, bitMask); + } + else + { + throw new Exception("Unable to parse value = " + value); + } + } + + // count the number of 1 bits in a ulong + int BitCount(ulong x) + { + int n = 0; + if (x > 0) do ++n; while ((x &= x - 1) > 1); + return n; + } + + // Check to see if the MSB is set after accounting for + // the mask. If it is, then the number should be converted + // to display a negative number + public void ToSigned() + { + if (m_Mask > 0) + { + // See if the sign bit is set + int numbits = BitCount(m_Mask); + if (m_Value > (Math.Pow(2, numbits - 1))) + { + // If it is, take the two's complement + m_Value = (~m_Value) + 1; + + // Mask off the leading F's from the conversion + ulong mask = 1; + for (int i = 0; i < numbits - 1; i++) + { + mask = (mask << 1) + 1; + } + + m_Value = (long)(((ulong)m_Value) & mask); + + // Add the negative sign + m_Value = -m_Value; + } + } + } + + public override string ToString() + { + return m_Value.ToString(); + } + + public void BitOR(T value) + { + long orValue = value.ToInt64(null); + m_Value |= orValue; + } + + private long PrepareWithBitMask(long val, ulong bitMask) + { + ulong value = (ulong)val; + ulong mask = bitMask; + + if (bitMask != 0) + { + if ((mask & 1) != 1) + { + while (((mask >> 1) & 1) != 1) //shift mask to LSB + { + mask >>= 1; + } + + mask >>= 1; // one last shift not done by loop + } + + value &= mask; // ensure value is contained in the same # of bits as the mask + + // Shift the value back to its proper spot in the memory + while (mask != bitMask) + { + value <<= 1; + mask <<= 1; + } + } + return (long)value; + } + + private long ApplyBitMask(ulong val, ulong bitMask) + { + ulong value = val; + + if (bitMask != 0) // Apply the bit field + { + value &= bitMask; + + // Shift until the bitmask resides in the LSB + if ((bitMask & 1) != 1) + { + while (((bitMask >> 1) & 1) != 1) + { + value >>= 1; + bitMask >>= 1; + } + + // We need one more shift after leaving the while loop + value >>= 1; + } + } + return (long)value; + } + } + +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/BytePackingXml.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/BytePackingXml.cs new file mode 100644 index 0000000..cb1520e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/BytePackingXml.cs @@ -0,0 +1,502 @@ +// ********************************************************************************************************** +// BytePackingXml.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using System.Collections.Generic; +using System.Xml; +using System.Xml.XPath; + +namespace Raytheon.Instruments.MessagingUtilities +{ + // Takes an XML ICD and adds in nodes to represent the byte packing + // The padding added will be displayed in the tool as arrays of characters + internal class BytePackingXml : XmlDocument + { + private readonly int m_Packing = 8; + private readonly Dictionary m_ConstMap; + private readonly Dictionary m_SizeMap; + private readonly Dictionary m_PadMap; + + public BytePackingXml(string icdStr) : base() + { + // Create the dictionaries + m_ConstMap = new Dictionary(); + m_PadMap = new Dictionary(); + m_SizeMap = new Dictionary(); + + // Create an XML document from the string + LoadXml(icdStr); + + XPathNavigator node = CreateNavigator(); + //Get the type of packing + XPathNodeIterator nodeset = node.Select("/interface/packing"); + if (nodeset.MoveNext() == true) + { + if (!Parse.Try(nodeset.Current.Value.Trim(), out m_Packing)) + { + switch (nodeset.Current.Value.Trim()) + { + case "char": + case "1": + m_Packing = 1; + break; + case "short": + case "2": + m_Packing = 2; + break; + case "long": + case "4": + m_Packing = 4; + break; + case "double": + case "8": + default: + m_Packing = 8; + break; + } + } + } + + // Handle all of the constants + nodeset = node.Select("/interface/constant"); + while (nodeset.MoveNext()) + { + ProcessConstantNode(nodeset.Current); + } + + nodeset = node.Select("/interface/typedef"); + while (nodeset.MoveNext()) + { + ProcessTypedefNode(nodeset.Current); + } + + nodeset = node.Select("/interface/enum"); + while (nodeset.MoveNext()) + { + ProcessEnumerationNode(nodeset.Current); + } + + nodeset = node.Select("/interface/structure|/interface/message"); + while (nodeset.MoveNext()) + { + ProcessStructureNode(nodeset.Current); + } + + NormalizeIcdLabels(); + } + + // This function takes all of the messages in the ICD + // and converts the labels into decimal, so when we do + // a string lookup, they will all be in the same known format + private void NormalizeIcdLabels() + { + XPathNavigator navigator = CreateNavigator(); + XPathNodeIterator nodeset; + + nodeset = navigator.Select("/interface/message/label"); + while (nodeset.MoveNext()) + { + try + { + double dLabel = GetConstFromString(nodeset.Current.Value); + nodeset.Current.SetValue(((int)dLabel).ToString()); + } + catch + { + throw new Exception("Message Label, " + nodeset.Current.Value + ", can not be converted to an integer"); + } + } + } + + private void ProcessConstantNode(XPathNavigator node) + { + string name = ""; + string constStr = ""; + double constNum = 0; + + if (node.MoveToChild("name", "")) + { + name = node.Value.Trim(); + node.MoveToParent(); + } + if (node.MoveToChild("value", "")) + { + constStr = node.Value.Trim(); + if ((constStr.Length != 0) && (constStr[0] != '\"')) + { + constNum = GetConstFromString(constStr); + } + else + { + constNum = 0; + } + node.MoveToParent(); + } + + // Verify the correctnes of the tag + if ((name != "") && (constStr != "")) + { + AddItemToMap(m_ConstMap, name, constNum); + } + else + { + throw new Exception( + "ERROR: Constant Definition Incorrect - :" + name + + " :" + constStr); + } + } + + private void ProcessTypedefNode(XPathNavigator node) + { + string name = ""; + string type = ""; + int typeSize = 0; // Size of the item + int typePad = 0; //Size of the largest item to pad to + + if (node.MoveToChild("name", "")) + { + name = node.Value.Trim(); + node.MoveToParent(); + } + if (node.MoveToChild("value", "")) + { + type = node.Value.Trim(); + GetSizeFromType(type, out typeSize, out typePad); + node.MoveToParent(); + } + + // Verify the correctnes of the tag + if ((name != "") && (type != "")) + { + AddItemToMap(m_PadMap, name, typePad); + AddItemToMap(m_SizeMap, name, typeSize); + } + else + { + throw new Exception( + "ERROR: Typedef Definition Incorrect - :" + name + + " :" + type); + } + } + + private void ProcessEnumerationNode(XPathNavigator node) + { + string name; + double constNum = 0; + var constStr = string.Empty; + + if (node.MoveToChild("name", "")) + { + name = node.Value.Trim(); + AddItemToMap(m_PadMap, name, 4); + AddItemToMap(m_SizeMap, name, 4); + node.MoveToParent(); + } + else + { + throw new Exception("ERROR: Enumeration Definition Incorrect. No tag present."); + } + + XPathNodeIterator nodeSet = node.Select("item|enum_item"); + while (nodeSet.MoveNext()) + { + name = string.Empty; + + if ((nodeSet.Current.MoveToChild("name", "")) || + (nodeSet.Current.MoveToChild("item_name", ""))) + { + name = nodeSet.Current.Value.Trim(); + nodeSet.Current.MoveToParent(); + } + if (nodeSet.Current.MoveToChild("value", "")) + { + constStr = nodeSet.Current.Value.Trim(); + constNum = GetConstFromString(constStr); + nodeSet.Current.MoveToParent(); + } + + // Verify the correctnes of the tag + if ((name != "") && (constStr != "")) + { + AddItemToMap(m_ConstMap, name, constNum); + } + else + { + throw new Exception($"ERROR: Enumeration Item Definition Incorrect - : {name} : {constStr}"); + } + } + } + + private void ProcessStructureNode(XPathNavigator node) + { + string name; + + if (node.MoveToChild("name", "")) + { + name = node.Value.Trim(); + node.MoveToParent(); + } + else + { + throw new Exception("ERROR: Stucture/Message Definition Incorrect. No tag present."); + } + + int maxSize = 0; + int padCount = 0; + uint bitCount = 0; // Used to see how many bits have been processed. + int lastItemSize = 0; + + var nodeSet = node.Select("item|struct_item|msg_item"); + while (nodeSet.MoveNext()) + { + GetItemSize(nodeSet.Current, out int padSize, out int itemSize, out int reps, out uint bits); + if ((lastItemSize != itemSize) || ((bitCount + bits) > (uint)(itemSize * 8))) + { + bitCount = 0; // Size changed or bit rollover + } + + if (bitCount == 0) + { + padCount += AddPadding(node, nodeSet.Current, padSize, padCount); + + // Set maxSize + if (padSize > maxSize) + { + maxSize = padSize; + } + + // Keep up with the pad count + padCount += (itemSize * reps); + } + + lastItemSize = itemSize; + bitCount += bits; + } + + if (maxSize != 0) + { + // Add final padding + padCount += AddPadding(node, null, maxSize, padCount); + } + + AddItemToMap(m_PadMap, name, maxSize); + AddItemToMap(m_SizeMap, name, padCount); + } + + private void GetItemSize(XPathNavigator node, out int padSize, out int itemSize, out int reps, out uint bits) + { + string name = ""; + + if ((node.MoveToChild("name", "")) || + (node.MoveToChild("item_name", ""))) + { + name = node.Value.Trim(); + node.MoveToParent(); + } + + itemSize = -1; + padSize = -1; + reps = 1; + bits = 0; + + var nodeSet = node.Select("type"); + while (nodeSet.MoveNext()) + { + GetSizeFromType(nodeSet.Current.Value.Trim(), out padSize, out itemSize); + } + + nodeSet = node.Select("bits"); + if (nodeSet.MoveNext()) + { + bits = (uint)GetConstFromString(nodeSet.Current.Value.Trim()); + } + + nodeSet = node.Select("arrayLength|imageWidth|imageHeight"); + while (nodeSet.MoveNext()) + { + try + { + reps *= (int)GetConstFromString(nodeSet.Current.Value.Trim()); + } + catch (Exception e) + { + throw new Exception + (e.Message + " item name = \"" + name + "\", tag = <" + + nodeSet.Current.Name + ">."); + + } + } + + if ((itemSize == -1) || (padSize == -1)) + { + throw new Exception + ("ERROR: Item named " + name + "does not contain a tag."); + } + + if (bits == 0) + bits = (uint)padSize * 8; + } + + private double GetConstFromString(string constStr) + { + if ((constStr.Length > 0) && (constStr[0] == '\'')) + { + byte charData = (byte)constStr[1]; + constStr = charData.ToString(); + } + + if (Parse.Try(constStr, out double data) == false) + { + if (Parse.Try(constStr, out int iData) == false) + { + try + { + data = m_ConstMap[constStr]; + } + catch + { + throw new Exception("ERROR: ConstantValue - \"" + constStr + "\" does not resolve to a number."); + } + } + else + { + data = (double)iData; + } + } + return data; + } + + private void AddItemToMap(Dictionary map, string name, int value) + { + if (map.ContainsKey(name)) + { + throw new Exception("ERROR: Element " + name + " is defined multiple times."); + } + else + { + map.Add(name, value); + } + } + + private void AddItemToMap(Dictionary map, string name, double value) + { + if (map.ContainsKey(name)) + { + throw new Exception("ERROR: Element " + name + " is defined multiple times."); + } + else + { + map.Add(name, value); + } + } + + private void GetSizeFromType(string type, out int typePad, out int typeSize) + { + // Remove all whitespace + type = type.Replace(" ", ""); + + if ((type == "char") || (type == "unsignedchar")) + { + typePad = 1; + typeSize = 1; + } + else if ((type == "short") || (type == "unsignedshort")) + { + typePad = 2; + typeSize = 2; + } + else if ((type == "unsigned") || (type == "unsignedint") || + (type == "int") || (type == "float") || + (type == "boolean") || (type == "address")) + { + typePad = 4; + typeSize = 4; + } + else if ((type == "double") || (type == "longlong") || + (type == "unsignedlonglong")) + { + typePad = 8; + typeSize = 8; + } + else // The type is complex and has already been defined + { + try + { + typePad = m_PadMap[type]; + typeSize = m_SizeMap[type]; + } + catch + { + throw new Exception("ERROR: - " + type + " used without being defined."); + } + } + } + + private int AddPadding(XPathNavigator ParentElement, XPathNavigator CurrentElement, int padSize, int padCount) + { + int padAdd = 0; + int padTo = padSize; + + if (m_Packing < padSize) + { + padTo = m_Packing; + } + + if ((padTo != 0) && (padCount % padTo != 0)) + { + padAdd = padTo - (padCount % padTo); + InsertPaddingNode(ParentElement, CurrentElement, padAdd); + } + + return padAdd; + } + + private void InsertPaddingNode(XPathNavigator ParentElement, XPathNavigator CurrentElement, int padAdd) + { + string pad = "" + + "" + Message.PADDING_ITEM_NAME + "" + + "char" + + "" + padAdd + "" + + "S" + + ""; + if (CurrentElement != null) + { + CurrentElement.InsertBefore(pad); + } + else // End padding + { + ParentElement.AppendChild(pad); + } + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/Message.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/Message.cs new file mode 100644 index 0000000..a2a353c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/Message.cs @@ -0,0 +1,2234 @@ +// ********************************************************************************************************** +// Message.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +// Ignore Spelling: Instru + +using Raytheon.Instruments.coeCSharp; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using System.Xml.XPath; + +namespace Raytheon.Instruments.MessagingUtilities +{ + public class Message : IEnumerable, ICloneable + { + public const string PADDING_ITEM_NAME = "****************"; + + public string Name { get { return _name; } set { _name = value; } } + public string InstruLabel => _instruLabel; + + private string _name; + private string _label; + public string Label { get => _label; } + + private string _hexLabel; + + private string _instruLabel; + private string _adapationStoreLabel; + private coeDataInterchange.FormatPacketType _packet = null; + + //private Logger Log; + private NLog.Logger _logger = NLog.LogManager.GetCurrentClassLogger(); + private XPathNavigator Messages; + + public MessageData[] MessageDataArray; + + private int _packing = 8; + private uint _count = 0; + private readonly int _extraFieldCount = 3; + + private ulong _sendSecond = 0; + private uint _sendFracOfSec = 0; + private string _mDomain = "0"; + + private MessageXmlDocument m_Icd = null; + + //Message Maps to support faster creation. + //We only want to parse the XML once. + private Dictionary m_MsgNameMap = null; + private Dictionary m_MsgLabelMap = null; + + // Used to protect the critical section + private static readonly object m_LockObj = new object(); + + // Default values + public static string IntegerDefault = "0"; + public static string FloatDefault = "0.00"; + public static string HexXDefault = "0x0"; + public static string HexBDefault = "0x0"; + public static string BinaryDefault = "0"; + public static string BitFieldDefault = "0"; + public static string StringDefault = ""; + public static string SubimageDefault = "c:\\image.bmp"; + + // Default Logger object + //public static Logger m_DefaultLog = new Logger(); + + private Message() { } + private Message(MessageXmlDocument MessageDatabase) + { + m_Icd = MessageDatabase; + + // Create the static maps if necessary + if ((m_MsgNameMap == null) || (m_MsgLabelMap == null)) + { + m_MsgNameMap = new Dictionary(); + m_MsgLabelMap = new Dictionary(); + } + } + + public Message(string messageName, MessageXmlDocument messageDatabase) + : this(messageName, messageDatabase, null) { } + + public Message(string messageName, MessageXmlDocument messageDatabase, NLog.Logger logger) + { + m_Icd = messageDatabase; + + // Create the static maps if necessary + if ((m_MsgNameMap == null) || (m_MsgLabelMap == null)) + { + m_MsgNameMap = new Dictionary(); + m_MsgLabelMap = new Dictionary(); + } + + if (m_MsgNameMap.ContainsKey(messageName) == true) + { + RetrieveClone((Message)m_MsgNameMap[messageName]); + } + else + { + string messageSpecificationString = messageDatabase.GetMessage(messageName); + if (messageSpecificationString == null) + { + throw new Exception(messageName + " Message not found in the ICD."); + } + else + { + Messages = messageDatabase.CreateNavigator(); + _name = messageName; + + if(logger != null) + _logger = logger; + + ParseMessageString(messageSpecificationString); + _logger.Log(NLog.LogLevel.Info, "Loading Message Data..."); + + Message clone = (Message)Clone(); + if (m_MsgNameMap.ContainsKey(_name) == false) + { + m_MsgNameMap.Add(_name, clone); + } + else + { + throw new Exception("Message <" + _name + "> is defined multiple times in the ICD."); + } + + if (_label != null) + { + if (m_MsgLabelMap.ContainsKey(_label) == false) + { + m_MsgLabelMap.Add(_label, clone); + } + else + { + m_MsgNameMap.Remove(_name); + throw new Exception("Message <" + _name + "> and Message <" + m_MsgLabelMap[_label]._instruLabel + + "> are both defined with Label " + _label + " in the ICD."); + } + } + } + } + } + + /// + /// This constructor populates the Message based on the Message Label + /// instead of the Message Name + /// + /// + /// + public Message(MessageXmlDocument messageDatabase, string messageLabel) + : this(messageDatabase, null, messageLabel) { } + + public Message(MessageXmlDocument messageDatabase, NLog.Logger logger, string messageLabel) + { + m_Icd = messageDatabase; + + // Create the static maps if necessary + if ((m_MsgNameMap == null) || (m_MsgLabelMap == null)) + { + m_MsgNameMap = new Dictionary(); + m_MsgLabelMap = new Dictionary(); + } + + if (m_MsgLabelMap.ContainsKey(messageLabel) == true) + { + RetrieveClone((Message)m_MsgLabelMap[messageLabel]); + } + else + { + var messageSpecificationString = messageDatabase.GetMessageFromLabel(messageLabel); + if (messageSpecificationString == null) + { + throw new Exception("Message with label " + messageLabel + " not found in ICD"); + } + else + { + Messages = messageDatabase.CreateNavigator(); + + if (logger != null) + _logger = logger; + + ParseMessageString(messageSpecificationString); + _logger.Log(NLog.LogLevel.Info, "Loading Message Data..."); + + Message clone = (Message)Clone(); + if (m_MsgNameMap.ContainsKey(_name) == false) + { + m_MsgNameMap.Add(_name, clone); + } + if (m_MsgLabelMap.ContainsKey(_label) == false) + { + m_MsgLabelMap.Add(_label, clone); + } + } + } + } + + public MessageXmlDocument ICD + { + get { return m_Icd; } + } + + public string SendTime + { + get + { + double frac = _sendFracOfSec; + frac /= 0x100000000; + string time = _sendSecond.ToString() + frac.ToString(".00000000000000"); + return time; + } + } + + public ulong SendSecond + { + get { return _sendSecond; } + set { _sendSecond = value; } + } + + public uint SendSecondFraction + { + get { return _sendFracOfSec; } + set { _sendFracOfSec = value; } + } + + public string Domain + { + get { return _mDomain; } + set { _mDomain = value; } + } + + public static void SetDefaults + ( + string integerDefault, string floatDefault, + string hexXDefault, string hexBDefault, + string binaryDefault, string bitFieldDefault, + string stringDefault, string subimageDefault + ) + { + IntegerDefault = integerDefault; + FloatDefault = floatDefault; + HexXDefault = hexXDefault; + HexBDefault = hexBDefault; + BinaryDefault = binaryDefault; + BitFieldDefault = bitFieldDefault; + StringDefault = stringDefault; + SubimageDefault = subimageDefault; + } + + public void Default() + { + SetEnumerationType(EnumerationType.ALL_NODES); + foreach (MessageData data in this) + { + if ((data.isArray != true) && + (data.isArrayOfStructures != true) && + (data.isStructure != true)) + { + if ((data.FieldDefaultValue != null) && (data.FieldDefaultValue.Trim() != "")) + { + data.FieldValue = data.FieldDefaultValue; + } + else if ((data.FieldMinValue != null) && (data.FieldMinValue.Trim() != "")) + { + data.FieldValue = data.FieldMinValue; + } + else if ((data.FieldMaxValue != null) && (data.FieldMaxValue.Trim() != "")) + { + data.FieldValue = data.FieldMaxValue; + } + else + { + // Get the defaults from the Injection + // pane of the options window + if (data.FieldInstruType == "I") + data.FieldValue = IntegerDefault; + else if (data.FieldInstruType == "F") + data.FieldValue = FloatDefault; + else if (data.FieldInstruType == "X") + data.FieldValue = HexXDefault; + else if (data.FieldInstruType == "B") + data.FieldValue = HexBDefault; + else if (data.FieldInstruType == "N") + data.FieldValue = BinaryDefault; + else if (data.FieldInstruType == "T") + data.FieldValue = BitFieldDefault; + else if (data.FieldInstruType == "S") + data.FieldValue = StringDefault; + else if (data.FieldInstruType == "P") + data.FieldValue = SubimageDefault; + else + data.FieldValue = ""; + } + } + } + } + + public coeDataInterchange.FormatPacketType GetInstruPacket() + { + if (_packet == null) + { + int count = 0; + uint length = 1; + char instru_type; + uint size; + uint ctr = 0; + MessageData lastData = null; + coeDataInterchange.FormatType lastInstru = null; + + coeDataInterchange.FormatType[] format = new coeDataInterchange.FormatType[GetCountForDataInterchange()]; + SetEnumerationType(Message.EnumerationType.FIELDS | + Message.EnumerationType.EXPAND_ARRAYS | + Message.EnumerationType.EXPAND_STRUCTURES); + + foreach (MessageData data in this) + { + if (ctr++ < _extraFieldCount) // Skip $msg_domain, $msg_label and $msg_send_time + continue; + + // When handling bit fields, we do not know if we want to move to the + // next byte (Index) until we examine the next element. + // + // ex. unsigned x:4; unsigned y:8; Both x and y operate on the same + // byte, but we don't know the same byte is being operated on until + // we see the declaration of y. + // + // Therefore, we are going to increase the index by staying one declaration + // ahead of the Index increase. If this declaration is operating on a new + // byte, then add the size of the previous byte. The last declaration + // will then be added on the end to get the appropriate size. + if (lastData != null) + { + if (IncreaseIndex(data)) + { + length = 1; + size = GetTypeSize(lastData.FieldType, lastData.isEnum); + instru_type = lastData.FieldInstruType[0]; + if ((lastData.FieldType == "char") && (lastData.FieldInstruType == "S")) + { + // Strings are handled individually + length = (uint)lastData.arrayLength; + } + if (lastData.FieldInstruType == "P") + { + size = lastData.imagePixelSize; + length = lastData.imageHeight * lastData.imageWidth; + instru_type = 'X'; + } + + format[count] = + new coeDataInterchange.FormatType(lastData.FieldName, + length, + size, + instru_type); + + if (lastData.bitMask != 0) + { + if (lastInstru != null) + { + format[count].m_Repetition = 0; + format[count].m_FormatLength = GetNumBitsInMask(lastData.bitMask); + format[count].m_Format = 't'; + lastInstru.m_Repetition++; + lastInstru = null; + } + else + { + format[count].m_Repetition = 1; + format[count].m_Format = 'T'; + + format[count + 1] = + new coeDataInterchange.FormatType(lastData.FieldName, + 0, + GetNumBitsInMask(lastData.bitMask), + 't'); + count++; + } + } + + count++; + } + else + { + if (lastInstru == null) + { + format[count] = + new coeDataInterchange.FormatType(lastData.FieldName, + 0, + GetTypeSize(lastData.FieldType, lastData.isEnum), + 'T'); + lastInstru = format[count]; + count++; + } + + format[count] = + new coeDataInterchange.FormatType(lastData.FieldName, + 0, + GetNumBitsInMask(lastData.bitMask), + 't'); + lastInstru.m_Repetition++; + count++; + } + } + lastData = data; + } + + if (lastData != null) // The message has 1 or more elements + { + // Add the last element to the size + length = 1; + size = GetTypeSize(lastData.FieldType, lastData.isEnum); + instru_type = lastData.FieldInstruType[0]; + if ((lastData.FieldType == "char") && (lastData.FieldInstruType == "S")) + { + // Strings are handled individually + length = (uint)lastData.arrayLength; + } + if (lastData.FieldInstruType == "P") + { + size = lastData.imagePixelSize; + length = lastData.imageHeight * lastData.imageWidth; + instru_type = 'X'; + } + + if (lastData.bitMask == 0) + { + format[count] = + new coeDataInterchange.FormatType(lastData.FieldName, + length, + size, + instru_type); + } + else // (lastData.bitMask != 0) + { + if (lastInstru == null) + { + format[count] = + new coeDataInterchange.FormatType(lastData.FieldName, + 0, + size, + 'T'); + lastInstru = format[count]; + count++; + } + + format[count] = + new coeDataInterchange.FormatType(lastData.FieldName, + 0, + GetNumBitsInMask(lastData.bitMask), + 't'); + lastInstru.m_Repetition++; + } + _packet = new coeDataInterchange.FormatPacketType(_name, GetMessageSize(), (uint)format.Length, format); + } + else // There are no items in the message + { + _packet = new coeDataInterchange.FormatPacketType(_name, GetMessageSize(), 0, new coeDataInterchange.FormatType[0]); + } + } + + // FOR DEBUG PURPOSES +#if false + Debug.WriteLine(""); + Debug.WriteLine("-------------------------------------------------------------------------"); + Debug.WriteLine("Message Name = " + Packet.m_Name); + Debug.WriteLine(""); + foreach (DataInterchange.FormatType f in Packet.m_Format) + Debug.WriteLine("\"" + f.m_FieldName + + "\", " + f.m_Repetition + + ", " + f.m_FormatLength + + ", \'" + f.m_Format + + "\'"); + Debug.WriteLine("-------------------------------------------------------------------------"); +#endif + + return _packet; + } + + private uint GetNumBitsInMask(ulong mask) + { + uint count = 0; + ulong bit = 1; + for (int i = 0; i < sizeof(ulong) * 8; i++) + { + if ((bit & mask) != 0) + { + count++; + } + + bit <<= 1; + } + + return count; + } + + private void ParseMessageString(string messageSpecificationString) + { + lock (m_LockObj) + { + var messageSpecification = new XmlDocument(); + int index = 0; + + messageSpecification.LoadXml(messageSpecificationString); + var item = messageSpecification.CreateNavigator(); + + //Get the type of packing + var nodeset = item.Select("/packing"); + if (nodeset.MoveNext() == true) + { + if (!Parse.Try(nodeset.Current.Value.Trim(), out _packing)) + { + switch (nodeset.Current.Value.Trim()) + { + case "char": + _packing = 1; + break; + case "short": + _packing = 2; + break; + case "long": + _packing = 4; + break; + case "double": + default: + _packing = 8; + break; + } + } + } + + // Three extra fields will be added to the top of every + // Message in CMIT, $msg_domain, $msg_label, $msg_send_time + nodeset = item.Select("/message/item|/message/msg_item"); + MessageDataArray = new MessageData[nodeset.Count + _extraFieldCount]; + //MessageData.m_BitCounter = 0; // Reset the bit counter for each new message + + item.MoveToChild("message", ""); + if (item.MoveToChild("name", "")) + { + _name = item.Value.Trim(); + item.MoveToParent(); + } + if (item.MoveToChild("label", "")) + { + // Convert the label from whatever format it is in to decimal. + uint msgLabel = 0; + + _label = NormalizeValue(item.Value.Trim()); + + if (Parse.Try(_label, out int temp) == false) + { + throw new Exception("Message Label for " + _name + " could not be evaluated to an integer"); + } + + if (temp < 0) + { + byte[] array = BitConverter.GetBytes(temp); + msgLabel = BitConverter.ToUInt32(array, 0); + } + else + msgLabel = Convert.ToUInt32(temp); + + _label = msgLabel.ToString(); + _hexLabel = msgLabel.ToString("X"); + + item.MoveToParent(); + } + if (item.MoveToChild("instruLabel", "")) + { + _instruLabel = item.Value.Trim(); + item.MoveToParent(); + } + if (item.MoveToChild("adaptationSaveLabel", "")) + { + _adapationStoreLabel = item.Value.Trim(); + item.MoveToParent(); + } + + MessageDataArray[index] = new MessageData("$msg_domain", + "unsigned int", Domain, Domain, m_Icd); + MessageDataArray[index++].FieldInstruType = "X"; + MessageDataArray[index] = new MessageData("$msg_label", + "unsigned int", _label, _label, m_Icd); + MessageDataArray[index++].FieldInstruType = "X"; + MessageDataArray[index] = new MessageData("$msg_send_time", + "double", null, null, m_Icd); + MessageDataArray[index++].FieldInstruType = "F"; + + while (nodeset.MoveNext()) + { + AddToMessageData(nodeset.Current.Clone(), "", MessageDataArray, index++, 0); + } + } + } + + private void ParseMessageString(string messageSpecificationString, + string messageSelectionString, + string namePrefix, + MessageData parentField) + { + var messageSpecification = new XmlDocument(); + int index = 0; + + messageSpecification.LoadXml(messageSpecificationString); + XPathNavigator item = messageSpecification.CreateNavigator(); + + XPathNodeIterator nodeset = item.Select(messageSelectionString); + parentField.SetStructureSize(nodeset.Count); + + while (nodeset.MoveNext()) + { + AddToMessageData(nodeset.Current.Clone(), namePrefix, parentField.MessageArray, index++, parentField.depth + 1); + } + } + + private void AddToMessageData(XPathNavigator item, + string namePrefix, + MessageData[] dataArray, + int arrayIndex, + int depth) + { + + string fieldName = null; + string fieldType = null; + string fieldDefaultValue = null; + XPathNavigator structureDefinition; + bool isEnum = false; + + int arrayLength; + LinkedList length = new LinkedList(); + // + // Extract the name, type, default value, and array length values + // for the field + // + + if (item.MoveToChild("name", "")) + { + fieldName = item.Value.Trim(); + item.MoveToParent(); + } + if (item.MoveToChild("item_name", "")) + { + fieldName = item.Value.Trim(); + item.MoveToParent(); + } + if (item.MoveToChild("type", "")) + { + fieldType = NormalizeType(item.Value, ref isEnum); + item.MoveToParent(); + } + if (item.MoveToChild("default", "")) + { + fieldDefaultValue = NormalizeValue(item.Value); + item.MoveToParent(); + } + else if (item.MoveToChild("minRange", "")) + { + fieldDefaultValue = NormalizeValue(item.Value); + item.MoveToParent(); + } + + // + // Check to see if this field is a structure by locating the structure + // definition. + // + + structureDefinition = Messages.SelectSingleNode("/interface/structure[name='" + fieldType + "']|/interface/message[name='" + fieldType + "']"); + + // + // Create the MessageData object for this field and put it in the array. + // Set max and min range values if they exist. + // + + dataArray[arrayIndex] = new MessageData(namePrefix + fieldName, + fieldType, null, fieldDefaultValue, m_Icd); + //If Type is an enum sent the isEnum field to true + if (isEnum) + { + dataArray[arrayIndex].isEnum = true; + } + + XPathNodeIterator nodeSet = item.Select("arrayLength"); + while (nodeSet.MoveNext()) + { + arrayLength = 0; + Parse.Try(NormalizeValue(nodeSet.Current.Value), out arrayLength); + if (arrayLength != 0) + { + length.AddFirst(arrayLength); + } + } + + if (item.MoveToChild("imageWidth", "")) + { + Parse.Try(NormalizeValue(item.Value), out uint width); + if (width != 0) + { + dataArray[arrayIndex].imageWidth = width; + } + item.MoveToParent(); + } + if (item.MoveToChild("imageHeight", "")) + { + Parse.Try(NormalizeValue(item.Value), out uint height); + if (height != 0) + { + dataArray[arrayIndex].imageHeight = height; + } + item.MoveToParent(); + } + if (item.MoveToChild("imagePixelSize", "")) + { + Parse.Try(NormalizeValue(item.Value), out uint pixelSize); + if (pixelSize != 0) + { + dataArray[arrayIndex].imagePixelSize = pixelSize; + } + item.MoveToParent(); + } + if (item.MoveToChild("maxRange", "")) + { + dataArray[arrayIndex].SetMaxValue(item.Value.Trim()); + item.MoveToParent(); + } + if (item.MoveToChild("minRange", "")) + { + dataArray[arrayIndex].SetMinValue(item.Value.Trim()); + item.MoveToParent(); + } + + if (item.MoveToChild("bits", "")) + { + Parse.Try(NormalizeValue(item.Value), out int bits); + dataArray[arrayIndex].SetBitValue(bits); + item.MoveToParent(); + } + else + { + dataArray[arrayIndex].SetBitValue(0); + } + + if (item.MoveToChild("instruType", "")) + { + dataArray[arrayIndex].SetInstruType(item.Value.Trim()); + if ((dataArray[arrayIndex].FieldInstruType == "S") && (dataArray[arrayIndex].FieldType == "unsigned char")) + { + // In CMIT, all strings are of type char. If the user defines a string of unsigned chars, we + // can still handle them if type is changed to char. + dataArray[arrayIndex].FieldType = "char"; + } + else if ((dataArray[arrayIndex].FieldInstruType == "S") && (dataArray[arrayIndex].FieldType != "char")) + { + // If the type is not char, the CMIT will not handle strings. We will change the instruType + // to X, so these fields are handled properly. + dataArray[arrayIndex].FieldInstruType = "X"; + } + item.MoveToParent(); + } + + // Initialize the image buffer if this is a subimage item + if ((dataArray[arrayIndex].imageWidth != 0) && (dataArray[arrayIndex].imageHeight != 0)) + { + dataArray[arrayIndex].imageBufferSize = + dataArray[arrayIndex].imageWidth * + dataArray[arrayIndex].imageHeight * + GetTypeSize(dataArray[arrayIndex].FieldType, dataArray[arrayIndex].isEnum); + dataArray[arrayIndex].imageBuffer = new byte[dataArray[arrayIndex].imageBufferSize]; + dataArray[arrayIndex].SetInstruType("P"); + dataArray[arrayIndex].SetPixelSize(); + } + else if (dataArray[arrayIndex].FieldInstruType == "P") + { + // If no imageWidth and imageHeight are defined, then + // this item can not have an instruType of "P" + dataArray[arrayIndex].FieldInstruType = "X"; + } + + dataArray[arrayIndex].depth = depth; + // + // If the field is a singleton, we're done. Other combinations + // could be an array, a structure, or an array of structures. + // + + if (length.Count > 0) + { + ParseArray(structureDefinition, + dataArray[arrayIndex], + length); + } + else if (structureDefinition != null) + { + ParseMessageString(structureDefinition.OuterXml, "/structure/item|/message/item|/structure/struct_item|/message/msg_item", dataArray[arrayIndex].FieldName + ".", + dataArray[arrayIndex]); + } + } + + private void ParseArray + ( + XPathNavigator StructureDefinition, + MessageData DataArray, + LinkedList ArrayLength + ) + { + int length = ArrayLength.Last.Value; + ArrayLength.RemoveLast(); + if (length > 0) + { + // If the array type is an enumeration type, need to make it an integer + XPathNavigator navigator = m_Icd.CreateNavigator(); + XPathNavigator position; + try + { + position = navigator.SelectSingleNode("/interface/enum[name='" + DataArray.FieldType + "']"); + if (position != null) + { + DataArray.FieldType = "unsigned int"; + } + } + catch (Exception e) + { + System.Diagnostics.Debug.WriteLine(e.Message); + } + + DataArray.SetArraySize(length); + + if (ArrayLength.Count != 0) + { + for (int index = 0; index < length; index++) + { + ParseArray(StructureDefinition, + DataArray.MessageArray[index], + ArrayLength); + } + } + else + { + if (StructureDefinition != null) + { + ParseMessageString(StructureDefinition.OuterXml, "/structure/item|/message/item|/structure/struct_item|/message/msg_item", + DataArray.MessageArray[0].FieldName + ".", + DataArray.MessageArray[0]); + for (int index = 1; index < length; index++) + { + DataArray.MessageArray[index].isStructure = true; + + DataArray.MessageArray[index].MessageArray = CloneMessageData(DataArray.MessageArray[0].MessageArray); + CorrectClonedArrayIndex(DataArray.MessageArray[index].MessageArray, + DataArray.MessageArray[0].FieldName.Trim(), + DataArray.MessageArray[index].FieldName.Trim()); + } + DataArray.isArrayOfStructures = true; + } + } + } + + ArrayLength.AddFirst(length); + } + + private void CorrectClonedArrayIndex(MessageData[] array, + string old_str, + string new_str) + { + foreach (MessageData data in array) + { + // We want to replace the index in the name of the structure. The "begin" substring + // ensures we only replace the first instance of the string + string begin = data.FieldName.Substring(0, new_str.Length); + begin = begin.Replace(old_str, new_str); + + data.FieldName = begin + data.FieldName.Substring(new_str.Length); + if (data.MessageArray != null) + { + CorrectClonedArrayIndex(data.MessageArray, old_str, new_str); + } + } + } + + internal string NormalizeValue(string value) + { + XPathNavigator messagesItem; + bool iterating; + + value = value.Trim(); + do + { + iterating = false; + if ((value.Length > 0) && (value[0] != '\"') && (value[0] != '\'')) + { + messagesItem = Messages.SelectSingleNode("/interface/constant[name='" + value + "']|/interface/enum/item[name='" + value + "']"); + if (messagesItem == null) + { + messagesItem = Messages.SelectSingleNode("/interface/constant[name='" + value + "']|/interface/enum/enum_item[name='" + value + "']"); + } + if (messagesItem != null) + { + messagesItem.MoveToChild("value", ""); + value = messagesItem.InnerXml; + iterating = true; + } + } + } while (iterating); + + return value; + } + + private string NormalizeType(string value, ref bool isEnum) + { + XPathNavigator MessagesItem; + bool iterating; + + do + { + iterating = false; + MessagesItem = Messages.SelectSingleNode("/interface/typedef[name='" + NormalizeValue(value) + "']"); + if (MessagesItem != null) + { + MessagesItem.MoveToChild("value", ""); + value = MessagesItem.InnerXml; + iterating = true; + } + //Check if Value is an enumeration + MessagesItem = Messages.SelectSingleNode("/interface/enum[name='" + NormalizeValue(value) + "']"); + if (MessagesItem != null) + { + isEnum = true; + } + } while (iterating); + + return value; + } + + public void Reset() + { + SetEnumerationType(EnumerationType.EXPANDED_FIELDS); + foreach (MessageData data in this) + { + data.FieldValue = null; + data.usesRegister = false; + } + } + + public MessageData Set(string field, string value) + { + MessageData LocatedDataItem = null; + + SetEnumerationType(EnumerationType.ALL_NODES); + foreach (MessageData data in this) + { + if (string.Compare(field, data.FieldName) == 0) + { + if (data.isArrayOfStructures) + { + ; // Do nothing in this case + } + if (data.isArray || data.isStructure) + { + data.FieldValue = value; + if (value.StartsWith("$")) + { + data.usesRegister = true; + } + foreach (MessageData ArrayData in data.MessageArray) + { + if (!ArrayData.isArray && !ArrayData.isArrayOfStructures && !ArrayData.isStructure) + { + ArrayData.FieldArrayValue = value; + if (value.StartsWith("$")) + { + ArrayData.usesRegister = true; + } + } + } + } + else + { + data.FieldValue = value; + if (value.StartsWith("$")) + { + data.usesRegister = true; + } + LocatedDataItem = data; + } + break; + } + } + return LocatedDataItem; + } + + public MessageData GetItemFromMsg(string name) + { + // Add each message item to the tree + SetEnumerationType(EnumerationType.ALL_NODES); + foreach (MessageData Data in this) + { + // Find the Item that has been selected in current Message + if (Data.FieldName == name) + { + return Data; + } + } + + return null; + } + + /// + /// logs message with all the fields + /// + /// + /// + public void SendToLog(EnumerationType enumerationType = EnumerationType.EXPANDED_FIELDS, MessageDirection direction = MessageDirection.File) + { + string directionSign = direction == MessageDirection.File ? "_" : direction == MessageDirection.In ? "<<<" : ">>>"; + _logger.Log(NLog.LogLevel.Info, $"{directionSign} Message Name: {_name}; Label: {_label} (0x{_hexLabel})"); + SetEnumerationType(enumerationType); + foreach (MessageData data in this) + { + string displayFieldValue; + if(data.FieldName == "$msg_label") + { + displayFieldValue = $"{data.FieldValue} (0x{_hexLabel})"; + } + else + { + displayFieldValue = data.FieldValue ?? $"{data.FieldDefaultValue} (D)"; + } + var spacer = new string(Enumerable.Repeat(' ', data.depth * 4).ToArray()); + _logger.Log(NLog.LogLevel.Info, $"{spacer}{data.FieldName} ({data.FieldType}) = {displayFieldValue}"); + } + } + + // helps with visual identification in the log of incoming vs outgoing + public enum MessageDirection + { + File, + In, + Out + } + + // This class supplies an enumerator that is capable of iterating over the fields in the + // message with a variety of options. The SetEnumerationType method sets how the enumerator + // will iterate over the fields. The enumeration values can be added to derive various + // combinations of iterations. The values are as follows: + // FIELDS Only non array and structure fields + // ARRAY_NODES The message_data nodes that have isArray set + // STRUCTURE_NODES The message_data nodes that have isStructure set + // ARRAY_PRIMITIVE_NODES Nodes with isArray set that are not arrays of structures + // EXPAND_ARRAYS The array fields linked onto an array node + // EXPAND_STRUCTURES The structure fields linked onto a structure node + // TOP_NODES Top level Fields and array/structure nodes + // EXPANDED_FIELDS All fields, structures and arrays expanded + // ALL_NODES All nodes (the sum of all the above) + // + + public enum EnumerationType + { + FIELDS = 0x01, + ARRAY_NODES = 0x02, + STRUCTURE_NODES = 0x04, + ARRAY_PRIMITIVE_NODES = 0x08, + EXPAND_ARRAYS = 0x10, + EXPAND_STRUCTURES = 0x20, + TOP_NODES = 0x07, + EXPANDED_FIELDS = 0x31, + ALL_NODES = 0xFF + }; + private EnumerationType EnumType = EnumerationType.TOP_NODES; + + public void SetEnumerationType(EnumerationType type) + { + EnumType = type; + } + + public IEnumerator GetEnumerator() + { + return new MessageEnumerator(MessageDataArray, EnumType); + } + + private class MessageEnumerator : IEnumerator + { + + private int CurrentIndex; + private bool doExpandArray; + private readonly EnumerationType enumType = EnumerationType.TOP_NODES; + private readonly MessageData[] RootMessageArray; + private MessageData[] CurrentMessageArray; + private readonly Stack indexStack = new Stack(); + private readonly Stack messageStack = new Stack(); + + private MessageEnumerator() + { + Reset(); + } + + public MessageEnumerator(MessageData[] Root, EnumerationType Type) + { + RootMessageArray = Root; + enumType = Type; + Reset(); + } + + public void Reset() + { + CurrentIndex = -1; + CurrentMessageArray = RootMessageArray; + doExpandArray = false; + indexStack.Clear(); + messageStack.Clear(); + } + + public bool MoveNext() + { + bool Scanning = true; + bool Status = true; + + while (Scanning) + { + CurrentIndex++; + // + // If need to start expanding an array (array or structure), do so + // + if (doExpandArray) + { + doExpandArray = false; + indexStack.Push(CurrentIndex); + messageStack.Push(CurrentMessageArray); + CurrentMessageArray = CurrentMessageArray[CurrentIndex - 1].MessageArray; + CurrentIndex = -1; + } + // + // Else see if this node needs to be returned + // + else + { + // + // If at the end of an array, pop the stacks + // + while (CurrentIndex >= CurrentMessageArray.Length) + { + if (indexStack.Count == 0) + { + return false; // End of iteration + } + else + { + CurrentIndex = indexStack.Pop(); + CurrentMessageArray = messageStack.Pop(); + } + } + if (CurrentMessageArray[CurrentIndex].isStructure) + { + if ((enumType & EnumerationType.STRUCTURE_NODES) != 0) + { + Scanning = false; + } + if ((enumType & EnumerationType.EXPAND_STRUCTURES) != 0) + { + doExpandArray = true; + } + } + else if (CurrentMessageArray[CurrentIndex].isArray) + { + if ((enumType & EnumerationType.ARRAY_NODES) != 0) + { + Scanning = false; + } + if ((enumType & EnumerationType.ARRAY_PRIMITIVE_NODES) != 0) + { + if (!CurrentMessageArray[CurrentIndex].isArrayOfStructures) + { + Scanning = false; + } + } + if ((enumType & EnumerationType.EXPAND_ARRAYS) != 0) + { + doExpandArray = true; + } + } + else + { + if ((enumType & EnumerationType.FIELDS) != 0) + { + Scanning = false; + } + } + } + } + return Status; + } + + public object Current + { + get + { + return CurrentMessageArray[CurrentIndex]; + } + } + + } + + enum TypeSize + { + INT = 4, + UINT = 4, + CHAR = 1, + SHORT = 2, + USHORT = 2, + UNSIGNED_CHAR = 1, + BOOL = 1, + DOUBLE = 8, + LONGLONG = 8, + FLOAT = 4, + ENUM = 4 + } + + public void MsgDataToBuffer(ref byte[] DataBuffer, out uint MessageSize) + { + int Index = 0; + uint pictureSize; + int Offset = 0; + MessageData lastData = null; + byte[] ByteArray; + int ctr = 0; + + // Data buffer was just passed from a fresh "new byte[]" so all values are guaranteed to + // be 0 at the beginning. + // + // For each element in data element in the message, the string representation of + // the data will be passed to the BitFieldGeneric class with its bit mask to + // be converted into a binary value. The BitFieldGeneric value will then be + // Bitwise ORed to buffer, allowing bit fields to be handled properly. This + // ORed value will then be converted into a byte array and placed in the data + // buffer for transfer. + + SetEnumerationType(EnumerationType.FIELDS | + EnumerationType.EXPAND_ARRAYS | + EnumerationType.EXPAND_STRUCTURES); + + foreach (MessageData data in this) + { + //Handle $msg_domain, $msg_label and $msg_send_time appropriately + if (ctr == 0) // handle $msg_domain + { + Domain = data.FieldValue; + ctr++; + continue; + } + else if (ctr == 1) // handle $msg_label + { + // Do we want the user to be able to change the label on the fly + //Label = data.FieldValue; + ctr++; + continue; + } + else if (ctr == 2) // handle $msg_send_time + { + ctr++; + continue; + } + + + // Padding may have FieldValue set to null, change it to "" + if (data.FieldValue == null) + data.FieldValue = ""; + + // This increases the index into the buffer. See GetMessageSize() + // for a detailed explanation of the algorithm + if (lastData != null) + { + if (IncreaseIndex(data)) + { + if ((lastData.FieldType == "char") && (lastData.FieldInstruType == "S")) + { + // Strings are handled individually + Index += (int)TypeSize.CHAR * lastData.arrayLength; + } + else if (lastData.FieldInstruType == "P") + { + pictureSize = GetTypeSize(lastData.FieldType, lastData.isEnum); + pictureSize *= lastData.imageWidth * lastData.imageHeight; + Index += (int)pictureSize; + } + else + { + Index += (int)GetTypeSize(lastData.FieldType, lastData.isEnum); + } + } + } + lastData = data; + + // Process each message element based on its type + if ((data.FieldInstruType == "P") && (data.imageBuffer != null)) + { + data.imageBuffer.CopyTo(DataBuffer, Index); + } + else + { + switch (data.FieldType) + { + case "int": + BitFieldGeneric iParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + iParsedValue.BitOR(BitConverter.ToInt32(DataBuffer, Index)); + ByteArray = BitConverter.GetBytes(iParsedValue.ToInt()); + ByteArray.CopyTo(DataBuffer, Index); + break; + + case "char": + decimal ParsedValue; + if (data.FieldInstruType == "S") + { + // If this is a string, copy the entire string + for (int i = 0; i < data.arrayLength; i++) + { + if (i < data.FieldValue.Length) + { + DataBuffer[Index + i] = (byte)data.FieldValue[i]; + } + else + { + DataBuffer[Index + i] = 0; + } + } + } + else // This is not a string + { + if (Parse.Try(data.FieldValue, out ParsedValue)) + { + BitFieldGeneric sbParsedValue = new BitFieldGeneric + (data.FieldValue, data.bitMask); + sbParsedValue.BitOR((sbyte)DataBuffer[Index]); + DataBuffer[Index] = (byte)sbParsedValue.ToSByte(); + } + else if ((data.FieldValue != null) && (data.FieldValue.Length > 0)) + { + DataBuffer[Index] = (byte)data.FieldValue[0]; + } + else + { + DataBuffer[Index] = 0; + } + } + break; + case "short": + BitFieldGeneric sParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + sParsedValue.BitOR(BitConverter.ToInt16(DataBuffer, Index)); + ByteArray = BitConverter.GetBytes(sParsedValue.ToShort()); + ByteArray.CopyTo(DataBuffer, Index); + break; + case "unsigned char": + case "unsignedchar": + if (Parse.Try(data.FieldValue, out ParsedValue)) + { + BitFieldGeneric sbParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + sbParsedValue.BitOR(DataBuffer[Index]); + DataBuffer[Index] = (byte)sbParsedValue.ToSByte(); + } + else if ((data.FieldValue != null) && (data.FieldValue.Length > 0)) + { + DataBuffer[Index] = (byte)data.FieldValue[0]; + } + else + { + DataBuffer[Index] = 0; + } + break; + case "unsigned short": + case "unsignedshort": + BitFieldGeneric usParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + usParsedValue.BitOR(BitConverter.ToUInt16(DataBuffer, Index)); + ByteArray = BitConverter.GetBytes(usParsedValue.ToUShort()); + ByteArray.CopyTo(DataBuffer, Index); + break; + case "unsigned int": + case "unsignedint": + case "unsigned": + case "boolean": + case "address": + BitFieldGeneric uiParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + uiParsedValue.BitOR(BitConverter.ToUInt32(DataBuffer, Index)); + ByteArray = BitConverter.GetBytes(uiParsedValue.ToUInt()); + ByteArray.CopyTo(DataBuffer, Index + Offset); + break; + case "float": + float FlParsedValue; + if (!Parse.Try(string.IsNullOrEmpty(data.FieldValue) ? "0" : data.FieldValue, out FlParsedValue)) + { + throw new Exception($"Unable to parse value = {data.FieldValue} "); + } + ByteArray = BitConverter.GetBytes(FlParsedValue); + ByteArray.CopyTo(DataBuffer, Index); + break; + case "double": + double DbParsedValue; + if (!Parse.Try(string.IsNullOrEmpty(data.FieldValue) ? "0" : data.FieldValue, out DbParsedValue)) + { + throw new Exception($"Unable to parse value = {data.FieldValue} "); + } + ByteArray = BitConverter.GetBytes(DbParsedValue); + ByteArray.CopyTo(DataBuffer, Index); + break; + case "long long": + case "longlong": + BitFieldGeneric llParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + llParsedValue.BitOR(BitConverter.ToInt64(DataBuffer, Index)); + ByteArray = BitConverter.GetBytes(llParsedValue.ToLong()); + ByteArray.CopyTo(DataBuffer, Index); + break; + case "unsigned long long": + case "unsignedlonglong": + BitFieldGeneric ullParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + ullParsedValue.BitOR(BitConverter.ToUInt64(DataBuffer, Index)); + ByteArray = BitConverter.GetBytes(ullParsedValue.ToULong()); + ByteArray.CopyTo(DataBuffer, Index); + break; + default: + if (data.isEnum) + { + data.FieldValue = GetEnumerationValue(data.FieldValue, data.FieldType); + BitFieldGeneric eParsedValue = new BitFieldGeneric(data.FieldValue, data.bitMask); + eParsedValue.BitOR(BitConverter.ToUInt32(DataBuffer, Index)); + ByteArray = BitConverter.GetBytes(eParsedValue.ToUInt()); + ByteArray.CopyTo(DataBuffer, Index); + } + break; + } + } + } + + if (lastData != null) // Ensure the message has items + { + // Add the last element to the size + if ((lastData.FieldType == "char") && (lastData.FieldInstruType == "S")) + { + // Strings are handled individually + Index += (int)TypeSize.CHAR * lastData.arrayLength; + } + else if (lastData.FieldInstruType == "P") + { + pictureSize = GetTypeSize(lastData.FieldType, lastData.isEnum); + pictureSize *= lastData.imageWidth * lastData.imageHeight; + Index += (int)pictureSize; + } + else + { + Index += (int)GetTypeSize(lastData.FieldType, lastData.isEnum); + } + } + + MessageSize = (uint)Index; + } + + private string GetEnumerationValue(string Value, string Type) + { + uint value; // enum value + string returnValue = ""; + + if (Parse.Try(Value, out value) == false) + { + Dictionary enums = m_Icd.GetEnumerations(Type); + foreach (KeyValuePair pair in enums) + { + if (Value == pair.Key) + { + returnValue = pair.Value; + break; + } + } + } + else + { + returnValue = value.ToString(); + } + + if (returnValue == "") + { + throw new Exception("Unable to parse value = " + Value + ". No valid enumeration exists."); + } + + return returnValue; + } + + public bool BufferToMsgData(byte[] DataBuffer) + { + int index = 0; + MessageData lastData = null; + int ctr = 0; + + SetEnumerationType(EnumerationType.FIELDS | + EnumerationType.EXPAND_ARRAYS | + EnumerationType.EXPAND_STRUCTURES); + foreach (MessageData data in this) + { + if (ctr == 0) // handle $msg_domain + { + data.FieldValue = Domain; + ctr++; + continue; + } + else if (ctr == 1) // handle $msg_label + { + data.FieldValue = _label; + ctr++; + continue; + } + else if (ctr == 2) // handle $msg_send_time + { + data.FieldValue = SendTime; + ctr++; + continue; + } + + // This increases the index into the buffer. See GetMessageSize() + // for a detailed explanation of the algorithm + if (lastData != null) + { + if (IncreaseIndex(data)) + { + if ((lastData.FieldType == "char") && (lastData.FieldInstruType == "S")) + { + // Strings are handled individually + index += (int)TypeSize.CHAR * lastData.arrayLength; + } + else if (lastData.FieldInstruType == "P") + { + uint pictureSize = GetTypeSize(lastData.FieldType, lastData.isEnum); + pictureSize *= lastData.imageWidth * lastData.imageHeight; + index += (int)pictureSize; + } + else + { + index += (int)GetTypeSize(lastData.FieldType, lastData.isEnum); + } + } + } + lastData = data; + + // Process each message element based on its type + if ((data.FieldInstruType == "P") && (data.imageBuffer != null)) + { + for (int i = 0; i < data.imageBuffer.Length; i++) + { + data.imageBuffer[i] = DataBuffer[index + i]; + } + data.FieldValue = "--- Subimage --- "; + } + else + { + switch (data.FieldType) + { + case "int": + BitFieldGeneric IValue = new BitFieldGeneric + (BitConverter.ToInt32(DataBuffer, index), data.bitMask); + IValue.ToSigned(); + data.FieldValue = IValue.ToString(); + break; + case "char": + if (data.FieldInstruType == "S") + { + // Handle string + data.FieldValue = ""; + for (int i = 0; i < data.arrayLength; i++) + { + if (DataBuffer[index + i] == 0) break; + data.FieldValue += (char)DataBuffer[index + i]; + } + } + else + { + BitFieldGeneric CValue = new BitFieldGeneric + ((sbyte)DataBuffer[index], data.bitMask); + CValue.ToSigned(); + data.FieldValue = CValue.ToString(); + } + break; + case "short": + BitFieldGeneric SValue = new BitFieldGeneric + (BitConverter.ToInt16(DataBuffer, index), data.bitMask); + SValue.ToSigned(); + data.FieldValue = SValue.ToString(); + break; + case "unsigned char": + case "unsignedchar": + BitFieldGeneric SBValue = new BitFieldGeneric + (DataBuffer[index], data.bitMask); + data.FieldValue = SBValue.ToString(); /*ACB*/ + //data.FieldValue = DataBuffer[Index].ToString(); + break; + case "unsigned short": + case "unsignedshort": + BitFieldGeneric USValue = new BitFieldGeneric + (BitConverter.ToUInt16(DataBuffer, index), data.bitMask); + data.FieldValue = USValue.ToString(); + break; + case "unsigned int": + case "unsignedint": + case "unsigned": + case "address": + case "boolean": + BitFieldGeneric UIValue = new BitFieldGeneric + (BitConverter.ToUInt32(DataBuffer, index), data.bitMask); + data.FieldValue = UIValue.ToString(); + break; + case "float": + float FValue = BitConverter.ToSingle(DataBuffer, index); + data.FieldValue = FValue.ToString(); + break; + case "double": + double DValue = BitConverter.ToDouble(DataBuffer, index); + data.FieldValue = DValue.ToString(); + break; + case "long long": + case "longlong": + BitFieldGeneric LLValue = new BitFieldGeneric + (BitConverter.ToInt64(DataBuffer, index), data.bitMask); + LLValue.ToSigned(); + data.FieldValue = LLValue.ToString(); + break; + case "unsigned long long": + case "unsignedlonglong": + BitFieldGeneric ULLValue = new BitFieldGeneric + (BitConverter.ToUInt64(DataBuffer, index), data.bitMask); + data.FieldValue = ULLValue.ToString(); + break; + default: + if (data.isEnum) + { + BitFieldGeneric EnumValue = new BitFieldGeneric + (BitConverter.ToUInt32(DataBuffer, index), data.bitMask); + data.FieldValue = EnumValue.ToString(); + } + break; + } + } + } + + return true; + } + + internal uint GetCountForDataInterchange() + { + uint ctr = 0; + if (_count == 0) + { + MessageData lastData = null; + + SetEnumerationType(Message.EnumerationType.FIELDS | + Message.EnumerationType.EXPAND_ARRAYS | + Message.EnumerationType.EXPAND_STRUCTURES); + + foreach (MessageData data in this) + { + if (ctr++ < _extraFieldCount) // Skip $msg_domain, $msg_label and $msg_send_time + continue; + + // When handling bit fields, we do not know if we want to move to the + // next byte (Index) until we examine the next element. + // + // ex. unsigned x:4; unsigned y:8; Both x and y operate on the same + // byte, but we don't know the same byte is being operated on until + // we see the declaration of y. + // + // Therefore, we are going to increase the index by staying one declaration + // ahead of the Index increase. If this declaration is operating on a new + // byte, then add the size of the previous byte. The last declaration + // will then be added on the end to get the appropriate size. + if (lastData != null) + { + if (IncreaseIndex(data)) + { + _count++; + if (lastData.bitMask != 0) + { + _count++; + } + } + else + { + _count++; + } + } + lastData = data; + } + + // Add the last element to the size + _count++; + if (lastData.bitMask != 0) + { + _count++; + } + } + + return (uint)_count; + } + + public uint GetMessageSize() + { + uint Index = 0; + uint pictureSize; + MessageData lastData = null; + uint ctr = 0; + + SetEnumerationType(Message.EnumerationType.FIELDS | + Message.EnumerationType.EXPAND_ARRAYS | + Message.EnumerationType.EXPAND_STRUCTURES); + + foreach (MessageData data in this) + { + + if (ctr++ < _extraFieldCount) // Skip $msg_domain, $msg_label and $msg_send_time + continue; + // When handling bit fields, we do not know if we want to move to the + // next byte (Index) until we examine the next element. + // + // ex. unsigned x:4; unsigned y:8; Both x and y operate on the same + // byte, but we don't know the same byte is being operated on until + // we see the declaration of y. + // + // Therefore, we are going to increase the index by staying one declaration + // ahead of the Index increase. If this declaration is operating on a new + // byte, then add the size of the previous byte. The last declaration + // will then be added on the end to get the appropriate size. + if (lastData != null) + { + if (IncreaseIndex(data)) + { + if ((lastData.FieldType == "char") && (lastData.FieldInstruType == "S")) + { + // Strings are handled individually + Index += (uint)TypeSize.CHAR * (uint)lastData.arrayLength; + } + else if (lastData.FieldInstruType == "P") + { + pictureSize = GetTypeSize(lastData.FieldType, lastData.isEnum); + pictureSize *= lastData.imageWidth * lastData.imageHeight; + Index += pictureSize; + } + else + { + Index += GetTypeSize(lastData.FieldType, lastData.isEnum); + } + } + } + lastData = data; + } + + if (lastData != null) // Ensure there are items in the message + { + // Add the last element to the size + if ((lastData.FieldType == "char") && (lastData.FieldInstruType == "S")) + { + // Strings are handled individually + Index += (uint)TypeSize.CHAR * (uint)lastData.arrayLength; + } + else if (lastData.FieldInstruType == "P") + { + pictureSize = GetTypeSize(lastData.FieldType, lastData.isEnum); + pictureSize *= lastData.imageWidth * lastData.imageHeight; + Index += pictureSize; + } + else + { + Index += GetTypeSize(lastData.FieldType, lastData.isEnum); + } + } + + return (uint)Index; + } + + private bool IncreaseIndex(MessageData Data) + { + if ((Data.bitMask == 0) || ((Data.bitMask & 1) == 1)) + { + return true; + } + else + { + return false; + } + } + + static internal uint GetTypeSize(string Type, bool IsEnum) + { + uint size = 4; + + switch (Type) + { + case "char": + case "unsigned char": + case "unsignedchar": + size = (uint)TypeSize.CHAR; + break; + + case "short": + case "unsigned short": + case "unsignedshort": + size = (uint)TypeSize.SHORT; + break; + + case "int": + case "unsigned int": + case "unsignedint": + case "unsigned": + case "address": + case "boolean": + case "float": + size = (uint)TypeSize.INT; + break; + + case "double": + case "long long": + case "longlong": + case "unsigned long long": + case "unsignedlonglong": + size = (uint)TypeSize.LONGLONG; + break; + + default: + if (IsEnum == true) + size = (uint)TypeSize.ENUM; + //else + //throw new Exception("Invalid Type"); + break; + } + + return size; + } + + // + // This function validates that the FieldValue is of the correct type and + // is within the Max and Min values. If all the data is valid this + // function returns true. If the data is invalid the function returns + // false and the inValid MessageData elements will have there isValid + // field set to false. + // + public bool ValidateMsgData() + { + bool DataValid = true; + SetEnumerationType(Message.EnumerationType.FIELDS | + Message.EnumerationType.EXPAND_ARRAYS | + Message.EnumerationType.EXPAND_STRUCTURES); + + foreach (MessageData data in this) + { + data.isValid = true; + switch (data.FieldType) + { + case "int": + int IntParsedValue; + int IMaxValue, IMinValue; + if (!Parse.Try(data.FieldValue, out IntParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out IMinValue) && + Parse.Try(data.FieldMaxValue, out IMaxValue)) + { + if (IntParsedValue < IMinValue || IntParsedValue > IMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + + case "char": + char ChParsedValue; + byte ByteParsedValue; + //If the value can be parsed as a byte assume it is a byte, if not try as char + if (Parse.Try(data.FieldValue, out ByteParsedValue)) + { + //TODO: Validate against Min and Max here + } + else + { + if (Parse.Try(data.FieldValue, out ChParsedValue)) + { + //TODO: Validate against Min and Max here + } + else + { + if (data.FieldValue != null) + { + DataValid = false; + data.isValid = false; + } + } + } + break; + case "short": + short ShParsedValue; + short ShMaxValue, ShMinValue; + if (!Parse.Try(data.FieldValue, out ShParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out ShMinValue) && + Parse.Try(data.FieldMaxValue, out ShMaxValue)) + { + if (ShParsedValue < ShMinValue || ShParsedValue > ShMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "unsigned char": + case "unsignedchar": + byte UchParsedValue; + byte UchMaxValue, UchMinValue; + if (!Parse.Try(data.FieldValue, out UchParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out UchMinValue) && + Parse.Try(data.FieldMaxValue, out UchMaxValue)) + { + if (UchParsedValue < UchMinValue || UchParsedValue > UchMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "unsigned short": + case "unsignedshort": + ushort UshParsedValue; + ushort UshMaxValue, UshMinValue; + if (!Parse.Try(data.FieldValue, out UshParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out UshMinValue) && + Parse.Try(data.FieldMaxValue, out UshMaxValue)) + { + if (UshParsedValue < UshMinValue || UshParsedValue > UshMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "unsigned int": + case "unsignedint": + case "unsigned": + uint UiParsedValue; + uint UiMaxValue, UiMinValue; + if (!Parse.Try(data.FieldValue, out UiParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out UiMinValue) && + Parse.Try(data.FieldMaxValue, out UiMaxValue)) + { + if (UiParsedValue < UiMinValue || UiParsedValue > UiMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "float": + float FlParsedValue; + float FlMaxValue, FlMinValue; + if (!Parse.Try(data.FieldValue, out FlParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out FlMinValue) && + Parse.Try(data.FieldMaxValue, out FlMaxValue)) + { + if (FlParsedValue < FlMinValue || FlParsedValue > FlMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "double": + double DbParsedValue; + double DbMaxValue, DbMinValue; + if (!Parse.Try(data.FieldValue, out DbParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out DbMinValue) && + Parse.Try(data.FieldMaxValue, out DbMaxValue)) + { + if (DbParsedValue < DbMinValue || DbParsedValue > DbMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "long long": + case "longlong": + long LlParsedValue; + long LlMaxValue, LlMinValue; + if (!Parse.Try(data.FieldValue, out LlParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out LlMinValue) && + Parse.Try(data.FieldMaxValue, out LlMaxValue)) + { + if (LlParsedValue < LlMinValue || LlParsedValue > LlMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "unsigned long long": + case "unsignedlonglong": + ulong ULlParsedValue; + ulong ULlMaxValue, ULlMinValue; + if (!Parse.Try(data.FieldValue, out ULlParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out ULlMinValue) && + Parse.Try(data.FieldMaxValue, out ULlMaxValue)) + { + if (ULlParsedValue < ULlMinValue || ULlParsedValue > ULlMaxValue) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "boolean": + uint BParsedValue; + if (!Parse.Try(data.FieldValue, out BParsedValue)) + { + DataValid = false; + data.isValid = false; + break; + } + if (Parse.Try(data.FieldMinValue, out UiMinValue) && + Parse.Try(data.FieldMaxValue, out UiMaxValue)) + { + if (BParsedValue < 0 || BParsedValue > 1) + { + DataValid = false; + data.isValid = false; + } + } + break; + case "address": + + break; + default: + //This fn will not validate enumerations + if (!data.isEnum) + { + //Data is invalid because it is of an unknown type + DataValid = false; + data.isValid = false; + } + break; + } + } + return DataValid; + } + + public bool CompareFieldValues(Message Msg) + { + Msg.SetEnumerationType(EnumerationType.EXPANDED_FIELDS); + foreach (MessageData Data in Msg) + { + + foreach (MessageData ThisData in this) + { + if (ThisData.FieldName == Data.FieldName) + { + if (ThisData.FieldValue != Data.FieldValue) + return false; + break; + } + } + } + //If this function has not returned at this point than the Value fields are equal + return true; + } + + #region Serialization/Deserialization for COE send + public byte[] serialize() + { + uint MsgSize = GetMessageSize(); + uint MsgSizeOut = 0; + byte[] buffer = new byte[MsgSize]; + + //Write MessageData to OE Message Buffer + MsgDataToBuffer(ref buffer, out MsgSizeOut); + if (MsgSize != MsgSizeOut) + { + buffer = null; // error + throw new Exception("Message " + _name + ": serialization failed"); + } + return buffer; + } + + public bool deserialize(byte[] stream) + { + return BufferToMsgData(stream); + } + #endregion + + #region ICloneable Members + + public void RetrieveClone(Message clone) + { + _name = clone._name; + _label = clone._label; + Domain = clone.Domain; + _instruLabel = clone._instruLabel; + _packet = clone._packet; + _adapationStoreLabel = clone._adapationStoreLabel; + + //Log = clone.Log; + Messages = clone.Messages; + _packing = clone._packing; + _count = clone._count; + m_Icd = clone.m_Icd; + + if (clone.MessageDataArray == null) + { + MessageDataArray = null; + } + else + { + MessageDataArray = new MessageData[clone.MessageDataArray.Length]; + for (int i = 0; i < clone.MessageDataArray.Length; i++) + { + MessageDataArray[i] = (MessageData)clone.MessageDataArray[i].Clone(); + } + } + } + + /// + /// + /// + /// + public object Clone() + { + Message clone = new Message + { + _name = _name, + _label = _label, + Domain = Domain, + _instruLabel = _instruLabel, + _adapationStoreLabel = _adapationStoreLabel, + _packet = _packet, + /*clone.Log = Log;*/ + Messages = Messages, + _packing = _packing, + _count = _count, + m_Icd = m_Icd, + MessageDataArray = CloneMessageData(MessageDataArray) + }; + return clone; + } + + /// + /// + /// + /// + /// + private MessageData[] CloneMessageData(MessageData[] orig) + { + MessageData[] clone = null; + if (orig != null) + { + clone = new MessageData[orig.Length]; + for (int i = 0; i < orig.Length; i++) + { + clone[i] = (MessageData)orig[i].Clone(); + } + } + + return clone; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/MessageData.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/MessageData.cs new file mode 100644 index 0000000..c294ec5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/MessageData.cs @@ -0,0 +1,600 @@ +// ********************************************************************************************************** +// MessageData.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using System.Collections.Generic; +using System.IO; + +using Raytheon.Instruments.coeCSharp; + +namespace Raytheon.Instruments.MessagingUtilities +{ + public class MessageData : ICloneable + { + public string FieldName; + public string FieldType; + public string FieldValue; + public string FieldArrayValue; + public string FieldDefaultValue; + public string FieldMaxValue; + public string FieldMinValue; + public string FieldBitValue; + public string FieldInstruType; + public string Variable; + public string MaxOffset; + public string MinOffset; + public string VerifyType; + public bool isSelected; + public bool isArray; + public bool isStructure; + public bool isArrayOfStructures; + public bool isEnum; + public bool usesRegister; + public bool isValid; + public bool useRange; + public int arrayLength; + public uint imageWidth; + public uint imageHeight; + public uint imagePixelSize; + public ulong bitMask; + public bool expanded; + public int depth; + public byte[] imageBuffer; + public uint imageBufferSize; + public MessageData[] MessageArray; + + public delegate coe.Status ReadImageDelegate + ( + string filename, + uint columns, + uint rows, + uint pixel_size, + byte[] buffer + ); + + private MessageXmlDocument m_Icd; + + internal int m_BitCounter = 0; // used to calculate the bit mask + + internal static Dictionary m_ReadFunctions = null; + private MessageData() { } + private MessageData(MessageXmlDocument Icd) + { + FieldName = null; + FieldType = null; + FieldValue = null; + FieldArrayValue = null; + FieldDefaultValue = null; + FieldMaxValue = null; + FieldMinValue = null; + FieldBitValue = null; + Variable = null; + MaxOffset = null; + MinOffset = null; + VerifyType = null; + isSelected = false; + isArray = false; + isStructure = false; + isArrayOfStructures = false; + usesRegister = false; + useRange = false; + arrayLength = 0; + imageWidth = 0; + imageHeight = 0; + imagePixelSize = 0; + bitMask = 0; + expanded = false; + depth = 0; + imageBufferSize = 0; + imageBuffer = null; + + m_Icd = Icd; + } + + public MessageData(string fieldname, + string fieldtype, + string fieldvalue, + string fielddefaultvalue, + MessageXmlDocument Icd) : + this(Icd) + { + FieldName = fieldname; + FieldType = fieldtype; + FieldValue = fieldvalue; + + SetInstruType(null); + SetDefaultValue(fielddefaultvalue); + + } + + public MessageData(string fieldname, + string fieldtype, + string fieldvalue, + string fielddefaultvalue, + string fieldmaxvalue, + string fieldminvalue, + MessageXmlDocument Icd) : + this(fieldname, fieldtype, fieldvalue, fielddefaultvalue, Icd) + { + SetMaxValue(fieldmaxvalue); + SetMinValue(fieldminvalue); + } + + public string FormattedValue + { + get { return FormatValue(FieldValue); } + } + public string FormattedMinValue + { + get { return FormatValue(FieldMinValue); } + } + public string FormattedMaxValue + { + get { return FormatValue(FieldMaxValue); } + } + + public static string ImageFileReadTypes + { + get + { + string fileTypes = ""; + if (m_ReadFunctions == null) return null; + foreach (string type in m_ReadFunctions.Keys) + { + if (fileTypes != "") + fileTypes += "|"; + + fileTypes += type.ToUpper() + " files (*." + type.ToLower() + ")|*." + type.ToLower(); + } + + return fileTypes; + } + } + + public void AddReadExtension(string extension, ReadImageDelegate readFunc) + { + if (m_ReadFunctions == null) + m_ReadFunctions = new Dictionary(); + + if (m_ReadFunctions.ContainsKey(extension)) + m_ReadFunctions[extension] = readFunc; + else + m_ReadFunctions.Add(extension, readFunc); + } + + public void UpdateImage() + { + if (FieldInstruType == "P") + { + if (File.Exists(FieldValue)) + { + string extension = FieldValue.Substring(FieldValue.LastIndexOf(".") + 1); + m_ReadFunctions[extension](FieldValue, + imageWidth, + imageHeight, + imagePixelSize, + imageBuffer); + } + else + { + // TODO add error message + //MessageBox.Show("Unable to open file " + FieldValue + + // " to populate " + FieldName, + // "File Read Error", + // MessageBoxButtons.OK, + // MessageBoxIcon.Error); + FieldValue = ""; + for (int i = 0; i < imageBuffer.Length; i++) + { + imageBuffer[i] = 0; + } + } + } + } + + + public void SetDefaultValue(string fieldDefaultValue) + { + // Initialize uninitialized value + if (fieldDefaultValue == null) + { + fieldDefaultValue = ""; + } + + if ((FieldType == "char") && (fieldDefaultValue.Contains("\""))) + { + FieldInstruType = "S"; + } + + FieldDefaultValue = RemoveCharFromString(fieldDefaultValue, '\"'); + } + + public void SetMaxValue(string fieldmaxvalue) + { + if (fieldmaxvalue == null) return; /* Bad argument */ + + if ((FieldType == "char") && (fieldmaxvalue.Contains("\""))) + { + FieldInstruType = "S"; + } + + FieldMaxValue = RemoveCharFromString(fieldmaxvalue, '\"'); + } + + public void SetMinValue(string fieldminvalue) + { + if (fieldminvalue == null) return; /* Bad argument */ + + if ((FieldType == "char") && (fieldminvalue.Contains("\""))) + { + FieldInstruType = "S"; + } + + FieldMinValue = RemoveCharFromString(fieldminvalue, '\"'); + } + + public void SetBitValue(int bits) + { + int size = (int)Message.GetTypeSize(FieldType, isEnum); + + // Determine the bitMask + if (bits == 0) + { + m_BitCounter = 0; + FieldBitValue = null; + } + else + { + FieldBitValue = bits.ToString(); + + // If bits overflow across the type boundary, then + // they start at the next boundary. + // + // MSDN : + // "Note that nYear is 8 bits long and would overflow + // the word boundary of the declared type, unsigned short. + // Therefore, it is begun at the beginning of a + // new unsigned short." + if (m_BitCounter + bits > size * 8) + { + m_BitCounter = 0; + } + + // 2^bits-1 will give a bit mask with bit# of 1's + // ex: bits = 5, bitMask = 11111 + bitMask = (ulong)Math.Pow(2, (double)bits) - 1; + + // We must slide the bitMask left to put it in place + bitMask <<= m_BitCounter; + m_BitCounter += bits; + + // If we have used all the bits in the type that was defined, then + // restart the counter + if (m_BitCounter == size * 8) + m_BitCounter = 0; + } + + if (bitMask == 0xffffff) + { + bitMask = 0; + } + } + + public void SetArraySize(int size) + { + char result; + + arrayLength = size; // Save the size + + if (!isArray && !isStructure) + { + // Don't handle strings as arrays + if ((FieldInstruType != "S") && (FieldInstruType != "P")) + { + isArray = true; + + MessageArray = new MessageData[size]; + // If the field type is char or unsigned char and the default value + // exists and is a string then write one char of the string to + // each element of the array + if ((FieldType == "char" || FieldType == "unsigned char") && + FieldDefaultValue != null && + !Parse.Try(FieldDefaultValue, out result)) + { + for (uint index = 0; index < size; index++) + { + //Only the elements that are required to spell out the string should + //receive default values. + if (index < FieldDefaultValue.Length) + { + MessageArray[index] = new MessageData(FieldName + "[" + index + "]", + FieldType, FieldValue, FieldDefaultValue[(int)index].ToString(), + FieldMaxValue, FieldMinValue, m_Icd); + MessageArray[index].FieldInstruType = FieldInstruType; + } + else + { + MessageArray[index] = new MessageData(FieldName + "[" + index + "]", + FieldType, FieldValue, "0", + FieldMaxValue, FieldMinValue, m_Icd); + MessageArray[index].FieldInstruType = FieldInstruType; + } + MessageArray[index].depth = depth + 1; + } + } + else + { + for (uint index = 0; index < size; index++) + { + MessageArray[index] = new MessageData(FieldName + "[" + index + "]", + FieldType, FieldValue, FieldDefaultValue, FieldMaxValue, + FieldMinValue, m_Icd); + MessageArray[index].FieldInstruType = FieldInstruType; + MessageArray[index].depth = depth + 1; + } + } + + } + } + } + + public void SetStructureSize(int size) + { + if (!isArray && !isStructure) + { + isStructure = true; + MessageArray = new MessageData[size]; + for (uint index = 0; index < size; index++) + { + MessageArray[index] = new MessageData(FieldName + ".", null, null, null, m_Icd); + } + } + } + + internal void SetInstruType(string Type) + { + if (Type != null) + { + FieldInstruType = Type; + + // Ensure 'S' is used properly + if ((Type == "S") && (FieldType != "char")) + { + return; /* << EXIT >> */ + } + } + else + { + if ((FieldType != null) && + ((FieldType.Trim() == "float") || (FieldType.Trim() == "double"))) + { + FieldInstruType = "F"; + } + else + { + FieldInstruType = "I"; + } + } + } + + internal void SetPixelSize() + { + // Only do this if the user did not define a size + if (imagePixelSize == 0) + { + switch (FieldType) + { + case "char": + case "unsigned char": + case "unsignedchar": + imagePixelSize = 1; + break; + + case "short": + case "unsigned short": + case "unsignedshort": + imagePixelSize = 2; + break; + + case "int": + case "unsigned int": + case "unsignedint": + case "unsigned": + case "boolean": + case "address": + case "float": + imagePixelSize = 4; + break; + + case "double": + case "long long": + case "longlong": + case "unsigned long long": + case "unsignedlonglong": + imagePixelSize = 8; + break; + + default: + if (isEnum) + { + imagePixelSize = 4; + } + else // Error case + { + imagePixelSize = 1; + } + break; + } + } + } + + + private string FormatValue(string Value) + { + if ((Value == null) || (Value == "")) + { + return ""; + } + else // Value exists + { + if (isEnum == false) + { + if (FieldInstruType == "I") + { + // This is being represented as a decimal + if (Parse.Try(Value, out long dec) == true) + { + return dec.ToString(); + } + } + else if (FieldInstruType == "F") + { + // This is being represented as floating point + if (Parse.Try(Value, out double flt) == true) + { + return flt.ToString(); + } + } + else if ((FieldInstruType == "X") || + (FieldInstruType == "B") || + (FieldInstruType == "T")) + { + // This is being represented as a hexadecimal value + if (Parse.Try(Value, out long hex) == true) + { + return "0x" + hex.ToString("X"); + } + } + else if (FieldInstruType == "N") + { + // This is being represented as a binary number + if (Parse.Try(Value, out long bin) == true) + { + return Convert.ToString(bin, 2) + "b"; + } + } + // else InstruType == 'S' or 'P' or anything else return the value + } + else // This value is an enumeration + { + Dictionary enums = m_Icd.GetEnumerations(FieldType); + if (enums.ContainsValue(Value) == true) + { + foreach (KeyValuePair pair in enums) + { + if (pair.Value.Trim() == Value.Trim()) + { + return pair.Key; + } + } + } + } + } + + return Value; // If nothing above applies, simply return the value string + } + + private String RemoveCharFromString(String str, char c) + { + if (str == null) return null; // Handle null case + + int index = str.IndexOf(c); + while (index != -1) + { + str = str.Remove(index, 1); + index = str.IndexOf(c); + } + + return str; + } + + #region ICloneable Members + + public object Clone() + { + MessageData clone = new MessageData(); + + clone.FieldName = FieldName; + clone.FieldType = FieldType; + clone.FieldValue = FieldValue; + clone.FieldArrayValue = FieldArrayValue; + clone.FieldDefaultValue = FieldDefaultValue; + clone.FieldMaxValue = FieldMaxValue; + clone.FieldMinValue = FieldMinValue; + clone.FieldBitValue = FieldBitValue; + clone.FieldInstruType = FieldInstruType; + clone.Variable = Variable; + clone.MaxOffset = MaxOffset; + clone.MinOffset = MinOffset; + clone.VerifyType = VerifyType; + clone.isSelected = isSelected; + clone.isArray = isArray; + clone.isStructure = isStructure; + clone.isArrayOfStructures = isArrayOfStructures; + clone.isEnum = isEnum; + clone.usesRegister = usesRegister; + clone.isValid = isValid; + clone.useRange = useRange; + clone.arrayLength = arrayLength; + clone.bitMask = bitMask; + clone.expanded = expanded; + clone.depth = depth; + clone.m_Icd = m_Icd; + clone.imageWidth = imageWidth; + clone.imageHeight = imageHeight; + clone.imagePixelSize = imagePixelSize; + clone.imageBufferSize = imageBufferSize; + if (imageBufferSize > 0) + { + clone.imageBuffer = new byte[imageBufferSize]; + imageBuffer.CopyTo(clone.imageBuffer, 0); + } + + if (MessageArray == null) + { + clone.MessageArray = null; + } + else + { + clone.MessageArray = new MessageData[MessageArray.Length]; + for (int i = 0; i < MessageArray.Length; i++) + { + clone.MessageArray[i] = (MessageData)MessageArray[i].Clone(); + } + } + + return clone; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/MessageXmlDocument.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/MessageXmlDocument.cs new file mode 100644 index 0000000..d2395a2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/MessageXmlDocument.cs @@ -0,0 +1,426 @@ +// ********************************************************************************************************** +// MessageXmlDocument.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +using System.Diagnostics; +using System.Threading; +using NLog; + +namespace Raytheon.Instruments.MessagingUtilities +{ + public class MessageXmlDocument : XmlDocument + { + private readonly ILogger _logger; + private readonly string _XmlFileName; + private string BuiltXML = ""; + + private uint m_MaxMsgSize = 0; + private readonly List m_IncludeList; + + private MessageXmlDocument() : base() + { + } + + public MessageXmlDocument(string Pathname, + ILogger logger) : + base() + { + _logger = logger; + _XmlFileName = Pathname; + + m_IncludeList = new List(); + RecurseProcessing(Pathname); + + BuiltXML = string.Concat(BuiltXML, ""); + BytePackingXml addPacking = new BytePackingXml(BuiltXML); + LoadXml(addPacking.OuterXml); + } + + public Dictionary GetEnumerations(string Type) + { + Dictionary enumList = new Dictionary(); + + // Get XML nodes to parse the XML ICD document + XPathNavigator Node = CreateNavigator(); + XPathNodeIterator Nodeset = Node.Select("interface/enum/name"); + + while (Nodeset.MoveNext()) + { + // Find the enumeration with the name of the type + if (Nodeset.Current.Value.Trim().Equals(Type.Trim())) + { + // Find all the enumeration items + XPathNavigator enumNode = Nodeset.Current.Clone(); + while (enumNode.MoveToNext()) + { + if (enumNode.Name.Trim().Equals("item") || + enumNode.Name.Trim().Equals("enum_item")) + { + string name = null; + string value = null; + + // Find all name nodes + XPathNavigator childNode = enumNode.Clone(); + childNode.MoveToFirstChild(); + do + { + if (childNode.Name.Trim().Equals("name")) + { + name = childNode.Value.Trim(); + } + else if (childNode.Name.Trim().Equals("item_name")) + { + name = childNode.Value.Trim(); + } + + if (childNode.Name.Trim().Equals("value")) + { + value = childNode.Value.Trim(); + } + + // Once we find the name & value, add it to the list + if ((name != null) && (value != null)) + { + enumList.Add(name, value); + break; + } + } while (childNode.MoveToNext()); + } + } + + break; // We found the enumeration we wanted + } + } + + return enumList; + } + + private void RecurseProcessing(string pathName) + { + string directory; + string IncludePathname; + XPathNodeIterator nodeset; + + // Only process each file once + pathName = pathName.Replace('/', '\\'); + if (m_IncludeList.Contains(pathName)) + { + return; // This file has already been processed + } + else + { + m_IncludeList.Add(pathName); + } + + _logger.Log(LogLevel.Info, $"Loading File: {pathName}"); + XPathDocument document = new XPathDocument(pathName); + XPathNavigator navigator = document.CreateNavigator(); + + // Verify this is a COE XML ICD + nodeset = navigator.Select("/interface"); + if (nodeset.Count == 0) + { + // This is not an XML ICD + throw new Exception($"Invalid COE XML Format. Unable to process {pathName}" + + "\nEnsure this is a properly formatted ICD."); + } + + nodeset = navigator.Select("/interface/include/file"); + while (nodeset.MoveNext()) + { + try + { + directory = DirectoryOf(pathName); + } + catch + { + directory = ".\\"; + } + + IncludePathname = nodeset.Current.Value.Trim(); + if ((!IncludePathname.StartsWith("\\")) && (!IncludePathname.Contains(":"))) + { + while (IncludePathname.StartsWith(".")) + { + if ((IncludePathname.StartsWith("..\\")) || (IncludePathname.StartsWith("../"))) + { + directory = DirectoryOf(directory); + IncludePathname = IncludePathname.Remove(0, 3); + } + else if ((IncludePathname.StartsWith(".\\")) || (IncludePathname.StartsWith("./"))) + { + IncludePathname = IncludePathname.Remove(0, 2); + } + } + IncludePathname = string.Concat(directory, "\\", IncludePathname); + } + RecurseProcessing(IncludePathname); + } + + nodeset = navigator.Select("/interface/packing|/interface/typedef|/interface/constant|interface/enum|/interface/structure|/interface/message"); + while (nodeset.MoveNext()) + { + string item = nodeset.Current.OuterXml; + int index; + while ((index = item.IndexOf("")) != -1) + { + item = item.Remove(index, item.IndexOf("") + 14 - index); + } + while ((index = item.IndexOf("") + 3 - index); + } + while (item.IndexOf("> ") != -1) + { + item = item.Replace("> ", ">"); + } + while (item.IndexOf(" <") != -1) + { + item = item.Replace(" <", "<"); + } + //_logger.Log(LogLevel.Trace, $"Loading Node :\n{item}"); + Thread.Sleep(1); + BuiltXML = string.Concat(BuiltXML, item); + } + } + + private string DirectoryOf(string Pathname) + { + return Pathname.Remove(Pathname.LastIndexOf("\\")); + } + + // + // From the XML document, the definition of a single message can be identified + // from the Message Name and returned as an XML string. + // + public string XmlFileName + { + get + { + return _XmlFileName; + } + } + + public string GetMessage(string messageName) + { + string message; + + messageName = messageName.Trim(); + _logger.Log(LogLevel.Info, $"Searching for message : {messageName}"); + try + { + message = SelectSingleNode($"/interface/message[name='{messageName}']").OuterXml; + message = TranslateValue(message); + _logger.Log(LogLevel.Trace, $"Found by name: {message}"); + } + catch + { + message = null; + _logger.Log(LogLevel.Error, "Message not found"); + } + return message; + } + + // + // From the XML document, the definition of a single message can be identified + // from the Message Label and returned as an XML string. + // + public string GetMessageFromLabel(string messageLabel) + { + string message; + string msgLabel = ""; + + if (Parse.Try(messageLabel, out int label) == true) + { + msgLabel = label.ToString(); + } + + _logger.Log(LogLevel.Info, $"Searching for message: {msgLabel}"); + try + { + // Search by message label + message = SelectSingleNode($"/interface/message[label='{msgLabel}']").OuterXml; + message = TranslateValue(message); + _logger.Log(LogLevel.Trace, $"Found by label: {message}"); + } + catch + { + try + { + // Search by instruLabel + message = SelectSingleNode($"/interface/message[instruLabel='{messageLabel}']").OuterXml; + message = TranslateValue(message); + _logger.Log(LogLevel.Trace, $"Found by instrument Label: {message}"); + } + catch + { + message = null; + _logger.Log(LogLevel.Error, "Message not found"); + } + } + return message; + } + + // + // From the XML document, the definition of a single message can be identified + // from the Message InstruLabel and returned as an XML string. + // + public string GetMessageFromInstruLabel(string messageInstruLabel) + { + string message; + + messageInstruLabel = messageInstruLabel.Trim(); + _logger.Log(LogLevel.Info, $"Searching for message: {messageInstruLabel}"); + try + { + message = SelectSingleNode($"/interface/message[instruLabel='{messageInstruLabel}']").OuterXml; + message = TranslateValue(message); + _logger.Log(LogLevel.Trace, $"Found by instrument label: {message}"); + } + catch + { + message = null; + _logger.Log(LogLevel.Error, "Message not found"); + } + return message; + } + + public uint GetLargestMessageSize() + { + lock (this) + { + // return the max message size if we have already calculated it + if (m_MaxMsgSize != 0) + { + return m_MaxMsgSize; + } + else + { + DateTime t1 = DateTime.Now; + + XPathNavigator navigator = CreateNavigator(); + XPathNodeIterator nodeset = navigator.Select("/interface/message/name"); + + while (nodeset.MoveNext()) + { + Message msg = new Message(nodeset.Current.Value.Trim(), this); + uint msgSize = msg.GetMessageSize(); + if (msgSize > m_MaxMsgSize) + { + m_MaxMsgSize = msgSize; + } + } + + DateTime t2 = DateTime.Now; + TimeSpan duration = t2 - t1; + Debug.WriteLine("Max Msg Size Algorithm Time = " + duration); + } + } + + return m_MaxMsgSize; + } + + public uint GetMessageSize(string MsgName) + { + uint msg_size = 0; + + lock (this) + { + XPathNavigator navigator = CreateNavigator(); + XPathNodeIterator nodeset = navigator.Select("/interface/message/name"); + + while (nodeset.MoveNext()) + { + if (MsgName == nodeset.Current.Value.Trim()) + { + Message msg = new Message(nodeset.Current.Value.Trim(), this); + msg_size = msg.GetMessageSize(); + } + } + } + + return msg_size; + } + + // + // Since the XML message definitions contain the definitions of all the enumerations and constants, + // this object is the only one containing the knowledge to interpret strings using enumerations and/or + // constants. This method will substitute enumerations and constants with their respective base values + // in a specified string. + // + public string TranslateValue(string Value) + { + XPathNavigator navigator = CreateNavigator(); + XPathNavigator position; + string NewValue = Value; + + // + // Substitute enumeration + // + try + { + position = navigator.SelectSingleNode("/interface/enum/item[name='" + NewValue + "']"); + if (position == null) + { + position = navigator.SelectSingleNode("/interface/enum/item[item_name='" + NewValue + "']"); + } + if (position != null) + { + position.MoveToChild("value", ""); + NewValue = position.Value; + } + + // + // Substitute constants + // + position = navigator.SelectSingleNode("/interface/constant[name='" + NewValue + "']"); + if (position != null) + { + NewValue = position.Value; + _logger.Log(LogLevel.Info, "Translating field value : " + Value + " -> " + NewValue); + } + } + catch (Exception e) + { + _logger.Error(e.Message); + } + + return NewValue; + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/OeMessage.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/OeMessage.cs new file mode 100644 index 0000000..7341ead --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/OeMessage.cs @@ -0,0 +1,130 @@ +// ********************************************************************************************************** +// OeMessage.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using Raytheon.Instruments.coeCSharp; +using System; + +namespace Raytheon.Instruments.MessagingUtilities +{ + public class OeMessage : coeMessage + { + public Message XmlMessage + { + get { return m_Msg; } + set + { + m_Msg = value; + Label = value.Label; + Size = value.GetMessageSize(); + } + } + + public new string Label + { + get { return base.Label.ToString(); } + set + { + if (Parse.Try(value, out uint label) == true) + { + base.Label = label; + } + else + { + throw new Exception("OeMessage: Label does not parse to an Unsigned Integer"); + } + } + } + + public new string Domain + { + get { return base.Domain.ToString(); } + set + { + if (Parse.Try(value, out uint domain) == true) + { + base.Domain = domain; + } + else + { + throw new Exception("OeMessage: Domain does not parse to an Unsigned Integer"); + } + } + } + + public OeMessage() : base(0) { m_Msg = null; } + public OeMessage(int size) : base(size) { m_Msg = null; } + public OeMessage(Message msg) + : base(0) + { + XmlMessage = msg; + } + public OeMessage(Message msg, int msgSize) : base(msgSize) + { + XmlMessage = msg; + } + + override public void Serialize() + { + if (m_Msg != null) + { + byte[] serializedBuffer = m_Msg.serialize(); + if (serializedBuffer.Length > BufferSize) + { + BufferSize = serializedBuffer.Length; + } + Size = (uint)serializedBuffer.Length; + copyToMessageBuffer(serializedBuffer); + Domain = m_Msg.Domain; + } + } + + override public void Deserialize() + { + if (m_Msg != null) + { + // Get sending time and pass it to the XmlMessage object; + GetSendTime(out ulong sendSec, out uint sendSecFrac); + m_Msg.SendSecond = sendSec; + m_Msg.SendSecondFraction = sendSecFrac; + m_Msg.Domain = Domain; + byte[] receiveBuffer = copyFromMessageBuffer(); + if (receiveBuffer != null) + { + m_Msg.deserialize(receiveBuffer); + } + } + } + + Message m_Msg = null; + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/Parse.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/Parse.cs new file mode 100644 index 0000000..a5033b1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/MessagingUtilities/Parse.cs @@ -0,0 +1,377 @@ +// ********************************************************************************************************** +// Parse.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Instruments.MessagingUtilities +{ + public class Parse + { + public static bool Try(string value, out byte result) + { + result = 0; + if (value == null) + return false; // Handle bad argument + + bool passed = byte.TryParse(value, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = byte.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out result); + } + else if (value.EndsWith("b") == true) + { + value = value.TrimEnd("b".ToCharArray()); + try + { + result = Convert.ToByte(value, 2); + passed = true; + } + catch + { + passed = false; + } + } + else + { + passed = true; // Handle Boolean TYPES + if (value.Trim().ToUpper().Equals("TRUE")) + result = 1; + else if (value.Trim().ToUpper().Equals("FALSE")) + result = 0; + else + passed = false; + } + } + + return passed; + } + + public static bool Try(string value, out decimal result) + { + result = 0; + if (value == null) + return false; // Handle bad argument + + bool passed = decimal.TryParse(value, System.Globalization.NumberStyles.Any, null, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = int.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out int hexResult); + if (passed) + { + result = hexResult; + } + } + } + + return passed; + } + + public static bool Try(string value, out short result) + { + result = 0; + if (value == null) + return false; // Handle bad argument + + bool passed = short.TryParse(value, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = short.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out result); + } + else if (value.EndsWith("b") == true) + { + value = value.TrimEnd("b".ToCharArray()); + try + { + result = Convert.ToInt16(value, 2); + passed = true; + } + catch + { + passed = false; + } + } + else + { + passed = true; // Handle Boolean TYPES + if (value.Trim().ToUpper().Equals("TRUE")) + result = 1; + else if (value.Trim().ToUpper().Equals("FALSE")) + result = 0; + else + passed = false; + } + } + + return passed; + } + + public static bool Try(string value, out ushort result) + { + result = 0; + if (value == null) + return false; // Handle bad argument + + bool passed = ushort.TryParse(value, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = ushort.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out result); + } + else if (value.EndsWith("b") == true) + { + value = value.TrimEnd("b".ToCharArray()); + try + { + result = Convert.ToUInt16(value, 2); + passed = true; + } + catch + { + passed = false; + } + } + else + { + passed = true; // Handle Boolean TYPES + if (value.Trim().ToUpper().Equals("TRUE")) + result = 1; + else if (value.Trim().ToUpper().Equals("FALSE")) + result = 0; + else + passed = false; + } + } + + return passed; + } + + public static bool Try(string value, out int result) + { + result = 0; + if (value == null) + return false; // Handle bad argument + + bool passed = int.TryParse(value, System.Globalization.NumberStyles.Any, null, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = int.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out result); + } + else if (value.EndsWith("b") == true) + { + value = value.TrimEnd("b".ToCharArray()); + try + { + result = Convert.ToInt32(value, 2); + passed = true; + } + catch + { + passed = false; + } + } + else + { + passed = true; // Handle Boolean TYPES + if (value.Trim().ToUpper().Equals("TRUE")) + result = 1; + else if (value.Trim().ToUpper().Equals("FALSE")) + result = 0; + else + passed = false; + } + } + + return passed; + } + + public static bool Try(string value, out uint result) + { + result = 0; + if (value == null) + return false; // Handle bad argument + + bool passed = uint.TryParse(value, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = uint.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out result); + } + else if (value.EndsWith("b") == true) + { + value = value.TrimEnd("b".ToCharArray()); + try + { + result = Convert.ToUInt32(value, 2); + passed = true; + } + catch + { + passed = false; + } + } + else + { + passed = true; // Handle Boolean TYPES + if (value.Trim().ToUpper().Equals("TRUE")) + result = 1; + else if (value.Trim().ToUpper().Equals("FALSE")) + result = 0; + else + passed = false; + } + } + + return passed; + } + + public static bool Try(string value, out long result) + { + result = 0; + if (value == null || value == "") + return false; // Handle bad argument + + bool passed = long.TryParse(value, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = long.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out result); + } + else if (value.EndsWith("b") == true) + { + value = value.TrimEnd("b".ToCharArray()); + try + { + result = Convert.ToInt64(value, 2); + passed = true; + } + catch + { + passed = false; + } + } + else + { + passed = true; // Handle Boolean TYPES + if (value.Trim().ToUpper().Equals("TRUE")) + result = 1; + else if (value.Trim().ToUpper().Equals("FALSE")) + result = 0; + else + passed = false; + } + } + + return passed; + } + + public static bool Try(string value, out ulong result) + { + result = 0; + if (value == null) + return false; // Handle bad argument + + bool passed = ulong.TryParse(value, out result); + if (passed == false) + { + if (value.StartsWith("0x") == true) + { + value = value.Substring(2, value.Length - 2); + passed = ulong.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out result); + } + else if (value.EndsWith("b") == true) + { + value = value.TrimEnd("b".ToCharArray()); + try + { + result = Convert.ToUInt64(value, 2); + passed = true; + } + catch + { + passed = false; + } + } + else + { + passed = true; // Handle Boolean TYPES + if (value.Trim().ToUpper().Equals("TRUE")) + result = 1; + else if (value.Trim().ToUpper().Equals("FALSE")) + result = 0; + else + passed = false; + } + } + + return passed; + } + + public static bool Try(string value, out char result) + { + return char.TryParse(value, out result); + } + + public static bool Try(string value, out float result) + { + if (value.EndsWith("f") == true) + value = value.TrimEnd("f".ToCharArray()); + + return float.TryParse(value, System.Globalization.NumberStyles.Any, null, out result); + } + + public static bool Try(string value, out double result) + { + if (value.EndsWith("f") == true) + value = value.TrimEnd("f".ToCharArray()); + + return double.TryParse(value, System.Globalization.NumberStyles.Any, null, out result); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlMbitParser.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlMbitParser.cs new file mode 100644 index 0000000..611862b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlMbitParser.cs @@ -0,0 +1,329 @@ +// ********************************************************************************************************** +// XmlMbitParser.cs +// 6/6/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +namespace Raytheon.Instruments.XmlUtilities +{ + public class XmlMbitParser + { + private readonly NLog.Logger _logger = NLog.LogManager.GetCurrentClassLogger(); + + private readonly Dictionary _commonElements = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + // store messages defined in xml files + private readonly List _mbitMessages = new List(); + + // store duplicate messages for diagnostic purposes + private readonly Dictionary> _duplicateMbitMessages = new Dictionary>(); + + // store each enumeration type and its associate key/value pairs + private readonly Dictionary _xmlEnums = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + // store duplicate enumerations for diagnostic purposes + private readonly Dictionary> _duplicateEnums = new Dictionary>(); + + // store each structure type and its associated data members + private readonly Dictionary _xmlStructures = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + // store duplicate structures for diagnostic purposes + private readonly Dictionary> _duplicateStructures = new Dictionary>(); + + // look up table for constants, the key is the constant name. A constant name can be defined in more than one namespace and have different values + private ILookup _xmlConstantsLookUpByConstantName = null; + + // look up table for constants, the key is the namespace in which the constant is defined. A constant name can be defined in more than one namespace and have different values + private ILookup _xmlConstantsLookUpByNameSpace = null; + + // store duplicate constants for diagnostic purposes + private readonly Dictionary> _duplicateConstants = new Dictionary>(); + + // store names of files that contain data types that we need to generate + public List m_dataTypeFilesToBeGenerated = new List(); + + /// + /// Parse XML files from the path folder + /// + /// + /// + public bool ParseXmlFiles(string path) + { + bool isSuccessful = true; + string xmlNamespace = string.Empty; + List constantList = new List(); + + if (!Directory.Exists(path)) + { + _logger.Error($"Path {path} not found"); + + isSuccessful = false; + return isSuccessful; + } + + string[] files = Directory.GetFiles(path, "*.xml", SearchOption.AllDirectories); + + List dataTypeFiles = new List(files.ToList()); + + foreach (string xmlFile in dataTypeFiles) + { + XPathDocument doc = null; + + int prevEnumCount = _xmlEnums.Count; + int prevStructureCount = _xmlStructures.Count; + int prevMessageCount = _mbitMessages.Count; + int prevConstantCount = constantList.Count; + + List comments = new List(); + + try + { + XmlReaderSettings readerSettings = new XmlReaderSettings() + { + // tells the xmlreader to ignore comment in XML file + IgnoreComments = true + }; + + using (XmlReader reader = XmlReader.Create(xmlFile, readerSettings)) + { + // load the XML file + doc = new XPathDocument(reader); + } + + XPathNavigator nav = doc.CreateNavigator(); + + xmlNamespace = Path.GetFileNameWithoutExtension(xmlFile); + + _commonElements[xmlNamespace] = new XmlParser.CommonXmlElements(); + + nav.MoveToRoot(); + + try + { + _logger.Info($"Parsing {Path.GetFileName(xmlFile)}"); + + if (nav.MoveToFirstChild()) + { + do + { + if (string.Equals(nav.Name, "interface", StringComparison.OrdinalIgnoreCase)) + { + if (nav.MoveToFirstChild()) + { + do + { + if (!XmlParser.GetCommonElementsFromXml(nav, _commonElements[xmlNamespace])) + { + if (string.Equals(nav.Name, "enum", StringComparison.OrdinalIgnoreCase)) + { + XmlParser.GetEnumeration(nav, xmlNamespace, _xmlEnums, _duplicateEnums); + } + else if (string.Equals(nav.Name, "structure", StringComparison.OrdinalIgnoreCase)) + { + XmlParser.GetStructure(nav, xmlNamespace, _xmlStructures, comments, _duplicateStructures); + comments.Clear(); + } + else if (string.Equals(nav.Name, "constant", StringComparison.OrdinalIgnoreCase)) + { + XmlParser.GetConstant(nav, xmlNamespace, constantList, _duplicateConstants); + } + else if (string.Equals(nav.Name, "message", StringComparison.OrdinalIgnoreCase)) + { + XmlParser.GetMbitMessage(nav, xmlNamespace, _mbitMessages, _duplicateMbitMessages); + } + else if (string.Equals(nav.Name, "comment", StringComparison.OrdinalIgnoreCase)) + { + comments.Add(nav.Value.Trim()); + } + else if (nav.Name.Length > 0) + { + throw new XmlParsingException("Unknown element \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + } + } while (nav.MoveToNext()); + } + } + } while (nav.MoveToNext()); + } + } + catch (XmlParsingException ex) + { + string message = "File : " + xmlFile + "\n" + ex.Message; + throw new Exception(message); + } + } + catch (Exception e) + { + _logger.Error(e); + isSuccessful = false; + } + + if (isSuccessful) + { + _logger.Info(" - SUCCESS"); + + _logger.Info("Results:"); + _logger.Info($"Constants: {constantList.Count - prevConstantCount}"); + _logger.Info($"Enumerations: {_xmlEnums.Count - prevEnumCount}"); + _logger.Info($"Structures: {_xmlStructures.Count - prevStructureCount}"); + _logger.Info($"Messages: {_mbitMessages.Count - prevMessageCount}"); + } + else + { + _logger.Warn(" - FAIL"); + break; + } + } + + if (constantList.Count > 0) + { + // we want to create a look up table from a list of constants + // the key for this table will be the constant name + _xmlConstantsLookUpByConstantName = constantList.ToLookup(item => item.name); + + // we want to create a look up table from a list of constants + // the key for this table will be the namespace + _xmlConstantsLookUpByNameSpace = constantList.ToLookup(item => item.nameSpace); + } + + if (_duplicateMbitMessages.Count > 0 || _duplicateConstants.Count > 0 || _duplicateEnums.Count > 0 || _duplicateStructures.Count > 0) + { + StreamWriter writer = null; + FileStream fs = null; + bool firstLineInFileAllocated = false; + string textToBeWrittenToFile = string.Empty; + string diagnosticFile = Path.Combine(path, "diagnostics.txt"); + + _logger.Info("Generating diagnostic information..."); + + foreach (KeyValuePair> dictItem in _duplicateMbitMessages) + { + if (!firstLineInFileAllocated) + firstLineInFileAllocated = true; + else + textToBeWrittenToFile += "\r\n\r\n"; + + textToBeWrittenToFile += "Duplicate definition for message \"" + dictItem.Key + "\" found in the following files: "; + foreach (string listItem in dictItem.Value) + { + textToBeWrittenToFile += "\r\n" + GetCodeIndentation(1) + listItem; + } + } + + foreach (KeyValuePair> dictItem in _duplicateStructures) + { + if (!firstLineInFileAllocated) + firstLineInFileAllocated = true; + else + textToBeWrittenToFile += "\r\n\r\n"; + + textToBeWrittenToFile += "Duplicate definition for structure \"" + dictItem.Key + "\" found in the following files: "; + foreach (string listItem in dictItem.Value) + { + textToBeWrittenToFile += "\r\n" + GetCodeIndentation(1) + listItem; + } + } + + foreach (KeyValuePair> dictItem in _duplicateEnums) + { + if (!firstLineInFileAllocated) + firstLineInFileAllocated = true; + else + textToBeWrittenToFile += "\r\n\r\n"; + + textToBeWrittenToFile += "Duplicate definition for enum \"" + dictItem.Key + "\" found in the following files: "; + foreach (string listItem in dictItem.Value) + { + textToBeWrittenToFile += "\r\n" + GetCodeIndentation(1) + listItem; + } + } + + foreach (KeyValuePair> dictItem in _duplicateConstants) + { + if (!firstLineInFileAllocated) + firstLineInFileAllocated = true; + else + textToBeWrittenToFile += "\r\n\r\n"; + + textToBeWrittenToFile += "Duplicate definition for constant \"" + dictItem.Key + "\" found in the following files: "; + foreach (string listItem in dictItem.Value) + { + textToBeWrittenToFile += "\r\n" + GetCodeIndentation(1) + listItem; + } + } + + if (textToBeWrittenToFile.Length > 0) + { + try + { + fs = new FileStream(diagnosticFile, FileMode.Create, FileAccess.ReadWrite); + writer = new StreamWriter(fs, Encoding.Default); + writer.Write(textToBeWrittenToFile); + } + catch (System.Exception ex) + { + _logger.Error(ex); + isSuccessful = false; + } + finally + { + if (writer != null) + { + writer.Close(); + fs.Close(); + } + } + } + + //m_mainWindow.updateStatusBox("DONE\n"); + } + + return isSuccessful; + } + public static string GetCodeIndentation(int indentMultiples) + { + string indentUnit = " "; + string indentation = string.Empty; + + for (int i = 1; i <= indentMultiples; i++) + indentation += indentUnit; + + return indentation; + } + } + +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlParser.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlParser.cs new file mode 100644 index 0000000..0111f37 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlParser.cs @@ -0,0 +1,588 @@ +// ********************************************************************************************************** +// XmlParser.cs +// 6/6/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using System.Collections.Generic; +using System.Xml; +using System.Xml.XPath; + +namespace Raytheon.Instruments.XmlUtilities +{ + public class XmlParser + { + public class CommonXmlElements + { + public List fileIncludes = new List(); + public string projectName = string.Empty; + public string classification = string.Empty; + public string fileHeader = string.Empty; + } + + public class XmlConstant + { + public string nameSpace = string.Empty; + public List comments = new List(); + public string name = string.Empty; + public string value = string.Empty; + public string description = string.Empty; + } + + public class XmlEnumeration + { + public string nameSpace = string.Empty; + public string description = string.Empty; + public List comments = new List(); + //public Dictionary enumKeyAndValuePairs = new Dictionary(); + public List enumItems = new List(); + } + + public class XmlEnumItem + { + public List comments = new List(); + public string name = string.Empty; + public string value = string.Empty; + } + + public class XmlStructure + { + public string nameSpace = string.Empty; + public string name = string.Empty; + public List comments = new List(); + public List structDataItems = new List(); + } + + public class XmlStructureItem + { + public string nameSpace = string.Empty; + public List comments = new List(); + public string name = string.Empty; + public string description = string.Empty; + public string type = string.Empty; + public string defaultVal = string.Empty; + public string arrayLength = string.Empty; + public string bits = string.Empty; + } + + public class XmlMbitMessage + { + public string nameSpace = string.Empty; + public string name = string.Empty; + public string label = string.Empty; + public string instruLabel = string.Empty; + public string description = string.Empty; + public List comments = new List(); + + public List dataItems = new List(); + } + + ///=================================================================================== + /// XmlParser.getCommonElementsFromXml + ///=================================================================================== + /// + /// Each XML file contains common elements such as header, includes, etc + /// We want to parse it and save the common elements + /// + /// navigator object that points to the current XML node we are at + /// data structure that stores all the common elements of each XML file + ///=================================================================================== + public static bool GetCommonElementsFromXml(XPathNavigator nav, CommonXmlElements commonElements) + { + bool isSuccessful = true; + + if (string.Equals(nav.Name, "include", StringComparison.OrdinalIgnoreCase)) + { + if (nav.MoveToFirstChild()) + { + GetFileIncludes(nav, commonElements); + + nav.MoveToParent(); + } + } + else if (string.Equals(nav.Name, "project", StringComparison.OrdinalIgnoreCase)) + { + commonElements.projectName = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "classification", StringComparison.OrdinalIgnoreCase)) + { + commonElements.classification = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "fileheader", StringComparison.OrdinalIgnoreCase)) + { + commonElements.fileHeader = nav.Value; + } + else if (string.Equals(nav.Name, "packing", StringComparison.OrdinalIgnoreCase)) + { + } + else + isSuccessful = false; + + return isSuccessful; + } + + ///=================================================================================== + /// XmlParser.getFileIncludes + ///=================================================================================== + /// + /// Get the file includes specify by the XML file + /// + /// navigator object that points to the current XML node we are at + /// data structure that stores all the common elements of each XML file + ///=================================================================================== + public static void GetFileIncludes(XPathNavigator nav, CommonXmlElements commonElements) + { + do + { + commonElements.fileIncludes.Add(nav.Value.Trim()); + + } while (nav.MoveToNext()); + } + + ///=================================================================================== + /// XmlParser.getConstant + ///=================================================================================== + /// + /// Parse the symbolic constant defined by the XML + /// + /// navigator object that points to the current XML node we are at + /// the XML file name that defines this constant + /// the Dictionary that stores this constant information + /// the Dictioanry that stores duplicate constant definitions + ///=================================================================================== + public static void GetConstant(XPathNavigator nav, string nameSpace, List xmlConstants, Dictionary> duplicateConstants) + { + XmlConstant tempXmlConstant = new XmlConstant(); + + if (nav.MoveToFirstChild()) + { + do + { + if (string.Equals(nav.Name, "name", StringComparison.OrdinalIgnoreCase)) + { + tempXmlConstant.name = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "description", StringComparison.OrdinalIgnoreCase)) + { + tempXmlConstant.description = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "value", StringComparison.OrdinalIgnoreCase)) + { + tempXmlConstant.value = nav.Value.Trim(); + } + else if (nav.Name.Length > 0) + { + throw new XmlParsingException("Unknown element \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + + } while (nav.MoveToNext()); + + nav.MoveToParent(); + } + + if (tempXmlConstant.name.Length > 0) + { + tempXmlConstant.nameSpace = nameSpace; + xmlConstants.Add(tempXmlConstant); + } + else + { + throw new XmlParsingException("Child element \"name\" not found for node \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + } + + ///=================================================================================== + /// XmlParser.getEnumeration + ///=================================================================================== + /// + /// Parse the enumeration type defined by the XML + /// + /// navigator object that points to the current XML node we are at + /// the XML file name that defines this enumeration type + /// data structure that stores enumeration data + /// the Dictioanry that stores duplicate enumeration type + ///=================================================================================== + public static void GetEnumeration(XPathNavigator nav, string nameSpace, Dictionary xmlEnums, Dictionary> duplicateEnums) + { + string enumTypeName = string.Empty; + string tempEnumTypeName = "temp"; + Dictionary tempXmlEnums = new Dictionary + { + [tempEnumTypeName] = new XmlEnumeration() + }; + tempXmlEnums[tempEnumTypeName].nameSpace = nameSpace; + + if (nav.MoveToFirstChild()) + { + do + { + if (string.Equals(nav.Name, "name", StringComparison.OrdinalIgnoreCase)) + { + enumTypeName = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "description", StringComparison.OrdinalIgnoreCase)) + { + tempXmlEnums[tempEnumTypeName].description = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "comment", StringComparison.OrdinalIgnoreCase)) + { + tempXmlEnums[tempEnumTypeName].comments.Add(nav.Value.Trim()); + } + else if (string.Equals(nav.Name, "item", StringComparison.OrdinalIgnoreCase) || string.Equals(nav.Name, "enum_item", StringComparison.OrdinalIgnoreCase)) + { + if (nav.MoveToFirstChild()) + { + GetEnumItem(nav, tempXmlEnums[tempEnumTypeName]); + + nav.MoveToParent(); + } + } + else if (nav.Name.Length > 0) + { + throw new XmlParsingException("Unknown element \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + + } while (nav.MoveToNext()); + + nav.MoveToParent(); + } + + if (enumTypeName.Length > 0) + { + if (xmlEnums.ContainsKey(enumTypeName)) + { + // save file name the defines this message that is a duplicate + if (!duplicateEnums.ContainsKey(enumTypeName)) + { + duplicateEnums[enumTypeName] = new List(); + } + + int index2 = duplicateEnums[enumTypeName].FindIndex(f => string.Equals(f, nameSpace + ".xml", StringComparison.OrdinalIgnoreCase)); + + if (index2 < 0) + duplicateEnums[enumTypeName].Add(nameSpace + ".xml"); + + // see if the official structure is already in the duplicate list + int index3 = duplicateEnums[enumTypeName].FindIndex(f => string.Equals(f, xmlEnums[enumTypeName].nameSpace + ".xml", StringComparison.OrdinalIgnoreCase)); + + // if the official structure is not in the duplicate list, we want to save it in the duplicate list + if (index3 < 0) + { + duplicateEnums[enumTypeName].Add(xmlEnums[enumTypeName].nameSpace + ".xml"); + } + } + else + { + xmlEnums[enumTypeName] = tempXmlEnums[tempEnumTypeName]; + } + } + else + { + throw new XmlParsingException("Child element \"name\" not found for node \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + } + + ///=================================================================================== + /// XmlParser.getEnumItem + ///=================================================================================== + /// + /// Parse each enumerated key/value pair + /// + /// navigator object that points to the current XML node we are at + /// data structure that stores enumeration data + ///=================================================================================== + public static void GetEnumItem(XPathNavigator nav, XmlEnumeration xmlEnum) + { + XmlEnumItem enumItem = new XmlEnumItem(); + + do + { + if (string.Equals(nav.Name, "name", StringComparison.OrdinalIgnoreCase) || string.Equals(nav.Name, "item_name", StringComparison.OrdinalIgnoreCase)) + { + enumItem.name = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "value", StringComparison.OrdinalIgnoreCase)) + { + enumItem.value = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "comment", StringComparison.OrdinalIgnoreCase)) + { + enumItem.comments.Add(nav.Value.Trim()); + } + else if (nav.Name.Length > 0) + { + throw new XmlParsingException("Unknown element \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + + } while (nav.MoveToNext()); + + xmlEnum.enumItems.Add(enumItem); + } + + public static void GetStructure(XPathNavigator nav, string nameSpace, Dictionary xmlStructures, List comments, Dictionary> duplicateStructures) + { + string structureTypeName = string.Empty; + string tempStructureTypeName = "temp"; + Dictionary tempXmlStructures = new Dictionary(); + + tempXmlStructures[tempStructureTypeName] = new XmlStructure(); + tempXmlStructures[tempStructureTypeName].nameSpace = nameSpace; + + if (nav.MoveToFirstChild()) + { + do + { + if (string.Equals(nav.Name, "name", StringComparison.OrdinalIgnoreCase)) + { + structureTypeName = nav.Value.Trim(); + + if (comments != null && comments.Count > 0) + { + tempXmlStructures[tempStructureTypeName].comments = new List(comments); + } + } + else if (string.Equals(nav.Name, "comment", StringComparison.OrdinalIgnoreCase)) + { + tempXmlStructures[tempStructureTypeName].comments.Add(nav.Value.Trim()); + } + else if (string.Equals(nav.Name, "item", StringComparison.OrdinalIgnoreCase) || string.Equals(nav.Name, "struct_item", StringComparison.OrdinalIgnoreCase)) + { + if (nav.MoveToFirstChild()) + { + XmlStructureItem structureItem = new XmlStructureItem(); + structureItem.nameSpace = nameSpace; + GetStructureItem(nav, structureItem); + + tempXmlStructures[tempStructureTypeName].structDataItems.Add(structureItem); + + nav.MoveToParent(); + } + } + else if (nav.Name.Length > 0) + { + throw new XmlParsingException("Unknown element \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + + } while (nav.MoveToNext()); + + nav.MoveToParent(); + } + + if (structureTypeName.Length > 0) + { + if (xmlStructures.ContainsKey(structureTypeName)) + { + // save file name the defines this message that is a duplicate + if (!duplicateStructures.ContainsKey(structureTypeName)) + { + duplicateStructures[structureTypeName] = new List(); + } + + int index2 = duplicateStructures[structureTypeName].FindIndex(f => string.Equals(f, nameSpace + ".xml", StringComparison.OrdinalIgnoreCase)); + + if (index2 < 0) + duplicateStructures[structureTypeName].Add(nameSpace + ".xml"); + + // see if the official structure is already in the duplicate list + int index3 = duplicateStructures[structureTypeName].FindIndex(f => string.Equals(f, xmlStructures[structureTypeName].nameSpace + ".xml", StringComparison.OrdinalIgnoreCase)); + + // if the official structure is not in the duplicate list, we want to save it in the duplicate list + if (index3 < 0) + { + duplicateStructures[structureTypeName].Add(xmlStructures[structureTypeName].nameSpace + ".xml"); + } + } + else + { + xmlStructures[structureTypeName] = tempXmlStructures[tempStructureTypeName]; + xmlStructures[structureTypeName].name = structureTypeName; + } + } + else + { + throw new XmlParsingException("Child element \"name\" not found for node \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + } + + ///=================================================================================== + /// XmlParser.getStructureItem + ///=================================================================================== + /// + /// Parse the data structure defined by the XML + /// + /// navigator object that points to the current XML node we are at + /// data structure that stores all data members of the data structure + ///=================================================================================== + public static void GetStructureItem(XPathNavigator nav, XmlStructureItem xmlStructureItem) + { + do + { + if (string.Equals(nav.Name, "name", StringComparison.OrdinalIgnoreCase) || string.Equals(nav.Name, "item_name", StringComparison.OrdinalIgnoreCase)) + { + xmlStructureItem.name = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "type", StringComparison.OrdinalIgnoreCase)) + { + xmlStructureItem.type = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "default", StringComparison.OrdinalIgnoreCase)) + { + xmlStructureItem.defaultVal = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "arrayLength", StringComparison.OrdinalIgnoreCase)) + { + xmlStructureItem.arrayLength = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "comment", StringComparison.OrdinalIgnoreCase)) + { + xmlStructureItem.comments.Add(nav.Value.Trim()); + } + else if (string.Equals(nav.Name, "description", StringComparison.OrdinalIgnoreCase)) + { + xmlStructureItem.description = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "bits", StringComparison.OrdinalIgnoreCase)) + { + xmlStructureItem.bits = nav.Value.Trim(); + } + else if (nav.Name.Length > 0) + { + throw new XmlParsingException("Unknown element \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + + } while (nav.MoveToNext()); + } + + ///=================================================================================== + /// XmlParser.getMbitMessage + ///=================================================================================== + /// + /// Parse the message defined by the XML + /// + /// navigator object that points to the current XML node we are at + /// the XML file name that defines this message + /// list of messages defined by XML + /// the Dictioanry that stores duplicate messages + ///=================================================================================== + public static void GetMbitMessage(XPathNavigator nav, string nameSpace, List mbitMessages, Dictionary> duplicateMbitMessages) + { + var mbitMsg = new XmlMbitMessage() + { + nameSpace = nameSpace + }; + + if (nav.MoveToFirstChild()) + { + do + { + if (string.Equals(nav.Name, "name", StringComparison.OrdinalIgnoreCase)) + { + mbitMsg.name = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "label", StringComparison.OrdinalIgnoreCase)) + { + mbitMsg.label = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "instrulabel", StringComparison.OrdinalIgnoreCase)) + { + mbitMsg.instruLabel = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "description", StringComparison.OrdinalIgnoreCase)) + { + mbitMsg.description = nav.Value.Trim(); + } + else if (string.Equals(nav.Name, "comment", StringComparison.OrdinalIgnoreCase)) + { + mbitMsg.comments.Add(nav.Value.Trim()); + } + else if (string.Equals(nav.Name, "item", StringComparison.OrdinalIgnoreCase) + || string.Equals(nav.Name, "struct_item", StringComparison.OrdinalIgnoreCase) + || string.Equals(nav.Name, "msg_item", StringComparison.OrdinalIgnoreCase)) + { + if (nav.MoveToFirstChild()) + { + XmlStructureItem structureItem = new XmlStructureItem() + { + nameSpace = nameSpace + }; + GetStructureItem(nav, structureItem); + + mbitMsg.dataItems.Add(structureItem); + + nav.MoveToParent(); + } + } + else if (nav.Name.Length > 0) + { + throw new XmlParsingException("Unknown element \"" + nav.OuterXml.Substring(0, nav.OuterXml.IndexOf(">") + 1) + "\" on line " + ((IXmlLineInfo)nav).LineNumber.ToString()); + } + + } while (nav.MoveToNext()); + + nav.MoveToParent(); + + int index = mbitMessages.FindIndex(f => string.Equals(f.name, mbitMsg.name, StringComparison.OrdinalIgnoreCase)); + + if (index >= 0) + { + // save file name the defines this message that is a duplicate + if (!duplicateMbitMessages.ContainsKey(mbitMsg.name)) + { + duplicateMbitMessages[mbitMsg.name] = new List(); + } + + int index3 = duplicateMbitMessages[mbitMsg.name].FindIndex(f => string.Equals(f, nameSpace + ".xml", StringComparison.OrdinalIgnoreCase)); + + if (index3 < 0) + duplicateMbitMessages[mbitMsg.name].Add(nameSpace + ".xml"); + + // see if the official message is already in the duplicate list + int index2 = duplicateMbitMessages[mbitMsg.name].FindIndex(f => string.Equals(f, mbitMessages[index].nameSpace + ".xml", StringComparison.OrdinalIgnoreCase)); + + // if the official message is not in the duplicate list, we want to save it in the duplicate list + if (index2 < 0) + { + duplicateMbitMessages[mbitMsg.name].Add(mbitMessages[index].nameSpace + ".xml"); + } + + // the existing message is defined in an xml file other than MsgsMc.xml. At this time, we want the messages in MsgsMc.xml to take precedence over other xml files. + // Why is the same message being defined in multiple xml files? + if (!string.Equals(mbitMessages[index].nameSpace, "msgsmc", StringComparison.OrdinalIgnoreCase) && string.Equals(nameSpace, "msgsmc", StringComparison.OrdinalIgnoreCase)) + { + mbitMessages.RemoveAt(index); + mbitMessages.Add(mbitMsg); + } + } + else + mbitMessages.Add(mbitMsg); + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlParsingException.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlParsingException.cs new file mode 100644 index 0000000..5fdb8ca --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/XmlUtilities/XmlParsingException.cs @@ -0,0 +1,51 @@ +// ********************************************************************************************************** +// XmlParsingException.cs +// 6/6/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Instruments.XmlUtilities +{ + class XmlParsingException : SystemException + { + ///=================================================================================== + /// CodeGenerator.XmlParsingException + ///=================================================================================== + /// + /// Constructor + /// + /// description of the exception + ///=================================================================================== + public XmlParsingException(string message) + : base(message) + { } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.05.00.00/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.05.00.00/x86/coeWindows-shared.dll new file mode 100644 index 0000000..a09a534 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.05.00.00/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.00.00/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.00.00/x86/coeWindows-shared.dll new file mode 100644 index 0000000..ee8bdc1 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.00.00/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.02.00/x64/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.02.00/x64/coeWindows-shared.dll new file mode 100644 index 0000000..ef788ac Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.02.00/x64/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.02.00/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.02.00/x86/coeWindows-shared.dll new file mode 100644 index 0000000..61c2271 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.02.00/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.03.00/x64/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.03.00/x64/coeWindows-shared.dll new file mode 100644 index 0000000..909cbaf Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.03.00/x64/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.03.00/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.03.00/x86/coeWindows-shared.dll new file mode 100644 index 0000000..727dae8 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.03.00/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.00/x64/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.00/x64/coeWindows-shared.dll new file mode 100644 index 0000000..2adb114 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.00/x64/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.00/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.00/x86/coeWindows-shared.dll new file mode 100644 index 0000000..350e0a8 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.00/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.01/x64/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.01/x64/coeWindows-shared.dll new file mode 100644 index 0000000..2adb114 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.01/x64/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.01/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.01/x86/coeWindows-shared.dll new file mode 100644 index 0000000..90806ce Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.01/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.02/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.02/x86/coeWindows-shared.dll new file mode 100644 index 0000000..90ade81 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.02/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.02/x86/coeWindows-sharedd.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.02/x86/coeWindows-sharedd.dll new file mode 100644 index 0000000..972f431 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.06.05.02/x86/coeWindows-sharedd.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.08.00.00/x86/coeWindows-shared.dll b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.08.00.00/x86/coeWindows-shared.dll new file mode 100644 index 0000000..c003291 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/build/R04.08.00.00/x86/coeWindows-shared.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/CMessage.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/CMessage.cs new file mode 100644 index 0000000..88cc840 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/CMessage.cs @@ -0,0 +1,123 @@ +// ********************************************************************************************************** +// CMessage.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + /// + /// Message: compatability option; This class provides a message object option that is compatible + /// with what was used in COE 3.x. This is also the format generated by CMAT. + /// + public abstract class CMessage : coeMessage, IDisposable + { + protected CMessage(uint size) : this(size, 0) { } + protected CMessage(uint size, uint label) : this(size, label, 0) { } + protected CMessage(uint size, uint label, int priority) : base((int)size, label, priority) { } + + ~CMessage() + { + Dispose(false); + } + + new public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + new protected void Dispose(bool disposing) + { + base.Dispose(disposing); + } + + abstract public byte[] serialize(); + abstract public bool deserialize(byte[] stream); + + override public void Serialize() + { + byte[] data = serialize(); + if (data.Length > 0) + { + Marshal.Copy(data, 0, m_UnmanagedBuffer, data.Length); + Size = (uint)data.Length; + } + } + + override public void Deserialize() + { + byte[] data = copyFromMessageBuffer(); + deserialize(data); + } + } + +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coe.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coe.cs new file mode 100644 index 0000000..795c160 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coe.cs @@ -0,0 +1,1361 @@ +// ********************************************************************************************************** +// coe.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using NLog; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace Raytheon.Instruments.coeCSharp +{ + public class coe + { + public const string coeDLL = "coeWindows-shared.dll"; + + private IntPtr router { get; set; } + public IntPtr Router => router; + public IntPtr Database { get; set; } + public IntPtr Protocol { get; set; } + public bool IsConnected { get; set; } + + public string ProtocolName { get; set; } + public string ProtocolCmitName { get; set; } + + public coeEndpoint _realTimeCtrlEndpoint = null; + + public const int OE_TRUE = 1; + public const int OE_FALSE = 0; + + public const int OE_Do_Not_Wait = 0; + public const int OE_Wait_Forever = -1; + + internal static coeDataInterchangePackets _dataInterchangePackets = new coeDataInterchangePackets(); + + public enum Status : int + { + ERROR = -1, + SUCCESS = 0, + FAILED_INSUFFICIENT_RESOURCES = 1, + FAILED_INTERNAL_ERROR = 2, + FAILED_INVALID_ADDRESS = 3, + FAILED_INVALID_NAME = 4, + FAILED_INVALID_PARAMETER = 5, + FAILED_MESSAGE_NOT_AVAILABLE = 6, + FAILED_MESSAGE_NOT_RETURNABLE = 7, + FAILED_MESSAGE_TOO_LARGE = 8, + FAILED_NAME_NOT_FOUND = 9, + FAILED_OBJECT_DELETED = 10, + FAILED_OBJECT_NOT_FOUND = 11, + FAILED_OBJECT_ALREADY_EXISTS = 12, + FAILED_REQUEST_DENIED = 13, + FAILED_TIMEOUT = 14, + FAILED_INVALID_ASYNCH_ID = 15, + FAILED_OPERATION_IN_PROGRESS = 16, + FAILED_INVALID_ASSOCIATION = 17, + FAILED_INVALID_HOST_FOR_CREATION = 18, + FAILED_INVALID_SCOPE = 19, + FAILED_INVALID_TRIGGER = 20, + FAILED_LOG_OVERFLOW = 21, + FAILED_INVALID_INDEX = 22, + FAILED_INVALID_CLOCK_SOURCE = 23, + FAILED_INVALID_CONVERSION = 24, + FAILED_INVALID_DATE = 25, + FAILED_INVALID_MONOTONIC = 26, + FAILED_INCOMPATIBLE_FORMAT = 27, + FAILED_TIMER_NOT_SET = 28, + FAILED_OBJECT_NOT_TRACEABLE = 29, + FAILED_FILE_ALREADY_EXISTS = 30, + FAILED_FILE_DOES_NOT_EXIST = 31, + FAILED_FILE_OPEN = 32, + FAILED_INVALID_HANDLE = 33, + FAILED_INVALID_MODE = 34, + FAILED_INVALID_OPTIONS = 35, + FAILED_INVALID_PATH = 36, + FAILED_NOT_IMPLEMENTED = 55, + FAILED_NOT_ENABLED = 56, + FAILED_NOT_SUPPORTED = 57, + FAILED_NOT_ENCRYPTED = 58, + FAILED_VERIFY_ERROR = 59, + FAILED_MESSAGE_IS_SIGNED = 60, + FAILED_MESSAGE_IS_ENCRYPTED = 61, + FAILED_PROTOCOL_OPERATION_PENDING = 62, + FAILED_PROTOCOL_NO_MESSAGE_AVAILABLE = 63, + FAILED_PROTOCOL_BUSY = 64 + }; + + public enum ScopeType + { + OE_Local = 0, + OE_Shared = 1, + OE_Networked = 2 + }; + + public enum DatabaseRegistrationType + { + REFERENCE_DATABASE_TRANSMIT_ALL = 0, + REFERENCE_DATABASE_LOCAL_REGISTRATIONS = 1, + REFERENCE_DATABASE_REMOTE_REGISTRATIONS = 2, + }; + + + + public enum MessageTypes : byte + { + PING = 0, + PING_RESPONSE = 1, + REGISTRATION_QUERY = 2, + REGISTRATION_RESPONSE = 3, + REGISTRATION_MESSAGE = 4, + DISCONNECT_MESSAGE = 5, + BINDING_MESSAGE = 6, + LABELED_MESSAGE = 8, + }; + + public enum RegistrationType : byte + { + NONE = 0, + REGISTRATION = 1, + DEREGISTRATION = 2, + }; + + enum ELEMENT_TYPE + { + TYPE_CHAR = 0, + TYPE_SHORT, + TYPE_INT, + TYPE_LONG, + TYPE_LONG_LONG, + TYPE_FLOAT, + TYPE_DOUBLE, + TYPE_STR, + TYPE_NULL_STR + }; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void RealTimeDisplayCallback(string value); + + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr CallBackDelegate(uint Label); + + #region DLLImports + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "coe_version_Get_Version")] + private static extern IntPtr coe_version_Get_Version(); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Configure")] + private static extern Status OE_Initialization_Configure(uint stacksize, + int priority, + int affinity, + uint systemClockPeriod); + + + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Memory_Tracker_Configure")] + public static extern Status OE_Memory_Tracker_Configure(); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Memory_Tracker_Disable")] + public static extern Status OE_Memory_Tracker_Disable(); + + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Memory_Tracker_Display_Usage")] + public static extern void OE_Memory_Tracker_Display_Usage(); + + + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Router_Database_Query_Open")] + private static extern uint OE_Router_Database_Query_Open(IntPtr db, + IntPtr query_data, + uint queryType, + ref IntPtr handle); + + [StructLayout(LayoutKind.Sequential)] + public struct Destination + { + public uint type; + public IntPtr destination; + public uint label; + public uint domain; + public uint mediaAddress; + public uint flags; + }; + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Router_Database_Query_Next")] + private static extern IntPtr OE_Router_Database_Query_Next(IntPtr handle); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Router_Database_Query_Close")] + private static extern uint OE_Router_Database_Query_Close(IntPtr handle); + + + + + + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "initialize_coe_router")] + private static extern IntPtr initialize_coe_router(); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "shutdown_coe_router")] + private static extern Status shutdown_coe_router(IntPtr router); + + + [StructLayout(LayoutKind.Sequential)] + public unsafe struct PARSE_DATA_SECTION + { + public char* section_name; + public uint list_count; + public uint* list; + public uint* next; + }; + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "add_config_item")] + public static extern int add_config_item(IntPtr sect_list, + string section_name, + string element_name, + string element_value); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "get_element")] + private static extern int get_element(IntPtr sect_list, string section, string element, ELEMENT_TYPE dt, IntPtr data, int param); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "delete_config_database")] + public static extern int delete_config_database(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_router_params")] + private static extern Status configure_router_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_database_params")] + private static extern Status configure_database_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_tcp_media_binding_params")] + private static extern Status configure_tcp_media_binding_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tcp_media_binding_configure")] + private static extern IntPtr tcp_media_binding_configure(IntPtr router); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tcp_media_binding_shutdown")] + private static extern Status tcp_media_binding_shutdown(); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_udp_buffer_pools_params")] + private static extern Status configure_udp_buffer_pools_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_udp_router_protocol_params")] + private static extern Status configure_udp_router_protocol_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_udp_simple_registration_protocol_params")] + private static extern Status configure_udp_simple_registration_protocol_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_udp_media_binding_params")] + private static extern Status configure_udp_media_binding_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "udp_media_binding_configure")] + private static extern IntPtr udp_media_binding_configure(IntPtr router); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "udp_media_binding_shutdown")] + private static extern Status udp_media_binding_shutdown(); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "configure_serial_media_binding_params")] + private static extern Status configure_serial_media_binding_params(IntPtr sect_list); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "serial_media_binding_configure")] + private static extern IntPtr serial_media_binding_configure(IntPtr router); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "serial_media_binding_shutdown")] + private static extern Status serial_media_binding_shutdown(); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Router_Register_Protocol")] + private static extern Status OE_Router_Register_Protocol(IntPtr router, IntPtr protocol, uint flags); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Router_Deregister_Protocol")] + private static extern Status OE_Router_Deregister_Protocol(IntPtr router, IntPtr protocol); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Shutdown")] + private static extern Status OE_Initialization_Shutdown(); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Create_Database")] + private static extern uint OE_Initialization_Create_Database(uint stackID, + DatabaseRegistrationType registrationType, + uint numberOfInitialDatabaseObjects, + uint numberOfIncrementalDatabaseObjects, + uint numberOfInitialQueries, + uint numberOfIncrementalQueries, + int doAllLabelsRegistration); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Create_Buffers")] + private static extern uint OE_Initialization_Create_Buffers(uint stackID, + uint buffersInitialCount_1, + uint buffersSize_1, + uint buffersInitialCount_2, + uint buffersSize_2, + uint buffersInitialCount_3, + uint buffersSize_3, + uint buffersInitialCount_4, + uint buffersSize_4); + + + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_UDP_Stack")] + private static extern uint OE_Initialization_UDP_Stack(uint numberOfInitialDatabaseObjects, + uint numberOfIncrementalDatabaseObjects, + int doAllLabelsRegistration, + uint routerID, + uint port, + byte[] serverAddress, + uint maximumPacketSize, + uint registrationPacketSize, + uint buffersInitialCount_1, + uint buffersSize_1, + uint buffersInitialCount_2, + uint buffersSize_2, + uint buffersInitialCount_3, + uint buffersSize_3, + uint buffersInitialCount_4, + uint buffersSize_4, + uint UDPreceiveBufferSize); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Get_Router")] + internal static extern IntPtr OE_Initialization_Get_Router(uint stackID); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Get_Database")] + internal static extern IntPtr OE_Initialization_Get_Database(uint stackID); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "get_coe_router_database")] + internal static extern IntPtr get_coe_router_database(IntPtr router); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Get_Protocol")] + internal static extern IntPtr OE_Initialization_Get_Protocol(uint stackID); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Initialization_Get_Media_Binding")] + internal static extern IntPtr OE_Initialization_Get_Media_Binding(uint stackID); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Router_Protocol_Extended_Routine")] + private static extern Status OE_Router_Protocol_Extended_Routine(IntPtr oeObject, + uint routineIdentifier, + IntPtr routineParameters); + + [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, EntryPoint = "GetModuleHandle")] + private static extern IntPtr GetModuleHandle(byte[] dllName); + + [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, EntryPoint = "GetProcAddress")] + private static extern IntPtr GetProcAddress(IntPtr handle, + byte[] routineName); + + [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, EntryPoint = "ZeroMemory")] + private static extern IntPtr ZeroMemory(IntPtr buffer, int length); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Set_Timestamp_Function")] + private static extern void OE_Set_Timestamp_Function(IntPtr routine); + + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Enable_Logger")] + public static extern Status OE_Enable_Logger(); + + + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Set_Log_Level")] + public static extern void OE_Set_Log_Level(int Level); + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Get_Log_Level")] + public static extern int OE_Get_Log_Level(); + + + [DllImport(coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Set_Log_Callback")] + public static extern Status OE_Set_Log_Callback( + [MarshalAs(UnmanagedType.FunctionPtr)] + RealTimeDisplayCallback callbackPointer + ); + + + [DllImport("kernel32", CharSet = CharSet.None, ExactSpelling = false, SetLastError = true)] + private static extern bool FreeLibrary(IntPtr hModule); + + public static void UnloadImportedDll(string dllName) + { + foreach (ProcessModule module in Process.GetCurrentProcess().Modules) + { + if (module.FileName.EndsWith(dllName)) + { + coe.FreeLibrary(module.BaseAddress); + } + } + } + + #endregion DLLImports + + public static string GetVersion() + { + string versionString = Marshal.PtrToStringAnsi(coe_version_Get_Version()); + return versionString; + } + + public static Status Configure(uint clockPeriod) + { + return OE_Initialization_Configure(4096, 0, 0, clockPeriod); + } + + public static void Destroy() + { + + try + { + OE_Initialization_Shutdown(); + } + catch + { + } + } + + public static Status CreateDatabase(uint stackID, + DatabaseRegistrationType registrationType, + uint numberOfInitialDatabaseObjects, + uint numberOfIncrementalDatabaseObjects, + uint numberOfInitialQueries, + uint numberOfIncrementalQueries, + bool doAllLabelsRegistration) + { + return (Status)OE_Initialization_Create_Database(stackID, registrationType, numberOfInitialDatabaseObjects, numberOfIncrementalDatabaseObjects, + numberOfInitialQueries, numberOfIncrementalQueries, doAllLabelsRegistration == true ? 1 : 0); + } + + public static Status CreateBuffers(uint stackID, + uint buffersInitialCount_1, + uint buffersSize_1, + uint buffersInitialCount_2, + uint buffersSize_2, + uint buffersInitialCount_3, + uint buffersSize_3, + uint buffersInitialCount_4, + uint buffersSize_4) + { + return (Status)OE_Initialization_Create_Buffers(stackID, buffersInitialCount_1, buffersSize_1, buffersInitialCount_2, buffersSize_2, + buffersInitialCount_3, buffersSize_3, buffersInitialCount_4, buffersSize_4); + } + + + + public static Status CreateUdpStack(uint numberOfInitialDatabaseObjects, + uint numberOfIncrementalDatabaseObjects, + bool doAllLabelsRegistration, + uint routerID, + uint port, + string serverAddress, + uint maximumPacketSize, + uint registrationPacketSize, + uint buffersInitialCount_1, + uint buffersSize_1, + uint buffersInitialCount_2, + uint buffersSize_2, + uint buffersInitialCount_3, + uint buffersSize_3, + uint buffersInitialCount_4, + uint buffersSize_4, + uint UDPreceiveBufferSize) + { + byte[] serverString = Encoding.ASCII.GetBytes(serverAddress + 'x'); + serverString[serverString.Length - 1] = 0; + return (Status)OE_Initialization_UDP_Stack(numberOfInitialDatabaseObjects, + numberOfIncrementalDatabaseObjects, + doAllLabelsRegistration == true ? 1 : 0, + routerID, + port, + serverString, + maximumPacketSize, + registrationPacketSize, + buffersInitialCount_1, + buffersSize_1, + buffersInitialCount_2, + buffersSize_2, + buffersInitialCount_3, + buffersSize_3, + buffersInitialCount_4, + buffersSize_4, + UDPreceiveBufferSize); + } + + public static uint OE_Router_Database_Query_Open_(IntPtr db, + IntPtr query_data, + uint queryType, + ref IntPtr handle) + { + return OE_Router_Database_Query_Open(db, query_data, queryType, ref handle); + } + + public static IntPtr OE_Router_Database_Query_Next_(IntPtr handle) + { + return OE_Router_Database_Query_Next(handle); + } + + + public static uint OE_Router_Database_Query_Close_(IntPtr handle) + { + return OE_Router_Database_Query_Close(handle); + } + + + + public void SetConnected(bool state) + { + IsConnected = state; + } + + public Status tcp_media_binding_configure( uint port, //port + char[] serverAddress, //serverAddress + uint maximumPacketSize, //maximumPacketSize + uint UDPtransmitBufferSize,//UDPtransmitBufferSize + uint UDPreceiveBufferSize, //UDPreceiveBufferSize + uint TCPtransmitBufferSize,//TCPtransmitBufferSize + uint TCPreceiveBufferSize, //TCPreceiveBufferSize + uint TCPoptionFlags, //TCPoptionFlags + Dictionary>> options + ) + { + IntPtr plist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + uint tmp = 32; + + if (Configure(10000) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + ZeroMemory(plist, Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + foreach (KeyValuePair>> s in options) + { + foreach (KeyValuePair v in s.Value) + { + add_config_item(plist, s.Key, v.Key, v.Value); + } + } + + if (configure_router_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (configure_database_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + router = initialize_coe_router(); + if (router == (IntPtr)Status.ERROR) + return Status.FAILED_INTERNAL_ERROR; + + Database = get_coe_router_database(router); + if (Database == (IntPtr)Status.ERROR) + return Status.FAILED_INTERNAL_ERROR; + + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "LOCAL_PORT", port.ToString()); + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "NUM_PORTS", tmp.ToString()); + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "NUM_DYNAMIC_NODES", tmp.ToString()); + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "SERVER_ADDRESS", new string(serverAddress)); + + tmp = 0; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "UDP_TX_BUFFER_SIZE", tmp.ToString()); + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "UDP_RX_BUFFER_SIZE", UDPreceiveBufferSize.ToString()); + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "TCP_TX_BUFFER_SIZE", TCPtransmitBufferSize.ToString()); + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "TCP_RX_BUFFER_SIZE", TCPreceiveBufferSize.ToString()); + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "PACKET_SIZE", maximumPacketSize.ToString()); + + tmp = 1; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "TCP_SELECT_VALUE", tmp.ToString()); + + tmp = 1; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "DISABLE_NAG_DELAY", tmp.ToString()); + + tmp = 1000; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "TIMER_RATE", tmp.ToString()); + + tmp = 1; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "CONNECT_KA_RATE", tmp.ToString()); + + tmp = 1; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "", tmp.ToString()); + + tmp = 1; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "RECV_KA_RATE", tmp.ToString()); + + tmp = 4096; + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_STACK_SIZE", tmp.ToString()); + + tmp = 0; /*port_THREAD_MIDDLE_PRIORITY*/ + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_PRIORITY", tmp.ToString()); + + tmp = 0; /*OE_THREAD_NO_AFFINITY*/ + add_config_item(plist, "TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_AFFINITY", tmp.ToString()); + + if (configure_tcp_media_binding_params(plist) != Status.SUCCESS) + { + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + return Status.FAILED_INTERNAL_ERROR; + } + + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + Protocol = tcp_media_binding_configure(router); + if (Protocol == (IntPtr)Status.ERROR) // protocol API error returns -1 + { + // if media binding start up fails, media binding shutdown is done + // inside coe framework + + if (shutdown_coe_router(router) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (OE_Initialization_Shutdown() != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + return Status.FAILED_INTERNAL_ERROR; + } + + ProtocolName = "REMOTE"; + ProtocolCmitName = "" + new string(serverAddress) + ": " + port.ToString(); + + if (OE_Router_Register_Protocol(router, Protocol, 0x02) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + return Status.SUCCESS; + } + + public Status tcp_media_binding_configure(Dictionary>> options, ILogger logger = null) + { + IntPtr plist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + Status status; + + if ((status = Configure(10000)) != Status.SUCCESS) + { + logger?.Error($"Unable to run OE_Initialization_Configure, status {status}"); + return status; + } + + ZeroMemory(plist, Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + foreach (KeyValuePair>> s in options) + { + foreach (KeyValuePair v in s.Value) + { + add_config_item(plist, s.Key, v.Key, v.Value); + } + } + + if ((status = configure_router_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure router params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_database_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure database params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + router = initialize_coe_router(); + if (router == (IntPtr)Status.ERROR) + { + logger?.Error("Unable to initialize coe router"); + return Status.FAILED_INTERNAL_ERROR; + } + + Database = get_coe_router_database(router); + if (Database == (IntPtr)Status.ERROR) + { + logger?.Error("Unable to get coe router database"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_tcp_media_binding_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure TCP media binding params, status {status}"); + + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + return Status.FAILED_INTERNAL_ERROR; + } + + try + { + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + } + catch (Exception ex) + { + logger?.Error(ex, $"Unable delete_config_database and FreeHGlobal"); + } + + Protocol = tcp_media_binding_configure(router); + if (Protocol == (IntPtr)Status.ERROR) // protocol API error returns -1 + { + logger?.Error("Unable to configure TCP media binding"); + + // if media binding start up fails, media binding shutdown is done + // inside coe framework + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + { + logger?.Error($"Unable shutdown coe router, status {status}"); + } + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + { + logger?.Error($"OE_Initialization_Shutdown error, status {status}"); + } + + return Status.FAILED_INTERNAL_ERROR; + } + + var tcpParams = options["TCP_MEDIA_BINDING_CONFIG"]; + var serverAddress = tcpParams.FirstOrDefault(l => l.Key == "SERVER_ADDRESS").Value; + var port = tcpParams.FirstOrDefault(l => l.Key == "LOCAL_PORT").Value; + + ProtocolName = "REMOTE"; + ProtocolCmitName = $"{serverAddress}: {port}"; + + if ((status = OE_Router_Register_Protocol(router, Protocol, 0x02)) != Status.SUCCESS) + { + logger?.Error($"Unable to register TCP router protocol, status {status}"); + + // if media binding start up fails, media binding shutdown is done + // inside coe framework + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + { + logger?.Error($"Unable shutdown coe router, status {status}"); + } + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + { + logger?.Error($"OE_Initialization_Shutdown error, status {status}"); + } + + return Status.FAILED_INTERNAL_ERROR; + } + + return Status.SUCCESS; + } + + public Status TCP_media_binding_shutdown(ILogger logger = null) + { + Status status; + if ((status = OE_Router_Deregister_Protocol(router, Protocol)) != Status.SUCCESS) + logger?.Error($"TCP OE_Router_Deregister_Protocol error, status {status}"); + + if ((status = tcp_media_binding_shutdown()) != Status.SUCCESS) + logger?.Error($"TCP tcp_media_binding_shutdown error, status {status}"); + + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + logger?.Error($"TCP shutdown_coe_router error, status {status}"); + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + logger?.Error($"TCP OE_Initialization_Shutdown error, status {status}"); + + return status; + } + + + public Status udp_media_binding_configure(Dictionary>> options, ILogger logger = null) + { + IntPtr plist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + Status status; + + if ((status = Configure(10000)) != Status.SUCCESS) + { + logger?.Error($"Unable to run OE_Initialization_Configure, status {status}"); + return status; + } + + ZeroMemory(plist, Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + foreach (KeyValuePair>> s in options) + { + foreach (KeyValuePair v in s.Value) + { + add_config_item(plist, s.Key, v.Key, v.Value); + } + } + + if ((status = configure_router_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure router params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_database_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure database params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + router = initialize_coe_router(); + if (router == (IntPtr)Status.ERROR) + { + logger?.Error("Unable to initialize coe router"); + return Status.FAILED_INTERNAL_ERROR; + } + + Database = get_coe_router_database(router); + if (Database == (IntPtr)Status.ERROR) + { + logger?.Error("Unable to get coe router database"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_udp_buffer_pools_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure udp buffer pools params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_udp_router_protocol_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure udp router protocol params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_udp_simple_registration_protocol_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure udp simple registration protocol params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_udp_media_binding_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure UDP media binding params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + try + { + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + } + catch (Exception ex) + { + logger?.Error(ex, $"Unable delete_config_database and FreeHGlobal"); + } + + Protocol = udp_media_binding_configure(router); + if (Protocol == (IntPtr)Status.ERROR) // protocol API error returns -1 + { + logger?.Error("Unable to configure UDP media binding"); + + // if media binding start up fails, media binding shutdown is done + // inside coe framework + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + { + logger?.Error($"Unable shutdown coe router, status {status}"); + } + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + { + logger?.Error($"OE_Initialization_Shutdown error, status {status}"); + } + + return Status.FAILED_INTERNAL_ERROR; + } + + var udpParams = options["UDP_MEDIA_BINDING_CONFIG"]; + var remote_address = udpParams.FirstOrDefault(l => l.Key == "REMOTE_IP_ADDRESS").Value; + var r_send_port = udpParams.FirstOrDefault(l => l.Key == "REMOTE_SEND_PORT").Value; + var r_recv_port = udpParams.FirstOrDefault(l => l.Key == "REMOTE_RECV_PORT").Value; + var local_address = udpParams.FirstOrDefault(l => l.Key == "LOCAL_IP_ADDRESS").Value; + var l_send_port = udpParams.FirstOrDefault(l => l.Key == "LOCAL_SEND_PORT").Value; + var l_recv_port = udpParams.FirstOrDefault(l => l.Key == "LOCAL_RECV_PORT").Value; + + ProtocolName = $"{remote_address}:{r_send_port}:{r_recv_port}"; + ProtocolCmitName = $"{local_address}:{l_send_port}:{l_recv_port}"; + + if ((status = OE_Router_Register_Protocol(router, Protocol, 0)) != Status.SUCCESS) + { + logger?.Error($"Unable to register UDP router protocol, status {status}"); + + // if media binding start up fails, media binding shutdown is done + // inside coe framework + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + { + logger?.Error($"Unable shutdown coe router, status {status}"); + } + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + { + logger?.Error($"OE_Initialization_Shutdown error, status {status}"); + } + + return Status.FAILED_INTERNAL_ERROR; + } + + return Status.SUCCESS; + } + + public Status udp_media_binding_configure( + char[] local_address, + char[] remote_address, + uint l_send_port, + uint l_recv_port, + uint r_send_port, + uint r_recv_port, + uint recv_timeout, + Dictionary>> options) + { + IntPtr plist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + if (Configure(10000) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + ZeroMemory(plist, Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + foreach (KeyValuePair>> s in options) + { + foreach (KeyValuePair v in s.Value) + { + add_config_item(plist, s.Key, v.Key, v.Value); + } + } + + if (configure_router_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (configure_database_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + router = initialize_coe_router(); + if (router == (IntPtr)Status.ERROR) + return Status.FAILED_INTERNAL_ERROR; + + Database = get_coe_router_database(router); + if (Database == (IntPtr)Status.ERROR) + return Status.FAILED_INTERNAL_ERROR; + + add_config_item(plist, "UDP_MEDIA_BINDING_CONFIG", "LOCAL_IP_ADDRESS", new string(local_address)); + add_config_item(plist, "UDP_MEDIA_BINDING_CONFIG", "REMOTE_IP_ADDRESS", new string(remote_address)); + add_config_item(plist, "UDP_MEDIA_BINDING_CONFIG", "LOCAL_SEND_PORT", l_send_port.ToString()); + add_config_item(plist, "UDP_MEDIA_BINDING_CONFIG", "LOCAL_RECV_PORT", l_recv_port.ToString()); + add_config_item(plist, "UDP_MEDIA_BINDING_CONFIG", "REMOTE_SEND_PORT", r_send_port.ToString()); + add_config_item(plist, "UDP_MEDIA_BINDING_CONFIG", "REMOTE_RECV_PORT", r_recv_port.ToString()); + add_config_item(plist, "UDP_MEDIA_BINDING_CONFIG", "RECV_TIMEOUT", recv_timeout.ToString()); + + configure_udp_buffer_pools_params(plist); + + if (configure_udp_router_protocol_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (configure_udp_simple_registration_protocol_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (configure_udp_media_binding_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + Protocol = udp_media_binding_configure(router); + if (Protocol == (IntPtr)Status.ERROR) // protocol API error returns -1 + { + // if media binding start up fails, media binding shutdown is done + // inside coe framework + + if (shutdown_coe_router(router) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (OE_Initialization_Shutdown() != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + return Status.FAILED_INTERNAL_ERROR; + } + + ProtocolName = "" + new string(remote_address) + ": " + r_send_port.ToString() + ":" + r_recv_port.ToString(); + ProtocolCmitName = "" + new string(local_address) + ": " + l_send_port.ToString() + ":" + l_recv_port.ToString(); + + if (OE_Router_Register_Protocol(router, Protocol, 0) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + return Status.SUCCESS; + } + + public Status UDP_media_binding_shutdown(ILogger logger = null) + { + Status status; + + if ((status = OE_Router_Deregister_Protocol(router, Protocol)) != Status.SUCCESS) + logger?.Error($"UDP OE_Router_Deregister_Protocol error, status {status}"); + + if ((status = udp_media_binding_shutdown()) != Status.SUCCESS) + logger?.Error($"UDP udp_media_binding_shutdown error, status {status}"); + + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + logger?.Error($"UDP shutdown_coe_router error, status {status}"); + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + logger?.Error($"UDP OE_Initialization_Shutdown error, status {status}"); + + return Status.SUCCESS; + } + + public Status serial_media_binding_configure(Dictionary>> options, ILogger logger = null) + { + IntPtr plist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + Status status; + + if ((status = Configure(10000)) != Status.SUCCESS) + { + logger?.Error($"Unable to run OE_Initialization_Configure, status {status}"); + return status; + } + + ZeroMemory(plist, Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + foreach (KeyValuePair>> s in options) + { + foreach (KeyValuePair v in s.Value) + { + add_config_item(plist, s.Key, v.Key, v.Value); + } + } + + if ((status = configure_router_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure router params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_database_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure database params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + router = initialize_coe_router(); + if (router == (IntPtr)Status.ERROR) + { + logger?.Error("Unable to initialize coe router"); + return Status.FAILED_INTERNAL_ERROR; + } + + Database = get_coe_router_database(router); + if (Database == (IntPtr)Status.ERROR) + { + logger?.Error("Unable to get coe router database"); + return Status.FAILED_INTERNAL_ERROR; + } + + if ((status = configure_serial_media_binding_params(plist)) != Status.SUCCESS) + { + logger?.Error($"Unable to configure serial media binding params, status {status}"); + return Status.FAILED_INTERNAL_ERROR; + } + + try + { + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + } + catch (Exception ex) + { + logger?.Error(ex, $"Unable delete_config_database and FreeHGlobal"); + } + + Protocol = serial_media_binding_configure(router); + if (Protocol == (IntPtr)Status.ERROR) + { + logger?.Error("Unable to configure serial media binding"); + + // if media binding start up fails, media binding shutdown is done + // inside coe framework + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + { + logger?.Error($"Unable shutdown coe router, status {status}"); + } + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + { + logger?.Error($"OE_Initialization_Shutdown error, status {status}"); + } + + return Status.FAILED_INTERNAL_ERROR; + } + + var serialParams = options["SERIAL_MEDIA_BINDING_CONFIG"]; + var port = serialParams.FirstOrDefault(l => l.Key == "DEVICE_NAME").Value; + + ProtocolName = "REMOTE"; + ProtocolCmitName = $"CMIT: {port}"; + + if ((status = OE_Router_Register_Protocol(router, Protocol, 0)) != Status.SUCCESS) + { + logger?.Error($"Unable to register router protocol, status {status}"); + + // if media binding start up fails, media binding shutdown is done + // inside coe framework + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + { + logger?.Error($"Unable shutdown coe router, status {status}"); + } + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + { + logger?.Error($"OE_Initialization_Shutdown error, status {status}"); + } + + return Status.FAILED_INTERNAL_ERROR; + } + + return Status.SUCCESS; + } + + public Status serial_media_binding_configure(char[] port, + uint baudrate, + uint databits, + uint stopbits, + uint parity, + uint flowcontrol, + uint recv_timeout, + Dictionary>> options) + { + IntPtr plist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + if (Configure(10000) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + ZeroMemory(plist, Marshal.SizeOf(typeof(PARSE_DATA_SECTION))); + + foreach (KeyValuePair>> s in options) + { + foreach (KeyValuePair v in s.Value) + { + add_config_item(plist, s.Key, v.Key, v.Value); + } + } + + if (configure_router_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (configure_database_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + router = initialize_coe_router(); + if (router == (IntPtr)Status.ERROR) + return Status.FAILED_INTERNAL_ERROR; + + Database = get_coe_router_database(router); + if (Database == (IntPtr)Status.ERROR) + return Status.FAILED_INTERNAL_ERROR; + + add_config_item(plist, "SERIAL_MEDIA_BINDING_CONFIG", "DEVICE_NAME", port.ToString()); + add_config_item(plist, "SERIAL_MEDIA_BINDING_CONFIG", "BAUD_RATE", baudrate.ToString()); + add_config_item(plist, "SERIAL_MEDIA_BINDING_CONFIG", "DATA_BITS", databits.ToString()); + add_config_item(plist, "SERIAL_MEDIA_BINDING_CONFIG", "STOP_BITS", stopbits.ToString()); + add_config_item(plist, "SERIAL_MEDIA_BINDING_CONFIG", "PARITY", parity.ToString()); + add_config_item(plist, "SERIAL_MEDIA_BINDING_CONFIG", "FLOW_CONTROL", flowcontrol.ToString()); + add_config_item(plist, "SERIAL_MEDIA_BINDING_CONFIG", "RECV_PROCESSING_DELAY", recv_timeout.ToString()); + + if (configure_serial_media_binding_params(plist) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + delete_config_database(plist); + Marshal.FreeHGlobal(plist); + Protocol = serial_media_binding_configure(router); + if (Protocol == (IntPtr)Status.ERROR) + { + // if media binding start up fails, media binding shutdown is done + // inside coe framework + + if (shutdown_coe_router(router) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + if (OE_Initialization_Shutdown() != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + return Status.FAILED_INTERNAL_ERROR; + } + + ProtocolName = "REMOTE"; + ProtocolCmitName = "CMIT: " + new string(port); + + if (OE_Router_Register_Protocol(router, Protocol, 0) != Status.SUCCESS) + return Status.FAILED_INTERNAL_ERROR; + + return Status.SUCCESS; + } + + public Status SERIAL_media_binding_shutdown(ILogger logger = null) + { + Status status; + if ((status = OE_Router_Deregister_Protocol(router, Protocol)) != Status.SUCCESS) + logger?.Error($"Serial OE_Router_Deregister_Protocol error, status {status}"); + + if ((status = serial_media_binding_shutdown()) != Status.SUCCESS) + logger?.Error($"Serial serial_media_binding_shutdown error, status {status}"); + + if ((status = shutdown_coe_router(router)) != Status.SUCCESS) + logger?.Error($"Serial shutdown_coe_router error, status {status}"); + + if ((status = OE_Initialization_Shutdown()) != Status.SUCCESS) + logger?.Error($"Serial OE_Initialization_Shutdown error, status {status}"); + + return status; + } + + struct AddressParametersStructure + { + internal uint mediaAddress; + internal IntPtr bufferAddress; + internal uint bufferSize; + } + + public static string DiagnosticMediaAddressToString(uint stackID, + uint mediaAddress) + { + if (mediaAddress == 0xFFFFFFFF) + { + string IPString = "ALL"; + return IPString; + } + else + { + IntPtr bufferPointer = Marshal.AllocHGlobal(32); + AddressParametersStructure parameters; + parameters.mediaAddress = mediaAddress; + parameters.bufferSize = 32; + parameters.bufferAddress = bufferPointer; + IntPtr parametersPointer = Marshal.AllocHGlobal(Marshal.SizeOf(parameters)); + + Marshal.StructureToPtr(parameters, parametersPointer, false); + OE_Router_Protocol_Extended_Routine(OE_Initialization_Get_Media_Binding(stackID), 0, parametersPointer); + string IPstring = Marshal.PtrToStringAnsi(bufferPointer); + + Marshal.FreeHGlobal(parametersPointer); + Marshal.FreeHGlobal(bufferPointer); + return IPstring; + } + } + struct ConnectionsParametersStructure + { + internal int numberOfBuffers; + internal IntPtr bufferAddress; + internal int bufferSize; + } + + public static int DiagnosticConnections(uint stackID, + string[] results) + { + IntPtr bufferPointer = Marshal.AllocHGlobal(results.Length * 32); + ConnectionsParametersStructure parameters; + parameters.numberOfBuffers = results.Length; + parameters.bufferSize = 32; + parameters.bufferAddress = bufferPointer; + IntPtr parametersPointer = Marshal.AllocHGlobal(Marshal.SizeOf(parameters)); + + Marshal.StructureToPtr(parameters, parametersPointer, false); + IntPtr mediaBinding = OE_Initialization_Get_Media_Binding(stackID); + OE_Router_Protocol_Extended_Routine(mediaBinding, 1, parametersPointer); + ConnectionsParametersStructure returnValues; + returnValues = (ConnectionsParametersStructure)Marshal.PtrToStructure(parametersPointer, typeof(ConnectionsParametersStructure)); + for (int index = 0; index < returnValues.numberOfBuffers; index++) + { + results[index] = Marshal.PtrToStringAnsi(new IntPtr((bufferPointer.ToInt64() + (index * 32)))); + } + + Marshal.FreeHGlobal(parametersPointer); + Marshal.FreeHGlobal(bufferPointer); + return returnValues.numberOfBuffers; + } + // + // + // + // Time Tagging + // + // + // + public enum TimeTaggingType { NONE, SYSTEM_TIMER_NANOSECONDS, SYSTEM_TIMER_FRACTIONS, LPT }; + public static void setTimeTagging(TimeTaggingType tagType) + { + IntPtr routineAddress = IntPtr.Zero; + byte[] coeDllName = Encoding.ASCII.GetBytes(coeDLL + 'x'); + coeDllName[coeDllName.Length - 1] = 0; + IntPtr dllHandle = GetModuleHandle(coeDllName); + switch (tagType) + { + case TimeTaggingType.NONE: + break; + case TimeTaggingType.SYSTEM_TIMER_NANOSECONDS: + { + byte[] coeRoutineName = Encoding.ASCII.GetBytes("OE_Clock_Handler_Get_System_Time" + 'x'); + coeRoutineName[coeRoutineName.Length - 1] = 0; + routineAddress = GetProcAddress(dllHandle, coeRoutineName); + } + break; + case TimeTaggingType.SYSTEM_TIMER_FRACTIONS: + { + byte[] coeRoutineName = Encoding.ASCII.GetBytes("OE_Clock_Handler_Get_System_Time_With_Fractions" + 'x'); + coeRoutineName[coeRoutineName.Length - 1] = 0; + routineAddress = GetProcAddress(dllHandle, coeRoutineName); + } + break; + case TimeTaggingType.LPT: + { + byte[] coeRoutineName = Encoding.ASCII.GetBytes("Precision_Time_Get_COE_MsgHdr_Timestamp" + 'x'); + coeRoutineName[coeRoutineName.Length - 1] = 0; + routineAddress = GetProcAddress(dllHandle, coeRoutineName); + } + break; + } + OE_Set_Timestamp_Function(routineAddress); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeDataInterchange.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeDataInterchange.cs new file mode 100644 index 0000000..47cb57b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeDataInterchange.cs @@ -0,0 +1,138 @@ +// ********************************************************************************************************** +// coeDataInterchange.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + + [StructLayout(LayoutKind.Sequential, Pack = 4)] + internal struct DataInterchangeManagedCodeFormatType + { + public DataInterchangeManagedCodeFormatType(coeDataInterchange.FormatType format) + { + m_Repetition = format.m_Repetition; + m_FormatLength = format.m_FormatLength; + m_Format = format.m_Format; + } + + [MarshalAs(UnmanagedType.U4)] + internal uint m_Repetition; + [MarshalAs(UnmanagedType.U4)] + internal uint m_FormatLength; + [MarshalAs(UnmanagedType.U4)] + internal uint m_Format; + } + + public class coeDataInterchange + { + public const int LABEL_SIZE = 40; + + public class FormatType + { + public FormatType(string fieldName, + uint repetition, + uint length, + char format) + { + m_FieldName = fieldName; + m_Repetition = repetition; + m_FormatLength = length; + m_Format = format; + } + + public string m_FieldName; + public uint m_Repetition; + public uint m_FormatLength; + public char m_Format; + } + + public class FormatPacketType + { + public FormatPacketType(string name, + uint msgSize, + uint numItems, + FormatType[] format) + { + m_Name = name; + m_NumberItems = numItems; + m_DataByteSize = msgSize; + m_Format = format; + } + + public string m_Name; + public uint m_NumberItems; + public uint m_DataByteSize; + public FormatType[] m_Format; + } + } + +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeDataInterchangePackets.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeDataInterchangePackets.cs new file mode 100644 index 0000000..b7f7a82 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeDataInterchangePackets.cs @@ -0,0 +1,163 @@ +// ********************************************************************************************************** +// coeDataInterchangePackets.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Data Interchange Packet + // + // + // + public class coeDataInterchangePackets + { + private Dictionary _packets; + public coe.CallBackDelegate _delegate; + private GCHandle _GCdelegate; + + internal coeDataInterchangePackets() + { + _packets = new Dictionary(); + _delegate = new coe.CallBackDelegate(Find); + _GCdelegate = GCHandle.Alloc(_delegate); + } + + ~coeDataInterchangePackets() + { + foreach (KeyValuePair entry in _packets) + { + Marshal.FreeHGlobal(entry.Value); + } + _GCdelegate.Free(); + } + + internal IntPtr Find(uint Label) + { + _packets.TryGetValue(Label, out IntPtr packetArray); + return packetArray; + } + + private void FormatString(byte[] dataBuffer, ref uint StartingIndex, string Name) + { + uint index; + for (index = 0; index < Name.Length && index < 39; index++) + { + dataBuffer[StartingIndex++] = (byte)Name[(int)index]; + } + for (; index < 40; index++) + { + dataBuffer[StartingIndex++] = 0; + } + } + + private void FormatUint(byte[] dataBuffer, + ref uint StartingIndex, + uint DataValue) + { + dataBuffer[StartingIndex++] = (byte)((DataValue) & 0xFF); + dataBuffer[StartingIndex++] = (byte)((DataValue >> 8) & 0xFF); + dataBuffer[StartingIndex++] = (byte)((DataValue >> 16) & 0xFF); + dataBuffer[StartingIndex++] = (byte)((DataValue >> 24) & 0xFF); + } + + internal IntPtr Add(uint Label, coeDataInterchange.FormatPacketType packet) + { + IntPtr packetArray = IntPtr.Zero; + if ((packet.m_NumberItems > 0) && (!_packets.TryGetValue(Label, out packetArray))) + { + int sizeOfInterchangeStructure = (int)(52 + (packet.m_NumberItems * 52)); + packetArray = Marshal.AllocHGlobal(sizeOfInterchangeStructure); + byte[] dataArray = new byte[sizeOfInterchangeStructure]; + // Format the byte array with the data + uint dataArrayIndex = 0; + FormatString(dataArray, ref dataArrayIndex, packet.m_Name); + FormatUint(dataArray, ref dataArrayIndex, packet.m_NumberItems); + FormatUint(dataArray, ref dataArrayIndex, packet.m_DataByteSize); + FormatUint(dataArray, ref dataArrayIndex, (uint)((IntPtr)(packetArray.ToInt32() + 52))); + for (int count = 0; count < packet.m_NumberItems; count++) + { + FormatString(dataArray, ref dataArrayIndex, packet.m_Format[count].m_FieldName); + FormatUint(dataArray, ref dataArrayIndex, packet.m_Format[count].m_Repetition); + FormatUint(dataArray, ref dataArrayIndex, packet.m_Format[count].m_FormatLength); + FormatUint(dataArray, ref dataArrayIndex, packet.m_Format[count].m_Format); + } + Marshal.Copy(dataArray, 0, packetArray, sizeOfInterchangeStructure); + _packets.Add(Label, packetArray); + } + return packetArray; + } + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEndpoint.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEndpoint.cs new file mode 100644 index 0000000..0bc4272 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEndpoint.cs @@ -0,0 +1,309 @@ +// ********************************************************************************************************** +// coeEndpoint.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Endpoint + // + // + // + public class coeEndpoint : IDisposable + { + #region DLLImports + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Create_Dynamic_With_Domain")] + private static extern IntPtr OE_Endpoint_Create_Dynamic_With_Domain(IntPtr Name, + coe.ScopeType Scope, + IntPtr Router, + uint Domain, + uint MaximumTransmitMessages, + uint MaximumReceiveMessages, + uint MaximumTransmitMessageSize, + uint MaximumReceiveMessageSize, + IntPtr ApplicationContext, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Delete")] + private static extern coe.Status OE_Endpoint_Delete(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Associate")] + private static extern coe.Status OE_Endpoint_Associate(IntPtr _obj, + IntPtr Event, + TriggerType Trigger); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Send_Labeled")] + private static extern coe.Status OE_Endpoint_Send_Labeled(IntPtr _obj, + IntPtr Message, + uint Options, + uint Handling_Policy); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Peek")] + private static extern coe.Status OE_Endpoint_Peek(IntPtr _obj, + out uint Message_Label, + out uint Message_Size, + out int Message_Priority); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Wait")] + private static extern coe.Status OE_Endpoint_Wait(IntPtr _obj, + int Timeout); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Receive")] + private static extern coe.Status OE_Endpoint_Receive(IntPtr _obj, + ref IntPtr Message, + uint Handling_Policy, + int Timeout, + IntPtr Source); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Register_Ex2")] + private static extern coe.Status OE_Endpoint_Register_Ex2(IntPtr _obj, + uint Label, + [MarshalAs(UnmanagedType.FunctionPtr)] + coe.CallBackDelegate callbackD); + + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Deregister")] + private static extern coe.Status OE_Endpoint_Deregister(IntPtr _obj, + uint Label); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Endpoint_Empty")] + private static extern coe.Status OE_Endpoint_Empty(IntPtr _obj); + + #endregion + + public enum TriggerType : int + { + DATA_RECEIVED = 0, + BUFFER_EMPTY = 1, + DATA_DISCARDED = 2 + }; + + private bool _disposed; + private IntPtr _handle; + private readonly coeEvent[] _events; + private const int MaximumNumberOfEvents = 4; + private int _numberOfEvents; + + // Constant to be used for a non-queued endpoint + public const uint NON_QUEUED_SIZE = 0; + + public coeEndpoint(uint maxMessageSize, IntPtr router = default) : this(0, maxMessageSize, 0, router) { } + public coeEndpoint(uint maxMessageSize, uint maxBufferMessages, IntPtr router = default) + : this(0, maxMessageSize, maxBufferMessages, router) { } + public coeEndpoint(uint domain, uint maxMessageSize, uint maxBufferMessages, IntPtr router = default) + { + _handle = OE_Endpoint_Create_Dynamic_With_Domain(IntPtr.Zero, coe.ScopeType.OE_Local, router, domain, + maxBufferMessages, maxBufferMessages, maxMessageSize, maxMessageSize, IntPtr.Zero, out coe.Status oe_status); + if (oe_status != coe.Status.SUCCESS) + { + _handle = IntPtr.Zero; + throw new Exception("Unable to create OE_Endpoint. Error = " + oe_status); + } + else + { + _numberOfEvents = 0; + _events = new coeEvent[MaximumNumberOfEvents]; + } + } + + ~coeEndpoint() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + } + if (_handle != IntPtr.Zero) + { + for (int index = 0; index < _numberOfEvents; index++) + { + _events[index].Disable(); + } + OE_Endpoint_Delete(_handle); + _handle = IntPtr.Zero; + } + _disposed = true; + } + + public IntPtr Handle + { + get { return _handle; } + } + + public coe.Status Register(uint label) + { + coe.Status status = OE_Endpoint_Register_Ex2(_handle, label, null); + return status; + } + + public coe.Status Register(uint label, coeDataInterchange.FormatPacketType packet) + { + + coe._dataInterchangePackets.Add(label, packet); + coe.Status status = OE_Endpoint_Register_Ex2(_handle, label, coe._dataInterchangePackets._delegate); + return status; + } + + public coe.Status Deregister(uint label) + { + coe.Status status = OE_Endpoint_Deregister(_handle, label); + return status; + } + + public coe.Status Send(coeMessage message) + { + return Send(message, 0); + } + + public coe.Status Send(coeMessage message, uint options) + { + message.Serialize(); + return OE_Endpoint_Send_Labeled(_handle, message.Handle, options, 0); + } + + public coe.Status Peek(out uint message_Label, + out uint message_Size, + out int message_Priority) + { + coe.Status status; + status = OE_Endpoint_Peek(_handle, out uint messageLabel, out uint messageSize, out int messagePriority); + message_Label = messageLabel; + message_Size = messageSize; + message_Priority = messagePriority; + return status; + } + + public coe.Status Wait(int timeout) + { + return OE_Endpoint_Wait(_handle, timeout); + } + + public coe.Status Clear() + { + return OE_Endpoint_Empty(_handle); + } + + public coe.Status Receive(coeMessage message, int timeout) + { + coe.Status Status; + IntPtr coeMessageHandle = message != null ? message.Handle : IntPtr.Zero; + Status = OE_Endpoint_Receive(_handle, ref coeMessageHandle, 0, timeout, IntPtr.Zero); + if (Status == coe.Status.SUCCESS) + { + message.Deserialize(); + } + return Status; + } + + public coe.Status Receive(coeMessage message) + { + return Receive(message, coe.OE_Wait_Forever); + } + + public coe.Status Associate(coeEventFlag eventFlag, uint mask, TriggerType trigger) + { + coe.Status status; + + if (_numberOfEvents >= MaximumNumberOfEvents) + { + status = coe.Status.FAILED_INSUFFICIENT_RESOURCES; + } + else + { + _events[_numberOfEvents] = new coeEvent(); + _events[_numberOfEvents].SetNotification(eventFlag, mask); + status = OE_Endpoint_Associate(_handle, _events[_numberOfEvents].Handle, trigger); + if (status == coe.Status.SUCCESS) + { + status = _events[_numberOfEvents].Enable(); + _numberOfEvents++; + } + } + return status; + } + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEvent.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEvent.cs new file mode 100644 index 0000000..21959b5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEvent.cs @@ -0,0 +1,177 @@ +// ********************************************************************************************************** +// coeEvent.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Event + // + // + // + public class coeEvent : IDisposable + { + + #region DLLImports + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Create_Dynamic")] + private static extern IntPtr OE_Event_Create_Dynamic(IntPtr Name, + PersistenceType Persistence, + int Priority, + IntPtr ApplicationContext, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Delete")] + public static extern coe.Status OE_Event_Delete(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Enable")] + private static extern coe.Status OE_Event_Enable(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Disable")] + private static extern coe.Status OE_Event_Disable(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Set_Event_Flag_Notification")] + private static extern coe.Status OE_Event_Set_Event_Flag_Notification(IntPtr _obj, + IntPtr EventFlag, + uint Mask); + #endregion + + public enum PersistenceType : int + { + ONE_SHOT = 0, + ENDURING = 1 + } + private bool _disposed = false; + private IntPtr _handle = IntPtr.Zero; + + public coeEvent() : this(PersistenceType.ENDURING, 0) { } + public coeEvent(PersistenceType persistence) : this(persistence, 0) { } + public coeEvent(int priority) : this(PersistenceType.ENDURING, priority) { } + public coeEvent(PersistenceType persistence, int priority) + { + _handle = OE_Event_Create_Dynamic(IntPtr.Zero, persistence, priority, IntPtr.Zero, out coe.Status oe_status); + if (oe_status != coe.Status.SUCCESS) + { + _handle = IntPtr.Zero; + throw new Exception("Unable to create OE_Event. Error = " + oe_status); + } + } + + ~coeEvent() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected void Dispose(bool disposing) + { + if (_disposed) return; + + if (disposing) + { + } + if (_handle != IntPtr.Zero) + { + OE_Event_Delete(_handle); + _handle = IntPtr.Zero; + } + _disposed = true; + } + + internal IntPtr Handle + { + get { return _handle; } + } + + public coe.Status Enable() + { + return OE_Event_Enable(_handle); + } + + public coe.Status Disable() + { + return OE_Event_Disable(_handle); + } + + public coe.Status SetNotification(coeEventFlag eventFlag, uint mask) + { + return OE_Event_Set_Event_Flag_Notification(_handle, eventFlag.Handle, mask); + } + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEventFlag.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEventFlag.cs new file mode 100644 index 0000000..e740199 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeEventFlag.cs @@ -0,0 +1,201 @@ +// ********************************************************************************************************** +// coeEventFlag.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Event Flag + // + // + // + public class coeEventFlag : IDisposable + { + + #region DLLImports + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Create_Dynamic")] + private static extern IntPtr OE_Event_Flag_Create_Dynamic(IntPtr Name, + coe.ScopeType Scope, + uint InitialMask, + IntPtr ApplicationContext, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Delete")] + private static extern coe.Status OE_Event_Flag_Delete(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Set")] + private static extern coe.Status OE_Event_Flag_Set(IntPtr _obj, + uint Mask); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Clear")] + private static extern coe.Status OE_Event_Flag_Clear(IntPtr _obj, + uint Mask); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Peek_Mask")] + private static extern coe.Status OE_Event_Flag_Peek_Mask(IntPtr _obj, + out uint Mask); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Event_Flag_Wait")] + private static extern coe.Status OE_Event_Flag_Wait(IntPtr _obj, + uint Mask, + uint ResetMask, + WaitPolicyType PolicyType, + int TimeInterval, + out uint CurrentMask); + + #endregion + + private bool _disposed = false; + private IntPtr _handle = IntPtr.Zero; + + public enum WaitPolicyType : int + { + WAIT_FOR_ALL = 0, + WAIT_FOR_ANY = 1 + } + + public coeEventFlag() + { + _handle = OE_Event_Flag_Create_Dynamic(IntPtr.Zero, coe.ScopeType.OE_Local, 0, IntPtr.Zero, out coe.Status oe_status); + if (oe_status != coe.Status.SUCCESS) + { + _handle = IntPtr.Zero; + throw new Exception("Unable to create OE_Event_Flag. Error = " + oe_status); + } + } + + ~coeEventFlag() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + } + if (_handle != IntPtr.Zero) + { + OE_Event_Flag_Delete(_handle); + _handle = IntPtr.Zero; + } + _disposed = true; + } + + internal IntPtr Handle + { + get { return _handle; } + } + + public coe.Status Set(uint mask) + { + return OE_Event_Flag_Set(_handle, mask); + } + + public coe.Status Clear(uint mask) + { + return OE_Event_Flag_Clear(_handle, mask); + } + + public coe.Status Peek(out uint mask) + { + coe.Status status; + status = OE_Event_Flag_Peek_Mask(_handle, out uint currentMask); + mask = currentMask; + return status; + } + + public coe.Status Wait(uint mask, + uint resetMask, + WaitPolicyType waitPolicy, + int timeout, + out uint currentMask) + { + coe.Status status; + status = OE_Event_Flag_Wait(_handle, mask, resetMask, waitPolicy, timeout, out uint returnedMask); + currentMask = returnedMask; + return status; + } + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessage.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessage.cs new file mode 100644 index 0000000..195f72e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessage.cs @@ -0,0 +1,392 @@ +// ********************************************************************************************************** +// coeMessage.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + /// + /// Message Attributes + /// + [AttributeUsage(AttributeTargets.All)] + public class MessageOffset : Attribute + { + readonly uint _bufferOffset; + public MessageOffset(uint bufferOffset) + { + _bufferOffset = bufferOffset; + } + public uint Offset + { + get { return _bufferOffset; } + } + } + [AttributeUsage(AttributeTargets.All)] + public class MessageSize : Attribute + { + readonly int _bufferSize; + public MessageSize(int bufferSize) + { + _bufferSize = bufferSize; + } + public int Size + { + get { return _bufferSize; } + } + } + + /// + /// Message: base class + /// + public abstract class coeMessage : IDisposable + { + #region DLLImports + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_Create")] + private static extern IntPtr OE_Message_Create(IntPtr Buffer_Address, + uint Size, + int Create_Shared, + IntPtr ApplicationContext, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_Delete")] + private static extern coe.Status OE_Message_Delete(IntPtr Handle); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Priority")] + private static extern coe.Status OE_Message_set_Priority(IntPtr Handle, + int Priority); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Priority")] + private static extern int OE_Message_get_Priority(IntPtr Handle, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Domain")] + private static extern coe.Status OE_Message_set_Domain(IntPtr Handle, + uint Domain); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Domain")] + private static extern uint OE_Message_get_Domain(IntPtr Handle, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Label")] + private static extern coe.Status OE_Message_set_Label(IntPtr Handle, + uint Label); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Label")] + private static extern uint OE_Message_get_Label(IntPtr Handle, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_set_Data_Size")] + private static extern coe.Status OE_Message_set_Data_Size(IntPtr Handle, + uint Size); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Data_Size")] + private static extern uint OE_Message_get_Data_Size(IntPtr Handle, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Transmit_Timestamp")] + private static extern coe.Status OE_Message_get_Transmit_Timestamp(IntPtr Handle, + out ulong Seconds, + out uint Fraction_Of_Second); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Message_get_Receive_Timestamp")] + private static extern coe.Status OE_Message_get_Receive_Timestamp(IntPtr Handle, + out ulong Seconds, + out uint Fraction_Of_Second); + #endregion + + private bool disposed = false; + protected IntPtr m_Handle = IntPtr.Zero; + protected IntPtr m_UnmanagedBuffer = IntPtr.Zero; + protected int m_UnmanagedBufferSize = 0; + protected int m_Size; + protected byte[] m_Buffer; + + // + // The following routines are provided for testing and access purposes + // + public IntPtr GetUnmanagedBuffer() { return m_UnmanagedBuffer; } + public byte[] GetManagedBuffer() { return m_Buffer; } + + protected coeMessage(int size) : this(size, 0) { } + protected coeMessage(int size, uint label) : this(size, label, 0) { } + protected coeMessage(int size, uint label, int priority) + { + if (size == 0) + { + size = getPayloadSize(); + } + if (size > 0) + { + m_Buffer = new byte[size]; + m_UnmanagedBuffer = Marshal.AllocHGlobal((int)size); + m_UnmanagedBufferSize = (int)size; + } + m_Handle = OE_Message_Create(m_UnmanagedBuffer, (uint)size, coe.OE_FALSE, IntPtr.Zero, out coe.Status oe_status); + if (oe_status != coe.Status.SUCCESS) + { + m_Handle = IntPtr.Zero; + throw new Exception("Unable to create OE_Message. Error = " + oe_status); + } + else + { + m_Size = size; + // The message was created successfully + oe_status = OE_Message_set_Priority(m_Handle, priority); + if (oe_status != coe.Status.SUCCESS) + { + throw new Exception("Unable to set message priority to " + priority + ". Error = " + oe_status); + } + + oe_status = OE_Message_set_Label(m_Handle, label); + if (oe_status != coe.Status.SUCCESS) + { + throw new Exception("Unable to set message priority to " + label + ". Error = " + oe_status); + } + } + } + + ~coeMessage() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected void Dispose(bool disposing) + { + if (disposed) return; + + if (disposing) + { + } + if (m_UnmanagedBuffer != IntPtr.Zero) + { + Marshal.FreeHGlobal(m_UnmanagedBuffer); + m_UnmanagedBuffer = IntPtr.Zero; + } + if (m_Handle != IntPtr.Zero) + { + OE_Message_Delete(m_Handle); + m_Handle = IntPtr.Zero; + } + disposed = true; + } + + internal IntPtr Handle + { + get { return m_Handle; } + } + + public uint Domain + { + get + { + return OE_Message_get_Domain(m_Handle, out coe.Status status); + } + set + { + coe.Status status = OE_Message_set_Domain(m_Handle, value); + } + } + + public uint Label + { + get + { + return OE_Message_get_Label(m_Handle, out coe.Status status); + } + set + { + coe.Status status = OE_Message_set_Label(m_Handle, value); + } + } + + public int Priority + { + get + { + return OE_Message_get_Priority(m_Handle, out coe.Status status); + } + set + { + coe.Status status = OE_Message_set_Priority(m_Handle, value); + } + } + + public uint Size + { + get + { + return OE_Message_get_Data_Size(m_Handle, out coe.Status status); + } + set + { + coe.Status status = OE_Message_set_Data_Size(m_Handle, value); + } + } + + public int BufferSize + { + get + { + return m_UnmanagedBufferSize; + } + set + { + if (value > m_UnmanagedBufferSize) + { + uint savedDomain = Domain; + uint savedLabel = Label; + int savedPriority = Priority; + uint savedSize = Size; + + if (m_UnmanagedBuffer != IntPtr.Zero) + { + Marshal.FreeHGlobal(m_UnmanagedBuffer); + m_UnmanagedBuffer = IntPtr.Zero; + } + if (m_Handle != IntPtr.Zero) + { + OE_Message_Delete(m_Handle); + m_Handle = IntPtr.Zero; + } + m_Buffer = new byte[value]; + m_UnmanagedBuffer = Marshal.AllocHGlobal((int)value); + m_UnmanagedBufferSize = (int)value; + m_Handle = OE_Message_Create(m_UnmanagedBuffer, (uint)value, coe.OE_FALSE, IntPtr.Zero, out coe.Status oe_status); + m_Size = value; + + Domain = savedDomain; + Label = savedLabel; + Priority = savedPriority; + Size = savedSize; + } + } + } + + public void GetSendTime(out ulong Seconds, out uint FractionOfSecond) + { + var status = OE_Message_get_Transmit_Timestamp(m_Handle, out ulong seconds, out uint fractionOfSecond); + Seconds = seconds; + FractionOfSecond = fractionOfSecond; + } + + public void GetReceiveTime(out ulong Seconds, out uint FractionOfSecond) + { + var status = OE_Message_get_Receive_Timestamp(m_Handle, out ulong seconds, out uint fractionOfSecond); + Seconds = seconds; + FractionOfSecond = fractionOfSecond; + } + + abstract public void Serialize(); + abstract public void Deserialize(); + + // Serialization/Deserialization support + private void alignIndex(ref int dataBufferIndex, + int alignment) + { + int indexMisalignment = dataBufferIndex % alignment; + if (indexMisalignment > 0) + { + dataBufferIndex += alignment - indexMisalignment; + } + } + + public int getPayloadSize() + { + int size = 0; + return serializationSupport.getPayloadSize(this, GetType(), ref size); + } + + + protected void copyToMessageBuffer(byte[] data) + { + Marshal.Copy(data, 0, m_UnmanagedBuffer, data.Length); + } + + protected byte[] copyFromMessageBuffer() + { + byte[] data = null; + uint dataSize = OE_Message_get_Data_Size(m_Handle, out coe.Status status); + if (dataSize > 0) + { + Marshal.Copy(m_UnmanagedBuffer, m_Buffer, 0, (int)dataSize); + data = m_Buffer; + } + return data; + } + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageBasic.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageBasic.cs new file mode 100644 index 0000000..dd3f9af --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageBasic.cs @@ -0,0 +1,102 @@ +// ********************************************************************************************************** +// coeMessageBasic.cs +// 7/8/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; + +namespace Raytheon.Instruments.coeCSharp +{ + /// + /// The coeMessageBasic class is a template that can be used to create user messages + /// + internal class coeMessageBasic : coeMessage, IDisposable + { + public coeMessageBasic(uint size) : this(size, 0) { } + public coeMessageBasic(uint size, uint label) : this(size, label, 0) { } + public coeMessageBasic(uint size, uint label, int priority) : base((int)size, label, priority) { } + + ~coeMessageBasic() + { + Dispose(false); + } + + new public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + new protected void Dispose(bool disposing) + { + base.Dispose(disposing); + } + + override public void Serialize() + { + } + + override public void Deserialize() + { + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageFormatted.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageFormatted.cs new file mode 100644 index 0000000..48cde15 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageFormatted.cs @@ -0,0 +1,206 @@ +// ********************************************************************************************************** +// coeMessageFormatted.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Message: formatted option; This class provides automatic serialization + // of all defined public members with an attribute describing the order and + // placement in the binary buffer in which the message fields will be serialized. + // All members not defined as public or without a MessageOffset attribute will be + // ignored during serialization. + // + // Types currently supported include all scalar types and arrays of scalar types. + // Structures are also supported, which can contain single dimension arrays of scalar types. + // Structures can also be nested. The only restriction on all these elements is that arrays + // cannot contain structures, however, structures can contain arrays of scalar elements. + // + // Specifying a 0 size will cause the constructor to try to automatically size the + // message buffer, however since fields are individually specified, this may cause + // difficulties in assuming what is actually needed. It is recommended that this + // class be manually specified as to its internal buffer size. + // + // The same provision for arrays of classes that was described for the serialized option + // holds for the formatted option. All arrays of classes must have all objects in the array + // created with a new before sizing or serialization can be successfully done. + // + // Example: + // + // public class exampleMessage : coeMessageFormatted + // { + // [MessageOffset(0)] + // public uint field1; + // [MessageOffset(4)] + // public ushort field2; + // [MessageOffset(6)] + // public ushort field3; + // [MessageOffset(8)] + // public uint field4; + // [MessageOffset(12)] + // public uint field5; + // [MessageOffset(16)] + // public uint field6; + // public exampleMessage(uint size) : base(size) { } + // } + // + // + // + public abstract class coeMessageFormatted : coeMessage, IDisposable + { + protected coeMessageFormatted(uint size) : this(size, 0) { } + protected coeMessageFormatted(uint size, uint label) : this(size, label, 0) { } + protected coeMessageFormatted(uint size, uint label, int priority) : base((int)size, label, priority) { } + + ~coeMessageFormatted() + { + Dispose(false); + } + + new public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + new protected void Dispose(bool disposing) + { + base.Dispose(disposing); + } + + private bool SerializeGetOffset(FieldInfo field, out int dataIndex) + { + MessageOffset offsetAttribute = null; + dataIndex = 0; + + // + // The following line is for .NET 4.5 or later + // + // MessageOffset offsetAttribute = (MessageOffset)field.GetCustomAttribute(typeof(MessageOffset)); + // + // The following lines are for earlier versions of .NET + var attributes = field.GetCustomAttributes(typeof(MessageOffset), true); + if (attributes.Length > 0) + { + offsetAttribute = (MessageOffset)attributes[0]; + } + // + // + if (offsetAttribute != null) + { + dataIndex = (int)offsetAttribute.Offset; + return true; + } + else + { + return false; + } + } + + override public void Serialize() + { + uint dataSize = 0; + int dataIndex = 0; + FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo field in fields) + { + if (SerializeGetOffset(field, out dataIndex)) + { + serializationSupport.serializeField(field, m_Buffer, ref dataIndex, this); + if (dataIndex > dataSize) dataSize = (uint)dataIndex; + } + } + Size = dataSize; + if (dataSize > 0) + { + Marshal.Copy(m_Buffer, 0, m_UnmanagedBuffer, (int)dataSize); + } + } + + override public void Deserialize() + { + byte[] data = copyFromMessageBuffer(); + int dataIndex = 0; + FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo field in fields) + { + if (SerializeGetOffset(field, out dataIndex)) + { + serializationSupport.deserializeField(field, data, ref dataIndex, this); + } + } + } + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageSerialized.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageSerialized.cs new file mode 100644 index 0000000..bb54a09 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeMessageSerialized.cs @@ -0,0 +1,197 @@ +// ********************************************************************************************************** +// coeMessageSerialized.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Message: serializable option; This class provides automatic serialization + // of all defined public members. All members not defined as public + // will be ignored during serialization. + // + // Types currently supported include all scalar types and arrays of scalar types. + // Structures are also supported, which can contain single dimension arrays of scalar types. + // Structures can also be nested. This message class does support arrays of structures. + // + // The presence of the constructor is optional, and can be used to force a particular size + // of a buffer. Omitting the size on the call to the base class, or providing a size value + // of 0 will cause the constructor to automatically size the data, as will omitting the + // constuctor declaration entirely. + // + // Example: + // + // public class exampleMessage : coeMessageSerialized + // { + // public uint field1; + // public ushort field2; + // public ushort field3; + // public uint field4; + // public uint field5; + // public uint field6; + // + // public exampleMessage() : base(SIZE) { } + // } + // + // Special care needs to be taken when using arrays in a message definition, or in any class + // that is used as a member of a message. Since C# arrays are dynamic, the array member must + // be initialized with a new directive to declare the specific size of the array. This must + // also be done for any sequences or strings used as message or class members. In addition, + // any objects in that array must be specifically created and added to the array in the + // constructor, if auto-sizing of the using message is being done. This initialization only + // needs to be done for classes, not for data types. However, before the message can be + // serialized for transmission, the array must be completely filled with the total number + // of objects for which it was created. + // + // Example: + // + // public class nestedStructure + // { + // public uint field1; + // } + // + // public class exampleStructure + // { + // public uint field1; + // public uint[] field2 = new uint[4]; + // public nestedStructure[] field3 = new nestedStructure[3]; + // + // public exampleStructure() + // { + // field3[0] = new nestedStructure(); + // field3[1] = new nestedStructure(); + // field3[2] = new nestedStructure(); + // } + // } + // + // public class exampleMessage : coeMessageSerialized + // { + // public uint field1; + // public coeSequence mySequence = new coeSequence(8); + // public coeString myString = new coeString(12); + // public exampleStructure mystructure = new exampleStructure(); + // } + // + // + // + public abstract class coeMessageSerialized : coeMessage, IDisposable + { + protected coeMessageSerialized() : this(0) { } + protected coeMessageSerialized(uint size) : this(size, 0) { } + protected coeMessageSerialized(uint size, uint label) : this(size, label, 0) { } + protected coeMessageSerialized(uint size, uint label, int priority) : base((int)size, label, priority) { } + + ~coeMessageSerialized() + { + Dispose(false); + } + + new public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + new protected void Dispose(bool disposing) + { + base.Dispose(disposing); + } + + override public void Serialize() + { + FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); + int dataIndex = 0; + foreach (FieldInfo field in fields) + { + Type myType = field.GetType(); + object myObject = field.GetValue(this); + serializationSupport.serializeField(field, m_Buffer, ref dataIndex, this); + } + Size = (uint)dataIndex; + Marshal.Copy(m_Buffer, 0, m_UnmanagedBuffer, m_Buffer.Length); + } + + override public void Deserialize() + { + byte[] data = copyFromMessageBuffer(); + int dataIndex = 0; + FieldInfo[] fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo field in fields) + { + serializationSupport.deserializeField(field, data, ref dataIndex, this); + } + } + + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeSequence.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeSequence.cs new file mode 100644 index 0000000..ce23f2c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeSequence.cs @@ -0,0 +1,150 @@ +// ********************************************************************************************************** +// coeSequence.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Sequences and Strings + // + // + // + + public class coeSequence + { + private ushort _numberOfElements; + private readonly ushort _maximumNumberOfElements; + private readonly ushort _sizeOfElement; + private readonly T[] _data; + + public coeSequence(ushort length) + { + _maximumNumberOfElements = length; + _numberOfElements = 0; + _data = new T[length]; + int mySize = 0; + serializationSupport.getPayloadSize(this, GetType(), ref mySize); + _sizeOfElement = (ushort)((mySize - 8) / length); + } + + public Type ElementType + { + get + { + return typeof(T); + } + } + public void Clear() + { + _numberOfElements = 0; + } + + public uint Count() + { + return _numberOfElements; + } + + public uint MaximumCount() + { + return _maximumNumberOfElements; + } + + public ushort SizeOfElement + { + get { return _sizeOfElement; } + } + + public uint AddItem(T item) + { + if (_numberOfElements < _maximumNumberOfElements) + { + _data[_numberOfElements++] = item; + } + return _numberOfElements; + } + + public T Get(ushort index) + { + if (index < _numberOfElements) + { + return _data[index]; + } + else + { + throw new NullReferenceException("Index does not reference a valid value"); + } + } + } + +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeString.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeString.cs new file mode 100644 index 0000000..1d9fd53 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeString.cs @@ -0,0 +1,129 @@ +// ********************************************************************************************************** +// coeString.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System.Text; + +namespace Raytheon.Instruments.coeCSharp +{ + public class coeString + { + private ushort _numberOfElements; + private readonly ushort _maximumNumberOfElements; + private readonly ushort _sizeOfElement; + private readonly byte[] _data; + + public coeString(ushort length) + { + _maximumNumberOfElements = length; + _numberOfElements = 0; + _sizeOfElement = 1; + _data = new byte[length + 2]; + } + + public void Clear() + { + _numberOfElements = 0; + } + + public uint Count() + { + return _numberOfElements; + } + + public uint MaximumCount() + { + return _maximumNumberOfElements; + } + + public ushort SizeOfElement + { + get { return _sizeOfElement; } + } + + public uint AddString(string item) + { + int index = 0; + while (_numberOfElements < _maximumNumberOfElements && + index < item.Length) + { + _data[_numberOfElements++] = (byte)item[index++]; + } + _data[_numberOfElements] = 0; + return _numberOfElements; + } + + public string Get() + { + return Encoding.UTF8.GetString(_data, 0, _numberOfElements); + } + } + +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeTimer.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeTimer.cs new file mode 100644 index 0000000..6c36dd5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coeTimer.cs @@ -0,0 +1,228 @@ +// ********************************************************************************************************** +// coeTimer.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Timer + // + // + // + public class coeTimer : IDisposable + { + + #region DLLImports + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Create_Dynamic")] + private static extern IntPtr OE_Timer_Create_Dynamic(IntPtr Name, + coe.ScopeType Scope, + uint TimerFormat, + TimerType TimerKind, + IntPtr Clock, + IntPtr ApplicationContext, + out coe.Status Status); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Delete")] + public static extern coe.Status OE_Timer_Delete(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Associate")] + private static extern coe.Status OE_Timer_Associate(IntPtr _obj, + IntPtr Event, + TriggerType Trigger); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Set_Relative")] + private static extern coe.Status OE_Timer_Set_Relative(IntPtr _obj, + uint TimeInterval); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Resume")] + private static extern coe.Status OE_Timer_Resume(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Timer_Cancel")] + private static extern coe.Status OE_Timer_Cancel(IntPtr _obj); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Environment_get_The_System_Clock_Handler")] + private static extern IntPtr OE_Environment_get_The_System_Clock_Handler(); + + [DllImport(coe.coeDLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OE_Clock_Handler_Convert_To_Time_Interval")] + private static extern IntPtr OE_Clock_Handler_Convert_To_Time_Interval(IntPtr _obj, + uint Interval, + TimerResolutionType Resolution, + out uint TimeInterval); + #endregion + + public enum TriggerType : int + { + TIMER_EXPIRED = 1 + }; + + public enum TimerType : int + { + PERIODIC = 0, + ONE_SHOT = 1 + }; + + public enum TimerResolutionType : int + { + MINUTE = 0, + SECOND = 1, + MILLISECOND = 2, + MICROSECOND = 3, + FRAME = 4 + }; + + private bool _disposed = false; + private IntPtr _handle = IntPtr.Zero; + private const uint _timerRelative = 1; + private readonly coeEvent _timerEvent; + + public coeTimer(TimerType Type) + { + _handle = OE_Timer_Create_Dynamic(IntPtr.Zero, coe.ScopeType.OE_Local, _timerRelative, Type, OE_Environment_get_The_System_Clock_Handler(), IntPtr.Zero, out coe.Status oe_status); + if (oe_status != coe.Status.SUCCESS) + { + _handle = IntPtr.Zero; + throw new Exception("Unable to create OE_Timer. Error = " + oe_status); + } + else + { + _timerEvent = new coeEvent(); + } + } + + ~coeTimer() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected void Dispose(bool disposing) + { + if (_disposed) return; + + if (disposing) + { + } + if (_handle != IntPtr.Zero) + { + _timerEvent.Disable(); + OE_Timer_Delete(_handle); + _handle = IntPtr.Zero; + } + _disposed = true; + } + + internal IntPtr Handle + { + get { return _handle; } + } + + public coe.Status Set(uint interval, TimerResolutionType resolution) + { + OE_Clock_Handler_Convert_To_Time_Interval(OE_Environment_get_The_System_Clock_Handler(), interval, resolution, out uint timerInterval); + return OE_Timer_Set_Relative(_handle, timerInterval); + } + + public coe.Status Set(uint Interval) + { + return Set(Interval, TimerResolutionType.MILLISECOND); + } + + public coe.Status Resume() + { + return OE_Timer_Resume(_handle); + } + + public coe.Status Cancel() + { + return OE_Timer_Cancel(_handle); + } + + public coe.Status Associate(coeEventFlag eventFlag, uint mask, TriggerType trigger) + { + coe.Status Status; + + _timerEvent.SetNotification(eventFlag, mask); + Status = OE_Timer_Associate(_handle, _timerEvent.Handle, trigger); + _timerEvent.Enable(); + return Status; + } + } + +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/serializationSupport.cs b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/serializationSupport.cs new file mode 100644 index 0000000..b18e9ca --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/serializationSupport.cs @@ -0,0 +1,647 @@ +// ********************************************************************************************************** +// serializationSupport.cs +// 6/1/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + +//\\ +//----------------------------------------------------------------------------// +// Copyright %(copyright)s Raytheon Company. // +// This software was developed pursuant to Contract Number %(contractNumber)s // +// with the U.S. government. The U.S. government's rights in and to this // +// copyrighted software are as specified in DFARS 252.227-7014 which was made // +// part of the above contract. // +//----------------------------------------------------------------------------// +//\\<\UnlimitedRights> + +//\\ +//----------------------------------------------------------------------------// +// WARNING - This document contains technical data and / or technology whose // +// export or disclosure to Non-U.S. Persons, wherever located, is restricted // +// by the International Traffic in Arms Regulations (ITAR) (22 C.F.R. // +// Section 120-130) or the Export Administration Regulations (EAR) (15 C.F.R. // +// Section 730-774). This document CANNOT be exported (e.g., provided to a // +// supplier outside of the United States) or disclosed to a Non-U.S. Person, // +// wherever located, until a final jurisdiction and classification // +// determination has been completed and approved by Raytheon, and any // +// required U.S. Government approvals have been obtained. Violations are // +// subject to severe criminal penalties. // +//----------------------------------------------------------------------------// +//\\<\EximUndetermined> + +using System; +using System.Reflection; + +namespace Raytheon.Instruments.coeCSharp +{ + // + // + // + // Serialization Support + // + // + // + public class serializationSupport + { + public static int getPayloadSize(object target, Type targetType, ref int size) + { + FieldInfo[] fields = targetType.GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo field in fields) + { + getFieldSize(field, target, ref size); + } + return size; + } + public static int getFieldSize(FieldInfo field, object target, ref int size) + { + if (field.FieldType == typeof(char) || + field.FieldType == typeof(byte) || + field.FieldType == typeof(byte) || + field.FieldType == typeof(sbyte)) + { + size += 1; + } + else if (field.FieldType == typeof(char[]) || + field.FieldType == typeof(byte[]) || + field.FieldType == typeof(byte[]) || + field.FieldType == typeof(sbyte[])) + { + byte[] values = (byte[])field.GetValue(target); + size += 1 * ((Array)field.GetValue(target)).Length; + } + else if (field.FieldType == typeof(short) || + field.FieldType == typeof(ushort) || + field.FieldType == typeof(short) || + field.FieldType == typeof(ushort)) + { + alignIndex(ref size, 2); + size += 2; + } + else if (field.FieldType == typeof(short[]) || + field.FieldType == typeof(ushort[]) || + field.FieldType == typeof(short[]) || + field.FieldType == typeof(ushort[])) + { + alignIndex(ref size, 2); + size += 2 * ((Array)field.GetValue(target)).Length; + } + else if (field.FieldType == typeof(int) || + field.FieldType == typeof(uint) || + field.FieldType == typeof(int) || + field.FieldType == typeof(uint) || + field.FieldType == typeof(float)) + { + alignIndex(ref size, 4); + size += 4; + } + else if (field.FieldType == typeof(int[]) || + field.FieldType == typeof(uint[]) || + field.FieldType == typeof(int[]) || + field.FieldType == typeof(uint[]) || + field.FieldType == typeof(float[])) + { + alignIndex(ref size, 4); + size += 4 * ((Array)field.GetValue(target)).Length; + } + else if (field.FieldType == typeof(long) || + field.FieldType == typeof(ulong) || + field.FieldType == typeof(long) || + field.FieldType == typeof(ulong) || + field.FieldType == typeof(double)) + { + alignIndex(ref size, 8); + size += 8; + } + else if (field.FieldType == typeof(long[]) || + field.FieldType == typeof(ulong[]) || + field.FieldType == typeof(long[]) || + field.FieldType == typeof(ulong[]) || + field.FieldType == typeof(double[])) + { + alignIndex(ref size, 8); + size += 8 * ((Array)field.GetValue(target)).Length; + } + else if (field.FieldType.IsArray) // Array of classes + { + alignIndex(ref size, 4); + Array targetArray = (Array)field.GetValue(target); + int arraySize = targetArray.Length; + object[] objectArray = (object[])field.GetValue(target); + var arrayElementType = objectArray.GetType().GetElementType(); + for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) + { + object arrayItem = objectArray[arrayIndex]; + Type arrayItemType = arrayItem.GetType(); + FieldInfo[] subfields = arrayItemType.GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo subfield in subfields) + { + Type subfieldType = subfield.GetType(); + Type elementType = subfield.FieldType.GetElementType(); + getFieldSize(subfield, arrayItem, ref size); + } + } + } + else // Class + { + alignIndex(ref size, 4); + object objectItem = field.GetValue(target); + FieldInfo[] subfields = field.FieldType.GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo subfield in subfields) + { + Type subfieldType = subfield.GetType(); + Type elementType = subfield.FieldType.GetElementType(); + getFieldSize(subfield, objectItem, ref size); + } + } + return size; + } + + public static void alignIndex(ref int dataBufferIndex, int alignment) + { + int indexMisalignment = dataBufferIndex % alignment; + if (indexMisalignment > 0) + { + dataBufferIndex += alignment - indexMisalignment; + } + } + public static void serializeField(FieldInfo field, + byte[] dataBuffer, + ref int dataBufferIndex, + object target) + { + Type fieldType = field.GetType(); + object fieldObject = field.GetValue(target); + + if (field.FieldType == typeof(char) || + field.FieldType == typeof(byte) || + field.FieldType == typeof(byte) || + field.FieldType == typeof(sbyte)) + { + byte value = Convert.ToByte(field.GetValue(target)); + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + } + else if (field.FieldType == typeof(char[])) + { + char[] values = (char[])field.GetValue(target); + foreach (char value in values) + { + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + } + } + else if (field.FieldType == typeof(byte[]) || + field.FieldType == typeof(byte[]) || + field.FieldType == typeof(sbyte[])) + { + byte[] values = (byte[])field.GetValue(target); + foreach (byte value in values) + { + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + } + } + else if (field.FieldType == typeof(short) || + field.FieldType == typeof(ushort) || + field.FieldType == typeof(short) || + field.FieldType == typeof(ushort)) + { + alignIndex(ref dataBufferIndex, 2); + ushort value = Convert.ToUInt16(field.GetValue(target)); + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF); + } + else if (field.FieldType == typeof(short[]) || + field.FieldType == typeof(ushort[]) || + field.FieldType == typeof(short[]) || + field.FieldType == typeof(ushort[])) + { + alignIndex(ref dataBufferIndex, 2); + ushort[] values = (ushort[])field.GetValue(target); + foreach (char value in values) + { + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF); + } + } + else if (field.FieldType == typeof(int) || + field.FieldType == typeof(uint) || + field.FieldType == typeof(int) || + field.FieldType == typeof(uint)) + { + alignIndex(ref dataBufferIndex, 4); + uint value = Convert.ToUInt32(field.GetValue(target)); + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF); + } + else if (field.FieldType == typeof(float)) + { + alignIndex(ref dataBufferIndex, 4); + float floatValue = (float)field.GetValue(target); + byte[] valueArray = BitConverter.GetBytes(floatValue); + dataBuffer[dataBufferIndex++] = valueArray[0]; + dataBuffer[dataBufferIndex++] = valueArray[1]; + dataBuffer[dataBufferIndex++] = valueArray[2]; + dataBuffer[dataBufferIndex++] = valueArray[3]; + } + else if (field.FieldType == typeof(int[]) || + field.FieldType == typeof(uint[]) || + field.FieldType == typeof(int[]) || + field.FieldType == typeof(uint[])) + { + alignIndex(ref dataBufferIndex, 4); + uint[] values = (uint[])field.GetValue(target); + foreach (uint value in values) + { + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF); + } + } + else if (field.FieldType == typeof(float[])) + { + alignIndex(ref dataBufferIndex, 4); + float[] values = (float[])field.GetValue(target); + foreach (float floatValue in values) + { + byte[] valueArray = BitConverter.GetBytes(floatValue); + dataBuffer[dataBufferIndex++] = valueArray[0]; + dataBuffer[dataBufferIndex++] = valueArray[1]; + dataBuffer[dataBufferIndex++] = valueArray[2]; + dataBuffer[dataBufferIndex++] = valueArray[3]; + } + } + else if (field.FieldType == typeof(long) || + field.FieldType == typeof(ulong) || + field.FieldType == typeof(long) || + field.FieldType == typeof(ulong)) + { + alignIndex(ref dataBufferIndex, 8); + ulong value = Convert.ToUInt64(field.GetValue(target)); + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 32 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 40 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 48 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 56 & 0xFF); + } + else if (field.FieldType == typeof(double)) + { + alignIndex(ref dataBufferIndex, 8); + double doubleValue = (double)field.GetValue(target); + byte[] valueArray = BitConverter.GetBytes(doubleValue); + dataBuffer[dataBufferIndex++] = valueArray[0]; + dataBuffer[dataBufferIndex++] = valueArray[1]; + dataBuffer[dataBufferIndex++] = valueArray[2]; + dataBuffer[dataBufferIndex++] = valueArray[3]; + dataBuffer[dataBufferIndex++] = valueArray[4]; + dataBuffer[dataBufferIndex++] = valueArray[5]; + dataBuffer[dataBufferIndex++] = valueArray[6]; + dataBuffer[dataBufferIndex++] = valueArray[7]; + } + else if (field.FieldType == typeof(long[]) || + field.FieldType == typeof(ulong[]) || + field.FieldType == typeof(long[]) || + field.FieldType == typeof(ulong[])) + { + alignIndex(ref dataBufferIndex, 8); + ulong[] values = (ulong[])field.GetValue(target); + foreach (ulong value in values) + { + dataBuffer[dataBufferIndex++] = (byte)(value & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 8 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 16 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 24 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 32 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 40 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 48 & 0xFF); + dataBuffer[dataBufferIndex++] = (byte)(value >> 56 & 0xFF); + } + } + else if (field.FieldType == typeof(double[])) + { + alignIndex(ref dataBufferIndex, 8); + double[] values = (double[])field.GetValue(target); + foreach (double doubleValue in values) + { + byte[] valueArray = BitConverter.GetBytes(doubleValue); + dataBuffer[dataBufferIndex++] = valueArray[0]; + dataBuffer[dataBufferIndex++] = valueArray[1]; + dataBuffer[dataBufferIndex++] = valueArray[2]; + dataBuffer[dataBufferIndex++] = valueArray[3]; + dataBuffer[dataBufferIndex++] = valueArray[4]; + dataBuffer[dataBufferIndex++] = valueArray[5]; + dataBuffer[dataBufferIndex++] = valueArray[6]; + dataBuffer[dataBufferIndex++] = valueArray[7]; + } + } + else if (field.FieldType.IsArray) // Array of classes + { + alignIndex(ref dataBufferIndex, 4); + Array targetArray = (Array)field.GetValue(target); + int arraySize = targetArray.Length; + object[] objectArray = (object[])field.GetValue(target); + Type arrayElementType = objectArray.GetType().GetElementType(); + for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) + { + object arrayItem = objectArray[arrayIndex]; + Type arrayItemType = arrayItem.GetType(); + FieldInfo[] subfields = arrayItemType.GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo subfield in subfields) + { + Type subfieldType = subfield.GetType(); + Type elementType = subfield.FieldType.GetElementType(); + serializeField(subfield, dataBuffer, ref dataBufferIndex, arrayItem); + } + } + } + else // Class + { + alignIndex(ref dataBufferIndex, 4); + FieldInfo[] subfields = fieldObject.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo subfield in subfields) + { + Type subfieldType = subfield.GetType(); + Type elementType = subfield.FieldType.GetElementType(); + serializeField(subfield, dataBuffer, ref dataBufferIndex, fieldObject); + } + } + } + + public static void deserializeField(FieldInfo field, + byte[] dataBuffer, + ref int dataBufferIndex, + object target) + { + Type fieldType = field.GetType(); + object fieldObject = field.GetValue(target); + + if (field.FieldType == typeof(char)) + { + char value = Convert.ToChar(dataBuffer[dataBufferIndex++]); + field.SetValue(target, value); + } + else if (field.FieldType == typeof(byte) || + field.FieldType == typeof(byte)) + { + byte value = dataBuffer[dataBufferIndex++]; + field.SetValue(target, value); + } + else if (field.FieldType == typeof(sbyte)) + { + sbyte value = Convert.ToSByte(dataBuffer[dataBufferIndex++]); + field.SetValue(target, value); + } + else if (field.FieldType == typeof(char[])) + { + char[] values = (char[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = (char)dataBuffer[dataBufferIndex++]; + } + field.SetValue(target, values); + } + else if (field.FieldType == typeof(byte[]) || + field.FieldType == typeof(byte[])) + { + byte[] values = (byte[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = dataBuffer[dataBufferIndex++]; + } + field.SetValue(target, values); + } + else if (field.FieldType == typeof(sbyte[])) + { + sbyte[] values = (sbyte[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = (sbyte)dataBuffer[dataBufferIndex++]; + } + field.SetValue(target, values); + } + else if (field.FieldType == typeof(short) || + field.FieldType == typeof(ushort) || + field.FieldType == typeof(short) || + field.FieldType == typeof(ushort)) + { + alignIndex(ref dataBufferIndex, 2); + ushort value = (ushort)(dataBuffer[dataBufferIndex++] + + (ushort)(dataBuffer[dataBufferIndex++] << 8)); + if (field.FieldType == typeof(short) || + field.FieldType == typeof(short)) + { + field.SetValue(target, Convert.ToInt16(value)); + } + else + { + field.SetValue(target, value); + } + } + else if (field.FieldType == typeof(short[]) || + field.FieldType == typeof(ushort[]) || + field.FieldType == typeof(short[]) || + field.FieldType == typeof(ushort[])) + { + alignIndex(ref dataBufferIndex, 2); + ushort[] values = (ushort[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = (ushort)(dataBuffer[dataBufferIndex++] + + (ushort)(dataBuffer[dataBufferIndex++] << 8)); + } + field.SetValue(target, values); + } + else if (field.FieldType == typeof(int) || + field.FieldType == typeof(uint) || + field.FieldType == typeof(int) || + field.FieldType == typeof(uint)) + { + alignIndex(ref dataBufferIndex, 4); + uint value = dataBuffer[dataBufferIndex++] + + ((uint)dataBuffer[dataBufferIndex++] << 8) + + ((uint)dataBuffer[dataBufferIndex++] << 16) + + ((uint)dataBuffer[dataBufferIndex++] << 24); + if (field.FieldType == typeof(int) || + field.FieldType == typeof(int)) + { + field.SetValue(target, Convert.ToInt32(value)); + } + else + { + field.SetValue(target, value); + } + } + else if (field.FieldType == typeof(int[]) || + field.FieldType == typeof(uint[]) || + field.FieldType == typeof(int[]) || + field.FieldType == typeof(uint[])) + { + alignIndex(ref dataBufferIndex, 4); + uint[] values = (uint[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = dataBuffer[dataBufferIndex++] + + ((uint)dataBuffer[dataBufferIndex++] << 8) + + ((uint)dataBuffer[dataBufferIndex++] << 16) + + ((uint)dataBuffer[dataBufferIndex++] << 24); + } + field.SetValue(target, values); + } + else if (field.FieldType == typeof(float)) + { + alignIndex(ref dataBufferIndex, 4); + float singleValue = BitConverter.ToSingle(dataBuffer, dataBufferIndex); + dataBufferIndex += 4; + field.SetValue(target, singleValue); + } + else if (field.FieldType == typeof(float[])) + { + alignIndex(ref dataBufferIndex, 4); + float[] values = (float[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = BitConverter.ToSingle(dataBuffer, dataBufferIndex); + dataBufferIndex += 4; + } + field.SetValue(target, values); + } + else if (field.FieldType == typeof(long) || + field.FieldType == typeof(ulong) || + field.FieldType == typeof(long) || + field.FieldType == typeof(ulong)) + { + alignIndex(ref dataBufferIndex, 8); + uint value = dataBuffer[dataBufferIndex++] + + ((uint)dataBuffer[dataBufferIndex++] << 8) + + ((uint)dataBuffer[dataBufferIndex++] << 16) + + ((uint)dataBuffer[dataBufferIndex++] << 24) + + ((uint)dataBuffer[dataBufferIndex++] << 32) + + ((uint)dataBuffer[dataBufferIndex++] << 40) + + ((uint)dataBuffer[dataBufferIndex++] << 48) + + ((uint)dataBuffer[dataBufferIndex++] << 56); + if (field.FieldType == typeof(long) || + field.FieldType == typeof(long)) + { + field.SetValue(target, Convert.ToInt64(value)); + } + else + { + field.SetValue(target, value); + } + } + else if (field.FieldType == typeof(long[]) || + field.FieldType == typeof(ulong[]) || + field.FieldType == typeof(long[]) || + field.FieldType == typeof(ulong[])) + { + alignIndex(ref dataBufferIndex, 8); + ulong[] values = (ulong[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = dataBuffer[dataBufferIndex++] + + ((uint)dataBuffer[dataBufferIndex++] << 8) + + ((uint)dataBuffer[dataBufferIndex++] << 16) + + ((uint)dataBuffer[dataBufferIndex++] << 24) + + ((uint)dataBuffer[dataBufferIndex++] << 32) + + ((uint)dataBuffer[dataBufferIndex++] << 40) + + ((uint)dataBuffer[dataBufferIndex++] << 48) + + ((uint)dataBuffer[dataBufferIndex++] << 56); + } + field.SetValue(target, values); + } + else if (field.FieldType == typeof(double)) + { + alignIndex(ref dataBufferIndex, 8); + field.SetValue(target, BitConverter.ToDouble(dataBuffer, dataBufferIndex)); + dataBufferIndex += 8; + } + else if (field.FieldType == typeof(double[])) + { + alignIndex(ref dataBufferIndex, 8); + double[] values = (double[])field.GetValue(target); + for (int index = 0; index < values.Length; index++) + { + values[index] = BitConverter.ToDouble(dataBuffer, dataBufferIndex); + dataBufferIndex += 8; + } + field.SetValue(target, values); + } + else if (field.FieldType.IsArray) + { + alignIndex(ref dataBufferIndex, 4); + Array targetArray = (Array)field.GetValue(target); + int arraySize = targetArray.Length; + object[] objectArray = (object[])field.GetValue(target); + Type arrayElementType = objectArray.GetType().GetElementType(); + for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) + { + object arrayItem = objectArray[arrayIndex]; + Type arrayItemType = arrayItem.GetType(); + FieldInfo[] subfields = arrayItemType.GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo subfield in subfields) + { + Type subfieldType = subfield.GetType(); + Type elementType = subfield.FieldType.GetElementType(); + deserializeField(subfield, dataBuffer, ref dataBufferIndex, arrayItem); + } + } + } + else + { + alignIndex(ref dataBufferIndex, 4); + FieldInfo[] subfields = fieldObject.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo subfield in subfields) + { + Type subfieldType = subfield.GetType(); + object subfieldObject = subfield.GetValue(fieldObject); + Type elementType = subfield.FieldType.GetElementType(); + deserializeField(subfield, dataBuffer, ref dataBufferIndex, fieldObject); + } + } + } + + } +} + +//\\ +//----------------------------------------------------------------------------// +// UNCLASSIFIED // +//----------------------------------------------------------------------------// +//\\<\Unclassified> + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDevice.csproj b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDevice.csproj new file mode 100644 index 0000000..cea9768 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDevice.csproj @@ -0,0 +1,37 @@ + + + + + net472 + Raytheon.Instruments.COECommDevice + Specialized instrument for running real time Build In Tests via COE implementing ICommDevice interface + + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDeviceInstrument.cs b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDeviceInstrument.cs new file mode 100644 index 0000000..98316f2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDeviceInstrument.cs @@ -0,0 +1,859 @@ +// ********************************************************************************************************** +// COECommDeviceInstrument.cs +// 7/11/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; +using Raytheon.Instruments.MessagingUtilities; +using System.Xml.XPath; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Linq; +using System.Threading; +using Raytheon.Common; +using Raytheon.Instruments.coeCSharp; +using System.Xml; +using System.IO; +using System.Reflection; +using System.Globalization; +using NLog; + +namespace Raytheon.Instruments +{ + /// + /// This device supports different ways of communicating with other COE nodes + /// TCP + /// UDP + /// Serial + /// + public enum DriverType + { + Undefined, + TCP, + UDP, + Serial + }; + + public class COECommDeviceInstrument : ICommDevice + { + /// + /// Nlog Logger + /// + readonly ILogger _logger; + + /// + /// Cancellation token to stop reading incoming messages + /// + private CancellationTokenSource _cancellationTokenSource = null; + + /// + /// collection of the messages received + /// + private readonly Dictionary, OeMessage> _messages; + + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + /// + /// UDP, TCP, Serial or Undefined + /// + private DriverType _driverType; + + /// + /// dictionary of options when initializing COE endpoint and router + /// + private readonly Dictionary>> _options = new Dictionary>>(); + + /// + /// reference to the main wrapper class for Common Operating Environment + /// + private readonly coe _coe; + + /// + /// COE endpoint + /// + private coeEndpoint _endpoint; + + /// + /// used for initialization of the endpoint + /// + private uint _maxMessageSize; + private uint _epQueueDepth; + + /// + /// collection of all labels with message names per every XML file + /// + private readonly Dictionary> _icds = new Dictionary>(); + + /// + /// timeout can be set for the reader in a separate call + /// + private uint _receiverTimeout; + + /// + /// Number of milliseconds to wake up and check the message when receiving + /// + private int _checkForMessageIntervalMs; + + /// + /// collection of response labels or messages that COE endpoint should be registered for + /// + private List _responseLabels = new List(); + + /// + /// collection of message XML documents (processed XML files) used in COE communications + /// + private readonly Dictionary _xmlDocs = new Dictionary(); + + /// + /// instrument constructor + /// + public COECommDeviceInstrument(string name, IConfigurationManager configurationManager, DriverType driverType = DriverType.Undefined, ILogger logger = null) + { + Info = new InstrumentMetadata + { + ModelNumber = "COECommDevice" + }; + + if(logger == null) + logger = LogManager.GetCurrentClassLogger(); + _logger = logger; + + Status = State.Uninitialized; + DetailedStatus = "COE Uninitialized"; + + Name = name; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + if (configurationManager == null) + { + _logger.Error($"Cannot create {Name} without a configuration manager"); + return; + } + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _messages = new Dictionary, OeMessage>(); + + _driverType = driverType; + + _coe = new coe(); + } + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + + public bool ClearErrors() + { + return true; + } + + /// + /// Initializes COE instrument + /// + public void Initialize() + { + _logger.Trace($"{Name}({_driverType}) Initializing..."); + + if (_driverType == DriverType.Undefined) + _driverType = _configuration.GetConfigurationValue("Parameters", "DriverType", "TCP"); + + _options.Clear(); + _options.Add("ROUTER_CONFIG", new List> + { + { new KeyValuePair("NODE_ID", _configuration.GetConfigurationValue("ROUTER_CONFIG", "NODE_ID", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_STATE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_STATE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_LABEL_MESSAGE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_LABEL_MESSAGE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_BRIDGE_REGISTRATION", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_BRIDGE_REGISTRATION", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_ROUTER_DATABASE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_ROUTER_DATABASE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("ROUTER_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("BUFFER_SIZE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "BUFFER_SIZE", "256")) }, + { new KeyValuePair("ENABLE_REGISTRATION_MESSAGES", _configuration.GetConfigurationValue("ROUTER_CONFIG", "ENABLE_REGISTRATION_MESSAGES", "1")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("ROUTER_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + }); + + _options.Add("ROUTER_PROTOCOL_CONFIG", new List> + { + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("ROUTER_PROTOCOL_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("ROUTER_PROTOCOL_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("ROUTER_PROTOCOL_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + }); + + var poolEntry = _configuration.GetConfigurationValue("ROUTER_BUFFER_POOLS", "POOL_ENTRY", "100,32|50,128|100,384|150,1536|10,65535"); + if (!string.IsNullOrEmpty(poolEntry)) + { + var poolEntries = poolEntry.Split('|'); + if (poolEntries.Any()) + { + var entries = new List>(); + foreach (var entry in poolEntries) + { + entries.Add(new KeyValuePair("POOL_ENTRY", entry)); + } + _options.Add("ROUTER_BUFFER_POOLS", entries); + } + } + + _options.Add("BASIC_REGISTRATION_CONFIG", new List> + { + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND_BUFFER", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_SEND_BUFFER", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV_BUFFER", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_RECV_BUFFER", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_STATE", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_STATE", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_PING_SEND", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_PING_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_PING_RECV", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_PING_RECV", "0")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("BASIC_REGISTRATION_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + }); + + switch (_driverType) + { + case DriverType.UDP: + _options.Add("UDP_MEDIA_BINDING_CONFIG", new List> + { + { new KeyValuePair("LOCAL_IP_ADDRESS", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "LOCAL_IP_ADDRESS", "127.0.0.1")) }, + { new KeyValuePair("REMOTE_IP_ADDRESS", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "REMOTE_IP_ADDRESS", "127.0.0.1")) }, + { new KeyValuePair("LOCAL_SEND_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "LOCAL_SEND_PORT", "32010")) }, + { new KeyValuePair("LOCAL_RECV_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "LOCAL_RECV_PORT", "32020")) }, + { new KeyValuePair("REMOTE_SEND_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "REMOTE_SEND_PORT", "32011")) }, + { new KeyValuePair("REMOTE_RECV_PORT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "REMOTE_RECV_PORT", "32021")) }, + { new KeyValuePair("RECV_TIMEOUT", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "RECV_TIMEOUT", "200")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + { new KeyValuePair("MTU_SIZE", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "MTU_SIZE", "1472")) }, + { new KeyValuePair("THREAD_STACK_SIZE", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "THREAD_STACK_SIZE", "16384")) }, + { new KeyValuePair("THREAD_NAME", _configuration.GetConfigurationValue("UDP_MEDIA_BINDING_CONFIG", "THREAD_NAME", "UDP_MB_RCV")) }, + }); + break; + + case DriverType.TCP: + _options.Add("TCP_MEDIA_BINDING_CONFIG", new List> + { + { new KeyValuePair("LOCAL_PORT", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "LOCAL_PORT", "9990")) }, + { new KeyValuePair("NUM_PORTS", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "NUM_PORTS", "32")) }, + { new KeyValuePair("NUM_DYNAMIC_NODES", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "NUM_DYNAMIC_NODES", "32")) }, + { new KeyValuePair("SERVER_ADDRESS", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "SERVER_ADDRESS", "127.0.0.1:9990")) }, + { new KeyValuePair("UDP_TX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "UDP_TX_BUFFER_SIZE", "5000")) }, + { new KeyValuePair("UDP_RX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "UDP_RX_BUFFER_SIZE", "32768")) }, + { new KeyValuePair("TCP_TX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TCP_TX_BUFFER_SIZE", "5000")) }, + { new KeyValuePair("TCP_RX_BUFFER_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TCP_RX_BUFFER_SIZE", "4096")) }, + { new KeyValuePair("PACKET_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "PACKET_SIZE", "5128")) }, + { new KeyValuePair("TCP_SELECT_VALUE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TCP_SELECT_VALUE", "1")) }, + { new KeyValuePair("DISABLE_NAG_DELAY", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISABLE_NAG_DELAY", "1")) }, + { new KeyValuePair("TIMER_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "TIMER_RATE", "1000")) }, + { new KeyValuePair("CONNECT_KA_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "CONNECT_KA_RATE", "1")) }, + { new KeyValuePair("RECV_KA_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_KA_RATE", "1")) }, + { new KeyValuePair("SERVER_CONNECT_RATE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "SERVER_CONNECT_RATE", "1")) }, + { new KeyValuePair("RECV_THREAD_STACK_SIZE", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_STACK_SIZE", "4096")) }, + { new KeyValuePair("RECV_THREAD_PRIORITY", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_PRIORITY", "0")) }, + { new KeyValuePair("RECV_THREAD_AFFINITY", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_AFFINITY", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND_BUFFER", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_UDP_RECV", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_UDP_RECV", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_UDP_RECV_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_UDP_RECV_BUFFER", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_TCP_RECV", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_TCP_RECV", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_TCP_RECV_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_TCP_RECV_BUFFER", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "1")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV_BUFFER", _configuration.GetConfigurationValue("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV_BUFFER", "1")) }, + }); + break; + + case DriverType.Serial: + _options.Add("SERIAL_MEDIA_BINDING_CONFIG", new List> + { + { new KeyValuePair("DEVICE_NAME", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DEVICE_NAME", "\\\\.\\COM1")) }, + { new KeyValuePair("BAUD_RATE", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "BAUD_RATE", "9600")) }, + { new KeyValuePair("DATA_BITS", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DATA_BITS", "8")) }, + { new KeyValuePair("STOP_BITS", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "STOP_BITS", "1")) }, + { new KeyValuePair("PARITY", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "PARITY", "0")) }, + { new KeyValuePair("FLOW_CONTROL", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "FLOW_CONTROL", "0")) }, + { new KeyValuePair("MTU_SIZE", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "MTU_SIZE", "256")) }, + { new KeyValuePair("RECV_PROCESSING_DELAY", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "RECV_PROCESSING_DELAY", "100")) }, + { new KeyValuePair("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "0")) }, + { new KeyValuePair("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue("SERIAL_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "0")) }, + }); + break; + + default: + _logger.Error($"{Name}({_driverType}) Configured driver type not valid"); + break; + } + + _maxMessageSize = _configuration.GetConfigurationValue("Parameters", "MaxMessageSize", "5000"); + _epQueueDepth = _configuration.GetConfigurationValue("Parameters", "EPQueueDepth", "5000"); + _checkForMessageIntervalMs = _configuration.GetConfigurationValue("Parameters", "CheckForMessageIntervalMs", "100"); + + var responseLabels = _configuration.GetConfigurationListValue("ResponseMessageIds", "ResponseLabel", new List { "1", "2" }); + + var bitFilePaths = _configuration.GetConfigurationListValue("BitFilePaths", "FilePath", new List { "File1", "File2" }); + + _xmlDocs.Clear(); + foreach (var path in bitFilePaths) + { + _xmlDocs.Add(path, new MessageXmlDocument(path, _logger)); + } + + _icds.Clear(); + foreach (var path in bitFilePaths) + { + _icds.Add(path, ProcessFileForNamesAndLabels(path)); + } + + foreach (var strLabel in responseLabels) + { + uint label = GetLabelFromMessageId(strLabel); + if(label > 0) + _responseLabels.Add(label); + } + + DetailedStatus = "COE Initialized"; + Status = State.Ready; + } + + /// + /// performs self-test + /// + /// + public SelfTestResult PerformSelfTest() + { + _logger.Trace($"{Name}({_driverType}) Performing Self Test..."); + + // TODO implement method + return SelfTestResult.Pass; + } + + /// + /// Resets COE device comms + /// + /// + public void Reset() + { + _logger.Trace($"{Name}({_driverType}) Resetting..."); + + Close(); + + Open(); + } + + /// + /// Shuts down COE device + /// + public void Shutdown() + { + _logger.Trace($"{Name}({_driverType}) Shutting Down..."); + + try + { + Close(); + + //coe.UnloadImportedDll("coeWindows-shared.dll"); + } + catch (Exception ex) + { + _logger.Error(ex, $"{Name}({_driverType}) Error while closing"); + } + } + + #region ICommDevice functions + /// + /// Opens COE connection + /// + /// + public void Open() + { + _logger.Trace($"{Name}({_driverType}) Opening..."); + + try + { + switch (_driverType) + { + case DriverType.TCP: + + if (_coe.tcp_media_binding_configure(_options, _logger) != coe.Status.SUCCESS) + { + _logger.Error($"{Name}({_driverType}) COE TCP media binding initialization failure.\nTry checking your connection configuration.\nYou could have a port collision."); + Status = State.CommunicationFailure; + throw new Exception($"{Name}({_driverType}) COE TCP media binding initialization failure"); + } + _logger.Trace($"{Name}({_driverType}) COE TCP media binding initialization, {_coe.ProtocolCmitName}"); + break; + case DriverType.UDP: + if (_coe.udp_media_binding_configure(_options, _logger) != coe.Status.SUCCESS) + { + _logger.Error($"{Name}({_driverType}) COE UDP media binding initialization failure.\nTry checking your connection configuration.\nYou could have a port collision."); + Status = State.CommunicationFailure; + throw new Exception($"{Name}({_driverType}) COE UDP media binding initialization failure"); + } + _logger.Trace($"{Name}({_driverType}) COE UDP media binding initialization, Local: {_coe.ProtocolCmitName} Remote: {_coe.ProtocolName}"); + break; + case DriverType.Serial: + if (_coe.serial_media_binding_configure(_options, _logger) != coe.Status.SUCCESS) + { + _logger.Error($"{Name}({_driverType}) COE Serial media binding initialization failure.\nTry checking your connection configuration.\nYou could have a port collision."); + Status = State.CommunicationFailure; + throw new Exception($"{Name}({_driverType}) COE Serial media binding initialization failure"); + } + _logger.Trace($"{Name}({_driverType}) COE Serial media binding initialization, {_coe.ProtocolCmitName}"); + break; + default: + _logger.Error($"{Name}({_driverType}) Configured driver type not valid"); + throw new Exception($"{Name}({_driverType}) Configured driver type not valid"); + } + + foreach (var item in _options) + { + _logger.Trace($"{item.Key}:"); + foreach (var pair in item.Value) + { + _logger.Trace(string.Format("{0,-50} {1, -40}", pair.Key, pair.Value)); + } + } + + } + catch (Exception ex) + { + _logger.Error(ex); + Status = State.CommunicationFailure; + DetailedStatus = "Unable to Open"; + throw; + } + + try + { + _coe.SetConnected(true); + + //_endpoint = new coeEndpoint(_maxMessageSize, _epQueueDepth, coe.Router); + _endpoint = new coeEndpoint(_maxMessageSize, _epQueueDepth); + + _logger.Info($"{Name}({_driverType}) Endpoint Created, Max Message Size: {_maxMessageSize}, Queue Depth: {_epQueueDepth}"); + + foreach (var item in _responseLabels) + { + var fileName = WhichFileContainsTheLabel(item); + if (!string.IsNullOrEmpty(fileName)) + { + var msgName = _icds[fileName][item]; + if (!string.IsNullOrEmpty(msgName)) + { + _endpoint.Register(item); + _logger.Debug($"{Name}({_driverType}) Registering new message with the endpoint, {item}: {msgName}"); + } + else + { + _logger.Warn($"{Name}({_driverType}) Message with label {item} is not located in file {fileName}"); + } + } + else + { + _logger.Warn($"{Name}({_driverType}) Unable to locate label {item} in any of the XML files registered for COE device"); + } + } + + _cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => ReadMessages(_cancellationTokenSource.Token)); + + DetailedStatus = "Opened"; + } + catch (Exception ex) + { + Status = State.CommunicationFailure; + DetailedStatus = "Unable to Open"; + _logger.Error(ex); + throw; + } + } + + /// + /// Close COE endpoint + /// + /// + public void Close() + { + _logger.Trace($"{Name}({_driverType}) Closing ..."); + + _cancellationTokenSource?.Cancel(); + + Thread.Sleep(1000); + + lock (this) + { + _messages.Clear(); + } + + _coe.SetConnected(false); + var status = _driverType == DriverType.TCP ? + _coe.TCP_media_binding_shutdown(_logger) : _driverType == DriverType.UDP ? + _coe.UDP_media_binding_shutdown(_logger) : _coe.SERIAL_media_binding_shutdown(_logger); + + if (status != coe.Status.SUCCESS) + { + _logger.Error($"{_driverType} media binding shutdown failure, status {status}"); + } + else + { + _logger.Debug($"{_driverType} shutdown was successful"); + } + + _endpoint?.Dispose(); + + _cancellationTokenSource?.Dispose(); + _cancellationTokenSource = null; + + Status = State.Uninitialized; + DetailedStatus = "COE Closed"; + } + + /// + /// sets the timeout value for COE reading operation + /// + /// + /// + public void SetReadTimeout(uint timeout) + { + _logger.Trace($"{Name}({_driverType}) Setting read timeout {timeout} ms ..."); + + _receiverTimeout = timeout; + } + + /// + /// reads COE message either based on the label or just top message + /// + /// + /// might contain a COE label + /// + /// + public uint Read(ref byte[] dataRead) + { + _logger.Trace($"{Name}({_driverType}) Reading ..."); + + if (!_coe.IsConnected) + { + _logger.Error("Error reading COE message, COE not connected"); + return 0; + } + + // if the label was provided in the byte array use it to locate the first message with that name + // else just fetch the top message + var label = FromByteArrayToXml(dataRead); + KeyValuePair, OeMessage> message; + + lock (this) + { + message = string.IsNullOrEmpty(label) ? _messages.FirstOrDefault() : _messages.FirstOrDefault(m => m.Key.Item1 == label); + } + + if (message.Value != null) + { + // make a copy of the buffer + var buffer = message.Value.GetManagedBuffer(); + if(buffer != null) + { + Array.Copy(buffer, 0, dataRead, 0, buffer.Length); + + lock (this) + { + if (!_messages.Remove(message.Key)) + _logger.Warn($"{Name}({_driverType}) Unable to remove a message from the dictionary, label = {message.Key}"); + } + } + else + { + _logger.Error($"{Name}({_driverType}) Found a message with label {label}, but the Buffer is empty"); + return 0; + } + } + else + { + _logger.Error(string.IsNullOrEmpty(label) ? $"{Name}({_driverType}) No messages available to read at this time" : $"{Name}({_driverType}) Unable to find message with label {label}"); + return 0; + } + + return (uint)dataRead.Length; + } + + /// + /// keep reading messages and stash them in _messages dictionary with label and timestamp as a key + /// + /// + /// + private void ReadMessages(CancellationToken cancellationToken) + { + _logger.Debug($"{Name}({_driverType}) Starting to read messages."); + + try + { + while (!cancellationToken.IsCancellationRequested) + { + _logger.Debug($"{Name}({_driverType}) Checking for messages..."); + var status = _endpoint.Wait(1000); + + if (status == coe.Status.SUCCESS) + { + _logger.Debug($"{Name}({_driverType}) Message Received..."); + + while (_endpoint.Peek(out uint label, out uint size, out int priority) == coe.Status.SUCCESS) + { + _logger.Debug($"{Name}({_driverType}) Identified message by peeking..."); + + var xmlDoc = WhichFileContainsTheLabel(label); + + var message = new OeMessage((int)size + 1) + { + XmlMessage = new Message(_xmlDocs[xmlDoc], label.ToString()) + }; + + status = _endpoint.Receive(message); + + if (status == coe.Status.SUCCESS) + { + _logger.Debug($"{Name}({_driverType}) Successfully read message..."); + lock (this) + { + _messages.Add(new Tuple(message.Label, DateTime.Now), message); + } + } + else + { + _logger.Error($"{Name}({_driverType}) Endpoint Receive Failed. Status = {status}"); + } + } + } + // If not timeout and no cancellation requested + else if (status != coe.Status.FAILED_TIMEOUT && !cancellationToken.IsCancellationRequested) + { + _logger.Error($"{Name}({_driverType}) Event Flag Wait Failed. Status = {status}"); + } + } + _logger.Debug($"{Name}({_driverType}) Stopping to read messages. Cancellation was requested."); + } + catch (Exception ex) + { + _logger.Error(ex); + } + } + + /// + /// Writes COE message + /// + /// + /// + /// + public uint Write(byte[] data, uint numBytesToWrite) + { + _logger.Debug($"{Name}({_driverType}) Starting to write messages."); + + if (!_coe.IsConnected) + { + _logger.Error($"{Name}({_driverType}) Error sending COE message, COE not connected"); + return (uint)coe.Status.FAILED_NOT_ENABLED; + } + + try + { + var xmlData = FromByteArrayToXml(data); + var messageName = GetMessageNameFromXml(xmlData); + var message = new OeMessage(new Message(messageName, new MessageXmlDocument(xmlData, _logger))); + + //var status = _endpoint.Send(message, (uint)(_driverType == DriverType.TCP ? 0x01 : 0)); + var status = _endpoint.Send(message); + + if (status != coe.Status.SUCCESS) + { + _logger.Error($"{Name}({_driverType}) Error sending COE message, error code: {status}"); + } + + return status == coe.Status.ERROR ? (uint)coe.Status.FAILED_INTERNAL_ERROR : (uint)status; + } + catch (Exception ex) + { + _logger.Error(ex, $"{Name}({_driverType}) Error while writing a message"); + return (uint)coe.Status.FAILED_INTERNAL_ERROR; + } + } + #endregion + + /// + /// if byte array contains byte representation of XML then returns XML string + /// else returns empty string + /// + /// + /// + private static string FromByteArrayToXml(byte[] data) => System.Text.Encoding.Default.GetString(data); + private static byte[] FromStringToByteArray(string data) => System.Text.Encoding.UTF8.GetBytes(data); + + /// + /// Extract message node from XML for the OeMessage class + /// + /// + /// + private string GetMessageNameFromXml(string xmlData) + { + var doc = new XPathDocument(xmlData); + XPathNavigator navigator = doc.CreateNavigator(); + + var nodeset = navigator.Select("//@Message"); + + nodeset.MoveNext(); + + return nodeset.Current.InnerXml; + } + + /// + /// if message id can be converted to uint returns the value + /// otherwise returns the related label from the message id by dictionary lookup + /// + /// + /// + private uint GetLabelFromMessageId(string messageId) + { + uint labelId = FromStringToUint(messageId); + + if (labelId == 0) + { + foreach (var file in _icds) + { + var item = file.Value.FirstOrDefault(l => l.Value == messageId); + if (!string.IsNullOrEmpty(item.Value)) + return item.Key; + } + } + + return labelId; + } + /// + /// return file path for the file that contains the label + /// + /// + /// + private string WhichFileContainsTheLabel(uint label) + { + foreach (var item in _icds) + { + if (item.Value.Keys.Contains(label)) + { + return item.Key; + } + } + return string.Empty; + } + + /// + /// reads xml file and extracts all message names with associated labels + /// + /// + /// + private Dictionary ProcessFileForNamesAndLabels(string filePath) + { + var doc = new XPathDocument(filePath); + + XPathNavigator node = doc.CreateNavigator(); + XPathNodeIterator nodeset = node.Select("interface/message"); + + var result = new Dictionary(); + + while (nodeset.MoveNext()) + { + var children = nodeset.Current.SelectChildren(XPathNodeType.Element); + if (children.Count > 0) + { + string strName = string.Empty; + string strLabel = string.Empty; + + while (children.MoveNext()) + { + if (children.Current.Name == "name") + { + strName = children.Current.Value; + if (!string.IsNullOrEmpty(strName)) + strName = strName.Trim(); + } + else if (children.Current.Name == "label") + { + strLabel = children.Current.Value; + if (!string.IsNullOrEmpty(strLabel)) + strLabel = strLabel.Trim(); + } + } + + uint iLabel = FromStringToUint(strLabel); + + if (!string.IsNullOrEmpty(strName) && iLabel > 0) + { + result.Add(iLabel, strName); + } + } + } + return result; + } + + /// + /// converts from string representation of a label to uint value + /// + /// + /// + private uint FromStringToUint(string data) + { + if(!string.IsNullOrEmpty(data)) + { + if (data.StartsWith("0x", StringComparison.CurrentCultureIgnoreCase) || data.StartsWith("&H", StringComparison.CurrentCultureIgnoreCase)) + { + if (uint.TryParse(data.Substring(2), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out uint uiValue)) + return uiValue; + } + else + { + if (uint.TryParse(data, out uint uiValuel)) + return uiValuel; + } + } + return 0; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDeviceInstrumentFactory.cs b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDeviceInstrumentFactory.cs new file mode 100644 index 0000000..b0b1cdb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/COECommDeviceInstrumentFactory.cs @@ -0,0 +1,144 @@ +// ********************************************************************************************************** +// COECommDeviceInstrumentFactory.cs +// 5/18/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "COECommDeviceInstrumentFactory")] + public class COECommDeviceInstrumentFactory : IInstrumentFactory + { + /// + /// + /// + private ILogger _logger; + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + private readonly DriverType _driverType; + + public COECommDeviceInstrumentFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public COECommDeviceInstrumentFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null, + [Import(AllowDefault = true)] DriverType driverType = DriverType.TCP) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _driverType = driverType; + _supportedInterfaces.Add(typeof(ICommDevice)); + } + /// + /// + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new COECommDeviceInstrument(name, _configurationManager, _driverType); + } + catch (Exception ex) + { + _logger.Error(ex, $"Unable to construct {name} instrument instance"); + return null; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new COECommDeviceInstrument(name, _configurationManager, _driverType, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/ConfigurationHelper.cs b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/ConfigurationHelper.cs new file mode 100644 index 0000000..b18c884 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/BIT/COECommDevice/ConfigurationHelper.cs @@ -0,0 +1,135 @@ +// ********************************************************************************************************** +// ConfigurationHelper.cs +// 7/5/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Raytheon.Instruments +{ + /// + /// type conversion utility with a special case for enums + /// + public static class TypeConverter + { + public static T ChangeType(object value) + { + return typeof(T).IsEnum ? (T)Enum.Parse(typeof(T), value.ToString()) : (T)ChangeType(typeof(T), value); + } + + public static object ChangeType(Type t, object value) + { + System.ComponentModel.TypeConverter tc = TypeDescriptor.GetConverter(t); + return tc.ConvertFrom(value); + } + + public static void RegisterTypeConverter() where TC : System.ComponentModel.TypeConverter + { + TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC))); + } + } + + /// + /// Helper class contains extension fictions for reading types other than strings from configuration, + /// as well as reading lists of values + /// + public static class ConfigurationHelper + { + /// + /// template function for reading different types from configuration + /// + /// + /// + /// + /// + /// + public static T GetConfigurationValue(this IConfiguration configuration, string section, string key, string defaultValue) + { + var tmpResult = configuration.GetConfigurationValue(section, key, defaultValue); + return !string.IsNullOrEmpty(tmpResult) ? TypeConverter.ChangeType(tmpResult) : default; + } + + /// + /// returns multi-value result (list of T) from configuration + /// + /// + /// + /// + /// + /// + public static List GetConfigurationListValue(this IConfiguration configuration, string section, string key, List defaultValue) + { + var tmpResult = configuration.GetXmlConfiguration(section); + if (string.IsNullOrEmpty(tmpResult)) + { + var xmlStr = new StringBuilder(); + xmlStr.Append($"<{key}s>"); + foreach (var item in defaultValue) + { + xmlStr.Append($"<{key}>"); + xmlStr.Append(item.ToString()); + xmlStr.Append($""); + } + xmlStr.Append($""); + + configuration.SetXmlConfiguration(section, xmlStr.ToString()); + return defaultValue; + } + else + { + var stringRes = BuildElementListFromXml(tmpResult, key); + return new List(stringRes.Select(x => TypeConverter.ChangeType(x))); + } + } + + /// + /// returns values from XML section converted to string list + /// + /// + /// + /// + private static List BuildElementListFromXml(string data, string key) + { + XElement doc = XElement.Parse(data); + IEnumerable xmlMessages = from m + in doc.Elements($"{key}s").Elements(key) + select m; + var messages = xmlMessages.Select(x => x.Value); + return messages?.ToList(); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTS.cs b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTS.cs new file mode 100644 index 0000000..80d1248 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTS.cs @@ -0,0 +1,394 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.IO.Ports; +using System.Net.Sockets; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// Chiller class used to interact with the FTS chiller. + /// + public class ChillerFTS : IChiller, IDisposable + { + #region PrivateMembers + private enum DEGREES + { + Celsius = 0, + Fahrenheit = 1, + Kevin = 2 + } + + private static object m_sync = new object(); + + private const string _CARRIAGE_RETURN = "\r"; + private const string _FLOWDISABLE = "STOP"; + private const string _FLOWENABLE = "START"; + private const string _TEMPREAD = "PT?"; + private const string _TEMPREADSETPOINT = "SP?"; + private const string _TEMPSET = "SP="; + private const string _DEGREES = "DEGREES="; + private const string _SUCCESS = "OK"; + private const string _EXC_POINT = "!"; + + private readonly string _ipAddr; + private readonly int _port; + private const int _READ_BUFFER_SIZE = 128; + private const int _READ_TIMEOUT = 5000; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get; set; } + public bool FrontPanelEnabled { get; set; } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// Destructor + /// + ~ChillerFTS() + { + Dispose(false); + } + + /// + /// Open socket to the chiller + /// + private void ConnectEthernet() + { + Initialize(); + } + + public void Initialize() + { + //Create and open a socket to chiller cart server + TcpClient chillerSocket = new TcpClient(_ipAddr, _port); + _tcpStream = chillerSocket.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + + /// + /// Dispose of the object's resources. + /// + /// Currently disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + //Close Connection (if available) + _tcpStream?.Close(); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Send a command to the chiller and request a response + /// + /// Command to send. + /// Response from the chiller. + private string SendMessageGetResponse(string cmd) + { + lock (m_sync) + { + //Format the command before sending + string commandString = cmd + _CARRIAGE_RETURN; + + //convert to byte array for sending + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + //send the data + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + //clear the buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + //read from the response buffer + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + //convert response to a string + string rspStr = Encoding.ASCII.GetString(_readBuffer); + + //Check Response + if (rspStr.Contains(_SUCCESS)) + { + //Remove ! + rspStr = rspStr.Replace(_EXC_POINT, ""); + + //Parse string ("/r") + char[] delimit = { '\r' }; + string[] parsed = rspStr.Split(delimit, StringSplitOptions.RemoveEmptyEntries); + + //Return parsed message + return parsed[1]; + } + else + { + throw new Exception("SendMessageGetResponse::SendMessageGetResponse() - Command message not successful"); + } + } + } + /// + /// Change the units of measurement for the chiller. + /// + /// Celsius/Fahrenheit + private void SetDegreesUnits(DEGREES units) + { + lock (m_sync) + { + //Set the units of measurement to Celsius + string rsp = SendMessageGetResponse(_DEGREES + units.ToString()); + } + } + + #endregion + + + /// + /// ChillerFTS factory constructor + /// + /// + /// + public ChillerFTS(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + + _ipAddr = _configuration.GetConfigurationValue("ChillerFTS", "IpAddr", ""); + _port = _configuration.GetConfigurationValue("ChillerFTS", "Port", 0); + + _readBuffer = new byte[_READ_BUFFER_SIZE]; + + //Connect to device + ConnectEthernet(); + } + + /// + /// Constructor for the chiller. It makes a socket connection to the chiller and sets the degrees to Celsius + /// + /// The name + /// IP Address of the equipment + /// Port of the equipment + public ChillerFTS(string name, string ipAddress, int port) + { + Name = name; + _ipAddr = ipAddress; + _port = port; + _logger = LogManager.GetCurrentClassLogger(); + + _readBuffer = new byte[_READ_BUFFER_SIZE]; + + //Connect to device + ConnectEthernet(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public ChillerFTS(string name, string comPortName, uint delayBeforeReadMs, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One) + { + throw new NotImplementedException(); + } + + /// + /// Stop the chiller pump. + /// + public void DisableFlow() + { + lock (m_sync) + { + //Send the command to stop coolant flow + string rsp = SendMessageGetResponse(_FLOWDISABLE); + } + } + + /// + /// Dispose of this objects resources + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Start the chiller pump. + /// + public void EnableFlow() + { + lock (m_sync) + { + //Send the command to start coolant flow + string rsp = SendMessageGetResponse(_FLOWENABLE); + } + } + + /// + /// Query the current setting for the coolant. + /// + /// The current coolant setting. + public double GetCoolantSetpoint() + { + lock (m_sync) + { + //Name of the function + const string SETPOINT_RESPONSE = "F057="; + + //Request the setpoint + string results = SendMessageGetResponse(_TEMPREADSETPOINT); + + //Not connected. No results + if (results == "") + { + return double.MaxValue; + } + + //Remove function header + results = results.Replace(SETPOINT_RESPONSE, ""); + + return double.Parse(results); + } + } + + /// + /// Query the temperature of the coolant reservoir. + /// + /// The temperature of the coolant. + public double GetCoolantTemperature() + { + lock (m_sync) + { + //Name of the function + const string TEMP_RESPONSE = "F043="; + + //Request the temperature + string results = SendMessageGetResponse(_TEMPREAD); + + //Not connected. No results + if (results == "") + { + return double.MaxValue; + } + + //Remove function header + results = results.Replace(TEMP_RESPONSE, ""); + + return double.Parse(results); + } + } + + /// + /// Set the coolant temperature to a desired setpoint. + /// + /// The desired coolant temperature. + public void SetCoolantTemperature(double temp) + { + lock (m_sync) + { + //Set the coolant temperature + string rsp = SendMessageGetResponse(_TEMPSET + temp.ToString()); + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + return SelfTestResult.Unknown; + } + + public void Reset() + { + Shutdown(); + + Initialize(); + } + + public void Shutdown() + { + Dispose(); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTS.csproj b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTS.csproj new file mode 100644 index 0000000..4b36b83 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTS.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.ChillerFTS + Chiller FTS implementation + Chiller FTS implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTSFactory.cs b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTSFactory.cs new file mode 100644 index 0000000..6e42fe7 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerFTS/ChillerFTSFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// ChillerFTSFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ChillerFTSFactory")] + public class ChillerFTSFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ChillerFTSFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ChillerFTSFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IChiller)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ChillerFTS(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new ChillerSim(name, _configurationManager, _logger); + else + return new ChillerFTS(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSim.cs b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSim.cs new file mode 100644 index 0000000..2f9ed27 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSim.cs @@ -0,0 +1,224 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// A simulated chiller + /// + public class ChillerSim : IChiller, IDisposable + { + #region PrivateMembers + private double _setPoint; + private static object _sync = new object(); + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get; set; } + public bool FrontPanelEnabled { get; set; } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + ~ChillerSim() + { + Dispose(false); + } + /// + /// Dispose of the object's resources. + /// + /// Currently disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFunctions + + /// + /// ChillerFTS factory constructor + /// + /// + /// + public ChillerSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + /// + /// The constructor + /// + /// + public ChillerSim(string name) + { + Name = name; + _setPoint = 20.0; + _logger = LogManager.GetCurrentClassLogger(); + } + + + /// + /// Stop the chiller pump. + /// + public void DisableFlow() + { + } + + /// + /// Dispose of this objects resources + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Start the chiller pump. + /// + public void EnableFlow() + { + } + + /// + /// Query the current setting for the coolant. + /// + /// The current coolant setting. + public double GetCoolantSetpoint() + { + return _setPoint; + } + + /// + /// Query the temperature of the coolant reservoir. + /// + /// The temperature of the coolant. + public double GetCoolantTemperature() + { + double max = _setPoint + 5; + + double min = _setPoint - 5; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(100); + + return dataToReturn; + } + + /// + /// Set the coolant temperature to a desired setpoint. + /// + /// The desired coolant temperature. + public void SetCoolantTemperature(double temp) + { + _setPoint = temp; + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public void Shutdown() + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSim.csproj b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSim.csproj new file mode 100644 index 0000000..0193253 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSim.csproj @@ -0,0 +1,22 @@ + + + + + net472 + Raytheon.Instruments.ChillerSim + Chiller SIM implementation + Chiller SIM implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSimFactory.cs b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSimFactory.cs new file mode 100644 index 0000000..961d7ca --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Chiller/ChillerSim/ChillerSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// ChillerSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ChillerSimFactory")] + public class ChillerSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ChillerSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ChillerSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IChiller)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ChillerSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new ChillerSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlc.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlc.cs new file mode 100644 index 0000000..6c3cde0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlc.cs @@ -0,0 +1,360 @@ +// Ignore Spelling: Geu Sdlc + +using System; +using Raytheon.GuidedElectronicsUnit; +using System.Threading; +using Raytheon.Common; +using NLog; + +namespace Raytheon.Instruments +{ + public class CommDeviceGeuSdlc : ICommDevice, IDisposable + { + #region PrivateClassMembers + + private GuidedElectronicsUnit.GuidedElectronicsUnit _guidanceElectronicsUnit; + private readonly bool _idQuery = false; + private readonly bool _reset = false; + private readonly SelfTestResult _selfTestResult; + private State _state; + private readonly string _instrumentDriverSetup; + private readonly int _pollingRate; + private readonly string _resourceName; + private static readonly object _syncObj = new object(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivatelassFunctions + + /// + /// The Finalizer + /// + ~CommDeviceGeuSdlc() + { + Dispose(false); + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // close resources + try + { + if (_state == State.Ready) + { + _guidanceElectronicsUnit.Close(); + _guidanceElectronicsUnit.Dispose(); + _state = State.Uninitialized; + } + } + catch (Exception) + { + try + { + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + /// + /// Some HSS corrections + /// + /// + /// + private static unsafe void PerformHssSwirl(ref byte[] data, uint numDWords) + { + fixed (byte* pBytePtr = &data[0]) + { + for (int i = 0; i < numDWords; i++) + { + // swap the first word + ushort* pWord1 = (ushort*)pBytePtr + (i * 2); + *pWord1 = Util.Swap(*pWord1); + + //swap the second word + ushort* pWord2 = (ushort*)pBytePtr + ((i * 2) + 1); + *pWord2 = Util.Swap(*pWord2); + + // now swap the dword + uint* pDWord = (uint*)pBytePtr + i; + *pDWord = Util.SwapHighAndLowBytes(*pDWord); + } + } + } + + #endregion + + #region PublicClassFunctions + + bool IInstrument.DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + bool IInstrument.FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + InstrumentMetadata IInstrument.Info => throw new NotImplementedException(); + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceGeuSdlc(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + _resourceName = deviceName; + _guidanceElectronicsUnit = null; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _idQuery = _configuration.GetConfigurationValue("CommDeviceGeuSdlc", "IdQuery", true); + _reset = _configuration.GetConfigurationValue("CommDeviceGeuSdlc", "Reset", true); + _instrumentDriverSetup = _configuration.GetConfigurationValue("CommDeviceGeuSdlc", "InstrumentDriverSetup", ""); + _pollingRate = _configuration.GetConfigurationValue("CommDeviceGeuSdlc", "PollingRate", 10); + } + + /// + /// The constructor. Does not initialize anything. Use Initialize() to create the handle to the hardware + /// + /// + /// + /// + public CommDeviceGeuSdlc(string resourceName, bool idQuery, bool reset, string instrumentDriverSetup = "", int pollingRate = 10) + { + _resourceName = resourceName; + _idQuery = idQuery; + _reset = reset; + _guidanceElectronicsUnit = null; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + _instrumentDriverSetup = instrumentDriverSetup; + _pollingRate = pollingRate; + _logger = LogManager.GetCurrentClassLogger(); + } + + /// + /// + /// + /// + bool IInstrument.ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a HSS GEU SDLC Device called " + _resourceName; + } + } + + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Create a handle to the hardware + /// + public void Initialize() + { + const uint AUTO_FWDING_ADDR = 0x00080100; + const uint WRITE_OFFSET = 0x00200000; + const uint ENABLE_AUTO_FWDING = 0b0000_0001; + const uint ENABLE_TLP_HDR = 0b0000_0010; + //const uint INSERT_MSG_CNT = 0b0000_0100; + + _guidanceElectronicsUnit = new GuidedElectronicsUnit.GuidedElectronicsUnit(_resourceName, _idQuery, _reset, + $"QueryInstrStatus=true, Simulate=false, DriverSetup= {_instrumentDriverSetup}, PollingInterval={_pollingRate}"); + + _guidanceElectronicsUnit.LowLevel.HSSub9100.EnableIO = ControlState.Enabled; + + _guidanceElectronicsUnit.LowLevel.HSSub9100.WriteRegister(AUTO_FWDING_ADDR + WRITE_OFFSET, ENABLE_AUTO_FWDING | ENABLE_TLP_HDR); + + _state = State.Ready; + } + + /// + /// + /// + public string Name + { + get + { + return _resourceName; + } + } + + /// + /// + /// + /// + SelfTestResult IInstrument.PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + uint ICommDevice.Read(ref byte[] dataRead) + { + + if (_guidanceElectronicsUnit == null) + { + return 0; + } + + byte[] sdlcMsgs = new byte[0]; + lock (_syncObj) + { + // read all of the data that is available + sdlcMsgs = _guidanceElectronicsUnit.GsKwSyncronousDataLinkControl.FetchMessageData(); + } + + if (sdlcMsgs.Length > dataRead.Length) + { + throw new Exception("The data buffer that the host provided is: " + dataRead.Length + " bytes, there are: " + sdlcMsgs.Length + " bytes of SDLC data. Need to increase the host buffer size"); + } + + Buffer.BlockCopy(sdlcMsgs, 0, dataRead, 0, sdlcMsgs.Length); + + return (uint)sdlcMsgs.Length; + } + + /// + /// + /// + void IInstrument.Reset() + { + lock (_syncObj) + { + _guidanceElectronicsUnit.Close(); + _state = State.Uninitialized; + Thread.Sleep(500); + Initialize(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + void ICommDevice.SetReadTimeout(uint timeoutMs) + { + throw new NotImplementedException(); + } + + /// + /// + /// + void IInstrument.Shutdown() + { + lock (_syncObj) + { + if (_guidanceElectronicsUnit != null) + { + _guidanceElectronicsUnit.LowLevel.HSSub9100.EnableIO = ControlState.Disabled; + + _guidanceElectronicsUnit.Close(); + _guidanceElectronicsUnit.Dispose(); + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + /// + /// + uint ICommDevice.Write(byte[] data, uint numBytesToWrite) + { + lock (_syncObj) + { + if (numBytesToWrite % 4 != 0) + { + throw new Exception("Data is not dword aligned"); + } + + // do all of the HSS Tx only byte order corrections + PerformHssSwirl(ref data, numBytesToWrite / 4); + + var tempArr = new uint[data.Length / 4]; + Buffer.BlockCopy(data, 0, tempArr, 0, (int)numBytesToWrite); + _guidanceElectronicsUnit.GsKwSyncronousDataLinkControl.SendMessage(tempArr); + } + return numBytesToWrite; + } + + public void Close() + { + } + + public void Open() + { + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlc.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlc.csproj new file mode 100644 index 0000000..b4148c8 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlc.csproj @@ -0,0 +1,37 @@ + + + + + net472 + x86 + Raytheon.Instruments.CommDeviceGeuSdlc + CommDevice GeuSdlc implementation + CommDevice GeuSdlc implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + ..\..\Common\COTS\FSCC\netfscc.dll + + + ..\..\Common\COTS\Teradyne_SDLC\Raytheon.GuidedElectronicsUnit.Fx46.dll + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlcFactory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlcFactory.cs new file mode 100644 index 0000000..93dc8ae --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceGeuSdlc/CommDeviceGeuSdlcFactory.cs @@ -0,0 +1,141 @@ +// ********************************************************************************************************** +// CommDeviceGeuSdlcFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +// Ignore Spelling: Sdlc Geu + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceGeuSdlcFactory")] + public class CommDeviceGeuSdlcFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceGeuSdlcFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceGeuSdlcFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null ) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommDevice)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceGeuSdlc(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommDeviceSim(name, _configurationManager, _logger); + else + return new CommDeviceGeuSdlc(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsync.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsync.cs new file mode 100644 index 0000000..c78f736 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsync.cs @@ -0,0 +1,416 @@ +// ********************************************************************************************************** +// CommDeviceSerialAsync.cs +// 4/3/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Threading; +using System.Reflection; +using System.IO.Ports; + +namespace Raytheon.Instruments +{ + /// + /// A sim communication device + /// + public class CommDeviceSerialAsync : ICommAsync + { + #region PrivateClassMembers + + private uint _defaultReadTimeout; + private uint _defaultSendTimeout; + private uint _defaultReadBufferSize; + private static readonly object _syncObj = new object(); + + private SerialPort _serialPort; + + private readonly string _comPortName; + private readonly int _baudRate; + private readonly Parity _parity; + private readonly int _dataBits; + private readonly StopBits _stopBits; + + private readonly string _name; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + public bool ClearErrors() => false; + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public string DetailedStatus => $"This is a TCP/IP Device called {_name}"; + public InstrumentMetadata Info => throw new NotImplementedException(); + public State Status => _state; + public string Name => _name; + public SelfTestResult PerformSelfTest() => SelfTestResult; + public SelfTestResult SelfTestResult => SelfTestResult.Unknown; + + public void Close() => Shutdown(); + public void Reset() + { + Close(); + Open(); + } + + #region Private Functions + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + GC.SuppressFinalize(this); + } + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // close the socket + try + { + Shutdown(); + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + + #endregion + + #region Public Functions + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceSerialAsync(string name, IConfigurationManager configurationManager, ILogger logger) + { + _name = name; + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(name); + _logger = logger; + + _comPortName = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "COMPortName", "COM15"); + _baudRate = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "BaudRate", 115200); + _parity = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "Parity", Parity.None); + _dataBits = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "DataBits", 8); + _stopBits = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "StopBits", StopBits.One); + + _defaultReadTimeout = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "ReadTimeout", 25); + _defaultSendTimeout = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "SendTimeout", 5000); + _defaultReadBufferSize = _configuration.GetConfigurationValue("CommDeviceSerialAsync", "BufferSize", 1024); + + _state = State.Uninitialized; + } + + /// + /// initialize instrument + /// + public void Initialize() + { + if (_state != State.Uninitialized) + { + _logger.Warn("Reinitialization of existing Serial Async Connection. Attempting to call Shutdown."); + Shutdown(); + } + + _serialPort = new SerialPort(_comPortName, _baudRate, _parity, _dataBits, _stopBits); + + Open(); + } + + /// + /// Opens COM serial port for communications + /// + public void Open() + { + try + { + _serialPort.Open(); + _state = State.Ready; + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + throw; + } + } + + /// + /// shuts down the device + /// + public void Shutdown() + { + _logger.Debug("Shutting down"); + + _serialPort.Close(); + + _state = State.Uninitialized; + } + + /// + /// Read data from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(byte[] dataRead, CancellationToken token = default) + { + var bytesRead = await _serialPort.BaseStream.ReadAsync(dataRead, 0, dataRead.Length, token); + return (uint)bytesRead; + } + + /// + /// Read string from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(CancellationToken token = default) + { + var data = await ReadLineAsync(token); + return data; + } + + /// + /// Sets the read timeout + /// + /// + public void SetReadTimeout(uint timeoutMs) + { + if (_serialPort == null) + return; + + _logger.Trace($"Setting Reader Timeout: {timeoutMs} Ms"); + _serialPort.ReadTimeout = (int)timeoutMs; + } + + /// + /// Write data to the device asynchronously + /// + /// + /// + /// + public async Task WriteAsync(byte[] dataToSend, uint numBytesToWrite, CancellationToken token = default) + { + if (_serialPort == null || !_serialPort.IsOpen) + return 0; + + _logger.Trace($"Writing message to ({_comPortName}), bytes: {dataToSend?.Length}"); + + await _serialPort.BaseStream.WriteAsync(dataToSend, 0, (int)numBytesToWrite, token); + return numBytesToWrite; + } + + /// + /// Write string data to the device asynchronously + /// + /// + /// + public async Task WriteAsync(string message, CancellationToken token = default) + { + if (_serialPort == null || !_serialPort.IsOpen) + return; + + _logger.Trace($"Writing message to ({_comPortName}), message: {message}"); + await WriteLineAsync(message, token); + } + + /// + /// Send Command and Get Response asynchronously + /// + /// + /// + /// + public async Task SendCommandGetResponseAsync(string message, CancellationToken cancellationToken = default, int timeoutInMs = 5000) + { + if (_serialPort == null || !_serialPort.IsOpen) + return null; + + _logger.Trace($"Sending command waiting for response from ({_comPortName}), message: {message}"); + + using (var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(timeoutInMs))) + { + if (cancellationToken == default) + { + cancellationToken = cts.Token; + } + await WriteAsync(message, cancellationToken); + string readResponse = await ReadAsync(cancellationToken); + _logger.Trace($"Received response: {readResponse}"); + return readResponse; + } + } + + /// + /// Send Command and Get Response asynchronously + /// + /// + /// + /// + public async Task SendCommandGetResponseAsync(byte[] data, CancellationToken token = default, int timeoutInMs = 5000) + { + if (_serialPort == null || !_serialPort.IsOpen) + return null; + + _logger.Trace($"Sending command waiting for response from ({_comPortName}), message: {data}"); + + await WriteAsync(data, (uint)data.Length, token); + _serialPort.ReadTimeout = timeoutInMs; + var response = new byte[data.Length]; + await ReadAsync(response, token); + return response; + } + + /// + /// keeps reading until canceled via token, + /// received messages sent to dataReceived function + /// + /// + /// + /// + public async Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived) + { + if (_serialPort == null || !_serialPort.IsOpen) + return; + + _logger.Debug($"Starting continuous reading from {_comPortName} ..."); + + while (!cancellationToken.IsCancellationRequested) + { + var data = await ReadAsync(cancellationToken); + dataReceived?.Invoke(data); + } + + _logger.Debug($"Finished continuous reading from {_comPortName} ..."); + } + + /// + /// keeps reading until canceled via token, + /// received messages sent to dataReceived function + /// + /// + /// + /// + public async Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived) + { + if (_serialPort == null || !_serialPort.IsOpen) + return; + + _logger.Debug($"Starting continuous reading from {_comPortName} ..."); + + while (!cancellationToken.IsCancellationRequested) + { + var data = new byte[_defaultReadBufferSize]; // Adjust buffer size as needed + var bytesRead = await ReadAsync(data, cancellationToken); + Array.Resize(ref data, (int)bytesRead); + dataReceived?.Invoke(data); + } + + _logger.Debug($"Finished continuous reading from {_comPortName} ..."); + } + + #endregion + + #region private functions + /// + /// reads line async + /// + /// + /// + private async Task ReadLineAsync(CancellationToken cancellationToken = default) + { + try + { + cancellationToken.ThrowIfCancellationRequested(); + var line = await Task.Run(() => _serialPort.ReadLine(), cancellationToken); + return line; + } + catch (OperationCanceledException ex) + { + _logger.Error(ex, ex.Message); + return null; + } + } + + /// + /// writes line async + /// + /// + /// + /// + private async Task WriteLineAsync(string message, CancellationToken cancellationToken = default) + { + try + { + cancellationToken.ThrowIfCancellationRequested(); + await Task.Run(() => _serialPort.WriteLine(message), cancellationToken); + } + catch (OperationCanceledException ex) + { + _logger.Error(ex, ex.Message); + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsync.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsync.csproj new file mode 100644 index 0000000..de34d39 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsync.csproj @@ -0,0 +1,32 @@ + + + + + net472 + Raytheon.Instruments.CommDeviceSerialAsync + CommDevice Serial Asynchronous implementation + CommDevice Serial COM Asynchronous implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsyncFactory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsyncFactory.cs new file mode 100644 index 0000000..66c6d78 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSerialAsync/CommDeviceSerialAsyncFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// CommDeviceSerialAsyncFactory.cs +// 4/3/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceSerialAsyncFactory")] + public class CommDeviceSerialAsyncFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceSerialAsyncFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceSerialAsyncFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommAsync)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceSerialAsync(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new CommDeviceSerialAsync(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSim.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSim.cs new file mode 100644 index 0000000..ab720a4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSim.cs @@ -0,0 +1,315 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// A sim communication device + /// + public class CommDeviceSim : ICommDevice + { + #region PrivateClassMembers + private static object _syncObj = new Object(); + private readonly string _name; + private SelfTestResult _selfTestResult; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// The Finalizer + /// + ~CommDeviceSim() + { + Dispose(false); + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + } + + #endregion + + #region PublicFuctions + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceSim(string name, IConfigurationManager configurationManager, ILogger logger) + { + _name = name; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + + /// + /// + /// + /// + public CommDeviceSim(string name) + { + _name = name; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + _logger = LogManager.GetCurrentClassLogger(); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Comm Device Sim called " + _name; + } + } + + /// + /// Dispose of the resources + /// + public void Dispose() + { + Dispose(true); + + GC.SuppressFinalize(this); + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on device " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + } + + /// + /// + /// + /*public void Open() + { + lock (_syncObj) + { + } + }*/ + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + _selfTestResult = SelfTestResult.Pass; + return _selfTestResult; + } + } + + /// + /// Read data from the device. + /// + /// The buffer to put the data in + /// The number of bytes read + public uint Read(ref byte[] dataRead) + { + lock (_syncObj) + { + return (uint)dataRead.Length; + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + } + } + + /// + /// Sets the read timeout + /// + /// + public void SetReadTimeout(uint timeout) + { + lock (_syncObj) + { + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + _state = State.Uninitialized; + } + } + + /// + /// Write data to the device + /// + /// The data to write + /// The number of bytes to write + /// THe number of bytes that were written + public uint Write(byte[] dataToSend, uint numBytesToWrite) + { + lock (_syncObj) + { + return numBytesToWrite; + } + } + + public void Close() + { + throw new NotImplementedException(); + } + + public void Open() + { + throw new NotImplementedException(); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSim.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSim.csproj new file mode 100644 index 0000000..8a25cfe --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSim.csproj @@ -0,0 +1,22 @@ + + + + + net472 + Raytheon.Instruments.CommDeviceSim + CommDevice SIM implementation + CommDevice SIM implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSimFactory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSimFactory.cs new file mode 100644 index 0000000..95b3a6c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSim/CommDeviceSimFactory.cs @@ -0,0 +1,104 @@ +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceSimFactory")] + public class CommDeviceSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommDevice)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new CommDeviceSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422.cs new file mode 100644 index 0000000..5075693 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422.cs @@ -0,0 +1,517 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// Class for controlling a Commtech SUPERFSCC/4-PCIE-11 + /// + public class CommDeviceSuperFscc422 : ICommDevice, IDisposable + { + #region PrivateClassMembers + + private const uint _DEFAULT_READ_TIMEOUT = 10; + private const uint _RX_FIFO_BUFFER_SIZE = 8192; + private const uint _TX_FIFO_BUFFER_SIZE = 4096; + // The Super FSCC can DMA can stream data at 50 Mbits/sec + // The driver automatically transfers data from the FIFO into the MemoryCap which has a configurable size. Default to ~GB + + private uint _readTimeout; + private Fscc.Port _fscc; + private static object _syncObj = new Object(); + private readonly string _name; + private SelfTestResult _selfTestResult; + private State _state; + private readonly uint _portNum; + private readonly uint _clockFreq; + private readonly bool _shallWeReceiveMultiple; + private readonly bool _shallWeAppendStatus; + private readonly uint _bgrRegister; + private readonly uint _ccr0Register; + private readonly uint _ccr0SofResetValue; + private readonly uint _ccr1Register; + private readonly uint _ccr2Register; + private readonly uint _dpllrRegister; + private readonly uint _fcrRegister; + private readonly uint _fifotRegister; + private readonly uint _imrRegister; + private readonly uint _pprRegister; + private readonly uint _ramrRegister; + private readonly uint _rarRegister; + private readonly uint _smrRegister; + private readonly uint _ssrRegister; + private readonly uint _tcrRegister; + private readonly uint _tmrRegister; + private readonly uint _tsrRegister; + + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The Finalizer + /// + ~CommDeviceSuperFscc422() + { + Dispose(false); + } + + /// Dispose of the resources contained by this object + ///
+ /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _fscc.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception err) + { + try + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceSuperFscc422(string name, IConfigurationManager configurationManager, ILogger logger) + { + _name = name; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _portNum = _configuration.GetConfigurationValue("SuperFscc422", "PortNum", 0); + _clockFreq = _configuration.GetConfigurationValue("SuperFscc422", "ClockFreq", 0); + _shallWeReceiveMultiple = _configuration.GetConfigurationValue("SuperFscc422", "ShallWeReceiveMultiple", false); + _shallWeAppendStatus = _configuration.GetConfigurationValue("SuperFscc422", "ShallWeAppendStatus", false); + _bgrRegister = _configuration.GetConfigurationValue("SuperFscc422", "BgrRegister", 0); + _ccr0Register = _configuration.GetConfigurationValue("SuperFscc422", "Ccr0Register", 0); + _ccr0SofResetValue = _configuration.GetConfigurationValue("SuperFscc422", "Ccr0SofResetValue", 0); + _ccr1Register = _configuration.GetConfigurationValue("SuperFscc422", "Ccr1Register", 0); + _ccr2Register = _configuration.GetConfigurationValue("SuperFscc422", "Ccr2Register", 0); + _dpllrRegister = _configuration.GetConfigurationValue("SuperFscc422", "DpllrRegister", 0); + _fcrRegister = _configuration.GetConfigurationValue("SuperFscc422", "FcrRegister", 0); + _fifotRegister = _configuration.GetConfigurationValue("SuperFscc422", "FifotRegister", 0); + _imrRegister = _configuration.GetConfigurationValue("SuperFscc422", "ImrRegister", 0); + _pprRegister = _configuration.GetConfigurationValue("SuperFscc422", "PprRegister", 0); + _ramrRegister = _configuration.GetConfigurationValue("SuperFscc422", "RamrRegister", 0); + _rarRegister = _configuration.GetConfigurationValue("SuperFscc422", "RarRegister", 0); + _smrRegister = _configuration.GetConfigurationValue("SuperFscc422", "SmrRegister", 0); + _ssrRegister = _configuration.GetConfigurationValue("SuperFscc422", "SsrRegister", 0); + _tcrRegister = _configuration.GetConfigurationValue("SuperFscc422", "TcrRegister", 0); + _tmrRegister = _configuration.GetConfigurationValue("SuperFscc422", "TmrRegister", 0); + _tsrRegister = _configuration.GetConfigurationValue("SuperFscc422", "TsrRegister", 0); + + _readTimeout = _DEFAULT_READ_TIMEOUT; + + // created in Initialize() + _fscc = null; + } + + + /// + /// Opens the port and initializes the registers + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public CommDeviceSuperFscc422(string name, uint portNum, uint clockFreq, bool shallWeReceiveMultiple, bool shallWeAppendStatus, uint bgrRegister, uint ccr0Register, + uint ccr0SofResetValue, uint ccr1Register, uint ccr2Register, uint dpllrRegister, uint fcrRegister, uint fifotRegister, + uint imrRegister, uint pprRegister, uint ramrRegister, uint rarRegister, uint smrRegister, uint ssrRegister, uint tcrRegister, uint tmrRegister, uint tsrRegister) + { + _name = name; + _portNum = portNum; + _clockFreq = clockFreq; + _shallWeReceiveMultiple = shallWeReceiveMultiple; + _shallWeAppendStatus = shallWeAppendStatus; + _bgrRegister = bgrRegister; + _ccr0Register = ccr0Register; + _ccr0SofResetValue = ccr0SofResetValue; + _ccr1Register = ccr1Register; + _ccr2Register = ccr2Register; + _dpllrRegister = dpllrRegister; + _fcrRegister = fcrRegister; + _fifotRegister = fifotRegister; + _imrRegister = imrRegister; + _pprRegister = pprRegister; + _ramrRegister = ramrRegister; + _rarRegister = rarRegister; + _smrRegister = smrRegister; + _ssrRegister = ssrRegister; + _tcrRegister = tcrRegister; + _tmrRegister = tmrRegister; + _tsrRegister = tsrRegister; + + _readTimeout = _DEFAULT_READ_TIMEOUT; + + // created in Initialize() + _fscc = null; + + _logger = LogManager.GetCurrentClassLogger(); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FSCC 422 Device called " + _name; + } + } + + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _fscc = new Fscc.Port(_portNum); + + // false means that each read will return a single sdlc packet + // true means that each read will return everything in the buffer (multiple packets) + _fscc.RxMultiple = _shallWeReceiveMultiple; + + // if this to true...extra 2 bytes arrive at the end of every frame (first two bytes of STAR) + // The class processing the data needs to be aware of the extra two bytes + _fscc.AppendStatus = _shallWeAppendStatus; + + // ignore timeouts + _fscc.IgnoreTimeout = true; + + // purge the port + _fscc.Purge(true, true); + + // set the registers + _fscc.Registers.BGR = _bgrRegister; + _fscc.Registers.CCR0 = _ccr0Register; + _fscc.Registers.CCR1 = _ccr1Register; + _fscc.Registers.CCR2 = _ccr2Register; + _fscc.Registers.DPLLR = _dpllrRegister; + _fscc.Registers.FCR = _fcrRegister; + _fscc.Registers.FIFOT = _fifotRegister; + _fscc.Registers.IMR = _imrRegister; + _fscc.Registers.PPR = _pprRegister; + _fscc.Registers.RAMR = _ramrRegister; + _fscc.Registers.RAR = _rarRegister; + _fscc.Registers.SMR = _smrRegister; + _fscc.Registers.SSR = _ssrRegister; + _fscc.Registers.TCR = _tcrRegister; + _fscc.Registers.TMR = _tmrRegister; + _fscc.Registers.TSR = _tsrRegister; + + // false means that each read will return a single sdlc packet + // true means that each read will return everything in the buffer (multiple packets) + _fscc.RxMultiple = _shallWeReceiveMultiple; + + _fscc.ClockFrequency = _clockFreq; + + // if this to true...extra 2 bytes arrive at the end of every frame (first two bytes of STAR) + // The class processing the data needs to be aware of the extra two bytes + _fscc.AppendStatus = _shallWeAppendStatus; + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on device " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + throw new NotImplementedException(); + } + } + + /// + /// Read data from the device. + /// + /// The buffer to put the data in + /// The number of bytes read + public uint Read(ref byte[] dataRead) + { + lock (_syncObj) + { + uint numBytesRead = _fscc.Read(dataRead, (uint)dataRead.Length, _readTimeout); + + return numBytesRead; + } + } + + /// + /// Soft reset procedure as suggested by the vendor + /// + public void Reset() + { + lock (_syncObj) + { + _fscc.Registers.CCR0 = _ccr0SofResetValue; + + _fscc.Purge(true, true); + + _fscc.Registers.CCR0 = _ccr0Register; + } + } + + /// + /// + /// + /// + public void SetReadTimeout(uint timeoutMs) + { + lock (_syncObj) + { + _readTimeout = timeoutMs; + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + _fscc.Dispose(); + + _state = State.Uninitialized; + } + } + } + + /// + /// Write data to the device + /// + /// The data to write + /// The number of bytes to write + /// THe number of bytes that were written + public uint Write(byte[] dataToSend, uint numBytesToWrite) + { + lock (_syncObj) + { + uint numWritten = _fscc.Write(dataToSend, numBytesToWrite); + + if (numWritten != numBytesToWrite) + { + throw new Exception("num written " + numWritten + " not as expected: " + numBytesToWrite); + } + + return numWritten; + } + } + + public void Close() + { + throw new NotImplementedException(); + } + + public void Open() + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422.csproj new file mode 100644 index 0000000..d1b9644 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422.csproj @@ -0,0 +1,35 @@ + + + + + net472 + x86 + Raytheon.Instruments.CommDeviceSuperFscc422 + CommDevice SuperFscc422 implementation + CommDevice SuperFscc422 implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + ..\..\Common\COTS\FSCC\netfscc.dll + + + ..\..\Common\COTS\Teradyne_SDLC\Raytheon.GuidedElectronicsUnit.Fx46.dll + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422Factory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422Factory.cs new file mode 100644 index 0000000..e51ed03 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceSuperFscc422/CommDeviceSuperFscc422Factory.cs @@ -0,0 +1,161 @@ +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceSuperFscc422Factory")] + public class CommDeviceSuperFscc422Factory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceSuperFscc422Factory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceSuperFscc422Factory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommDevice)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceSuperFscc422(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommDeviceSim(name, _configurationManager, _logger); + else + return new CommDeviceSuperFscc422(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + + /// + /// + /// + /// + /// + /// + /// + public static ICommDevice CreateFastCommDevice(string instrumentDefFile, string iniSectionName, bool isThereHardware) + { + const string FAST_COMM_FSCC = "FAST_COMM_FSCC"; + + IniFile iniReader = new IniFile(instrumentDefFile); + + bool shallWeDebug = Convert.ToBoolean(iniReader.ReadValue(FAST_COMM_FSCC, "SHALL_WE_DEBUG")); + uint port = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "PORT")); + uint clock = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "CLOCK_FREQUENCY"), 16); + uint bgr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "BGR_REGISTER"), 16); + uint ccr0 = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "CCR0_REGISTER"), 16); + uint ccr0Reset = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "CCR0_SOF_RESET_VALUE"), 16); + uint ccr1 = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "CCR1_REGISTER"), 16); + uint ccr2 = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "CCR2_REGISTER"), 16); + uint dpllr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "DPLLR_REGISTER"), 16); + uint fcr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "FCR_REGISTER"), 16); + uint fifot = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "FIFO_T_REGISTER"), 16); + uint imr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "IMR_REGISTER"), 16); + uint ppr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "PPR_REGISTER"), 16); + uint ramr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "RAMR_REGISTER"), 16); + uint rar = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "RAR_REGISTER"), 16); + uint smr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "SMR_REGISTER"), 16); + uint ssr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "SSR_REGISTER"), 16); + uint tcr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "TCR_REGISTER"), 16); + uint tmr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "TMR_REGISTER"), 16); + uint tsr = Convert.ToUInt32(iniReader.ReadValue(FAST_COMM_FSCC, "TSR_REGISTER"), 16); + + bool shallWeReceiveMultiple = true; + bool shallWeAppendStatus = false; + + if (shallWeDebug == true) + { + shallWeReceiveMultiple = false; + shallWeAppendStatus = true; + } + + if (isThereHardware == true) + { + return new CommDeviceSuperFscc422(iniSectionName, port, clock, shallWeReceiveMultiple, shallWeAppendStatus, bgr, ccr0, ccr0Reset, ccr1, ccr2, dpllr, fcr, fifot, imr, ppr, ramr, rar, smr, ssr, tcr, tmr, tsr); + } + else + { + return new CommDeviceSim(iniSectionName); + } + } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsync.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsync.cs new file mode 100644 index 0000000..0990645 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsync.cs @@ -0,0 +1,465 @@ +// ********************************************************************************************************** +// CommDeviceTcpAsync.cs +// 3/6/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Threading; +using System.Reflection; + +namespace Raytheon.Instruments +{ + /// + /// A sim communication device + /// + public class CommDeviceTcpAsync : ICommAsync + { + #region PrivateClassMembers + + private uint _defaultReadTimeout; + private uint _defaultSendTimeout; + private uint _defaultReadBufferSize; + private static readonly object _syncObj = new object(); + private TcpClient _tcpClient; + private TcpListener _tcpListener; + private NetworkStream _tcpIpStream; + private int _port; + private string _remoteAddress; + private int _remotePort; + private readonly string _name; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + public bool ClearErrors() => false; + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public string DetailedStatus => $"This is a TCP/IP Device called {_name}"; + public InstrumentMetadata Info => throw new NotImplementedException(); + public State Status => _state; + public string Name => _name; + public SelfTestResult PerformSelfTest() => SelfTestResult; + public SelfTestResult SelfTestResult => SelfTestResult.Unknown; + public void Open() => Initialize(); + public void Close() => Shutdown(); + public void Reset() + { + Close(); + Open(); + } + + #region Private Functions + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + GC.SuppressFinalize(this); + } + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // close the socket + try + { + Shutdown(); + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + + #endregion + + #region Public Functions + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceTcpAsync(string name, IConfigurationManager configurationManager, ILogger logger) + { + _name = name; + + // _tcpClient is created in Initialize() + _tcpClient = null; + _tcpIpStream = null; + + _state = State.Uninitialized; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + /// + /// initialize instrument + /// + public void Initialize() + { + if (_state != State.Uninitialized) + { + _logger.Warn("Reinitialization of existing TCP Async Connection. Attempting to call Shutdown."); + Shutdown(); + } + + _defaultReadTimeout = _configuration.GetConfigurationValue("TcpClient", "ReadTimeout", 25); + _defaultSendTimeout = _configuration.GetConfigurationValue("TcpClient", "SendTimeout", 5000); + _defaultReadBufferSize = _configuration.GetConfigurationValue("TcpClient", "BufferSize", 1024); + + _remoteAddress = _configuration.GetConfigurationValue("TcpClient", "RemoteAddress", "127.0.0.1"); + _port = _configuration.GetConfigurationValue("TcpClient", "Port", 0); + + if (string.IsNullOrEmpty(_remoteAddress)) + { + _tcpListener = new TcpListener(IPAddress.Any, _port); + _tcpListener.Start(); + + _logger.Debug($"{MethodBase.GetCurrentMethod().Name} Started Listening on Port: {_port}"); + + Task.Run(async () => await _tcpListener.AcceptTcpClientAsync()).ContinueWith(t => + { + _tcpClient = t.Result; + + _remoteAddress = ((IPEndPoint)_tcpClient.Client.RemoteEndPoint).Address.ToString(); + _remotePort = ((IPEndPoint)_tcpClient.Client.RemoteEndPoint).Port; + + _logger.Debug($"{MethodBase.GetCurrentMethod().Name} Connection Established from Remote Address: {_remoteAddress}:{_remotePort}"); + + // set timeouts + _tcpClient.Client.SendTimeout = (int)_defaultSendTimeout; + _tcpClient.Client.ReceiveTimeout = (int)_defaultReadTimeout; + + // get the stream + _tcpIpStream = _tcpClient.GetStream(); + + _state = State.Ready; + }); + } + else + { + _remotePort = _port; + _tcpClient = new TcpClient(_remoteAddress, _remotePort); + + _logger.Debug($"{MethodBase.GetCurrentMethod().Name} Connected to Remote Address {_remoteAddress}:{_remotePort}"); + + // set timeouts + _tcpClient.Client.SendTimeout = (int)_defaultSendTimeout; + _tcpClient.Client.ReceiveTimeout = (int)_defaultReadTimeout; + + // get the stream + _tcpIpStream = _tcpClient.GetStream(); + + _state = State.Ready; + } + } + + /// + /// shuts down the device + /// + public void Shutdown() + { + _logger.Debug("Shutting down"); + _tcpClient?.Dispose(); + _tcpClient = null; + + _tcpListener?.Stop(); + _tcpListener = null; + + _tcpIpStream?.Dispose(); + _tcpIpStream = null; + + _state = State.Uninitialized; + } + + /// + /// Read data from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(byte[] dataRead, CancellationToken token = default) + { + if (_tcpIpStream == null) + return 0; + + if (_tcpIpStream.DataAvailable == true) + { + _state = State.Busy; + var bytesRead = await _tcpIpStream.ReadAsync(dataRead, 0, dataRead.Length, token); + + _logger.Trace($"Reading Data, bytes received: {bytesRead}"); + + _state = State.Ready; + return (uint)bytesRead; + } + else + { + return 0; + } + } + + /// + /// Read string from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(CancellationToken token = default) + { + if (_tcpIpStream == null) + return null; + + if (_tcpIpStream.DataAvailable == true) + { + _state = State.Busy; + var buffer = new byte[_defaultReadBufferSize]; + var bytesRead = await _tcpIpStream.ReadAsync(buffer, 0, buffer.Length, token); + _state = State.Ready; + + var message = Encoding.UTF8.GetString(buffer, 0, bytesRead); + + _logger.Trace($"Reading Data, message received: {message}"); + + return message; + } + else + { + return null; + } + } + + /// + /// Sets the read timeout + /// + /// + public void SetReadTimeout(uint timeoutMs) + { + _logger.Trace($"Setting Reader Timeout: {timeoutMs} Ms"); + + _tcpClient.Client.ReceiveTimeout = (int)timeoutMs; + } + + /// + /// Write data to the device asynchronously + /// + /// + /// + /// + public async Task WriteAsync(byte[] dataToSend, uint numBytesToWrite, CancellationToken token = default) + { + if (_tcpIpStream == null) + return 0; + + _logger.Trace($"Writing message to ({_remoteAddress}:{_remotePort}), bytes: {dataToSend?.Length}"); + + _state = State.Busy; + await _tcpIpStream.WriteAsync(dataToSend, 0, (int)numBytesToWrite, token); + _state = State.Ready; + return numBytesToWrite; + } + + /// + /// Write string data to the device asynchronously + /// + /// + /// + public async Task WriteAsync(string message, CancellationToken token = default) + { + if (_tcpIpStream == null) + return; + + _logger.Trace($"Writing message to ({_remoteAddress}:{_remotePort}), message: {message}"); + + _state = State.Busy; + var buffer = Encoding.UTF8.GetBytes(message); + await _tcpIpStream.WriteAsync(buffer, 0, buffer.Length, token); + _state = State.Ready; + } + + /// + /// Send Command and Get Response asynchronously + /// + /// + /// + /// + public async Task SendCommandGetResponseAsync(string message, CancellationToken cancellationToken = default, int timeoutInMs = 5000) + { + if (_tcpIpStream == null) + return null; + + _logger.Trace($"Sending command waiting for response from ({_remoteAddress}:{_remotePort}), message: {message}"); + + using (var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(timeoutInMs))) + { + if (cancellationToken == default) + { + cancellationToken = cts.Token; + } + await WriteAsync(message, cancellationToken); + string readResponse = await ReadAsync(cancellationToken); + _logger.Trace($"Received response: {readResponse}"); + return readResponse; + } + } + + /// + /// Send Command and Get Response asynchronously + /// + /// + /// + /// + public async Task SendCommandGetResponseAsync(byte[] data, CancellationToken cancellationToken = default, int timeoutInMs = 5000) + { + if (_tcpIpStream == null) + return null; + + _logger.Trace($"Sending command waiting for response from ({_remoteAddress}:{_remotePort}), message: {data}"); + + using (var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(timeoutInMs))) + { + if (cancellationToken == default) + { + cancellationToken = cts.Token; + } + await WriteAsync(data, (uint)data.Length, cancellationToken); + byte[] buffer = new byte[_defaultReadBufferSize]; + uint bytesRead = await ReadAsync(buffer, cancellationToken); + _logger.Trace($"Received response of size: {bytesRead}"); + + return buffer; + } + } + + /// + /// keeps reading until canceled via token, + /// received messages sent to dataReceived function + /// + /// + /// + /// + public async Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived) + { + _logger.Debug($"Starting continuous reading from {_remoteAddress}:{_remotePort} ..."); + + byte[] buffer = new byte[_defaultReadBufferSize]; + while (!cancellationToken.IsCancellationRequested) + { + if (_tcpIpStream == null) + { + continue; + } + + uint bytesRead = await ReadAsync(buffer, cancellationToken); + if (bytesRead > 0) + { + string data = Encoding.UTF8.GetString(buffer, 0, (int)bytesRead); + + _logger.Trace($"Message received from {_remoteAddress}:{_remotePort}: {data}"); + + dataReceived(data); + Array.Clear(buffer, 0, (int)bytesRead); + } + } + + _logger.Debug($"Finished continuous reading from {_remoteAddress}:{_remotePort} ..."); + } + + /// + /// keeps reading until canceled via token, + /// received messages sent to dataReceived function + /// + /// + /// + /// + public async Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived) + { + _logger.Debug($"Starting continuous reading from {_remoteAddress}:{_remotePort} ..."); + + byte[] buffer = new byte[_defaultReadBufferSize]; + while (!cancellationToken.IsCancellationRequested) + { + if (_tcpIpStream == null) + { + continue; + } + + uint bytesRead = await ReadAsync(buffer, cancellationToken); + if (bytesRead > 0) + { + _logger.Trace($"Message received from {_remoteAddress}:{_remotePort}: size {bytesRead}"); + byte[] bufferCopy = new byte[bytesRead]; + Array.Copy(buffer, bufferCopy, bytesRead); + dataReceived(bufferCopy); + Array.Clear(buffer, 0, (int)bytesRead); + } + } + + _logger.Debug($"Finished continuous reading from {_remoteAddress}:{_remotePort} ..."); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsync.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsync.csproj new file mode 100644 index 0000000..68ebd24 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsync.csproj @@ -0,0 +1,32 @@ + + + + + net472 + Raytheon.Instruments.CommDeviceTcpAsync + CommDevice TCP Asynchronous implementation + CommDevice TCP Asynchronous implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsyncFactory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsyncFactory.cs new file mode 100644 index 0000000..62eec1d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpAsync/CommDeviceTcpAsyncFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// CommDeviceTcpAsyncFactory.cs +// 3/6/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceTcpAsyncFactory")] + public class CommDeviceTcpAsyncFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceTcpAsyncFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceTcpAsyncFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommAsync)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceTcpAsync(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new CommDeviceTcpAsync(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClient.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClient.cs new file mode 100644 index 0000000..01d4419 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClient.cs @@ -0,0 +1,389 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.Net.Sockets; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Raytheon.Instruments +{ + /// + /// Class for controlling a TCP client communication device + /// + public class CommDeviceTcpClient : ICommDevice, IDisposable + { + #region PrivateClassMembers + private const uint _DEFAULT_READ_TIMEOUT = 25; + private const uint _DEFAULT_SEND_TIMEOUT = 5000; + private const uint _DEFAULT_READ_BUFFER_SIZE = 1024; + private static object _syncObj = new object(); + private TcpClient _tcpClient; + private NetworkStream _tcpIpStream; + private readonly int _remotePort; + private readonly string _remoteAddress; + private readonly string _name; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + public bool ClearErrors() => false; + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public string DetailedStatus => $"This is a TCP/IP Device called {_name}"; + public InstrumentMetadata Info => throw new NotImplementedException(); + public State Status => _state; + public string Name => _name; + public SelfTestResult PerformSelfTest() => SelfTestResult; + public SelfTestResult SelfTestResult => SelfTestResult.Unknown; + public void Open() => Initialize(); + public void Close() => Shutdown(); + public void Reset() + { + Close(); + Open(); + } + + #region Private Functions + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + GC.SuppressFinalize(this); + } + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // close the socket + try + { + Shutdown(); + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + + #endregion + + #region Public Functions + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceTcpClient(string name, IConfigurationManager configurationManager, ILogger logger, string remoteAddress = "", int remotePort = 0) + { + _name = name; + + // _tcpClient is created in Initialize() + _tcpClient = null; + _tcpIpStream = null; + + _state = State.Uninitialized; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + if(string.IsNullOrEmpty(remoteAddress)) + { + _remoteAddress = _configuration.GetConfigurationValue("TcpClient", "RemoteAddress", "127.0.0.1"); + } + else + { + _remoteAddress = remoteAddress; + } + + if(remotePort == 0) + { + _remotePort = _configuration.GetConfigurationValue("TcpClient", "RemotePort", 0); + } + else + { + _remotePort = remotePort; + } + } + + /// + /// legacy constructor + /// + /// The name of this device + /// The address of the server + /// The port that the server is listening on + public CommDeviceTcpClient(string name, string remoteAddress, int remotePort) + { + _name = name; + _remotePort = remotePort; + _remoteAddress = remoteAddress; + + // _tcpClient is created in Initialize() + _tcpClient = null; + _tcpIpStream = null; + + _logger = LogManager.GetCurrentClassLogger(); + + _state = State.Uninitialized; + } + + /// + /// initialize instrument + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _tcpClient = new TcpClient(_remoteAddress, _remotePort); + + // set timeouts + _tcpClient.Client.SendTimeout = (int)_DEFAULT_SEND_TIMEOUT; + _tcpClient.Client.ReceiveTimeout = (int)_DEFAULT_READ_TIMEOUT; + + // get the stream + _tcpIpStream = _tcpClient.GetStream(); + + _state = State.Ready; + } + else + { + throw new Exception($"expected the state to be Uninitialized, state was: {_state} on device {_name}"); + } + } + } + + /// + /// shuts down the device + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + _tcpIpStream.Dispose(); + _tcpClient.Dispose(); + _state = State.Uninitialized; + } + } + } + + /// + /// Read data from the device. + /// + /// The buffer to put the data in + /// The number of bytes read + public uint Read(ref byte[] dataRead) + { + lock (_syncObj) + { + if (_tcpIpStream.DataAvailable == true) + { + _state = State.Busy; + uint numBytesRead = (uint)(_tcpIpStream.Read(dataRead, 0, dataRead.Length)); + _state = State.Ready; + return numBytesRead; + } + else + { + return 0; + } + } + } + + /// + /// Read data from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(byte[] dataRead) + { + if (_tcpIpStream.DataAvailable == true) + { + _state = State.Busy; + var bytesRead = await _tcpIpStream.ReadAsync(dataRead, 0, dataRead.Length); + _state = State.Ready; + return (uint)bytesRead; + } + else + { + return 0; + } + } + + /// + /// Read string from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(CancellationToken token = default) + { + if (_tcpIpStream.DataAvailable == true) + { + _state = State.Busy; + var buffer = new byte[_DEFAULT_READ_BUFFER_SIZE]; + var bytesRead = await _tcpIpStream.ReadAsync(buffer, 0, buffer.Length, token); + _state = State.Ready; + return Encoding.UTF8.GetString(buffer, 0, bytesRead); + } + else + { + return null; + } + } + + + /// + /// Sets the read timeout + /// + /// + public void SetReadTimeout(uint timeoutMs) + { + _tcpClient.Client.ReceiveTimeout = (int)timeoutMs; + } + + /// + /// Write data to the device + /// + /// The data to write + /// The number of bytes to write + /// The number of bytes that were written + public uint Write(byte[] dataToSend, uint numBytesToWrite) + { + lock (_syncObj) + { + _state = State.Busy; + _tcpIpStream.Write(dataToSend, 0, (int)numBytesToWrite); + _state = State.Ready; + return numBytesToWrite; + } + } + + /// + /// Write data to the device asynchronously + /// + /// + /// + /// + public async Task WriteAsync(byte[] dataToSend, uint numBytesToWrite) + { + _state = State.Busy; + await _tcpIpStream.WriteAsync(dataToSend, 0, (int)numBytesToWrite); + _state = State.Ready; + return numBytesToWrite; + } + + /// + /// Write string data to the device asynchronously + /// + /// + /// + public async Task WriteAsync(string message) + { + _state = State.Busy; + var buffer = Encoding.UTF8.GetBytes(message); + await _tcpIpStream.WriteAsync(buffer, 0, buffer.Length); + _state = State.Ready; + } + + /// + /// Send Command and Get Response asynchronously + /// + /// + /// + /// + public async Task SendCommandGetResponseAsync(string message, int timeoutInMs = 5000) + { + _logger.Info($"Sending command waiting for response ({_remoteAddress}:{_remotePort}), message: {message}"); + + await WriteAsync(message); + + CancellationTokenSource tokenSource = new CancellationTokenSource(new TimeSpan(0, 0, 0, 0, milliseconds:timeoutInMs)); + + string readResponse = await ReadAsync(tokenSource.Token); + + _logger.Info($"Received response: {readResponse}"); + + return readResponse; + } + + /// + /// keeps reading until canceled via token, + /// received messages sent to dataReceived function + /// + /// + /// + /// + public async Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived) + { + _logger.Info($"About to start continuous reading from {_remoteAddress}:{_remotePort} ..."); + + byte[] buffer = new byte[_DEFAULT_READ_BUFFER_SIZE]; + while (!cancellationToken.IsCancellationRequested) + { + int bytesRead = await _tcpIpStream.ReadAsync(buffer, 0, buffer.Length, cancellationToken); + if (bytesRead > 0) + { + string data = Encoding.UTF8.GetString(buffer, 0, bytesRead); + + _logger.Info($"Message received from {_remoteAddress}:{_remotePort}: {data}"); + + dataReceived(data); + Array.Clear(buffer, 0, bytesRead); + } + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClient.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClient.csproj new file mode 100644 index 0000000..7f84abc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClient.csproj @@ -0,0 +1,32 @@ + + + + + net472 + Raytheon.Instruments.CommDeviceTcpClient + CommDevice TCP implementation + CommDevice TCP implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClientFactory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClientFactory.cs new file mode 100644 index 0000000..c9463ed --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceTcpClient/CommDeviceTcpClientFactory.cs @@ -0,0 +1,104 @@ +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceTcpClientFactory")] + public class CommDeviceTcpClientFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceTcpClientFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceTcpClientFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommDevice)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceTcpClient(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new CommDeviceTcpClient(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdp.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdp.cs new file mode 100644 index 0000000..84a9fef --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdp.cs @@ -0,0 +1,435 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.Net; +using System.Net.Sockets; + +namespace Raytheon.Instruments +{ + /// + /// Class for controlling a UDP communication device + /// + public class CommDeviceUdp : ICommDevice, IDisposable + { + #region PrivateClassMembers + private const uint _DEFAULT_SEND_TIMEOUT = 5000; + + private static readonly object _syncObj = new Object(); + private UdpClient _udpClient; + private readonly int _localPort; + private readonly int _remotePort; + private readonly string _remoteAddress; + private IPEndPoint _remoteIPEndPoint; + private string _name; + private readonly SelfTestResult _selfTestResult; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// The Finalizer + /// + ~CommDeviceUdp() + { + Dispose(false); + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // close the socket and threads + try + { + if (_state == State.Ready) + { + _udpClient.Close(); + + _udpClient.Dispose(); + + _state = State.Uninitialized; + } + } + catch (Exception) + { + try + { + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceUdp(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _localPort = _configuration.GetConfigurationValue("CommDeviceUdp", "LocalPort", 0); + _remotePort = _configuration.GetConfigurationValue("CommDeviceUdp", "RemotePort", 0); + _remoteAddress = _configuration.GetConfigurationValue("CommDeviceUdp", "RemoteAddress", "127.0.0.1"); + + // created in Initialize() + _udpClient = null; + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + + /// + /// + /// + /// The name of this instance + /// the port on the local computer to use + /// the port on the remote computer to send to + /// the address to send to + public CommDeviceUdp(string name, int localPort, int remotePort, string remoteAddress) + { + _name = name; + _localPort = localPort; + _remotePort = remotePort; + _remoteAddress = remoteAddress; + + // created in Initialize() + _udpClient = null; + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + _logger = LogManager.GetCurrentClassLogger(); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a UDP Device called " + _name; + } + } + + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _udpClient = new UdpClient(_localPort); + + _udpClient.Client.ReceiveBufferSize = int.MaxValue; + _udpClient.Client.SendBufferSize = int.MaxValue; + + _udpClient.Client.SendTimeout = (int)_DEFAULT_SEND_TIMEOUT; + + // set an arbitrary short receive timeout. Don't want the read call to block + _udpClient.Client.ReceiveTimeout = 5; + + IPAddress remoteAddy = IPAddress.Parse(_remoteAddress); + _remoteIPEndPoint = new IPEndPoint(remoteAddy, _remotePort); + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on device " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + throw new NotImplementedException(); + } + } + + /// + /// Read data from the device. + /// + /// The buffer to put the data in + /// The number of bytes read + public uint Read(ref byte[] dataRead) + { + lock (_syncObj) + { + try + { + dataRead = _udpClient.Receive(ref _remoteIPEndPoint); + + uint numBytesRead = (uint)(dataRead.Length); + + return numBytesRead; + } + catch (SocketException e) + { + if (e.SocketErrorCode == SocketError.TimedOut) + { + // expected, do nothing + return 0; + } + else + { + throw; + } + } + } + } + + /// + /// + public void Reset() + { + lock (_syncObj) + { + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public void SetReadTimeout(uint timeoutMs) + { + lock (_syncObj) + { + _udpClient.Client.ReceiveTimeout = (int)timeoutMs; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + _udpClient.Close(); + + _udpClient.Dispose(); + + _state = State.Uninitialized; + } + } + } + + /// + /// Write data to the device + /// + /// The data to write + /// The number of bytes to write + /// THe number of bytes that were written + public uint Write(byte[] dataToSend, uint numBytesToWrite) + { + lock (_syncObj) + { + const uint MAX_BYTES_PER_PACKET = 65400; + + uint index = 0; + + if (numBytesToWrite > MAX_BYTES_PER_PACKET) + { + uint numPacketsToSend = numBytesToWrite / MAX_BYTES_PER_PACKET; + int packetsSent = 0; + + while (packetsSent < numPacketsToSend) + { + Byte[] segment1 = new Byte[MAX_BYTES_PER_PACKET]; + Array.Copy(dataToSend, index, segment1, 0, MAX_BYTES_PER_PACKET); + uint count = (uint)(_udpClient.Send(segment1, (int)MAX_BYTES_PER_PACKET, _remoteIPEndPoint)); + index += count; + packetsSent++; + } + + Byte[] segment = new Byte[MAX_BYTES_PER_PACKET]; + uint numBytesRemaining = numBytesToWrite - index; + Array.Copy(dataToSend, index, segment, 0, numBytesRemaining); + index += (uint)(_udpClient.Send(segment, (int)numBytesRemaining, _remoteIPEndPoint)); + } + else + { + index = (uint)(_udpClient.Send(dataToSend, (int)numBytesToWrite, _remoteIPEndPoint)); + } + + return index; + } + } + + public void Close() + { + //throw new NotImplementedException(); + } + + public void Open() + { + //throw new NotImplementedException(); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdp.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdp.csproj new file mode 100644 index 0000000..d923c29 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdp.csproj @@ -0,0 +1,33 @@ + + + + + net472 + Raytheon.Instruments.CommDeviceUdp + Raytheon.Instruments + CommDevice UDP implementation + CommDevice UDP implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdpFactory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdpFactory.cs new file mode 100644 index 0000000..43b316c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdp/CommDeviceUdpFactory.cs @@ -0,0 +1,104 @@ +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceUdpFactory")] + public class CommDeviceUdpFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceUdpFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceUdpFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommDevice)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceUdp(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new CommDeviceUdp(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsync.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsync.cs new file mode 100644 index 0000000..ff97028 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsync.cs @@ -0,0 +1,468 @@ +// ********************************************************************************************************** +// CommDeviceUdpAsync.cs +// 3/6/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Threading; +using System.Net; + +namespace Raytheon.Instruments +{ + /// + /// A sim communication device + /// + public class CommDeviceUdpAsync : ICommAsync + { + #region PrivateClassMembers + private uint _defaultReadTimeout; + private uint _defaultSendTimeout; + private uint _defaultReadBufferSize; + private static readonly object _syncObj = new object(); + + private UdpClient _udpClient; + private IPEndPoint _remoteEndPoint; + + private int _localPort; + private int _remotePort; + private string _remoteAddress; + private readonly string _name; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + public bool ClearErrors() => false; + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public string DetailedStatus => $"This is a TCP/IP Device called {_name}"; + public InstrumentMetadata Info => throw new NotImplementedException(); + public State Status => _state; + public string Name => _name; + public SelfTestResult PerformSelfTest() => SelfTestResult; + public SelfTestResult SelfTestResult => SelfTestResult.Unknown; + public void Open() => Initialize(); + public void Close() => Shutdown(); + public void Reset() + { + Close(); + Open(); + } + + #region Private Functions + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + GC.SuppressFinalize(this); + } + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // close the socket + try + { + Shutdown(); + } + catch (Exception err) + { + _logger.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + + #endregion + + #region Public Functions + + /// + /// CommDevice factory constructor + /// + /// + /// + public CommDeviceUdpAsync(string name, IConfigurationManager configurationManager, ILogger logger) + { + _name = name; + + _state = State.Uninitialized; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + /// + /// initialize instrument + /// + public void Initialize() + { + if (_state != State.Uninitialized) + { + _logger.Warn("Reinitialization of existing UDP Async Connection. Attempting to call Shutdown."); + Shutdown(); + } + + _defaultReadTimeout = _configuration.GetConfigurationValue("UdpClient", "ReadTimeout", 25); + _defaultSendTimeout = _configuration.GetConfigurationValue("UdpClient", "SendTimeout", 5000); + _defaultReadBufferSize = _configuration.GetConfigurationValue("UdpClient", "BufferSize", 1024); + + _localPort = _configuration.GetConfigurationValue("UdpClient", "LocalPort", 0); + + _remoteAddress = _configuration.GetConfigurationValue("UdpClient", "RemoteAddress", "127.0.0.1"); + _remotePort = _configuration.GetConfigurationValue("UdpClient", "RemotePort", 0); + + _udpClient = new UdpClient(); + + if (string.IsNullOrEmpty(_remoteAddress)) + { + _logger.Debug($"Initializing as UDP Server. Listening on port: {_localPort}"); + _udpClient.Client.Bind(new IPEndPoint(IPAddress.Any, _localPort)); + } + else + { + _logger.Debug($"Initializing as UDP Client. Ready to Talk to: {_remoteAddress}:{_remotePort}"); + // get the remote endpoint + _remoteEndPoint = new IPEndPoint(IPAddress.Parse(_remoteAddress), _remotePort); + } + + // set timeouts + _udpClient.Client.SendTimeout = (int)_defaultSendTimeout; + _udpClient.Client.ReceiveTimeout = (int)_defaultReadTimeout; + + _state = State.Ready; + } + + /// + /// shuts down the device + /// + public void Shutdown() + { + _logger.Debug("Shutting Down..."); + _state = State.Uninitialized; + _udpClient?.Dispose(); + _udpClient = null; + } + + /// + /// Read data from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(byte[] dataRead, CancellationToken token = default) + { + if (_udpClient == null) + return 0; + + var received = await _udpClient.ReceiveAsync(); + Array.Copy(received.Buffer, dataRead, Math.Min(dataRead.Length, received.Buffer.Length)); + + UpdateRemoteAddressAndPort(received.RemoteEndPoint); + + _logger.Trace($"Reading Data, bytes received: {received.Buffer?.Length}"); + + return (uint)received.Buffer.Length; + } + + /// + /// Read string from the device asynchronously. + /// + /// The buffer to put the data in + /// The number of bytes read + public async Task ReadAsync(CancellationToken token = default) + { + if (_udpClient == null) + return null; + + var received = await _udpClient.ReceiveAsync(); + + UpdateRemoteAddressAndPort(received.RemoteEndPoint); + + var data = Encoding.UTF8.GetString(received.Buffer); + + _logger.Trace($"Reading Data, message received: {data}"); + + return data; + } + + /// + /// Sets the read timeout + /// + /// + public void SetReadTimeout(uint timeoutMs) + { + if (_udpClient == null) + return; + + _logger.Trace($"Setting Reader Timeout: {timeoutMs} Ms"); + + _udpClient.Client.ReceiveTimeout = (int)timeoutMs; + } + + /// + /// Write data to the device asynchronously + /// + /// + /// + /// + public async Task WriteAsync(byte[] dataToSend, uint numBytesToWrite, CancellationToken token = default) + { + if (_udpClient == null || _remoteEndPoint == null) + return 0; + + _logger.Trace($"Writing message to ({_remoteAddress}:{_remotePort}), bytes: {dataToSend?.Length}"); + + _state = State.Busy; + await _udpClient.SendAsync(dataToSend, (int)numBytesToWrite, _remoteEndPoint); + _state = State.Ready; + return numBytesToWrite; + } + + /// + /// Write string data to the device asynchronously + /// + /// + /// + /// + public async Task WriteAsync(string message, CancellationToken token = default) + { + if (_udpClient == null || _remoteEndPoint == null) + return; + + _logger.Trace($"Writing message to ({_remoteAddress}:{_remotePort}), message: {message}"); + + _state = State.Busy; + var dataToSend = Encoding.UTF8.GetBytes(message); + await _udpClient.SendAsync(dataToSend, dataToSend.Length, _remoteEndPoint); + _state = State.Ready; + } + + /// + /// Send Command and Get Response asynchronously + /// + /// + /// + /// + /// + public async Task SendCommandGetResponseAsync(string message, CancellationToken cancellationToken = default, int timeoutInMs = 5000) + { + if (_udpClient == null) + return null; + + _logger.Trace($"Sending command waiting for response from ({_remoteAddress}:{_remotePort}), message: {message}"); + + using (CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(timeoutInMs))) + { + if (cancellationToken == default) + { + cancellationToken = cts.Token; + } + await WriteAsync(message, cancellationToken); + string readResponse = await ReadAsync(cancellationToken); + _logger.Trace($"Received response: {readResponse}"); + + return readResponse; + } + } + + /// + /// Send Command and Get Response asynchronously + /// + /// + /// + /// + /// + public async Task SendCommandGetResponseAsync(byte[] data, CancellationToken cancellationToken = default, int timeoutInMs = 5000) + { + if (_udpClient == null) + return null; + + _logger.Trace($"Sending command waiting for response from ({_remoteAddress}:{_remotePort}), message length: {data.Length}"); + + using (CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(timeoutInMs))) + { + if (cancellationToken == default) + { + cancellationToken = cts.Token; + } + await WriteAsync(data, (uint)data.Length, cancellationToken); + byte[] buffer = new byte[_defaultReadBufferSize]; + uint bytesRead = await ReadAsync(buffer, cancellationToken); + _logger.Trace($"Received response of size: {bytesRead}"); + + return buffer; + } + } + + /// + /// keeps reading until canceled via token, + /// received messages sent to dataReceived function + /// + /// + /// + /// + public async Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived) + { + if (_udpClient == null) + return; + + _logger.Debug($"Starting continuous reading from port: {_localPort} ..."); + + while (!cancellationToken.IsCancellationRequested) + { + if (_udpClient == null) + break; + + var received = await ReceiveAsync(_udpClient, cancellationToken); + + if (received != null && received.Buffer != null) + { + UpdateRemoteAddressAndPort(received.RemoteEndPoint); + _logger.Trace($"Incoming Data from {_remoteAddress}:{_remotePort}: size {received.Buffer.Length}"); + string data = Encoding.UTF8.GetString(received.Buffer, 0, received.Buffer.Length); + dataReceived(data); + } + } + + _logger.Debug($"Finished continuous reading from {_remoteAddress}:{_remotePort} ..."); + } + + /// + /// keeps reading until canceled via token, + /// received messages sent to dataReceived function + /// + /// + /// + /// + public async Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived) + { + if (_udpClient == null) + return; + + _logger.Debug($"Starting continuous reading from port: {_localPort} ..."); + + while (!cancellationToken.IsCancellationRequested) + { + if (_udpClient == null) + break; + + var received = await ReceiveAsync(_udpClient, cancellationToken); + if (received != null && received.Buffer != null) + { + UpdateRemoteAddressAndPort(received.RemoteEndPoint); + _logger.Trace($"Incoming Data from {_remoteAddress}:{_remotePort}: size {received.Buffer.Length}"); + dataReceived(received.Buffer); + } + } + + _logger.Debug($"Finished continuous reading from {_remoteAddress}:{_remotePort} ..."); + } + + #endregion + + #region Private Functions + /// + /// Update client information for logging + /// + /// + private void UpdateRemoteAddressAndPort(IPEndPoint remoteEndPoint) + { + if (remoteEndPoint == null) + return; + + if (_remotePort == 0 || string.IsNullOrEmpty(_remoteAddress)) + { + _remotePort = remoteEndPoint.Port; + _remoteAddress = remoteEndPoint.Address.ToString(); + } + + if(_remoteEndPoint == null || _remoteEndPoint.Port != remoteEndPoint.Port ) + { + // get the remote endpoint + _remoteEndPoint = remoteEndPoint; + + _logger.Debug($"Starting to receive data from {_remoteAddress}:{_remotePort}"); + } + } + + /// + /// ReceiveAsyc with cancellation token implementation + /// + /// + /// + /// + private Task ReceiveAsync(UdpClient client, CancellationToken breakToken) => breakToken.IsCancellationRequested + ? Task.Run(() => new UdpReceiveResult()) + : Task.Factory.FromAsync + ((callback, state) => client.BeginReceive(callback, state), (ar) => + { + if (breakToken.IsCancellationRequested) + return new UdpReceiveResult(); + + IPEndPoint remoteEP = null; + var buffer = client.EndReceive(ar, ref remoteEP); + return new UdpReceiveResult(buffer, remoteEP); + },null); + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsync.csproj b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsync.csproj new file mode 100644 index 0000000..d3bc2d0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsync.csproj @@ -0,0 +1,33 @@ + + + + + net472 + Raytheon.Instruments.CommDeviceUdpAsync + Raytheon.Instruments + CommDevice UDP Asynchronous implementation + CommDevice UDP Asynchronous implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsyncFactory.cs b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsyncFactory.cs new file mode 100644 index 0000000..e670c85 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/CommDevice/CommDeviceUdpAsync/CommDeviceUdpAsyncFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// CommDeviceUdpAsyncFactory.cs +// 3/6/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommDeviceUdpAsyncFactory")] + public class CommDeviceUdpAsyncFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommDeviceUdpAsyncFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// CommDeviceUdpAsyncFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommDeviceUdpAsyncFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommAsync)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommDeviceUdpAsync(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new CommDeviceUdpAsync(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Advantech/Automation.BDaq4.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Advantech/Automation.BDaq4.dll new file mode 100644 index 0000000..74394c8 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Advantech/Automation.BDaq4.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/cfscc.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/cfscc.dll new file mode 100644 index 0000000..f75ac45 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/cfscc.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/netfscc.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/netfscc.dll new file mode 100644 index 0000000..9478895 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/netfscc.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Counter.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Counter.dll new file mode 100644 index 0000000..c7ca44b Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Counter.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Counter.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Counter.xml new file mode 100644 index 0000000..a435ab0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Counter.xml @@ -0,0 +1,1180 @@ + + + + Ivi.Counter + + + + + IviCounter class defined values for arm type. + + + + + Do not wait for an external arm source event. + + + + + Wait for an external arm source event. + + + + + IviCounter class defined values for the Coupling parameter of the Configure method in the IIviCounterChannel + interface. + + + + + The counter AC couples the channel signal. + + + + + The counter DC couples the channel signal. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + The IviCounter class-compliant root interface. + + + + + A reference to the IIviCounterChannelCollection interface. + + + + + A reference to the IIviCounterFrequency interface. + + + + + A reference to the IIviCounterPeriod interface. + + + + + A reference to the IIviCounterPulseWidth interface. + + + + + A reference to the IIviCounterDutyCycle interface. + + + + + A reference to the IIviCounterEdgeTime interface. + + + + + A reference to the IIviCounterFrequencyRatio interface. + + + + + A reference to the IIviCounterTimeInterval interface. + + + + + A reference to the IIviCounterPhase interface. + + + + + A reference to the IIviCounterTotalizeContinuous interface. + + + + + A reference to the IIviCounterTotalizeGated interface. + + + + + A reference to the IIviCounterTotalizeTimed interface. + + + + + A reference to the IIviCounterArm interface. + + + + + A reference to the IIviCounterMeasurement interface. + + + + + A reference to the IIviCounterVoltage interface. + + + + + The current measurement function of the Counter. + + + + + IviCounter class-compliant IIviCounterArm interface. + + + + + A reference to the IIviCounterArmStart interface. + + + + + A reference to the IIviCounterArmStop interface. + + + + + The IviCounter class-compliant IIviCounterArmStart interface. + + + + + A reference to the IIviCounterArmStartExternal interface. + + + + + The start arm type for armed measurements. + + + + + IviCounter class-compliant IIviCounterArmStartExternal interface. + + + + + Configures the external start arm source, level, slope and delay. + + The external start arm source. Refer to the Source property for details. + The external start arm level. Refer to the Level property for details. + The external start arm slope. Refer to the Slope property for details. + The external start arm delay. Refer to the Delay property for details. + + + + The start arm source for external armed measurements. The value can be a channel name alias, a + driver-specific channel string, or a standard value. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The voltage level in volts that starts external armed measurements. + + + + + The signal slope that starts external armed measurements. + + + + + The delay used after an external armed measurement has been armed. + + + + + IviCounter class-compliant IIviCounterArmStop interface. + + + + + A reference to the IIviCounterArmStopExternal interface. + + + + + The stop arm type for armed measurements. + + + + + IviCounter class-compliant IIviCounterArmStopExternal interface. + + + + + Configures the external stop arm source, level, slope and delay. + + The external stop arm source. Refer to the Source property for details. + The external stop arm level. Refer to the Level property for details. + The external stop arm slope. Refer to the Slope property for details. + The external stop arm Delay. Refer to the Delay property for details. + + + + The stop arm source for external armed measurements. The value can be a channel name alias, a + driver-specific channel string, or a standard value. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The voltage level in volts that stops external armed measurements. + + + + + The signal slope that stops external armed measurements. + + + + + The delay after the External Arm Stop event has occurred until the measurement stops. + + + + + IviCounter class-compliant IIviCounterChannel interface. + + + + + Configures the bandpass filter minimum and maximum frequencies for a channel. + + The minimum filter frequency. Refer to the MinimumFrequency property + for details. + The maximum filter frequency. Refer to the MaximumFrequency property + for details. + + + + Configures the level and hysteresis for a channel. + + The trigger Level the counter will use for the channel. Refer to the Level + property for details. + The hysteresis the counter will use for the channel. Refer to the Hysteresis + property for details. + + + + Configures the impedance, coupling, and attenuation of the counter channel. + + The impedance the counter will use to couple the input signal for the channel. + Refer to the Impedance property for details. + If true, the counter will couple the input signal for the channel. Refer to the + Coupling property for details. + The attenuation the counter will use for the channel. Refer to the Attenuation + property for details. + + + + The input impedance of the channel in Ohms. + + + + + The electrical coupling method used on the input channel. + + + + + The scale factor by which the channel attenuates the input. Increasing this value decreases the + sensitivity. For instance, setting this value to 10 attenuates the input by a factor of 10. + + + + + The voltage level the input signal must pass through to produce a count. Level is specified as the + voltage at the input terminals and is independent of attenuation. + + + + + The Hysteresis value in volts. Hysteresis sets how far a signal must fall below the level before a rising + edge can again be detected, and how far a signal must rise above the level before a falling edge can again + be detected. Hysteresis is specified as the voltage at the input terminals and is independent of + attenuation. + + + + + If true, the filter on the selected channel is enabled. + + + + + Indicates whether a rising (positive) or a falling (negative) edge triggers the counter. + + + + + The low cutoff frequency for the filter in hertz. Set to zero to disable low frequency filtering. + + + + + The high cutoff frequency for the filter in hertz. Set to Double.PositiveInfinity to disable high + frequency filtering. + + + + + IviCounter class-compliant IIviCounterChannelCollection interface. + + + + + IviCounter class-compliant IIviCounterDutyCycle interface. + + + + + Configures the frequency estimate and resolution for a duty cycle measurement. + + The channel on which the duty cycle is measured. Refer to the Channel property + for details. + The estimated frequency. Refer to the FrequencyEstimate property for + details. + The resolution of the duty cycle measurement. Refer to the Resolution property + for details. + + + + The input channel on which the duty cycle is measured. + + + + + The estimated frequency, in hertz, for the duty cycle measurement function. The driver uses this to + optimize the configuration of the instrument for the input signal. The driver typically use this to + set the duration of the measurement. + + + + + The resolution for the duty cycle measurement function. Duty Cycle Resolution is a unitless value. It is the + quantization size, i.e. the smallest delta value that can be detected. + + + + + IviCounter class-compliant IIviCounterEdgeTime interface. + + + + + Configures an edge time measurement. + + The channel on which the edge time will be measured. Refer to the Channel property + for details. + The estimated edge time. Refer to the Estimate property for details. + The resolution of the edge time measurement. Refer to the Resolution property + for details. + + + + Configures the reference type, estimate, resolution, high reference level, and low reference level + for an edge time measurement. + + The channel on which the edge time will be measured. Refer to the Channel property + for details. + The reference type. Refer to the ReferenceType property for details. + The estimated edge time. Refer to the Estimate property for details. + The resolution of the edge time measurement. Refer to the Resolution property + for details. + The high reference level for the edge time. Refer to the HighReference + property for details. + The low reference level for the edge time. Refer to the LowReference + property for details. + + + + The input channel on which the edge time is measured. + + + + + The estimated edge time for the edge time measurement function. + + + + + The resolution of the measurement for the edge time measurement function. It is the quantization size, + i.e. the smallest delta value that can be detected. + + + + + The current reference type of the Counter, which determines whether the Edge Time High Referenace and + Edge Time Low Reference are interpreted as percentage of peak-peak or absolute volts. + + + + + The high reference voltage level in volts for the edge time measurement function. For a Rise Time + measurement, this is the level where the measurement stops and for a Fall Time measurement, this is + the level where the measurement starts. + + + + + The low reference voltage level in volts for the edge time measurement function. For a Rise Time + measurement, this is the level where the measurement starts and for a Fall Time measurements, this is + the level where the measurement stops. + + + + + IviCounter class-compliant IIviCounterFrequency interface. + + + + + Configures a frequency measurement based on the specified aperture time. + + The channel on which the frequency will be measured. Refer to the Channel property + for details. + The aperture time of the frequency measurement. Refer to the ApertureTime + property for details. + + + + Configures the channel, estimate, and resolution for a frequency measurement. + + The channel on which the frequency will be measured. Refer to the Channel + property for details. + The estimated frequency. Refer to the Estimate property for details. + The resolution of the frequency measurement. Refer to the Resolution + property for details. + + + + Configures the channel, estimate, and resolution for a frequency measurement. + + The channel on which the frequency will be measured. Refer to the Channel + property for details. + If true, the instrument determines the estimated frequency. Refer to the + EstimateAuto property for details. + The resolution of the frequency measurement. Refer to the Resolution property + for details. + + + + Configures the channel, estimate, and resolution for a frequency measurement. + + The channel on which the frequency will be measured. Refer to the Channel + property for details. + The estimated frequency. Refer to the Estimate property for details. + If true, the instrument determines the resolution of the frequency + measurement. Refer to the ResolutionAuto property for details. + + + + Configures the channel, estimate, and resolution for a frequency measurement. + + The channel on which the frequency will be measured. Refer to the Channel property + for details. + If true, the instrument determines the estimated frequency. Refer to the + EstimateAuto property for details. + If true, the instrument determines the resolution of the frequency + measurement. Refer to the ResolutionAuto property for details. + + + + Provides auto frequency configuration. Configures the instrument to determine the best estimate and + resolution for the selected channel. + + The channel on which the frequency will be measured. Refer to the Channel + property for details. + + + + The input channel on which the frequency is measured. + + + + + The estimated frequency, in hertz, for the frequency measurement function. + + + + + The resolution of the measurement, in hertz, for the frequency measurement function. + + + + + The aperture time for the frequency with aperture time measurement function. It is the quantization size, + i.e. the smallest delta value that can be detected. + + + + + If true, the instrument determines the estimated frequency, in hertz, for the frequency measurement function. + + + + + If true, the instrument determines the resolution of the measurement, in hertz, for the frequency measurement + function. + + + + + IviCounter class-compliant IIviCounterFrequencyRatio interface. + + + + + Configures the numerator channel, denominator channel, estimated frequency, and resolution for a frequency + ratio measurement. + + The numerator channel on which the frequency ratio will be measured. Refer + to the NumeratorChannel property for details. + The denominator channel on which the frequency ratio will be measured. + Refer to the DenominatorChannel property for details. + The estimated frequency for the numerator of the frequency ratio. + Refer to the NumeratorFrequencyEstimate property for details. + The estimated frequency ratio measurement. Refer to the Estimate property for + details. + The resolution of the frequency ratio measurement. Refer to the Resolution + property for details. + + + + The input numerator channel on which the frequency ratio is measured. + + + + + The input denominator channel on which the frequency ratio is measured. + + + + + The estimated numerator frequency, in hertz, for the frequency ratio measurement function. The driver uses + this to optimize the configuration of the instrument for the input signal. The driver typically use this + to set the duration of the measurement. + + + + + The estimated frequency ratio for the frequency ratio measurement function. Estimate is a unitless value. + + + + + The resolution of the measurement for the frequency ratio measurement function. Resolution is a unitless + value. It is the quantization size, i.e. the smallest delta value that can be detected. + + + + + IviCounter class-compliant IIviCounterMeasurement interface. + + + + + Initiates and fetches a measurement based on the current configuration. + + Pass the maximum length of time in which to allow the read waveform measurement + operation to complete. If the operation does not complete within this time interval, the method returns + the Maximum Time Exceeded error. When this occurs, you can call the Abort method to cancel the read + waveform operation and return the counter to the idle state. + The measured value. + + + + Retrieves the result from a previously initiated measurement. + + The measured value. + + + + Aborts a previously initiated measurement. + + + + + Initiates a measurement based on the current configuration. + + + + + Determines whether a measurement is in progress, complete, or if the status is unknown. + + + + + IviCounter class-compliant IIviCounterPeriod interface. + + + + + Configures a period measurement based on the specified aperture time. + + The channel on which the period will be measured. Refer to the Channel property + for details. + The aperture time of the period measurement. Refer to the ApertureTime + property for details. + + + + Configures the estimate and resolution properties for a period measurement. + + The channel on which the period will be measured. Refer to the Channel property + for details. + The estimated period. Refer to the Estimate property for details. + The resolution of the period measurement. Refer to the Resolution property + for details. + + + + The input channel on which the period will be measured. + + + + + The estimated period for the period measurement function. The driver uses this to optimize the + configuration of the instrument for the input signal. The driver typically use this to set the + duration of the measurement. + + + + + The resolution of the measurement for the period measurement function. It is the quantization size, i.e. + the smallest delta value that can be detected. + + + + + The aperture time for the period with aperture time measurement function. Setting this property + overrides the period estimate and period resolution. This property can be read to determine the + value of aperture time selected by the driver based on the period estimate and period resolution. + + + + + IviCounter class-compliant IIviCounterPhase interface. + + + + + Configures the input channel, reference channel, estimate, and resolution for a phase measurement. + + The input channel on which the phase will be measured. Refer to the + InputChannel property for details. + The channel to which the phase measurement will be referenced. Refer to the + ReferenceChannel property for details. + The estimated phase. Refer to the FrequencyEstimate property for details. + The resolution of the phase measurement. Refer to the Resolution property for + details. + + + + The input channel on which the phase will be measured. + + + + + The reference channel to which the phase measurement will be referenced. + + + + + The estimated frequency, in hertz, for the phase measurement function reference channel. The driver uses + this property to optimize the configuration of the instrument for the input signal. The driver typically use this to set the duration of the measurement. + + + + + The resolution of the measurement, in degrees, for the phase measurement function reference channel. It is + the quantization size, i.e. the smallest delta value that can be detected. + + + + + IviCounter class-compliant IIviCounterPulseWidth interface. + + + + + Configures the estimate and resolution properties for a pulse width measurement. + + The channel on which the pulse width will be measured. Refer to the Channel property + for details. + The estimated pulse width. Refer to the Estimate property for details. + The resolution of the pulse width measurement. Refer to the Resolution property + for details. + + + + The channel on which the pulse width will be measured. + + + + + The estimated pulse width for the pulse width measurement function. The driver uses this to optimize the + configuration of the instrument for the input signal. The driver typically use this to set the duration + of the measurement. + + + + + The resolution of the measurement for the pulse width measurement function. It is the quantization size, i.e. + the smallest delta value that can be detected. + + + + + IviCounter class-compliant IIviCounterTimeInterval interface. + + + + + Configures the start and stop channels, estimate and resolution for a time interval measurement. + + The channel that will start the time interval measurement. Refer to the + StartChannel property for details. + The channel that will stop the time interval measurement. Refer to the + StopChannel property for details. + The estimated time interval. Refer to the Estimate property for details. + The resolution of the time interval measurement. Refer to the Resolution + property for details. + + + + The start channel used to perform the measure time interval measurement function. + + + + + The stop channel used to perform the measure time interval measurement function. + + + + + The estimated time interval for the time interval measurement function. + + + + + The resolution of the measurement for the time interval measurement function. It is the quantization size, + i.e. the smallest delta value that can be detected. + + + + + The stop holdoff time for a time interval measurement. The stop holdoff time is the time from the Time + Interval Start Channel Trigger until the Time Interval Stop Channel Trigger is enabled. Many counters + have a small, non-zero value as the minimum value for this property. To configure the instrument to use + the shortest stop hold-off, the user can specify a value of zero for this property. + + + + + IviCounter class-compliant IIviCounterTotalizeContinuous interface. + + + + + Stops the accumulation of counts for a continuous totalize measurement. + + + + + Clears the count and starts the counter for a continuous totalize measurement. + + + + + Configures the counter for a continuous totalize measurement. + + The input channel. + + + + Retrieves the current count while the counter is continuously totalizing. + + The current count. + + + + The input channel for the continuous totalize measurement function. + + + + + IviCounter class-compliant IIviCounterTotalizeGated interface. + + + + + Configures the gate source channel, the gating channel, and gate slope property for a gated totalize + measurement. + + The channel that will be counted. Refer to the Channel property for details. + The channel that will gate the counted channel. Refer to the GateSource + property for details. + The gate slope. Refer to the GateSlope property for details. + + + + The channel that will be counted for the gated totalize measurement function. + + + + + The channel that will gate the counted channel for the gated totalize measurement function. The value + can be a channel name alias, a driver-specific channel string, or a standard value. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The gate slope that enables the gated totalize measurement function. + + + + + IviCounter class-compliant IIviCounterTotalizeTimed interface. + + + + + Configures the gate time for the timed totalize measurement. + + The channel that will be counted. Refer to the Channel property for details. + The gate time that will gate the counter channel. Refer to the GateTime property + for details. + + + + The input channel that will be counted for the timed totalize measurement. + + + + + The gate time that will gate the counter channel for the timed totalize measurement function. + + + + + IviCounter class-compliant IIviCounterVoltage interface. + + + + + Configures the voltage measurement function, estimate, and resolution for a voltage measurement. + + The channel on which the voltage will be measured. Refer to the Channel property + for details. + The voltage function. Refer to the IIviCounter.MeasurementFunction + property for details. For this method, valid functions are DC Voltage, Maximum Voltage, Minimum Voltage, + RMS Voltage, and Peak-to-Peak Voltage. + The estimated voltage. Refer to the Estimate property for details. + The resolution of the voltage measurement. Refer to the Resolution + property for details. + + + + The channel on which the voltage will be measured. + + + + + The estimated voltage, in volts, for the voltage measurement function. + + + + + The resolution of the measurement, in volts, for the voltage measurement function. It is the quantization + size, i.e. the smallest delta value that can be detected. + + + + + Warning codes. + + + + + The instrument was in an uncalibrated state when the measurement + was taken. + + + + + The IviCounter class allows clients to create instances of drivers that implement the class-compliant + IviCounter interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviCounter drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviCounter class-compliant driver and return an IIviCounter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviCounter driver to be created. + + An IIviCounter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviCounter class-compliant driver and return an IIviCounter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviCounter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviCounter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviCounter class-compliant driver and return an IIviCounter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviCounter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviCounter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviCounter class-compliant driver and return an IIviCounter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviCounter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviCounter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + IviCounter class defined values for measurement function. + + + + + The Frequency measurement function. + + + + + The Frequency with Aperture measurement function. + + + + + The Period measurement function. + + + + + The Period with Aperture measurement function. + + + + + The Pulse Width measurement function. + + + + + The Duty Cycle measurement function. + + + + + The Edge Time measurement function. + + + + + The Frequency Ratio measurement function. + + + + + The Time Interval measurement function. + + + + + The Phase measurement function. + + + + + The Continuous Totalize measurement function. + + + + + The Gated Totalize measurement function. + + + + + The Timed Totalize measurement function. + + + + + The DC Voltage measurement function. + + + + + The Maximum Voltage measurement function. + + + + + The Minimum Voltage measurement function. + + + + + The RMS Voltage measurement function. + + + + + The Peak-to-Peak Voltage measurement function. + + + + + IviCounter class defined values for measurement complete status. + + + + + The counter is still acquiring data. + + + + + The counter has completed the measurement. + + + + + The counter cannot determine the status of the measurement. + + + + + IviCounter class defined values for reference type. + + + + + Edge Time is measured based on voltage reference levels. + + + + + Edge Time is measured based on percentage reference levels. + + + + IviCounter class defined values for slope. + + + + A positive (rising edge) slope. + + + + + A negative (falling edge) slope. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.DCPwr.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.DCPwr.dll new file mode 100644 index 0000000..08a455d Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.DCPwr.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.DCPwr.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.DCPwr.xml new file mode 100644 index 0000000..bb8ae02 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.DCPwr.xml @@ -0,0 +1,367 @@ + + + + Ivi.DCPwr + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + IviDCPwr class-compliant root interface + + + + + A reference to the IIviDCPwrOutputs interface + + + + + A reference to the IIviDCPwrTrigger interface + + + + + IviDCPwr class-compliant IIviDCPwrOutputs collection interface + + + + + Configures the output current limit value and the behavior of the power supply when the output current + is greater than or equal to that value. + + The behavior of the power supply when the output current is greater than or + equal to the value of the Limit parameter. Refer to the CurrentLimitBehavior property for details. + The power supply's output current limit. Refer to the CurrentLimit property for + details. + + + + Configures the power supply's output range on an output. Setting a voltage range can invalidate a previously + configured current range. Setting a current range can invalidate a previously configured voltage range. + + The kind of range to be configured, either Current or Voltage. + The range in which the power supply operates. This value is coerced to the closest value + the instrument supports that is greater than or equal to the value specified. + + + + Configures the over-voltage limit and the behavior of the power supply when the output voltage is greater + than or equal to the limit. + + The behavior of the power supply when the ouptut voltage is greater than or + equal to the value of the Limit parameter. When the Enabled parameter is False, the Limit parameter does + not affect the instrument's behavior, and the driver does not set the OVPLimit property. Refer to the + OVPEnabled property for details. + The power supply's over-voltage protection limit. Refer to the OVPLimit property. + + + + Takes a measurement on the output signal and returns the measured value. + + The type of measurement to take, either Current or Volatge + The measured value. + + + + Returns the maximum programmable current limit that the power supply accepts for a particular voltage + level on an output. + + The voltage level for which to determine the maximum programmable current limit. + The maximum programmable current limit for the specified voltage level. + + + + Returns true if the power supply is in the state indicated by the outputState parameter. + + The output state for which to query. + Returns true if the power supply is in the state indicated by the outputState parameter, + and False if it is not. + + + + Returns the maximum programmable voltage level that the power supply accepts for a particular current limit + on an output. + + The current limit for which to determine the maximum programmable voltage level. + Returns the maximum programmable voltage level for the specified current limit. + + + + Resets the power supply's output protection after an over-voltage or over-current condition occurs. + + + + + The output current limit, in Amps. + + + + + The behavior of the power supply when the output current is equal to or greater than the value of + the CurrentLimit property. + + + + + If true, the signal the power supply produces appears at the output connector. + + + + + The voltage the power supply allows, in Volts. + + + + + If True, the power supply disables the output when the output voltage is greater than or equal to the OVP limit. + + + + + The trigger source. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The value to which the power supply sets the current limit after a trigger event occurs, in Amps. + + + + + The value to which the power supply sets the voltage level after a trigger event occurs, in Volts. + + + + + The voltage level the DC power supply attempts to generate, in Volts. + + + + + IviDCPwr class-compliant IIviDCPwrOutputs collection interface + + + + + IviDCPwr class-compliant IIviDCPwrTrigger interface + + + + + Returns the power supply to the ignore triggers state if the power supply is currently waiting for a + trigger to change the output signal. If the power supply is not waiting for a trigger, this method does + nothing. + + + + + Causes the power supply to wait for a trigger if the power supply is not currently waiting for a trigger. + If the power supply is already waiting for a trigger, this method does nothing + + + + + Supplies a trigger signal when the IIviDCPwrOutput.TriggerSource property is set to a software trigger. + + + + + IviDCPwr class-compliant values for current limit behavior. + + + + + Output voltage is restricted such that the output current is not greater than the value of the Current Limit property. + + + + + When the output current is equal to or greater than the value of the Current Limit property, the output is disabled. + + + + + The IviDCPwr class allows clients to create instances of drivers that implement the class-compliant + IviDCPwr interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviDCPwr drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviDCPwr class-compliant driver and return an IIviDCPwr reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDCPwr driver to be created. + + An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDCPwr class-compliant driver and return an IIviDCPwr reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDCPwr driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDCPwr class-compliant driver and return an IIviDCPwr reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDCPwr driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviDCPwr class-compliant driver and return an IIviDCPwr reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDCPwr driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + IviDCPwr class-compliant values measurement type. + + + + + Current is measured. + + + + + Voltage is measured. + + + + + IviDCPwr class-compliant values for output state. + + + + + A constant voltage condition. + + + + + A constant current condition. + + + + + An over-voltage condition. + + + + + An over-current condition. + + + + + An unregulated condition. + + + + + IviDCPwr class-compliant values for the range type. + + + + + Current range. + + + + + Voltage range. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Digitizer.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Digitizer.dll new file mode 100644 index 0000000..29caab3 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Digitizer.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Digitizer.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Digitizer.xml new file mode 100644 index 0000000..2bc7df1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Digitizer.xml @@ -0,0 +1,2285 @@ + + + + Ivi.Digitizer + + + + + Defined values for the acquisition status result. + + + + + The digitizer is currently in the Idle state. + + + + + The digitizer is not currently in the Idle state. + + + + + The driver cannot query the instrument to determine if the digitizer is in the Idle state. + + + + + Defined values for the arm source operator. + + + + + Arm sources are AND'd together. The digitizer arms when all configured arm source conditions are satisfied. + + + + + Arm sources are OR'd together. The digitizer arms when the first configured arm source condition is + satisfied. + + + + + No operator is applied to the configured list of arm sources. The arm source list is ignored, and the + digitizer arms when the currently configured arm source, given by the Active Arm Source property, and + its associated arm conditions are satisfied. + + + + + Defined values for arm type. + + + + + The digitizer is configured for edge arming. An edge arm occurs when the arm signal specified + with the Arm Source property passes the voltage threshold specified with the Arm Level + property and has the slope specified with the Arm Slope property. + + + + + The digitizer is configured for width arming. Use the IviDigitizerWidthTrigger extension properties and + methods to configure the arm. + + + + + The digitizer is configured for runt arming. Use the IviDigitizerRuntTrigger extension properties and + methods to configure the arm. + + + + + The digitizer is configured for glitch arming. Use the IviDigitizerGlitchTrigger extension properties + and methods to configure the arm. + + + + + The digitizer is configured for arming on TV signals. Use the IviDigitizerTVTrigger extension properties + and methods to configure the arm. + + + + + The digitizer is configured for window arming. Use the IviDigitizerWindowTrigger extension properties and + methods to configure the arm. + + + + + Defined values for glitch arm/trigger condition. + + + + + The digitizer arms/triggers when the pulse width is less than the value you specify with the + Glitch Arm/Trigger Width property. + + + + + The digitizer arms/triggers when the pulse width is greater than the value you specify with the + Glitch Arm/Trigger Width property. + + + + + Defined values for glitch arm/trigger polarity. + + + + + The digitizer arms/triggers on a positive glitch. + + + + + The digitizer arms/triggers on a negative glitch. + + + + + The digitizer arms/triggers on either a positive or negative glitch. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to The arm source is not set to software arm.. + + + + + Looks up a localized string similar to Actual arm source: . + + + + + Looks up a localized string similar to Channel name: . + + + + + Looks up a localized string similar to The channel is not enabled for measurement.. + + + + + Looks up a localized string similar to Records to acquire >1, multi-record acquisition fetch must be used.. + + + + + Looks up a localized string similar to Records to acquire: . + + + + + An error occurred while trying to send an arm trigger. + + + This exception is used to report that the specified arm source is not set to software arm. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and the name of the arm source that was not set to software arm. + + The message that describes the error. + The name of the arm source. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the name of the arm source. + + + + + Gets the error message. + + + + + The channel is not enabled for measurement. + + + This exception is used to report that the specified channel is not enabled for measurement. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and the name of the arm source that was not set to software arm. + + The message that describes the error. + The name of the channel. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the name of the channel. + + + + + Gets the error message. + + + + + An error occurred while trying to fetch a single record when multiple records were expected. + + + This exception is used to report that the user attempted to fetch a single record when the digitizer was set to + acquire multiple records. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and the name of the arm source that was not set to software arm. + + The message that describes the error. + The number of records that the digitizer is set to acquire. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the name of the arm source. + + + + + Gets the error message. + + + + + IVI Digitizer class-compliant glitch triggering interface. + + + + + This method configures the glitch trigger. A glitch trigger occurs when the trigger signal has a pulse + with a width that is less than or greater than the glitch width. The end user specifies which comparison + criterion to use with the GlitchCondition parameter. The end-user specifies the glitch width with the + GlitchWidth parameter. The end-user specifies the polarity of the pulse with the GlitchPolarity parameter. + The trigger does not actually occur until the edge of a pulse that corresponds to the GlitchWidth and + GlitchPolarity crosses the threshold the end-user specifies in the TriggerLevel parameter. This method + affects instrument behavior only if the Trigger Type property is Glitch. Set the Trigger Type and Trigger + Coupling properties before calling this method. + + The trigger level. This value sets the Trigger Level property. + The glitch width. This value sets the Glitch Width property. + The glitch polarity. This value sets the Glitch Polarity property. + The glitch condition. This value sets the Glitch Condition property. + + + + The glitch condition. This property determines whether the glitch trigger happens when the + digitizer detects a pulse with a width less than or greater than the width value. + + + + + The polarity of the glitch that triggers the digitizer. + + + + + The glitch width. The digitizer triggers when it detects a pulse with a width less than or greater + than this value, depending on the Glitch Condition property. + + + + + IVI Digitizer class-compliant edge triggering interface. + + + + + This method sets the edge triggering properties. An edge trigger occurs when the trigger signal for the + TriggerSource passes through the voltage threshold that the end-user + specifies with the level parameter and has the slope that the end-user specifies with the slope parameter. + This method affects instrument behavior only if the Trigger Type property is Edge Trigger. Set the Trigger Type + and Trigger Coupling properties before calling this method. If the trigger source is one of the analog input + channels, an application program should configure the vertical range, vertical coupling, + and the maximum input frequency before calling this method. + + Specifies the trigger level. This value sets the Trigger Level property. + Specifies the trigger slope. This value sets the Trigger Slope property. + + + + Specifies whether a rising or a falling edge triggers the digitizer. This property affects instrument + operation only when the Trigger Type property is set to Edge. + + + + + IVI Digitizer class-compliant root interface. + + + + + Reference to the class-compliant IIviDigitizerAcquisition interface. + + + + + Reference to the class-compliant IIviDigitizerArm interface. + + + + + Reference to the class-compliant IIviDigitizerCalibration interface. + + + + + Reference to the class-compliant IIviDigitizerChannelCollection interface. + + + + + Reference to the class-compliant IIviDigitizerReferenceOscillator interface. + + + + + Reference to the class-compliant IIviDigitizerSampleClock interface. + + + + + Reference to the class-compliant IIviDigitizerTemperature interface. + + + + + Reference to the class-compliant IIviDigitizerTrigger interface. + + + + + IVI Digitizer class-compliant acquisition interface. + + + + + Aborts an acquisition and returns the digitizer to the Idle state. + + + + + This method configures the most commonly configured properties of the digitizer acquisition sub-system. + These properties are the samples per record, the number of records to acquire, and the sample rate. + + Specifies the number of records in the acquisition. This value sets the + Num Records to Acquire property. + Specifies the number of samples in each record. This value sets the Record Size + property. + Specifies the sample rate in samples per second. This value sets the Sample Rate + property. + + + + Creates a waveform object of type Double that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform with + a number of samples based on the current driver configuration. + Waveform object with elements of type Double. + + + + Create a waveform object of type Int32 that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform with + a number of samples based on the current driver configuration. + Waveform object with elements of type Int32. + + + + Create a waveform object of type Int16 that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform with + a number of samples based on the current driver configuration. + Waveform object with elements of type Int16. + + + + Create a waveform object of type SByte that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform with + a number of samples based on the current driver configuration. + Waveform object with elements of type SByte. + + + + Create a collection of waveform objects of type Double that can be used with multi-record Read and Fetch methods. + + The number of waveforms in the collection. If zero, the driver will create a + waveform collection with a number of waveforms based on the current driver configuration. + The number of elements in each waveform in the collection. If zero, the driver + will create each waveform with a number of elements based on the current driver configuration. + A collection of waveform objects with elements of type Double. + + + + Create a collection of waveform objects of type Int32 that can be used with multi-record Read and Fetch methods. + + The number of waveforms in the collection. If zero, the driver will create a + waveform collection with a number of waveforms based on the current driver configuration. + The number of elements in each waveform in the collection. If zero, the driver + will create each waveform with a number of elements based on the current driver configuration. + A collection of waveform objects with elements of type Int32. + + + + Create a collection of waveform objects of type Int16 that can be used with multi-record Read and Fetch methods. + + The number of waveforms in the collection. If zero, the driver will create a + waveform collection with a number of waveforms based on the current driver configuration. + The number of elements in each waveform in the collection. If zero, the driver + will create each waveform with a number of elements based on the current driver configuration. + A collection of waveform objects with elements of type Int16. + + + + Create a collection of waveform objects of type SByte that can be used with multi-record Read and Fetch methods. + + The number of waveforms in the collection. If zero, the driver will create a + waveform collection with a number of waveforms based on the current driver configuration. + The number of elements in each waveform in the collection. If zero, the driver + will create each waveform with a number of elements based on the current driver configuration. + A collection of waveform objects with elements of type SByte. + + + + Initiates a waveform acquisition. The digitizer leaves the Idle state and waits for a trigger. The digitizer + acquires a waveform for each enabled channel. + + + + + This method is used to determine the minimum amount of memory that is needed to fetch or read data from + the digitizer with maximum performance. + + Specifies the size of the sampled data that will be retrieved. The value of this + parameter must be 8, 16, 32 or 64, corresponding to the intended Read/Fetch method. + Specifies the number of records that will be read. + Specifies the start index within the record from which the data should be + retrieved. + Specifies the number of data points to return. + The minimum buffer size in samples needed for a subsequent Read or Fetch call with the same readout + parameters. + + + + Waits until the configured acquisition is complete. If no acquisition is currently running, this method + returns immediately. If the acquisition does not complete within the time period the user specified with the + maxTime parameter, the method throws the Max Time Exceeded exception. + + Specifies the maximum time the end-user allows for this method to complete. If + maxTime is PrecisionTimeSpan.MaxValue, the method waits indefinitely for the acquisition to complete. + + + + The maximum value that the First Valid Point parameter of the readout methods may assume. This + value is necessary to calculate the minimum size of the required data buffer to retrieved the entire + acquisition. + + + + + The maximum number of samples per channel that can be captured. + + + + + The minimum waveform record size. If the digitizer can support any arbitrary size record, then + this property returns 1. + + + + + The total number of records acquired since the acquistion was last initiated. You may read the value of + this property while an acquisition is in progress. + + + + + The number of waveform records to acquire. One waveform record is acquired for each recognized + trigger. + + + + + The number of samples to acquire in each waveform record. + + + + + The sample mode used by the digitizer. + + + + + The rate of the sample clock in samples per second. This number represents the inverse of the + interval between samples in the acquisition record. + + + + + Reference to the IIviDigitizerAcquisitionStatus interface. + + + + + Specifies whether or not the instrument should automatically combine enabled channels to satisfy + user-specified sample rates. When set to True, the instrument will automatically combine channels to meet + the sample rate requirements specified via the Sample Rate property. + + + + + IVI Digitizer class-compliant acquisition status interface. + + + + + Indicates whether the device is currently in the Idle state. If the driver cannot query the digitizer to + return its state, the driver returns the value Unknown. + + + + + Indicates whether the device is currently in the Measuring state. If the driver cannot query the digitizer + to return its state, the driver returns the value Unknown. + + + + + Indicates whether the device is currently in the Waiting For Arm state. If the driver cannot query the + digitizer to return its state, the driver returns the value Unknown. + + + + + Indicates whether the device is currently in the Waiting For Trigger state. If the driver cannot query the + digitizer to return its state, the driver returns the value Unknown. + + + + + IVI Digitizer class-compliant arm interface. + + + + + This method follows semantics similar to Send Software Trigger. Refer to IVI-3.3: Standard Cross-Class + Capabilities Specification for the prototype and complete description of the Send Software Trigger method. + + + + + Specifies the source the digitizer monitors for the arm event. The value specified here must be one of the + valid repeated capability names for the ArmSource repeated capability. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The number of times the arm has to occur to complete the arm loop; that is, the number of arms + that are accepted before the acquisition must be initiated again. + + + + + The delay from when the arm logic is satisfied until the waiting for trigger state is entered. + + + + + Reference to the class-compliant IIviDigitizerArmMultiArm interface. + + + + + Specifies whether or not an accepted arm appears at an output of the digitizer. + + + + + Reference to the IIviDigitizerArmSources interface. + + + + + IVI Digitizer class-compliant edge arming interface. + + + + + This method sets the edge arming properties. An edge occurs when the arm signal for the ArmSource + passes through the voltage threshold that the end-user specifies with + the level parameter and has the slope that the end-user specifies with the slope parameter. This method + affects instrument behavior only if the Arm Type property is Edge. Set the Arm Type and Arm Coupling properties + before calling this method. If the arm source is one of the analog input channels, an application program should + configure the vertical range, vertical coupling, probe attenuation, and the maximum input frequency before + calling this method. + + Specifies the arm level. This value sets the Trigger Level property. + Specifies the trigger slope. This value sets the Trigger Slope property. + + + + Specifies whether a rising or a falling edge arms the digitizer. This property affects instrument operation + only when the Arm Type property is set to Edge. + + + + + IVI Digitizer class-compliant glitch arming interface. + + + + + This method configures the glitch arm. A glitch arm occurs when the arm signal has a pulse with a width + that is less than or greater than the glitch width. The end user specifies which comparison criterion to + use with the GlitchCondition parameter. The end-user specifies the glitch width with the GlitchWidth + parameter. The end-user specifies the polarity of the pulse with the GlitchPolarity parameter. The arm does + not actually occur until the edge of a pulse that corresponds to the GlitchWidth and GlitchPolarity crosses + the threshold the end-user specifies in the TriggerLevel parameter. This method affects instrument + behavior only if the Arm Type property is Glitch. Set the Arm Type and Arm Coupling properties before calling this method. + + The arm level. This value sets the Arm Level property. + The glitch width. This value sets the Glitch Width property. + The glitch polarity. This value sets the Glitch Polarity property. + The glitch condition. This value sets the Glitch Condition property. + + + + The glitch condition. This property determines whether the glitch arm happens when the digitizer + detects a pulse with a width less than or greater than the width value. + + + + + The glitch width. The digitizer triggers when it detects a pulse with a width less than or greater + than this value, depending on the Glitch Condition property. + + + + + The polarity of the glitch that arms the digitizer. + + + + + IVI Digitizer class-compliant runt arming interface. + + + + + This method configures the runt arm. A runt occurs when the arm signal crosses one of the runt thresholds + twice without crossing the other runt threshold. The end-user specifies the runt thresholds with the + thresholdLow and thresholdHigh parameters. The end-user specifies the polarity of the runt with the polarity + parameter. This method affects instrument behavior only if the Arm Type property is Runt. Set the Arm Type + and Arm Coupling properties before calling this method. + + The runt arming low threshold. This value sets the ArmRunt ThresholdLow property. + The runt arming high threshold. This value sets the ArmRunt ThresholdHigh property. + The runt arming polarity. This value sets the ArmRunt Polarity property. + + + + The runt polarity. + + + + + The runt triggering high threshold in Volts. + + + + + The runt triggering low threshold in Volts. + + + + + IVI Digitizer class-compliant arm source interface. + + + + + Specifies how the digitizer couples the arm source. + + + + + Reference to the class-compliant IIviDigitizerArmEdge interface. + + + + + Reference to the class-compliant IIviDigitizerArmGlitch interface. + + + + + The arm hysteresis in Volts. + + + + + The voltage threshold for the arm sub-system. The units are Volts. This property affects + instrument behavior only when the Arm Type property is set to one of the following values: + Edge, Glitch, or Width. + + + + + Reference to the class-compliant IIviDigitizerArmRunt interface. + + + + + Reference to the class-compliant IIviDigitizerArmTV interface. + + + + + The kind of event that arms the digitizer. + + + + + Reference to the class-compliant IIviDigitizerArmWidth interface. + + + + + Reference to the class-compliant IIviDigitizerArmWindow interface. + + + + + IVI Digitizer class-compliant arm source collection interface. + [Refer to the instrument driver documentation for valid arm source names, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + IVI Digitizer class-compliant TV arming interface. + + + + + This method configures the digitizer for TV arming. It configures the TV signal format, the event and the + signal polarity. This method affects instrument behavior only if the Arm Type property is TV. Set the Arm Type + and Arm Coupling properties before calling this method. + + Specifies the TV arm signal format. This value sets the TV Arm Signal Format + property. + Specifies the TV arm event. This value sets the TV Arm Event property. + Specifies the polarity of the TV arm signal. This value sets the TV Arm Polarity + property. + + + + The line on which the digitizer arms. The driver uses this property when the TV Arm Event is set + to TV Event Line Number. The line number setting is independent of the field. This means that to arm on the + first line of the second field, the user must configure the line number to the value of 263 (if we presume + that field one had 262 lines). + + + + + The polarity of the TV signal. + + + + + The format of TV signal on which the digitizer arms. + + + + + The event on which the digitizer arms. + + + + + IVI Digitizer class-compliant width arming interface. + + + + + Configures the width arm level, thresholdLow, thresholdHigh, polarity, and condition. A width arm + occurs when a pulse, that passes through level, with a width between or outside, the width thresholds is + detected. + + Arm level. This value sets the Arm Level property. + Width low threshold. This value sets the Width Low Threshold + property. + Width high threshold. This value sets the Width High Threshold + property. + Pulse polarity. This value sets the Width Polarity property. + Specifies whether a pulse that is within or outside the user-specified thresholds + arms the digitizer. This value sets the Width Condition property. + + + + Specifies whether a pulse that is within or outside the high and low thresholds arms the digitizer. The + end-user specifies the high and low thresholds with the Width High Threshold and Width Low Threshold properties. + + + + + The polarity of the pulse that arms the digitizer. + + + + + The high width threshold time. + + + + + The low width threshold time. + + + + + IVI Digitizer class-compliant window arming interface. + + + + + Configures the window arm thresholdLow, thresholdHigh, and condition. A window arm occurs when a + signal that enters or leaves a given voltage range is detected. + + Window arming low threshold in Volts. This value sets the Window + Low Threshold property. + Window arming high threshold in Volts. This value sets the Window + High Threshold property. + Specifies whether a pulse that is within or outside the user-specified thresholds + arms the digitizer. This value sets the Width Condition property. + + + + Specifies whether a signal that is entering or leaving the voltage window defined by the high and low + thresholds arms the digitizer. The end-user specifies the high and low thresholds with the Window High + Threshold and Window Low Threshold properties. + + + + + The high window threshold voltage in Volts. + + + + + The low window threshold voltage in Volts. + + + + + IVI Digitizer class-compliant calibration interface. + + + + + Executes all internal calibrations. If the digitizer does not support self-calibration, + this method silently succeeds. + + + + + IVI Digitizer class-compliant channel interface. + + + + + This method configures the most commonly configured properties of the digitizer channel sub-system. + These properties are the range, offset, coupling, and whether the channel is enabled. + + Specifies the vertical range. This value sets the Vertical Range property. + Specifies the vertical offset. This value sets the Vertical Offset property. + Specifies how to couple the input signal. This value sets the Vertical Coupling property. + Specifies if the channel is enabled for acquisition. This value sets the Channel + Enabled property. + + + + Specifies how the digitizer couples the input signal for the channel. + + + + + This property is used to combine this channel with one or more other channels to interleave the returned + data. The string provided here specifies which channels should operate in combined mode with the current + channel. + + + + + Reference to the IIviDigitizerDownconversion interface. + + + + + Specifies whether the digitizer acquires a waveform for the channel. + + + + + Reference to the IIviDigitizerChannelFilter interface. + + + + + Some digitizers include multiple connectors for each digitizer input channel. These connectors are often + simply a matter of convenience for system cabling - multiple signals can be routed to the various + connectors, the desired signal can be sent into the digitizer by changing an internal switch. With + other digitizers, the connectors may be of different types or even different impedances. This property + is used to determine which connector is to be used. + + + + + The input impedance of this channel. The units are Ohms. + + + + + Reference to the IIviDigitizerChannelMeasurement interface. + + + + + Reference to the IIviDigitizerChannelMultiRecordMeasurement interface. + + + + + The location of the center of the range that you specify with the Range property. The units are Volts, + with respect to ground. For example, to acquire a sine wave spanning 0.0 to 10.0 Volts, set Offset to + 5.0 Volts. + + + + + The absolute value of the input range the digitizer can acquire for the channel. The units are Volts. + For example, to acquire a sine wave spanning -5.0 to 5.0 Volts, set Range to 10.0 Volts. + + + + + The temperature of the channel. The units are governed by the Temperature Units property. + + + + + This property is used to combine this channel with one or more other channels to achieve higher effective + sampling rates and/or greater memory depth. The string provided here specifies which channels should + operate in combined mode with the current channel. This property is a comma-separated list of two one or + more channel names. + + + + + IVI Digitizer class-compliant downconversion interface. + + + + + Configures how the digitizer performs downconversion. + + Enables or disables downversion. The driver uses this value to set the Downconversion + Enabled property. See the property description for more details. + Specifies the center frequency, in Hz, from which the digitizer should + downconvert. The driver uses this value to set the Downconversion Center Frequency property. + + + + The center frequency, in Hz, from which the digitizer should downconvert. + + + + + Enables or disables downconversion. When enabled, the Read and Fetch methods return data according to the + setting of the Fetch IQ Interleaved Data property. + + + + + Controls how the Read and Fetch methods return data when downconversion is enabled. When this property + is True and downconversion is enabled, the data returned from the Read and Fetch methods is interleaved + I-Q data points. When this property is False and downconversion is enabled, the Read and Fetch methods + return data with all I data points in sequence followed by all Q data points. This property has no effect + when the Downconversion Enabled property is False. + + + + + IVI Digitizer class-compliant channel filter interface. + + + + + This method is used to configure the minimum and maximum input filter frequencies for a specified channel. + + Specifies the minimum input filter frequency. This value sets the Input Filter + Min Frequency property. + Specifies the maximum input filter frequency. This value sets the Input Filter + Max Frequency property. + + + + Specifies whether or not to bypass the input filter. + + + + + The maximum input filter frequency. Specifying a value of zero means that the device should be + set to the full bandwidth that the filter can deliver without being bypassed. The units are Hertz. + + + + + The minimum input filter frequency. The units are Hertz. + + + + + IVI Digitizer class-compliant measurement interface. + + + + + This method returns the waveform the digitizer acquired for the specified channel. The waveform is from + a previously initiated acquisition. + + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the CreateWaveformSByte method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<SByte>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + This method returns the waveform the digitizer acquired for the specified channel. The waveform is from + a previously initiated acquisition. + + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the Create Waveform Int16 method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<Int16>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + This method returns the waveform the digitizer acquired for the specified channel. The waveform is from + a previously initiated acquisition. + + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the Create Waveform Int32 method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<Int32>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + This method returns the waveform the digitizer acquired for the specified channel. The waveform is from + a previously initiated acquisition. + + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the Create Waveform Double method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<Double>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) for the acquisition + to complete, and returns the waveform for this channel. Call FetchWaveform to obtain the waveforms for + other channels. + + Specifies the maximum time the end-user allows for this method to complete. Use + PrecisionTimeSpan.Zero for immediate triggering and PrecisionTimeSpan.MaxTime for an infinite timeout. + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the CreateWaveformSByte method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<SByte>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) for the acquisition + to complete, and returns the waveform for this channel. Call FetchWaveform to obtain the waveforms for + other channels. + + Specifies the maximum time the end-user allows for this method to complete. Use + PrecisionTimeSpan.Zero for immediate triggering and PrecisionTimeSpan.MaxTime for an infinite timeout. + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the Create Waveform Int16 method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<Int16>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) for the acquisition + to complete, and returns the waveform for this channel. Call FetchWaveform to obtain the waveforms for + other channels. + + Specifies the maximum time the end-user allows for this method to complete. Use + PrecisionTimeSpan.Zero for immediate triggering and PrecisionTimeSpan.MaxTime for an infinite timeout. + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the Create Waveform Int32 method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<Int32>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) for the acquisition + to complete, and returns the waveform for this channel. Call FetchWaveform to obtain the waveforms for + other channels. + + Specifies the maximum time the end-user allows for this method to complete. Use + PrecisionTimeSpan.Zero for immediate triggering and PrecisionTimeSpan.MaxTime for an infinite timeout. + The waveform object into which the measurement data is stored. The waveform memory may + be allocated before calling this method, or during the call to this method. To allocate memory before calling + this method, create a waveform object using the Create Waveform Double method and set the waveform parameter + to that waveform object. To allocate memory during the call to this method, set the waveform parameter to + (IWaveform<Double>)null. Note that this is critically different than setting waveforms to null, which + generates a build error. + A waveform object containing the measurement data. + + + + IVI Digitizer class-compliant multi-record measurement interface. + + + + + This method returns the (multi-record) waveform the digitizer acquired for the specified channel. The + waveform is from a previously initiated acquisition. + + Specifies the number of the first record to read. + Specifies the number of consecutive records to read. + Specifies the start index within the record from which the data should + be retrieved. + Specifies the number of data points per record to return. This number + may be larger than the amount of data available. + A Waveform collection object with a particular number of waveforms, each with data + of a particular size needed only for reusing waveform object across reads. The waveform collection memory + may allocated before calling this method, or during the call to this method. To allocate memory before + calling this method, create a waveform collection object using the CreateWaveformCollectionSByte method and + set the waveforms parameter to that waveform collection. To allocate memory during the call to this method, + set the waveforms parameter to (IWaveformCollection<SByte>)null. Note that this is critically different + than setting waveforms to null, which generates a build error. + A Waveform collection object with the specified waveforms. + + + + This method returns the (multi-record) waveform the digitizer acquired for the specified channel. The + waveform is from a previously initiated acquisition. + + Specifies the number of the first record to read. + Specifies the number of consecutive records to read. + Specifies the start index within the record from which the data should + be retrieved. + Specifies the number of data points per record to return. This number + may be larger than the amount of data available. + A Waveform collection object with a particular number of waveforms, each with data + of a particular size needed only for reusing waveform object across reads. The waveform collection memory + may allocated before calling this method, or during the call to this method. To allocate memory before + calling this method, create a waveform collection object using the Create Waveform Collection Int16 method and + set the waveforms parameter to that waveform collection. To allocate memory during the call to this method, + set the waveforms parameter to (IWaveformCollection<Int16>)null. Note that this is critically different + than setting waveforms to null, which generates a build error. + A Waveform collection object with the specified waveforms. + + + + This method returns the (multi-record) waveform the digitizer acquired for the specified channel. The + waveform is from a previously initiated acquisition. + + Specifies the number of the first record to read. + Specifies the number of consecutive records to read. + Specifies the start index within the record from which the data should + be retrieved. + Specifies the number of data points per record to return. This number + may be larger than the amount of data available. + A Waveform collection object with a particular number of waveforms, each with data + of a particular size needed only for reusing waveform object across reads. The waveform collection memory + may allocated before calling this method, or during the call to this method. To allocate memory before + calling this method, create a waveform collection object using the Create Waveform Collection Int32 method and + set the waveforms parameter to that waveform collection. To allocate memory during the call to this method, + set the waveforms parameter to (IWaveformCollection<Int32>)null. Note that this is critically different + than setting waveforms to null, which generates a build error. + A Waveform collection object with the specified waveforms. + + + + This method returns the (multi-record) waveform the digitizer acquired for the specified channel. The + waveform is from a previously initiated acquisition. + + Specifies the number of the first record to read. + Specifies the number of consecutive records to read. + Specifies the start index within the record from which the data should + be retrieved. + Specifies the number of data points per record to return. This number + may be larger than the amount of data available. + A Waveform collection object with a particular number of waveforms, each with data + of a particular size needed only for reusing waveform object across reads. The waveform collection memory + may allocated before calling this method, or during the call to this method. To allocate memory before + calling this method, create a waveform collection object using the Create Waveform Collection Double method and + set the waveforms parameter to that waveform collection. To allocate memory during the call to this method, + set the waveforms parameter to (IWaveformCollection<Double>)null. Note that this is critically different + than setting waveforms to null, which generates a build error. + A Waveform collection object with the specified waveforms. + + + + IVI Digitizer class-compliant channel collection interface. + + + + + IVI Digitizer class-compliant multi-arm interface. + + + + + Configures the digitizer to arm based on multiple arm sources. The digitizer can be instructed to arm when + any one of multiple arm source conditions are met or when all specified arm source conditions are met. + + A comma separated list of source names to be used in a multi arm scenario. The + driver uses this value to set the Arm Source List property. + Specifies the boolean operation to apply to the arm sources specified by the + SourceList parameter. The driver uses this value to set the Arm Source Operator property. + + + + A comma separated list of source names to be used in a multi arm scenario. This property only affects + instrument behavior when the Arm Source Operator property is set to AND or OR. When Arm Source Operator is + set to AND, the arm conditions associated with each source in this list must be simultaneously satsified in + order to arm the digitizer. When Arm Source Operator is set to OR, the first arm source in the list that + satisfies its arm conditions will arm the digitizer. Any valid name used for the Arm Source property may be + used in this list. An arm source may appear only once in the list. If a name in the list is not recognized, + the driver throws the Unknown Channel Name exception. See IVI-3.2 for the definition of this error. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The logical operation to apply to the arm sources specified by the Arm Source List property. See + the definition of that property for details. + + + + + IVI Digitizer class-compliant multi-trigger interface. + + + + + Configures the digitizer to trigger based on multiple trigger sources. The digitizer can be instructed to + trigger when any one of multiple trigger source conditions are met or when all specified trigger source + conditions are met. + + A comma separated list of source names to be used in a multi trigger scenario. + The driver uses this value to set the Trigger Source List property. + Specifies the boolean operation to apply to the trigger sources specified by + the SourceList parameter. The driver uses this value to set the Trigger Source Operator property. + + + + A comma separated list of source names to be used in a multi trigger scenario. This property only affects + instrument behavior when the Trigger Source Operator property is set to AND or OR. When Trigger Source + Operator is set to AND, the trigger conditions associated with each source in this list must be + simultaneously satsified in order to trigger the digitizer. When Trigger Source Operator is set to OR, the + first trigger source in the list that satisfies its trigger conditions will trigger the digitizer. Any + valid name used for the Trigger Source property may be used in this list. A trigger source may appear only + once in the list. If a name in the list is not recognized, the driver throws the Unknown Channel Name + exception. See IVI-3.2 for the definition of this error. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The logical operation to apply to the arm sources specified by the Arm Source List property. See + the definition of that property for details. + + + + + IVI Digitizer class-compliant reference oscillator interface. + + + + + Configures the digitizer's reference oscillator. + + Specifies the source of the reference frequency signal. The driver uses this value + to set the Reference Oscillator Source property. See the property description for more details. + Specifies the frequency of the external reference oscillator. This parameter is + only used if the Source is set to External. The driver uses this value to set the Reference Oscillator + Frequency property. See the property description for more details. + + + + The frequency of the external signal which is used as a frequency reference. This value is used only + if the Reference Oscillator Source property is set to External. The units are Hertz. + + + + + Specifies whether or not the reference frequency signal appears at an output of the digitizer. + + + + + The reference oscillator source used. + + + + + IVI Digitizer class-compliant sample clock interface. + + + + + Configures the digitizer's sample clock. + + Specifies the source of the sample clock signal. The driver uses this value to set + the Sample Clock Source property. + Specifies the frequency of the external sample clock. This parameter is only used + if the Sample Clock Source property is set to External. The driver uses this value to set the External + Sample Clock Frequency property. + Specifies the value by which the external sample clock should be divided. This value + is used only if the Sample Clock Source property is set to External. + + + + Specifies the value by which the external sample clock should be divided. This value is used only if the + Sample Clock Source property is set to External. + + + + + The frequency of the external signal which is as a sample clock. This value is used only if the + Sample Clock Source property is set to External. The units are Hertz. + + + + + Specifies whether or not the sample clock appears at a reference output of the digitizer. + + + + + The source of the clock used to pace acquisition sampling. + + + + + IVI Digitizer class-compliant temperature interface. + + + + + The temperature of the entire board. The units are governed by the Temperature Units property. + + + + + The temperature units returned by the Board Temperature and the Channel Temperature properties. + + + + + IVI Digitizer class-compliant trigger interface. + + + + + Refer to IVI-3.3: Standard Cross-Class Capabilities Specification for the prototype and complete description + of this method. + + + + + The source the digitizer monitors for the trigger event. The value specified here must be one + of the valid repeated capability names for the TriggerSource repeated capability. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The length of time from the trigger event to the first point in the waveform record. If the value + is positive, the first point in the waveform record occurs after the trigger event. If the value is + negative, the first point in the waveform record occurs before the trigger event. + + + + + The length of time the digitizer waits after it detects a trigger until the digitizer enables the + trigger subsystem to detect another trigger. The Trigger Holdoff property affects instrument operation + only when the digitizer requires multiple acquisitions to build a complete waveform. If Trigger Holdoff and + PreTriggerSamples are both non-zero, then both conditions must be satisfied before the digitizer will + accept a trigger. Note: Many digitizers have a small, non-zero value as the minimum value for this property. + To configure the instrument to use the shortest trigger hold-off, the user can specify a value of zero for + this property. Therefore, the IVI Class-Compliant specific driver shall coerce any value between zero and + the minimum value to the minimum value. No other coercion is allowed on this property. + + + + + The trigger modifier determines the digitizer's behavior in the absence of + the configured trigger. + + + + + Reference to the class-compliant IIviDigitizerMultiTrigger interface. + + + + + Specifies whether or not an accepted trigger appears at an output of the digitizer. + + + + + The number of samples that must be collected before a trigger event will be recognized. The + Pretrigger Samples property affects instrument operation only when the digitizer requires multiple + acquisitions to build a complete waveform. If Trigger Holdoff and Pretrigger Samples are are both non-zero, + then both conditions must be satisfied before the digitizer will accept a trigger. + + + + + Reference to the IIviDigitizerTriggerSourceCollection interface. + + + + + IVI Digitizer class-compliant runt triggering interface. + + + + + This method configures the runt trigger. A runt trigger occurs when the trigger signal crosses one of + the runt thresholds twice without crossing the other runt threshold. The end-user specifies the runt + thresholds with the RuntLowThreshold and RuntHighThreshold parameters. The end-user specifies the polarity + of the runt with the RuntPolarity parameter. This method affects instrument behavior only if the trigger + type is Runt Trigger. Set the Trigger Type and Trigger Coupling before calling this method. + + The runt triggering low threshold. This value sets the TriggerRunt ThresholdLow property. + The runt triggering high threshold. This value sets the TriggerRunt ThresholdHigh property. + The runt triggering polarity. This value sets the TriggerRunt Polarity property. + + + + The runt polarity. + + + + + The runt triggering high threshold in Volts. + + + + + The runt triggering low threshold in Volts. + + + + + IVI Digitizer class-compliant trigger source interface. + + + + + Specifies how the digitizer couples the trigger source. + + + + + Reference to the class-compliant IIviDigitizerTriggerEdge interface. + + + + + Reference to the class-compliant IIviDigitizerTriggerGlitch interface. + + + + + The trigger hysteresis in Volts. + + + + + The voltage threshold for the trigger sub-system. The units are Volts. This property affects + instrument behavior only when the Trigger Type is set to one of the following values: Edge, Glitch, + or Width. + + + + + Reference to the class-compliant IIviDigitizerTriggerRunt interface. + + + + + The kind of event that triggers the digitizer. + + + + + Reference to the class-compliant IIviDigitizerTriggerTV interface. + + + + + Reference to the class-compliant IIviDigitizerTriggerWidth interface. + + + + + Reference to the class-compliant IIviDigitizerTriggerWindow interface. + + + + + IVI Digitizer class-compliant trigger source collection interface. + [Refer to the instrument driver documentation for valid trigger source names, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + IVI Digitizer class-compliant TV triggering interface. + + + + + This method configures the digitizer for TV triggering. It configures the TV signal format, the event + and the signal polarity. This method affects instrument behavior only if the Trigger Type property is TV. + Set the Trigger Type and Trigger Coupling properties before calling this method. + + Specifies the TV trigger signal format. This value sets the TV Trigger Signal + Format property. + Specifies the TV trigger event. This value sets the TV Trigger Event property. + Specifies the polarity of the TV trigger. This value sets the TV Trigger Polarity + property. + + + + The line on which the digitizer triggers. The driver uses this property when the TV Trigger Event + is set to TV Event Line Number. The line number setting is independent of the field. This means that to + trigger on the first line of the second field, the user must configure the line number to the value of 263 + (if we presume that field one had 262 lines). + + + + + The polarity of the TV signal. + + + + + The format of TV signal on which the digitizer triggers. + + + + + The event on which the digitizer triggers. + + + + + IVI Digitizer class-compliant width triggering interface. + + + + + Configures the width trigger level, thresholdLow, thresholdHigh, polarity, and condition. A width + trigger occurs when a pulse, that passes through level, with a width between or outside, the width + thresholds is detected. + + Trigger Level. This value sets the Trigger Level property. + Sets the width triggering low threshold. This value sets the Width Low + Threshold property. + Sets the width triggering high threshold. This value sets the Width High + Threshold property. + Sets the width polarity. This value sets the Width Polarity property. + Specifies whether a pulse that is within or outside the user-specified thresholds + trigger waveform acquisition. This value sets the Width Condition property. + + + + Specifies whether a pulse that is within or outside the high and low thresholds triggers the digitizer. + The end-user specifies the high and low thresholds with the Width High Threshold and Width Low Threshold + properties. + + + + + The polarity of the pulse that triggers the digitizer. + + + + + The high width threshold time. + + + + + The low width threshold time. + + + + + IVI Digitizer class-compliant window triggering interface. + + + + + Configures the window trigger thresholdLow, thresholdHigh, and condition. A window trigger occurs + when a signal that enters or leaves a given voltage range is detected. + + Sets the window triggering low threshold in Volts. This value sets the Window Low + Threshold property. + Sets the window triggering high threshold in Volts. This value sets the Window + High Threshold property. + Specifies whether a pulse that is within or outside the user-specified thresholds + trigger waveform acquisition. This value sets the Width Condition property. + + + + Specifies whether a signal that is entering or leaving the voltage window defined by the high and low + thresholds triggers the digitizer. The end-user specifies the high and low thresholds with the Window High + Threshold and Window Low Threshold properties. + + + + + The high window threshold voltage in Volts. + + + + + The low window threshold voltage in Volts. + + + + + The IviDigitizer class allows clients to create instances of drivers that implement the class-compliant + IviDigitizer interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviDigitizer drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviDigitizer class-compliant driver and return an IIviDigitizer reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDigitizer driver to be created. + + An IIviDigitizer interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDigitizer class-compliant driver and return an IIviDigitizer reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDigitizer driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviDigitizer interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDigitizer class-compliant driver and return an IIviDigitizer reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDigitizer driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDigitizer interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviDigitizer class-compliant driver and return an IIviDigitizer reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDigitizer driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDigitizer interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + An interface designed to encapsulate a collection of objects that implement Ivi.Driver.IWaveform. + + An IVI.NET standard arithmetic type. + + + + This returns the waveform at the specified index in the waveform collection. + + The index of the waveform to be returned from the waveform collection. + The waveform to be returned from the waveform collection. + + + + The number of valid waveform objects in the waveform collection. If there are n valid waveforms, the + valid indexes for those waveforms range from 0 to n-1. + + + + + Defined values for the reference oscillator source. + + + + + The internal reference oscillator is used. + + + + + An external reference oscillator is used. + + + + + A PXI 10MHz clock line is used. + + + + + A PXI Express 100MHz clock line is used. + + + + + Defined values for runt arm/trigger polarity. + + + + + The digitizer arms/triggers on a positive runt. A positive runt occurs when a rising edge crosses the low + runt threshold and does not cross the high runt threshold before re-crossing the low runt threshold. + + + + + The digitizer arms/triggers on a negative runt. A negative runt occurs when a falling edge crosses the high + runt threshold and does not cross the low runt threshold before re-crossing the high runt threshold. + + + + + The digitizer arms/triggers on either a positive or negative runt. + + + + + Defined values for the sample clock source. + + + + + The internal sample clock is used. + + + + + An external sample clock is used. + + + + + Defined values for acquisition sample mode. + + + + + Real-time sampling is used. + + + + + Equivalent-time sampling is used. + + + + + Defined values for the temperature units. + + + + + Temperature values returned from the digitizer are in degrees Celsius. + + + + + Temperature values returned from the digitizer are in degrees Fahrenheit. + + + + + Temperature values returned from the digitizer are in degrees Kelvin. + + + + + Defined values for arm/trigger coupling. + + + + + The digitizer AC couples the arm/trigger signal. + + + + + The digitizer DC couples the arm/trigger signal. + + + + + The digitizer filters out the high frequencies from the arm/trigger signal. + + + + + The digitizer filters out the low frequencies from the arm/trigger signal. + + + + + The digitizer filters out the noise from the arm/trigger signal. + + + + + Defined values for trigger modifier. + + + + + The digitizer waits until the trigger the end-user specifies occurs. + + + + + The digitizer automatically triggers if the configured trigger does not occur within the digitizer timeout + period. + + + + + The digitizer adjusts the trigger level if the trigger the end-user specifies does not occur. + + + + + Defined values for the trigger source operator. + + + + + Trigger sources are AND'd together. The digitizer triggers when all configured trigger source conditions + are satisfied. + + + + + Trigger sources are OR'd together. The digitizer triggers when the first configured trigger source + condition is satisfied. + + + + + No operator is applied to the configured list of trigger sources. The trigger source list is ignored, and + the digitizer triggers when the currently configured trigger source, given by the Active Trigger Source + property, and its associated trigger conditions are satisfied. + + + + + Defined values for trigger type. + + + + + The digitizer is configured for edge triggering. An edge trigger occurs when the trigger signal specified + with the Trigger Source property passes the voltage threshold specified with the Trigger Level property + and has the slope specified with the Trigger Slope property. + + + + + The digitizer is configured for width triggering. Use the IviDigitizerWidthTrigger extension properties + and methods to configure the trigger. + + + + + The digitizer is configured for runt triggering. Use the IviDigitizerRuntTrigger extension properties and + methods to configure the trigger. + + + + + The digitizer is configured for glitch triggering. Use the IviDigitizerGlitchTrigger extension properties + and methods to configure the trigger. + + + + + The digitizer is configured for triggering on TV signals. Use the IviDigitizerTVTrigger extension + properties and methods to configure the trigger. + + + + + The digitizer is configured for window triggering. Use the IviDigitizerWindowTrigger extension properties + and methods to configure the trigger. + + + + + Defined values for TV arm/trigger signal format. + + + + + The digitizer arms/triggers on the NTSC signal format. + + + + + The digitizer arms/triggers on the PAL signal format. + + + + + The digitizer arms/triggers on the SECAM signal format. + + + + + Defined values for TV arm/trigger event. + + + + + The digitizer arms/triggers on field 1 of the video signal. + + + + + The digitizer arms/triggers on field 2 of the video signal. + + + + + The digitizer arms/triggers on any field. + + + + + The digitizer arms/triggers on any line. + + + + + The digitizer arms/triggers on a specific line number you specify with the TV Trigger Line Number + property. + + + + + Defined values for TV arm/trigger polarity. + + + + + The digitizer is configured to arm/trigger on a positive video sync pulse. + + + + + The digitizer is configured to arm/trigger on a negative video sync pulse. + + + + + Defined values for channel coupling. + + + + + The digitizer AC couples the input signal. + + + + + The digitizer DC couples the input signal. + + + + + The digitizer couples the channel to the ground. + + + + + Defined values for width arm/trigger condition. + + + + + The digitizer is configured to arm/trigger on signals when they enter the given arming/triggering window. + The end-user specifies the high and low thresholds with the Window Arm/Trigger High Threshold and + Window Arm/Trigger Low Threshold properties. + + + + + The digitizer is configured to arm/trigger on signals when they leave the given arming/triggering window. + The end-user specifies the high and low thresholds with the Window Arm/Trigger High Threshold and + Window Arm/Trigger Low Threshold properties. + + + + + Defined values for width arm/trigger polarity. + + + + + The digitizer is configured to arm/trigger on positive pulses that have a width that meets the condition + the user specifies with the Width Arm/Trigger Condition property. + + + + + The digitizer is configured to arm/trigger on negative pulses that have a width that meets the condition + the user specifies with the Width Arm/Trigger Condition property. + + + + + The digitizer is configured to arm/trigger on either positive or negative pulses that have a width that + meets the condition the user specifies with the Width Arm/Trigger Condition property. + + + + + Defined values for window arm/trigger condition. + + + + + The digitizer is configured to arm/trigger on pulses that have a width that is less than the high + threshold and greater than the low threshold. The end-user specifies the high and low thresholds with + the Window Arm/Trigger High Threshold and Window Arm/Trigger Low Threshold properties. + + + + + The digitizer is configured to arm/trigger on pulses that have a width that is either greater than the + high threshold or less than a low threshold. The end-user specifies the high and low thresholds with + the Window Arm/Trigger High Threshold and Window Arm/Trigger Low Threshold properties. + + + + IVI Digitizer values for slope. + + + + Positive slope. + + + + + Negative slope. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Dmm.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Dmm.dll new file mode 100644 index 0000000..d30d8e2 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Dmm.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Dmm.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Dmm.xml new file mode 100644 index 0000000..8e3dd25 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Dmm.xml @@ -0,0 +1,606 @@ + + + + Ivi.Dmm + + + + IVI Dmm values for automatic mode of operation. + + + + Specifies that the Dmm set automatic value selection off. + + + + + Specifies that the Dmm set automatic value selection on. + + + + + Specifies that the Dmm automatically select the value once, and then set automatic value selection off. + + + + IVI DMM class-compliant values for aperture time units. + + + Specifies seconds for aperture time units. + + + Specifies powerline cycles for aperture time units. + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + The IviDmm class allows clients to create instances of drivers that implement the class-compliant + IviDmm interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviDmm drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviDmm class-compliant driver and return an IIviDmm reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDmm driver to be created. + + An IIviDmm interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDmm class-compliant driver and return an IIviDmm reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDmm driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviDmm interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDmm class-compliant driver and return an IIviDmm reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDmm driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDmm interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviDmm class-compliant driver and return an IIviDmm reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDmm driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDmm interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + IVI DMM class-compliant values for Function + + + Specifies that the Dmm measure DC voltage. + + + Specifies that the Dmm measure AC voltage. + + + Specifies that the Dmm measure DC current. + + + Specifies that the Dmm measure AC current. + + + Specifies that the Dmm measure 2-wire resistance. + + + Specifies that the Dmm measure 4-wire resistance. + + + Specifies that the Dmm measure AC plus DC voltage. + + + Specifies that the Dmm measure AC plus DC current. + + + Specifies that the Dmm measure frequency. + + + Specifies that the Dmm measure period. + + + Specifies that the Dmm measure temperature. + + + IVI DMM class-compliant root interface + + + Configures the Function, Range, and Resolution properties. + Specifies the MeasurementFunction property. The units for the Range and Resolution + parameters, and the measurement values that are returned are implied by the selected function. Measurement values + are returned by the Read, Read Multiple Point, Fetch, and Fetch Multiple Point methods. + Specifies the Range property. It is coerced by the driver to the largest magnitude (positive or + negative) input value based on the rest of the instrument configuration. Negative values are permitted if valid for + the specified function (for instance DC Volts). Units are determined by Function. AutoRange is set to Auto.Off. + Specifies the Resolution property. Units are determined by Function. + + + Configures the Function, AutoRange, and Resolution properties. If the value of the Auto Range parameter is + 'On', then the Resolution parameter is ignored. + Specifies the MeasurementFunction property. The units for the Range and Resolution + parameters, and the measurement values that are returned are implied by the selected function. Measurement values + are returned by the Read, Read Multiple Point, Fetch, and Fetch Multiple Point methods. + Specifies the AutoRange property. It indicates whether the range is set automatically by the instrument. + When autoRange is set to Off, the range selected is driver dependent. To control the resulting range, use the overload of + this function that includes the range. + Specifies the Resolution property. Units are determined by Function. + + + The measurement function. This property determines the units for Range and Resolution and the values + returned by the Read, Read Multiple Point, Fetch, and Fetch Multiple Point methods. + + + The measurement range, coerced by the driver to the largest magnitude (positive or + negative) input value based on the rest of the + instrument configuration. Negative values are permitted if valid for the current function (for instance DC Volts). + Setting this property sets AutoRange to Auto.Off. Units are determined by Function. + + + Indicates whether the range is set automatically by the instrument.When autoRange is set to Off, the range + selected is driver dependent. To control the resulting range, use the overload of this function that includes the range. + + + The measurement resolution in absolute units. Units are determined by Function. + + + Reference to the class-compliant IIviDmmAc interface + + + Reference to the class-compliant IIviDmmAdvanced interface + + + Reference to the class-compliant IIviDmmFrequency interface + + + Reference to the class-compliant IIviDmmMeasurement interface + + + Reference to the class-compliant IIviDmmTemperature interface + + + Reference to the class-compliant IIviDmmTrigger interface + + + IVI DMM class-compliant AC interface + + + Configures the FrequencyMax and FrequencyMin properties for DMMs that take AC voltage or AC current + measurements. + Specifies the FrequencyMin property. It is the minimum frequency component of the input signal for AC measurements. + Specifies the FrequencyMax property. It is the maximum frequency component of the input signal for AC measurements. + + + The maximum frequency component of the input signal for AC measurements. The value of this property + affects instrument behavior only when the Function property is set to an AC voltage or AC current measurement. + + + The minimum frequency component of the input signal for AC measurements. The value of this property + affects instrument behavior only when the Function property is set to an AC voltage or AC current measurement. + + + IVI DMM class-compliant advanced features interface + + + The measurement aperture time (also known as integration time) based on the present configuration. + Units are specified by the property ApertureTimeUnits. + + + Specifies whether the aperture time is express in seconds or powerline cycles. + + + The auto-zero mode. When the auto-zero mode is 'On', the DMM internally disconnects the input + signal and takes a Zero Reading. The DMM then subtracts the Zero Reading from the measurement. If AutoZero + is 'Once', it configures the DMM to take a Zero Reading immediately. The DMM then subtracts this Zero + Reading from all subsequent values it measures. + + + The power line frequency in Hertz. This property is used when ApertureTimeUnits is PowerlineCycles. + + + IVI DMM class-compliant frequency interface + + + The expected maximum voltage level of the input signal for frequency and period measurements. Setting this + property sets Voltage Auto Range to Auto.Off. Units are Volts RMS. + + + Indicates whether the frequency voltage range is set automatically by the instrument. + + + IVI DMM class-compliant measurement interface + + + Aborts a previously initiated measurement and returns the DMM to the idle state. + + + Returns the measured value from a measurement that the Initiate method initiates. + The maximum time allowed for the measurement to complete. If maxTime is PrecisionTimeSpan.Zero, + the measurement should only be returned if it is already available. If maxTime is PrecisionTimeSpan.MaxValue, the + measurement should wait until a measurement is available, with no timeout. + The measured value. Out of range testing may be performed by using the IsOutOfRange, + IsOverRange, or IsUnderRange methods. + + + Returns an array of values from a measurement that the Initiate method initiates. + The maximum time allowed for the measurement to complete. If maxTime is PrecisionTimeSpan.Zero, + the measurement should only be returned if it is already available. If maxTime is PrecisionTimeSpan.MaxValue, the + measurement should wait until a measurement is available, with no timeout. + An array of measured values. The size of the array is the product of the trigger count and the + sample count. Out of range testing may be performed by using the IsOutOfRange, IsOverRange, or IsUnderRange + methods. + + + Returns an array of values from a measurement that the Initiate method initiates. + The maximum time allowed for the measurement to complete. If maxTime is PrecisionTimeSpan.Zero, + the measurement should only be returned if it is already available. If maxTime is PrecisionTimeSpan.MaxValue, the + measurement should wait until a measurement is available, with no timeout. + The number of measurements to return, starting with the first measurement + from the instrument. + An array of measured values. The size of the array is the smaller of numberOfMeasurements or the + product of the trigger count and the sample count. Out of range testing may be performed by using the + IsOutOfRange, IsOverRange, or IsUnderRange methods. + + + Initiates a measurement. When this method executes, the DMM leaves the idle state and waits for a + trigger. + + + Takes a measurement value obtained from one of the Read or Fetch methods and determines if the + value is a valid measurement value or a value indicating that an out of range condition occurred. Out of + range conditions include both over range and under range conditions. + Pass the measurement value you obtain from one of the Read or Fetch functions. + True if the value is out of range, otherwise false. + + + Takes a measurement value obtained from one of the Read or Fetch methods and determines if the + value is a valid measurement value or a value indicating that an over range condition occurred. + Pass the measurement value you obtain from one of the Read or Fetch functions. + True if the value is over range, otherwise false. + + + Takes a measurement value obtained from one of the Read or Fetch methods and determines if the + value is a valid measurement value or a value indicating that an under range condition occurred. + Pass the measurement value you obtain from one of the Read or Fetch functions. + True if the value is under range, otherwise false. + + + Initiates a measurement, waits for the DMM to return to the idle state, and returns the measured + value. + The maximum time allowed for the measurement to complete. If maxTime is PrecisionTimeSpan.MaxValue, the + measurement should wait until a measurement is available, with no timeout. + The measured value. Out of range testing may be performed by using the IsOutOfRange, IsOverRange, + or IsUnderRange methods. + + + Initiates a measurement, waits for the DMM to return to the idle state, and returns an array of + values. + The maximum time allowed for the measurement to complete. If maxTime is PrecisionTimeSpan.MaxValue, the + measurement should wait until a measurement is available, with no timeout. + An array of measured values. The size of the array is the product of the trigger count and the + sample count. Out of range testing may be performed by using the IsOutOfRange, IsOverRange, or IsUnderRange + methods. + + + Initiates a measurement, waits for the DMM to return to the idle state, and returns an array of + values. + The maximum time allowed for the measurement to complete. If maxTime is PrecisionTimeSpan.MaxValue, the + measurement should wait until a measurement is available, with no timeout. + The number of measurements to return, starting with the first measurement + from the instrument. + An array of measured values. The size of the array is the smaller of numberOfMeasurements or the + product of the trigger count and the sample count. Out of range testing may be performed by using the + IsOutOfRange, IsOverRange, or IsUnderRange methods. + + + Sends a software trigger, which causes the DMM to take a measurement. The IIviDmmTrigger.Source property must accept + Software Trigger as a valid setting for this method to work. If the IIviDmmTrigger.Source is not set to Software Trigger, + this method does nothing and throws TriggerNotSoftwareException. + + + IVI DMM class-compliant multipoint interface + + + Configures multipoint TriggerCount, SampleCount, SampleTrigger and SampleInterval properties. + Specifies the TriggerCount property. It is the number of triggers the DMM accepts before it returns to the idle state. + Specifies the SampleCount property. It is the number of measurements the DMM takes each time it receives a trigger. + Specifies the SampleTrigger property. It is the sample trigger source. If the value of the Sample Count is greater than 1, the + DMM enters the Wait-For-Sample-Trigger state after taking a single measurement. When the event specified by this + parameter occurs, the DMM exits the Wait-For-Sample-Trigger state and takes the next measurement. + Specifies the SampleInterval property. It is the interval between samples in seconds. + Applies only when Sample Count is greater than 1 and Sample Trigger is Interval. + + + The number of triggers the DMM accepts before it returns to the idle state. + + + The number of measurements the DMM takes each time it receives a trigger. + + + The interval between samples in seconds. Applies only when Sample Count is greater than 1 and Sample + Trigger is Interval. + + + + The sample trigger source. If the value of the Sample Count is greater than 1, the DMM enters the + Wait-For-Sample-Trigger state after taking a single measurement. When a sample trigger occurs, the DMM takes the + next measurement. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + IVI DMM class-compliant RTD interface + + + Configures the Alpha and Resistance parameters for a resistance temperature device. + Specifies the Alpha property. It is the alpha parameter for a resistance temperature device (RTD). + Specifies the Resistance property. It is the R0 parameter (resistance) for a resistance temperature device (RTD) also known as + the RTD reference value. + + + The alpha parameter for a resistance temperature device (RTD). Applies only when the Temperature + Transducer Type is set to 2 Wire RTD or 4 Wire RTD. + + + The R0 parameter (resistance) for a resistance temperature device (RTD). Also known as the RTD reference + value. Applies only when the Temperature Transducer Type is set to 2 Wire RTD or 4 Wire RTD. + + + IVI DMM class-compliant temperature interface + + + The type of device used to measure the temperature. This property affects instrument behavior only when + Function is set to a temperature measurement. + + + Reference to the class-compliant IIviDmmRtd interface + + + Reference to the class-compliant IIviDmmThermocouple interface + + + Reference to the class-compliant IIviDmmThermistor interface + + + IVI DMM class-compliant thermistor interface + + + The resistance of the thermistor in Ohms. Applies only when the IIviDmmTemperature.TransducerType property + is Thermistor. + + + IVI DMM class-compliant thermocouple interface + + + Configures the thermocouple Type and ReferenceJunctionType properties of a thermocouple. Applies only when + the IIviDmmTemperature.TransducerType is Thermocouple. + Specifies the Type property. It is the type of thermocouple used to measure the temperature. + Specifies the ReferenceJunctionType property. It is the type of reference junction used in the reference junction compensation. + + + The external reference junction temperature when a fixed reference junction thermocouple is used to + measure temperature, or the thermocouple junction temperature of an instrument without an internal temperature + sensor, in degrees Celsius. + + + The type of reference junction to be used in the reference junction compensation of a thermocouple + measurement. Applies only when the Temperature Transducer Type is Thermocouple. + + + The type of thermocouple used to measure the temperature. Applies only when the IIviDmmTemperature.TransducerType + is Thermocouple. + + + IVI DMM class-compliant trigger interface + + + Configures the trigger Source and Delay properties. + Specifies the Source property. + Specifies the Delay property. It is the interval between the time when the DMM receives the trigger and the time when + it takes a measurement. Positive values set the trigger delay. Negative values do not have a special meaning + but may be used to represent pre-trigger configurations. Auto Trigger Delay is set to Auto.Off. + + + Configures the trigger Source and AutoDelay properties. + Specifies the Source property. + Specifies the DelayAuto property. It indicates whether the range is set automatically by the instrument. If set to 'Off', + the driver Trigger Delay setting should stop at the current value selected by the algorithm. + + + The interval between the time when the DMM receives the trigger and the time when it takes a + measurement. Positive values set the trigger delay in seconds. Negative values set auto delay mode. + + + The interval between the time when the DMM receives the trigger and the time when it takes a + measurement. Positive values set the trigger delay. Negative values do not have a special meaning but may + be used to represent pre-trigger configurations. Setting this property sets AutoDelay to Auto.Off. + + + Indicates whether the trigger delay is set automatically by the instrument. + + + + The trigger source. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The destination of the measurement-complete signal generated after each measurement. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + Reference to the class-compliant IIviDmmMultipoint interface + + + IVI DMM class-compliant values for thermocouple ReferenceJunctionType + + + Specifies that the Dmm use a user-determined fixed value for the junction compensation. + + + Specifies that the Dmm use an internal sensor for the junction compensation. + + + IVI DMM class-compliant values for thermocouple Type + + + Specifies that the Dmm measure temperature using a type B thermocouple. + + + Specifies that the Dmm measure temperature using a type C thermocouple. + + + Specifies that the Dmm measure temperature using a type D thermocouple. + + + Specifies that the Dmm measure temperature using a type E thermocouple. + + + Specifies that the Dmm measure temperature using a type G thermocouple. + + + Specifies that the Dmm measure temperature using a type J thermocouple. + + + Specifies that the Dmm measure temperature using a type K thermocouple. + + + Specifies that the Dmm measure temperature using a type N thermocouple. + + + Specifies that the Dmm measure temperature using a type R thermocouple. + + + Specifies that the Dmm measure temperature using a type S thermocouple. + + + Specifies that the Dmm measure temperature using a type T thermocouple. + + + Specifies that the Dmm measure temperature using a type U thermocouple. + + + Specifies that the Dmm measure temperature using a type V thermocouple. + + + IVI DMM class-compliant values for temperature TransducerType + + + Specifies that the Dmm measure temperature using a thermocouple. + + + Specifies that the Dmm measure temperature using a thermistor. + + + Specifies that the Dmm measure temperature using a 2-wire resistive temperature device. + + + Specifies that the Dmm measure temperature using a 4-wire resistive temperature device. + + + IVI Driver values for Slope. + + + + Specifies positive slope. + + + + + Specifies negative slope. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Downconverter.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Downconverter.dll new file mode 100644 index 0000000..d77cb93 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Downconverter.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Downconverter.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Downconverter.xml new file mode 100644 index 0000000..8f96a98 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Downconverter.xml @@ -0,0 +1,865 @@ + + + + Ivi.Downconverter + + + + + Matched arrays of band crossing start and stop frequencies. + + + + + Constructs a band crossing start and stop frequency pair. + + The start frequency of the band. The units are Hertz. + The stop frequency of the band. The units are Hertz. + + + + The start frequency of the band. + + + + + The stop frequency of the band. + + + + + Defined values indicating whether the instrument is currently in a valid self-calibrated state or whether it + needs to be calibrated. + + + + + The downconverter is calibrated. + + + + + The downconverter requires further calibration. + + + + + The downconverter cannot determine the status of the calibration. + + + + + Defined values for the downconverter calibration status. + + + + + The downconverter has completed the calibration. + + + + + The downconverter is still performing the calibration. + + + + + The downconverter cannot determine the status of the calibration. + + + + + The downconverter calibration failed. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to The selected frequency list is not defined.. + + + + + Looks up a localized string similar to List name: . + + + + + Frequency list is unknown. + + + + + Initializes a new instance of the class with a specified error message and frequency list name. + + The message that describes the error. + The name of the unknown frequency list. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the unknown frequency list. + + + + + Gets the error message. + + + + + Defined values for selecting the step size scaling for RF input frequency stepped sweeps. + + + + + Indicates linear scaling for step sizes in stepped sweeps. + + + + + Indicates logarithmic scaling for step sizes in stepped sweeps. + + + + + Defined values for the RF input frequency sweep mode. + + + + + The RF input of the downconverter is a non-swept signal (continuous wave). Frequency settings from the base + capability group are used. + + + + + The downconverter sweeps the RF input signal's frequency in analog form (non-stepped). Refer to the + IviDownconverterAnalogyFrequencySweep extension group. + + + + + The downconverter sweeps the RF input signal's frequency in steps. Refer to the IviDownconverterFrequencyStep + extension group. + + + + + The downconverter uses a list to sweep the RF input signal frequency. Refer to the + IviDownconverterFrequencySweepList extension group. + + + + + IviDownconverter class-compliant root interface. + + + + + Reference to the class-compliant IIviDownconverterCalibration interface. + + + + + Reference to the class-compliant IIviDownconverterExternalLO interface. + + + + + Reference to the class-compliant IIviDownconverterExternalMixer interface. + + + + + Reference to the class-compliant IIviDownconverterIFOutput interface. + + + + + Reference to the class-compliant IIviDownconverterReferenceOscillator interface. + + + + + Reference to the class-compliant IIviDownconverterRFInput interface. + + + + + IviDownconverter class-compliant Calibration interface. + + + + + This method performs calibration on the entire device. This call can be blocking or non-blocking, + depending on the instrument implementation. If it is non-blocking, the user may use the GetCalibrationStatus + method to determine when the calibration is complete. + + This method throws an exception if the instrument does not support programmatic calibration operations. + + + + + This method queries the instrument to determine the whether the instrument is currently in a valid + self-calibrated state or whether it needs to be calibrated. This method returns the Calibrated value in + the Status parameter when the device does not need further self-calibration. + + The calibrated status of the device. + + + + This method queries the instrument to determine the status of all calibration operations initiated by + the Calibrate method. This method returns the Calibration Complete value in the Status parameter only + when calibration is complete. + + The calibration status of the device. + + + + IviDownconverter class-compliant external local oscillator interface. + + + + + True if the external LO is enabled, otherwise false. + + + + + Specifies the frequency of the external LO. The units are Hertz. + + + + + IviDownconverter class-compliant external mixer interface. + + + + + Reference to the class-compliant IIviDownconverterExternalMixerBias interface. + + + + + True if the external mixer is enabled, otherwise false. + + + + + Specifies the harmonic number, that is, the order of the harmonic used for conversion. + + + + + Specifies the number of ports. + + + + + IviDownconverter class-compliant external mixer bias interface. + + + + + This method configures the external mixer bias and the external mixer bias limit. + + Specifies the bias current. The driver uses this value to set the External Mixer Bias + Level property. + Specifies the bias current limit. The driver uses this value to set the External + Mixer Bias Limit property. See the property description for more details. + + + + True if the external mixer's bias is enabled, otherwise false. + + + + + Specifies the external mixer bias current. The units are Amps. + + + + + Specifies the external mixer bias current limit. The units are Amps. + + + + + IviDownconverter class-compliant frequency step interface. + + + + + Configures the properties that control frequency stepping dwell. + + Specifies whether the trigger initiates the next step. The driver uses this + value to set the Frequency Step Single Step Enabled property. + Specifies the duration of one frequency step. The driver uses this value to set the + Frequency Step Dwell property. See the property description for more details. + + + + Configures the properties that control the step frequencies of the downconverter's input frequency. These + properties are start and stop frequency, step size and lin/log scaling. If the stop frequency is less than + the start frequency, the frequency decreases during the sweep. + + Specifies the start frequency of the sweep. The driver uses this value to set the + Frequency Step Start property. See the property description for more details. + Specifies the stop frequency of the sweep. The driver uses this value to set the + Frequency Step Stop property. See the property description for more details. + Specifies the scaling of the step sweep. The driver uses this value to set the + Frequency Step Scaling property. See the property description for more details. + Specifies the size of one step. The driver uses this value to set the Frequency + Step Size property. See the property description for more details. + + + + Resets the current frequency step to the frequency step start value + + + + + Specifies the duration of one step. The units are seconds. Dwell time starts immediately after a trigger + or the next step. No settling time is added. This property is ignored if the Frequency Step Single Step + Enabled property is set to True. + + + + + Specifies the spacing of the steps. + + + + + True if single step mode is enabled, otherwise false. + + + + + Specifies the step size. The units are Hertz if the Frequency Step Scaling property is set to Linear. This + property is a unitless multiplier if the Frequency Step Scaling property is set to Logarithmic. + + + + + Specifies the start frequency of the stepped sweep. If the stop frequency is less than the start frequency, + the frequency decreases during the sweep. The units are Hertz. + + + + + Specifies the stop frequency of the stepped sweep. If the stop frequency is less than the start frequency, + the frequency decreases during the sweep. The units are Hertz. + + + + + IviDownconverter class-compliant frequency sweep interface. + + + + + Configures the whether the downconverter's RF input frequency is fixed, swept, or stepped. + + Specifies the frequency sweep mode of the downconverter. That is, how the frequency is swept + when the device is triggerred. The driver uses this value to + set the Frequency Sweep Mode property. See the property description for more details. + Specifies the source of the trigger to start an LO sweep. The driver uses this value + to set the Frequency Sweep Trigger Source property. + See the property description for more details. + + + + This method returns the band crossing information for sweeps. Sweep timing is influenced by points in the + sweep where frequency bands are crossed. This method returns pairs of start/stop frequencies over which + the sweep timing is constant. Sweep timing between different pairs of start/stop frequencies is variable. + The bands are returned in ascending order of frequency. + + An array of start and stop frequency pairs over which the sweep timing is constant. The + frequencies are returned in ascending order. The units are Hertz. + + + + This method waits until the configured frequency sweep is complete. If no frequency sweep is currently running, this + method returns immediately. If the sweep does not complete within the time period the user specified with + the maxTime parameter, the method throws the Max Time Exceeded exception. + + Specifies the maximum time this method will wait to complete. A value + of PrecisionTimeSpan.MaxValue indicates that the method is to wait indefinitely for the frequency sweep to + complete. + + + + Reference to the class-compliant IIviDownconverterRFInputFrequencySweepNormal interface. + + + + + If true, the downconverter is currently sweeping the RF input signal. + + + + + Reference to the class-compliant IIviDownconverterRFInputFrequencySweepList interface. + + + + + The sweep mode of the RF input signal. + + + + + The number of bands that will be returned from a call to the Get Band Crossing Info method. The count + returned here indicates the number of start-stop frequency pairs. + + + + + Reference to the class-compliant IIviDownconverterRFInputFrequencySweepStep interface. + + + + + The trigger used to start an LO sweep operation. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + IviDownconverter class-compliant frequency sweep analog interface. + + + + + Configures the start and stop frequency properties that control the frequency sweep of the RF input signal for analog sweep. + If the stop frequency is less than the start frequency, the frequency decreases during the sweep. + + Specifies the start frequency of the sweep. The driver uses this value to set the + Frequency Sweep Start property. See the property description for more details. + Specifies the stop frequency of the sweep. The driver uses this value to set the + Frequency Sweep Stop property. See the property description for more details. + + + + Specifies the start frequency of the LO sweep. If the stop frequency is less than the start frequency, the + frequency decreases during the sweep. The units are Hertz + + + + + Specifies the stop frequency of the LO sweep. If the stop frequency is less than the start frequency, the + frequency decreases during the sweep. The units are Hertz. + + + + + Specifies the duration of one LO sweep from start to stop frequency. + + + + + IviDownconverter class-compliant frequency sweep list interface. + + + + + Deletes all lists from the pool of defined lists. + + + + + Configures the properties that control frequency list stepping. + + Specifies whether the trigger initiates the next step. The driver uses + this value to set the Frequency List Single Step Enabled property. See the property description for more + details. + Specifies the duration of one frequency step. The driver uses this value to set the + Frequency List Dwell property. See the property description for more details. + + + + Creates a named list of frequency for a list sweep + + Specifies the name of the frequency list to be created. + Specifies the array of frequency values to become elements of the list. The + units are Hertz. + + + + Resets the current list to the first entry value. + + + + + Specifies the duration of one step. This property is ignored if the Frequency Sweep List Single Step + Enabled property is set to True. + + + + + Selects the list to be active using the name specified with CreateList + + + + + Enables single step mode. + + + + + IviDownconverter class-compliant IF output interface. + + + + + Returns the physical repeated capability identifier defined by the specific driver for the IF Output that + corresponds to the zero-based index that the user specifies. Valid values for the Index parameter are + between zero and the value of the IF Output Count property minus one. If the user passes an invalid value + for the Index parameter, the method returns an empty string. + + An index to the IF Output repeated capability between zero and the value of the IF + Output Count property minus one + A physical repeated capability identifier defined by the specific driver. + + + + Wait until all of the signals flowing through the downconverter have settled. If the signals did not settle + within the time period the user specified with the maxTime parameter, the method throws the Max Time + Exceeded exception. + + The maximum time for this method to complete before throwing an exception. A value + of PrecisionTimeSpan.MaxValue indicates that the method is to wait indefinitely for the frequency sweep to + complete. + + + + Specifies the IF output that is currently active. Subsequent calls to methods and properties that are based + on the IF Output repeated capability will be applied to the Active IF Output specified with this property. + The values for this property correspond to the allowed repeated capability names for the IF Output repeated + capability. Note that the Active IF Output property does not enable the specified output. This property + only controls the IF Output repeated capability instance to which other methods and properties apply. Use + the IF Output Enabled attribute to route the IF signal to a specific output. + [Use the Get IF Output Name method or refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Returns the number of IF Outputs available on the device. + + + + + True if the IF output is enabled, otherwise false. Only a single IF Output can be enabled at a time. Thus, + when this property is set to true for a particular IF output, all other IF outputs are disabled. + + + + + Returns the maximum effective IF signal bandwidth that the downconverter can present to the digitizer. The + units are Hertz. This value is a measure of the spectral width between two points for which the amplitude + profile is 3 dB below a peak close to mid band. + + + + + Returns the frequency of the IF output. The units are Hertz. + + + + + Specifies the amount of gain (or attenuation) to apply to the IF output of the downconverter. The units are + dB. Positive values for this property represent signal gain while negative values represent attenuation. + + + + + Indicates whether the downconverter has settled from changes to either the RF input signal or changes to + device control parameters, such as IF Output Gain, IF Frequency, or RF Attenuation. This property indicates + whether or not the IF output is valid for processing by another downstream system component, such as a + digitizer. + + + + + Specifies the bandwidth of the IF output video detection filter. The units are Hertz. + + + + + IviDownconverter class-compliant reference oscillator interface. + + + + + Configures the downconverters reference oscillator. + + Specifies the source of the reference frequency signal. The driver uses this value to + set the Reference Oscillator Source property. See the property description for more details. + Specifies the frequency of the external reference oscillator. This parameter is + only used if the Source is set to External. The driver uses this value to set the Reference Oscillator + Frequency property. See the property description for more details. + + + + Specifies the frequency of the external signal that is used as reference for internal IF frequency + generation. This value is used only if Reference Oscillator Source is set to External. The units are Hertz. + + + + + If True, the Reference output is enabled. If False, the Reference output is disabled. + + + + + Specifies the reference oscillator source used to generate the precise IF output frequency. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + IviDownconverter class-compliant RF output interface. + + + + + Returns the physical repeated capability identifier defined by the specific driver for the RF Output that + corresponds to the zero-based index that the user specifies. Valid values for the Index parameter are + between zero and the value of the RF Output Count property minus one. If the user passes an invalid value + for the Index parameter, the method returns an empty string. + + An index to the RF Output repeated capability between zero and the value of the RF + Output Count property minus one + A physical repeated capability identifier defined by the specific driver. + + + + Refer to IVI-3.3: Standard Cross Class Capabilities, Section 2 Software Triggering Capability for the + prototype and complete description of this method. + + + + + Specifies the RF input that is currently active. Subsequent calls to methods and properties that are based + on the RF Input repeated capability will be applied to the Active RF Input specified here. The values for + this property correspond to the allowed repeated capability names for the RF Input repeated capability. + [Use the Get RF Input Name method or refer to the instrument driver documentation for valid values, which + may include one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies the amount of attenuation (or gain) to apply to the RF input of the downconverter. The units are + dB. Positive values for this property represent attenuation while negative values represent gain. + + + + + Specifies whether or not the RF input signal bypasses the entire downconverter. When set to True, the RF + input signal is routed directly to the IF output indicated by the value of the Active IF Output property. + When set to False, the RF input signal is routed into the front end of the downconverter and follows the + normal signal path, as dictated by other downstream path control properties, such as Preselector Enabled + and Front End Bypass. + + + + + If true, automatic global corrections on the device is enabled, otherwisw false. + + + + + Returns the number of RF Inputs available on the device. + + + + + Specifies the coupling applied to RF input. + + + + + Specifies the frequency of the RF input. The units are Hertz. + + + + + Reference to the class-compliant IIviDownconverterRFInputFrequencySweep interface. + + + + + Enables or disables bypassing the downconverter's pre-selection filter. + + + + + Defined values for the type of RF input coupling. + + + + + The downconverter AC couples the RF input signal. + + + + + The downconverter DC couples the RF input signal. + + + + + The IviDownconverter class allows clients to create instances of drivers that implement the class-compliant + IviDownconverter interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviDownconverter drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviDownconverter class-compliant driver and return an IIviDownconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDownconverter driver to be created. + + An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDownconverter class-compliant driver and return an IIviDownconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDownconverter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviDownconverter class-compliant driver and return an IIviDownconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDownconverter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviDownconverter class-compliant driver and return an IIviDownconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviDownconverter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Driver.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Driver.dll new file mode 100644 index 0000000..efd2434 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Driver.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Driver.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Driver.xml new file mode 100644 index 0000000..8d0114d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Driver.xml @@ -0,0 +1,6099 @@ + + + + Ivi.Driver + + + + + Coercion event arguments. + + + + + Constructor. + + Coercion message. Refer to the Text property for details. + + + + The coercion message. + + + The coercion record string shall contain the following information: + (1) The name of the property that was coerced. This can be the generic name, the COM property name, or the C + defined constant. + (2) If the property applies to a repeated capability, the name of the repeated capability. The name can be + the specific driver repeated capability token or the virtual repeated capability name that the user specified. + (3) The value that the user specified for the property. + (4) The value to which the property was coerced. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to An access key must be provided when using machine-wide locking. + Driver identifier: {0}. + + + + + Looks up a localized string similar to Actual value: . + + + + + Looks up a localized string similar to Assembly qualified class name: . + + + + + Looks up a localized string similar to The Auto.Once enumeration value is not supported.. + + + + + Looks up a localized string similar to Invalid or unsupported lock type. + Driver identifier: {0} + Lock type: {1}. + + + + + Looks up a localized string similar to Failure - cannot recover.. + + + + + Looks up a localized string similar to Capacity: . + + + + + Looks up a localized string similar to Class name: . + + + + + Looks up a localized string similar to IviSessionFactory: The specific driver's main class (assembly qualified class name) is not specified in the configuration store.. + + + + + Looks up a localized string similar to An error occurred while using the Configuration Server.. + + + + + Looks up a localized string similar to IviSessionFactory: There was an error loading the Configuration Server.. + + + + + Looks up a localized string similar to A machine-wide lock cannot be granted because a .NET AppDomain-wide lock for the same access key already exists. + Driver identifier: {0} + Access key: {1}. + + + + + Looks up a localized string similar to The measured waveform or spectrum exceeds the capacity of the waveform or spectrum object's data array.. + + + + + Looks up a localized string similar to IviSessionFactory: An instance of the specific driver referenced by the driver session name could not be created, or did not support the specified type.. + + + + + Looks up a localized string similar to Driver session: . + + + + + Looks up a localized string similar to Error code: . + + + + + Looks up a localized string similar to The file does not conform to the expected file format.. + + + + + Looks up a localized string similar to Unable to find the specified file.. + + + + + Looks up a localized string similar to The file could not be opened.. + + + + + Looks up a localized string similar to File URI: . + + + + + Looks up a localized string similar to The firstValidPoint property must be 0 or greater.. + + + + + Looks up a localized string similar to The FirstValidPoint property must be less than the Capacity property.. + + + + + Looks up a localized string similar to The instrument ID query failed.. + + + + + Looks up a localized string similar to IviSessionFactory: The instrument class is not supported by the specific driver.. + + + + + Looks up a localized string similar to Instrument error detected. Use ErrorQuery() to determine the error(s).. + + + + + Looks up a localized string similar to The driver cannot retrieve the instrument status.. + + + + + Looks up a localized string similar to The intervalPerPoint property cannot be zero.. + + + + + Looks up a localized string similar to IviSessionFactory: The assembly qualified class name is in incorrect format. The correct format is "FullAssemblyName;NamespaceQualifiedTypeName".. + + + + + Looks up a localized string similar to The option string contains an invalid option value.. + + + + + Looks up a localized string similar to The spectrum class does not support data arrays of the specified type.. + + + + + Looks up a localized string similar to The waveform class does not support data arrays of the specified type.. + + + + + Looks up a localized string similar to An instrument I/O error occurred.. + + + + + Looks up a localized string similar to An I/O timeout occurred.. + + + + + Looks up a localized string similar to The call to the IVI-C driver did not succeed.. + + + + + Looks up a localized string similar to Failed to acquire driver synchronization lock within the specified timeout period.. + + + + + Looks up a localized string similar to The operation did not complete within the maximum time allowed.. + + + + + Looks up a localized string similar to Measured elements: . + + + + + Looks up a localized string similar to Method, property, or event name: . + + + + + Looks up a localized string similar to The multiplier parameter cannot be NaN or Infinity.. + + + + + Looks up a localized string similar to The multiplier parameter cannot be zero.. + + + + + Looks up a localized string similar to Logical or driver session name: . + + + + + Looks up a localized string similar to Arrays greater in size than 2GB are not supported.. + + + + + Looks up a localized string similar to Error loading Configuration Store.. + + + + + Looks up a localized string similar to Logical Name references a non-existent Driver Session.. + + + + + Looks up a localized string similar to The PrecisionDateTime value is Not a Time (NaT).. + + + + + Looks up a localized string similar to The method or property is not supported.. + + + + + Looks up a localized string similar to Method is only supported for Single or Double types.. + + + + + Looks up a localized string similar to The Offset property cannot be NaN or Infinity.. + + + + + Looks up a localized string similar to The Offset property is fixed at 0 for floating point data.. + + + + + Looks up a localized string similar to Operation in progress.. + + + + + Looks up a localized string similar to The option string is missing a required option.. + + + + + Looks up a localized string similar to Option name: . + + + + + Looks up a localized string similar to The option string is not formatted correctly.. + + + + + Looks up a localized string similar to Option value: . + + + + + Looks up a localized string similar to The specified argument was out of the range of valid values.. + + + + + Looks up a localized string similar to Parameter name: . + + + + + Looks up a localized string similar to Physical name: . + + + + + Looks up a localized string similar to Allowable range: . + + + + + Looks up a localized string similar to Repeated capability: . + + + + + Looks up a localized string similar to The rescale operation is not supported for floating point waveforms. + + + + + Looks up a localized string similar to The instrument reset failed.. + + + + + Looks up a localized string similar to The instrument does not support the reset operation.. + + + + + Looks up a localized string similar to Resource name: . + + + + + Looks up a localized string similar to The Scale property cannot be NaN or Infinity.. + + + + + Looks up a localized string similar to The Scale property cannot be zero in this context.. + + + + + Looks up a localized string similar to The Scale property is fixed at 1 for floating point data.. + + + + + Looks up a localized string similar to Invalid format for repeated capability selector.. + + + + + Looks up a localized string similar to The repeated capability selector has the wrong number of levels.. + + + + + Looks up a localized string similar to Invalid repeated capability name in selector.. + + + + + Looks up a localized string similar to The repeated capability selector name is required.. + + + + + Looks up a localized string similar to The repeated capability selector includes an invalid range or list.. + + + + + Looks up a localized string similar to Repeated capability selector value: . + + + + + Looks up a localized string similar to IviSessionFactory: The IVI.NET session factory method could not find a driver session that could be used to instantiate an IVI.NET instrument driver.. + + + + + Looks up a localized string similar to The simulation state cannot be changed.. + + + + + Looks up a localized string similar to Specific driver (software module): . + + + + + Looks up a localized string similar to IviSessionFactory: The software module referenced by the driver session could not be found in the configuration store.. + + + + + Looks up a localized string similar to The StartFrequency and StopFrequency properties must be equal when validPointCount is 1.. + + + + + Looks up a localized string similar to String value cannot be the empty string.. + + + + + Looks up a localized string similar to Timeout: . + + + + + Looks up a localized string similar to The trigger source is not set to software trigger.. + + + + + Looks up a localized string similar to Trigger source: . + + + + + Looks up a localized string similar to Type: . + + + + + Looks up a localized string similar to The response from the instrument was unexpected.. + + + + + Looks up a localized string similar to The option string contains an unknown option name.. + + + + + Looks up a localized string similar to The configuration store driver session references a physical name that is not defined by the driver.. + + + + + Looks up a localized string similar to Unknown resource.. + + + + + Looks up a localized string similar to Valid point count: . + + + + + Looks up a localized string similar to The validPointCount property must be 0 or greater.. + + + + + Looks up a localized string similar to The specified valid point count exceeds the capacity of the waveform or spectrum object's data array.. + + + + + Looks up a localized string similar to Value: . + + + + + Looks up a localized string similar to Value not supported.. + + + + + Looks up a localized string similar to Virtual name: . + + + + + The IVI.NET session factory method could not find the assembly qualified class name in the configuration + store. Assembly qualified class name is a property of the IVI.NET specific driver's software module entry. + It is needed to create an instance of the specific driver's main class. + + + This error is thrown after the driver session has been found, and the software module referenced by the + driver session has been found. The cause of the error is either that the assembly qualified class name is + blank, or that the program could not access the ISoftwareModule2 interface which contains the assembly + qualified class name. + If the assembly qualified class name is blank, the driver referenced by the software module is not + an IVI.NET driver, or the driver's software module entry is corrupt. If the driver is an IVI.NET driver, + the problem may be fixed by repairing or reinstalling the driver. + If the assembly qualified class name is not blank, the program could not access the ISoftwareModule2 + interface. This interface was added in version 1.5.0 of the IVI Shared Components. If a version of the + IVI Shared Components older than version 1.5.0 is installed, the problem may be fixed by upgrading to a + newer version. + This exception shall only be thrown by IVI.NET session factory methods distributed by the IVI Foundation + as part of the IVI.NET Shared Components. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message with the driver session and software + module specified. + + The name of the driver session to be instantiated by the IVI.NET session factory + method. + The name of the specific driver's software module referenced by the driver + session. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the driver session to be instantiated by the IVI.NET session factory method. + + + + + The name of the specific driver's software module referenced by the driver session. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + An error occurred while using the Configuration Server. + + + This exception is used to relay an exception thrown by the configuration server (for example, an + Unauthorized Access exception or an IO exception). The exception thrown by the Configuration Server + is the inner exception for this one. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a reference to the inner exception that is the cause of this + exception. + + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a reference to the C/COM error code that is the cause of this + exception. This call should not be used to relay exceptions from a .NET configuration server or PIA. + + If not equal to zero, the error code returned by an interop call to a C or COM + configuration server that is the cause of the current exception. If zero, the error code is ignored. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error code. If ErrorCode is 0, it is not applicable to this exception. + + + + + Gets the error message. + + + + + The IVI.NET session factory method could not load the configuration store specified. + + + This error is thrown if the driver cannot load the configuration store. The cause of the error is + either that no file name can be found, the file specified does not exist, or the file could not be + deserialized. + The session factory method gets the configuration store file name from configuration server's process + default location, if it is specified, or from the master location, which should always reference an extant + configuration store file. + If the file cannot be deserialized, then it does not conform to the version of the configuration store + XML schema currently installed by the IVI Shared Components installer. + This exception shall only be thrown by IVI.NET session factory methods distributed by the IVI Foundation + as part of the IVI.NET Shared Components. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a reference to the inner exception that is the cause of this + exception. + + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Create the exception message string based on the message. + + + + + The measured waveform or spectrum exceeds the capacity of the waveform or spectrum. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified measured number of elements and capacity. + + The measured number of elements. + The capacity of the waveform or spectrum. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The measured number of elements. + + + + + The capacity of the waveform or spectrum. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + A file does not conform to it's expected format. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified file name and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified file name and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified file name. + + The URI of the file which is not formatted correctly. + + + + Initializes a new instance of the class with a specified file name and a reference to the inner exception + that is the cause of this exception. + + The URI of the file which is not formatted correctly. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the exception + being thrown. + The that contains contextual information about the source or + destination. + + + + The Uri of the file which is not formatted correctly. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The instrument ID query failed. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The driver detected an instrument error. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The IVI.NET session factory method has determined that the specific driver's main class name (assembly + qualified class name) is not formatted properly in the configuration store. The format is + "FullAssemblyName;NamespaceQualifiedTypeName". + + + This error is thrown after the driver session has been found, and the software module referenced by the + driver session has been found. The cause of the error is that the assembly qualified class name is not + correctly formatted. + Example of a correctly formatted assembly qualified class name: + "Ivi.Driver.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a128c98f1d7717c1, processorArchitecture=MSIL" + This exception shall only be thrown by IVI.NET session factory methods distributed by the IVI Foundation + as part of the IVI.NET Shared Components. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message with the software module and + assembly qualified class name specified. + + The name of the specific driver's software module. + The driver's Assembly Qualified Class Name. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the specific driver's software module referenced by the driver session. + + + + + The driver's Assembly Qualified Class Name from the software module. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + An invalid value is assigned to an option. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified option name and value. + + The name of the option. + The invalid value assigned to the option. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the exception + being thrown. + The that contains contextual information about the source or + destination. + + + + The name of the parameter to which the unsupported value is assigned. + + + + + The invalid value for the specified option. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The spectrum class does support data arrays of the specified type. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and the spectrum type. + + The message that describes the error. + The specified spectrum type. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The specified spectrum type. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The waveform class does support data arrays of the specified type. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and the waveform type. + + The message that describes the error. + The specified waveform type. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The specified waveform type. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + A call to the underlying IO mechanism being used by the driver to communicate with the instrument has + failed. + + + The exception thrown by the underlying IO should be made the inner exception for this one. + This exception is used to relay an exception thrown or error reported by the underlying IO mechanism + being used by the driver to communicate with the instrument. The exception thrown by the underlying IO + should be made the inner exception for this one. + If the underlying IO reports a timeout, IOTimeoutException is used instead. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error + message and a reference to the inner exception that is the cause + of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a reference to the inner exception that is the cause of this + exception. + + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a reference to the C/COM error code that is the cause of this + exception. This call should not be used to relay exceptions from a .NET I/O library or PIA. + + If not equal to zero, the error code returned by an interop call to a C or COM + I/O library that is the cause of the current exception. If zero, the error code is ignored. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error code. If ErrorCode is 0, it is not applicable to this exception. + + + + + Gets the error message. + + + + + A call to the underlying IO mechanism being used by the driver to communicate with the instrument + has timed out. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and a specified timeout. + + The message that describes the error. + The timeout that was exceeded, including units. For example, '2000 ms'. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The timeout that was exceeded, including units. For example, '2000 ms' + + + + + Gets the error message. + + + + + An IVI-C interop action did not succeed. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and the error code of the error. + + The message that describes the error. + The error code of the error. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error code. + + + + + Gets the error message. + + + + + The operation implemented by the method did not complete within the maximum time allowed. + + + This exception is used (rather than the IOTimeoutException) whenever a method includes a parameter (for + example, maximumTime) that specifies maximum time allowed for the method's operation to complete. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error + message and a reference to the inner exception that is the cause + of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + The timeout that was exceeded, including units. For example, '2000 ms' + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The timeout that was exceeded, including units. For example, '2000 ms' + + + + + Gets the error message. + + + + + The PrecisionDateTime value is Not a Time (NaT). + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error + message and a reference to the inner exception that is the cause + of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + The message that describes the error. + Initializes a new instance of the class with a specified error message. + + The parameter whose value is NaT (Not A Time). + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The parameter whose value is NaT (Not A Time). + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + This exception is used when a driver feature (for this exception, a method, property, or event) is not + supported by the driver. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and a specified method, property, or + event name. + + The message that describes the error. + The name of the unsupported method, property, or event. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the parameter to which the unsupported value is assigned. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + An operation is in progress that prevents the current method or property from being executed. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + A required option is missing from the option string. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and a specified option name. + + The message that describes the error. + The name of the missing option. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the missing option. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The driver cannot parse the option string. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + Argument out-of-range. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message. + + The name of the parameter to which the out of range value is assigned. + The out of range value. + The allowable range. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the parameter to which the out of range value is assigned. + + + + + The out of range value. + + + + + The allowable range. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The instrument reset failed. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The instrument does not support the reset operation. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The selector is not a simple repeated capability selector, and the selector cannot be parsed. + + + If a more specific exceptions is available, it will be used: SelectorNameException, + SelectorNameUnknownException, SelectorRangeException, SelectorHierarchyException. + Since complex repeated capability selectors may not be used as indexers in IVI.NET, this exception + should never be thrown by an indexer. If the repeated capability selector does not support complex selectors, + use SelectorNameException. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified repeated capability name. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified repeated capability name and selector value. + + The name of the repeated capability (-not- the repeated capability + instance). + The invalid selector value. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the repeated capability (-not- the repeated capability instance). + + + + + The invalid selector value. + + + + + Gets the error message and the repeated capability name, or only the error message if no repeated + capability name is set. + + + + + a hierarchical repeated capability selector includes an invalid number of levels in the hierarchy of + nested identifiers. + + + If the only problem is an unknown name or names in the range, the Selector Name Exception should be + used. + Since complex repeated capability selectors may not be used as indexers in IVI.NET, this exception + should never be thrown by an indexer. If the repeated capability selector does not support complex selectors, + use the Invalid Selector exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified repeated capability name and selector value. + + The name of the repeated capability (-not- the repeated capability + instance). + The repeated capability selector value that contains the invalid hierarchy. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the repeated capability (-not- the repeated capability instance). + + + + + The repeated capability selector value that contains the invalid hierarchy. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + A repeated capability selector is expected, but the driver does not recognize the provided name. + + + This exception should be used with any repeated capability parameter or indexer when a more specific + exception is not appropriate. More specific exceptions are SelectorFormatException, + SelectorRangeException, and SelectorHierarchyException + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified repeated capability name and selector value. + + The name of the repeated capability (-not- the repeated capability + instance). + The repeated capability selector value that contains the invalid name. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the repeated capability (-not- the repeated capability instance). + + + + + The repeated capability selector value that contains the invalid name. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The selector has more than one instance of a repeated capability, but an instance is not specified. An empty + string is only valid for a repeated capability selector if there is only one instance of the repeated + capability. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and repeated capability name. + + The message that describes the error. + The name of the repeated capability (-not- the repeated capability + instance). + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the repeated capability (-not- the repeated capability instance). + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The selector has more than one instance of a repeated capability, but an instance is not specified. An empty + string is only valid for a repeated capability selector if there is only one instance of the repeated + capability. + + + Since complex repeated capability selectors may not be used as indexers in IVI.NET, this exception not + thrown by an indexer. If the repeated capability selector does not support complex selectors, the Invalid + Selector exception is used. + If there is an invalid range or list of repeated capability identifiers in a hierarchical selector that + also has an invalid number of levels, the SelectorHierarchyException is used. If the only problem is an unknown + name or names in the range, the SelectorNameException is used. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified repeated capability name and selector value. + + The name of the repeated capability (-not- the repeated capability + instance). + The repeated capability selector value that contains the invalid range. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the repeated capability (-not- the repeated capability instance). + + + + + The repeated capability selector value that contains the invalid range. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The IVI.NET session factory method could not find a driver session that could be used to instantiate an IVI.NET + instrument driver. + + + Name may refer to either a logical name or a physical name in the configuration store. This error is + thrown if the session factory method cannot find either a logical name or a driver session name that matches + the specified name, or the logical name references a driver session name that cannot be found. + This exception shall only be thrown by IVI.NET session factory methods distributed by the IVI Foundation + as part of the IVI.NET Shared Components. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message and the logical or driver session + name specified. + + The message that describes the error. + Name may refer to either a logical name or a physical name in the configuration store. + + + + Initializes a new instance of the class with a specified error message and the logical or driver session + name specified. + + The message that describes the error. + Name may refer to either a logical name or a physical name in the configuration store. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The logical name or driver session name passed to the IVI.NET session factory method. For IVI.NET + instrument drivers, logical names refer to driver sessions. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The simulation property cannot be set to false, only to true. Some drivers may not allow simulation to be + changed at all. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + An instance of the specific driver referenced by the driver session name could not be created, or did not + support the specified type. + + + This error is thrown after the driver session has been found, and the software module referenced by the + driver session has been found. The cause of the error is that the specific driver could not be instantiated, or + the driver did not support the specified type. + For example, the session factory specifies that the type to be returned is IviDmm, but the driver + doesn't support the IviDmm instrument class, this exception will be thrown. + This exception shall only be thrown by IVI.NET session factory methods distributed by the IVI Foundation + as part of the IVI.NET Shared Components. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message with the software module and type. + + The name of the specific driver's software module. + The class name, supported by the specific driver, that the session factory method is trying to + return. + + + + Initializes a new instance of the class with a specified error message with the software module and type. + + The name of the specific driver's software module. + The class name, supported by the specific driver, that the session factory method is trying to + return. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the specific driver's software module referenced by the driver session. + + + + + The class name, supported by the specific driver, that the session factory method is trying to return. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The IVI.NET session factory method could not find the software module referenced by the driver session in the + configuration store. + + + This error is thrown after the driver session has been found. The cause of the error is that the + software module referenced by the driver session could not be found. + In some cases, a driver session is connected to a specific driver's software module, and then that + driver is uninstalled, removing the software module entry from the configuration store. In this case, the + software module reference is maintained in the driver session, but the software module itself is missing. This + can be addressed by reinstalling the driver. + This exception shall only be thrown by IVI.NET session factory methods distributed by the IVI Foundation + as part of the IVI.NET Shared Components. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message with the driver session and software + module specified. + + The name of the driver session to be instantiated by the IVI.NET session factory + method. + The name of the specific driver's software module referenced by the driver + session. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the driver session to be instantiated by the IVI.NET session factory method. + + + + + The name of the specific driver's software module referenced by the driver session. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + Trigger Not Software. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error + message and a reference to the inner exception that is the cause + of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + The actual trigger source. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the actual trigger source. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The driver received an unexpected response from the instrument. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The option string contains an option name that it does not recognize. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified file name. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified file name and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified option name. + + The message that describes the error. + The unknown option name. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The unknown option name. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + When establishing the map from virtual repeated capability names to physical repeated capability names, the + physical name was not found.. + + + This exception also applies in cases where any member of a virtual range maps to a physical name that + does not exist. + Since the driver is required to read all relevant configuration store information in the constructor, + this exception is only thrown by the constructor. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with the data needed to identify where in the configuration store + the unknown physical identifier is used. + + The name of the driver session in which the unknown physical name is + referenced. + The name of the repeated capability (-not- the repeated capability + instance). + The virtual name (defined for the repeated capability) which references the + unknown physical name. + The unknown physical name. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the repeated capability (-not- the repeated capability instance). + + + + + The driver session that contains the unknown physical name. + + + + + For the specified driver session and repeated capability, the virtual name that points to the unknown + physical name. + + + + + The unknown physical name. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + Unrecoverable failure. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner + exception that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified actual count and capacity. + + The valid point count specified in the waveform or spectrum configure method. + The capacity of the waveform or spectrum. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The valid point count specified in the waveform or spectrum configure method. + + + + + The capacity of the waveform or spectrum. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + An enumeration value or a discrete value from a list of defined values is not supported by the specific driver. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with a specified parameter name and enumeration value. + + The name of the parameter to which the unsupported value is assigned. + The enumeration value that is not supported. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the exception + being thrown. + The that contains contextual information about the source or + destination. + + + + The name of the parameter to which the unsupported value is assigned. + + + + + The value that is not supported. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The base interface for synchronization locks obtained on the driver session. + + + + + Releases a driver synchronization lock. + + + + + IMemorySpectrum is a template interface for an IVI.NET spectrum that provides direct access to the data array + so it can be used where the data array is not in conventional memory. + + An IVI.NET standard arithmetic type. + + + + ISpectrum is the most basic template interface for an IVI.NET spectrum. ISpectrum does not provide direct + access to the data array so it can be used where the data array is not in conventional memory. ISpectrum is + also the basis for other spectrum types. + + Int64, Int32, Int16, Byte, Single, or Double. + + + + The Configure method fully defines the frequency (implicit) axis and number of data points in the spectrum. + Because of the interaction between these values, they are set as a group with this method or when the + spectrum is initially created. If triggerTime is not specified, it defaults to NaT. If actualCount is not + specified, the number of elements in the spectrum is not changed. + + The frequency of the first (index 0) data point in the data array. + The frequency of the final data point in the data array (that is the data point + at index ActualCount-1). + The time that this measurement was triggered. + The actual number of elements in the spectrum. + Ths Configure call does not change any of the explicit data in the spectrum if the extent of the + array is not changed. No changes to the underlying data array are made if the extent of the array is not + changed by specifying an actualCount that is different from the array currently in the spectrum. If the + actualCount is specified and it is different from the current value of Actual Count, the mechanism by which + the array is extended or contracted is driver-dependent. Regardless, the capacity of the spectrum shall not + change as a side effect of this method. Classes may optimize memory use by maintaining an actualCount + different from the capacity of the data array. If the actualCount exceeds the data array size, an + Insufficient Capacity Exception is thrown. + + + + The Configure method fully defines the frequency (implicit) axis and number of data points in the spectrum. + Because of the interaction between these values, they are set as a group with this method or when the + spectrum is initially created. If triggerTime is not specified, it defaults to NaT. If actualCount is not + specified, the number of elements in the spectrum is not changed. + + The frequency of the first (index 0) data point in the data array. + The frequency of the final data point in the data array (that is the data point + at index ActualCount-1). + The time that this measurement was triggered. + Ths Configure call does not change any of the explicit data in the spectrum. The capacity of the + spectrum does not change as a side effect of this method. + + + + The Configure method fully defines the frequency (implicit) axis and number of data points in the spectrum. + Because of the interaction between these values, they are set as a group with this method or when the + spectrum is initially created. If triggerTime is not specified, it defaults to NaT. If actualCount is not + specified, the number of elements in the spectrum is not changed. + + The frequency of the first (index 0) data point in the data array. + The frequency of the final data point in the data array (that is the data point + at index ActualCount-1). + The actual number of elements in the spectrum. + Ths Configure call does not change any of the explicit data in the spectrum if the extent of the + array is not changed. No changes to the underlying data array are made if the extent of the array is not + changed by specifying an actualCount that is different from the array currently in the spectrum. If the + actualCount is specified and it is different from the current value of Actual Count, the mechanism by which + the array is extended or contracted is driver-dependent. Regardless, the capacity of the spectrum shall not + change as a side effect of this method. Classes may optimize memory use by maintaining an actualCount + different from the capacity of the data array. If the actualCount exceeds the data array size, an + Insufficient Capacity Exception is thrown. + + + + The Configure method fully defines the frequency (implicit) axis and number of data points in the spectrum. + Because of the interaction between these values, they are set as a group with this method or when the + spectrum is initially created. If triggerTime is not specified, it defaults to NaT. If actualCount is not + specified, the number of elements in the spectrum is not changed. + + The frequency of the first (index 0) data point in the data array. + The frequency of the final data point in the data array (that is the data point + at index ActualCount-1). + Ths Configure call does not change any of the explicit data in the spectrum. The capacity of the + spectrum does not change as a side effect of this method. + + + + GetAllElements returns a copy of the entire data array in the template data type. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + A copy of the entire data array in the template data type. + If the array is too large, this method may throw an Out Of Memory exception. + + + + GetElements returns a copy of a portion of the entire data array in the template data type, starting at the + specified index and including the number of elements specified by count. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + The index in the spectrum that will be the first element in the returned array. That is, + element zero in the returned array is at this index in the spectrum. + The number of elements to be returned. + A copy of a portion of the entire data array in the template data type, starting at the specified + index and including the number of elements specified by count. + + + + GetScaled returns one element of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the returned value. + + The index of the data element to return. + One element of the data array as a Double. + + + + GetScaled returns all or part of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the values in the returned array. + + The index of the first element in the array to return. + The number of data points to include in the returned array. + All or part of the data array as a Double. + + + + PutElements sets all or part of the data array in a spectrum, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the spectrum + data array to receive the new data. If the array passed extends beyond the end of the spectrum, only + the elements up to the length of the spectrum are copied. The implicit axis of the spectrum is not + changed by PutElements. + + The data to be placed into the spectrum array. + + + + PutElements sets all or part of the data array in a spectrum, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the spectrum + data array to receive the new data. If the array passed extends beyond the end of the spectrum, only + the elements up to the length of the spectrum are copied. The implicit axis of the spectrum is not + changed by PutElements. + + The index of the first element of the data array to change. + The data to be placed into the spectrum array. + + + + This returns the data element at the specified index in the spectrum. Note that for scaled (that is, + integer) types, the scaling must be applied to the returned data element to convert it to a physical value + by the calling program. + + The index of the data element to be returned from the waveform array. + The data element to be retuirned from the spectrum array. + + + + The number of elements that the spectrum array can store. Note that Actual Count may be used to get the + actual number of elements in this spectrum. + + + + + True if one or more points in the spectrum array are not valid, otherwise false. + + If the elements are composed of a floating point type, ContainsInvalidElement shall be true if and + only if at least one element is set to NaN. If the elements are not composed of floating point types, + setting and reading ContainsInvalidElement may throw a Property Not Implemented exeption. + + + + + True if one or more points in the spectrum array are out of range. Out of range values are too large or too + small to represent. Numbers that are too close to zero to represent are not considered out of range. + + If the elements are composed of a floating point type, ContainsOutOfRangeElement shall be true if + and only if at least one element is set to +Inf or -Inf. If the elements are not composed of floating point + types, setting and reading ContainsOutOfRangeElement may throw a Property Not Implemented exeption. + + + + + For waveforms that contain invalid padding data at the beginning of the data array, FirstValidPoint indicates + the first element in the data array with valid data. If there is no padding data at the beginning of the data + array, FirstValidPoint will be zero. + + + + + The frequency difference between subsequent points in the data array. This value is set by the Configure + method. + + + + + The offset to apply to scale integer values. To convert an integer data array element to a physical value + first it is multiplied by the scale, and then the offset is added. If the integers in the data array do + not have an offset, the offset property is 0. If the contents of the data array are floating point scalars, + the offset property is set to 0. If the contents of the data array are some other type, the use of the offset + is dependent on that driver and data type. + + + + + The factor to apply to scale integer values. To convert an integer data array element to a physical value + the element is multiplied by scale, and then the offset is added. If the integers in the data array do not + have an offset, the scale property is set to 1. If the contents of the data array are floating point + scalars, the scale property is set to 1. If the contents of the data array are some other type, the use of + the scale is dependent on that driver and data type. + + + + + The frequency of the first (index 0) data point in the data array. This value is set by the Configure + method. + + + + + The frequency of the final data point in the data array (that is the data point at index ActualCount-1). + This value is set by the Configure method. + + + + + The time that this measurement was triggered. This value is set by the Configure method. + + + + + The actual number of valid elements in the waveform. This count does not include any points occurring + before FirstValidPoint. + + + + + A public, in-memory array containing elements of type T that contains the explicit spectrum data. + Clients can use the Data property to directly access the in-memory data without copying data. + + + + + IMemoryWaveform is a template interface for an IVI.NET waveform that provides direct access to the data array + so it can be used where the data array is not in conventional memory. + + An IVI.NET standard arithmetic type. + + + + IWaveform is the most basic template interface for an IVI.NET waveform. IWaveform does not provide direct + access to the data array so it can be used where the data array is not in conventional memory. IWaveform is + also the basis for other waveform types. + + Int64, Int32, Int16, SByte, Byte, Single, or Double. + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If actualCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The actual number of elements in the waveform. + The time that this measurement was triggered. + The Configure method does not change any of the explicit data in the Waveform. If the actualCount + is specified and it is different from the current value of Actual Count, the mechanism by which the array is + extended or contracted is depends on the implemeting waveform class. Classes may optimize memory use by + maintaining an actualCount different from the capacity of the data array. The capacity of the waveform shall + not change as a side effect of the Configure method. If the actualCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If actualCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The time that this measurement was triggered. + The Configure method does not change any of the explicit data in the Waveform. If the actualCount + is specified and it is different from the current value of Actual Count, the mechanism by which the array is + extended or contracted is depends on the implemeting waveform class. Classes may optimize memory use by + maintaining an actualCount different from the capacity of the data array. The capacity of the waveform shall + not change as a side effect of the Configure method. If the actualCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If actualCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The actual number of elements in the waveform. + The Configure method does not change any of the explicit data in the Waveform. If the actualCount + is specified and it is different from the current value of Actual Count, the mechanism by which the array is + extended or contracted is depends on the implemeting waveform class. Classes may optimize memory use by + maintaining an actualCount different from the capacity of the data array. The capacity of the waveform shall + not change as a side effect of the Configure method. If the actualCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If actualCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The Configure method does not change any of the explicit data in the Waveform. If the actualCount + is specified and it is different from the current value of Actual Count, the mechanism by which the array is + extended or contracted is depends on the implemeting waveform class. Classes may optimize memory use by + maintaining an actualCount different from the capacity of the data array. The capacity of the waveform shall + not change as a side effect of the Configure method. If the actualCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If actualCount is not specified, the number of elements in the waveform is not changed. + + The amount of time between data points in the waveform (required). + The actual number of elements in the waveform. + The Configure method does not change any of the explicit data in the Waveform. If the actualCount + is specified and it is different from the current value of Actual Count, the mechanism by which the array is + extended or contracted is depends on the implemeting waveform class. Classes may optimize memory use by + maintaining an actualCount different from the capacity of the data array. The capacity of the waveform shall + not change as a side effect of the Configure method. If the actualCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If actualCount is not specified, the number of elements in the waveform is not changed. + + The amount of time between data points in the waveform (required). + The Configure method does not change any of the explicit data in the Waveform. If the actualCount + is specified and it is different from the current value of Actual Count, the mechanism by which the array is + extended or contracted is depends on the implemeting waveform class. Classes may optimize memory use by + maintaining an actualCount different from the capacity of the data array. The capacity of the waveform shall + not change as a side effect of the Configure method. If the actualCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + GetAllElements returns a copy of the entire data array in the template data type. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + A copy of the entire data array in the template data type. + If the array is too large, this method may throw an Out Of Memory exception. + + + + GetElements returns a copy of a portion of the entire data array in the template data type, starting at the + specified index and including the number of elements specified by count. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + The index in the Waveform that will be the first element in the returned array. That is, + element zero in the returned array is at this index in the Waveform. + The number of elements to be returned. + A copy of a portion of the entire data array in the template data type, starting at the specified + index and including the number of elements specified by count. + + + + GetScaled returns one element of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the returned value. + + The index of the data element to return. + One element of the data array as a Double. + + + + GetScaled returns all or part of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the values in the returned array. + + The index of the first element in the array to return. + The number of data points to include in the returned array. + All or part of the data array as a Double. + + + + PutElements sets all or part of the data array in a waveform, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the waveform + data array to receive the new data. If the array passed extends beyond the end of the Waveform, only + the elements up to the length of the waveform are copied. The implicit axis of the waveform is not + changed by PutElements. + + The data to be placed into the waveform array. + + + + PutElements sets all or part of the data array in a waveform, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the waveform + data array to receive the new data. If the array passed extends beyond the end of the Waveform, only + the elements up to the length of the waveform are copied. The implicit axis of the waveform is not + changed by PutElements. + + The index of the first element of the data array to change. + The data to be placed into the waveform array. + + + + PutElements sets all or part of the data array in a waveform, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the waveform + data array to receive the new data. If the array passed extends beyond the end of the Waveform, only + the elements up to the length of the waveform are copied. The implicit axis of the waveform is not + changed by PutElements. + + The index of the first element of the data array to change. + The data to be placed into the waveform array. + + + + This returns the data element at the specified index in the waveform. Note that for scaled (that is, + integer) types, the scaling must be applied to the returned data element to convert it to a physical value + by the calling program. + + The index of the data element to be returned from the waveform array. + The data element to be retuirned from the waveform array. + + + + The number of elements that the waveform array can store. Note that Actual Count may be used to get the + actual number of elements in this waveform. + + + + + True if one or more points in the waveform array are not valid, otherwise false. + + If the elements are composed of a floating point type, ContainsInvalidElement shall be true if and + only if at least one element is set to NaN. If the elements are not composed of floating point types, + setting and reading ContainsInvalidElement may throw a Property Not Implemented exeption. + + + + + True if one or more points in the waveform array are out of range. Out of range values are too large or too + small to represent. Numbers that are too close to zero to represent are not considered out of range. + + If the elements are composed of a floating point type, ContainsOutOfRangeElement shall be true if + and only if at least one element is set to +Inf or -Inf. If the elements are not composed of floating point + types, setting and reading ContainsOutOfRangeElement may throw a Property Not Implemented exeption. + + + + + The time between the last valid data point in the waveform and the TriggerTime. Positive + values of EndTime indicate that the End Time occurred after the trigger. + This value is set by the Configure method. + + + + + For waveforms that contain invalid padding data at the beginning of the data array, FirstValidPoint indicates + the first element in the data array with valid data. If there is no padding data at the beginning of the data + array, FirstValidPoint will be zero. + + + + + The amount of time between data points in the data array. This value is set by the Configure method. + + + + + The offset to apply to scale integer values. To convert an integer data array element to a physical value + first it is multiplied by the scale, and then the offset is added. If the integers in the data array do + not have an offset, the offset property is 0. If the contents of the data array are floating point scalars, + the offset property is set to 0. If the contents of the data array are some other type, the use of the offset + is dependent on that driver and data type. + + + + + The factor to apply to scale integer values. To convert an integer data array element to a physical value + the element is multiplied by scale, and then the offset is added. If the integers in the data array do not + have an offset, the scale property is set to 1. If the contents of the data array are floating point + scalars, the scale property is set to 1. If the contents of the data array are some other type, the use of + the scale is dependent on that driver and data type. + + + + + The time between the first valid data point (that is the data point at index FirstValidPoint) in the waveform and the + trigger. Positive values indicate that the StartTime occurred after the trigger. + This value is set by the Configure method. + + + + + The timespan represented by the valid points in the waveform. Numerically, it is equivalent to the + IntervalPerPoint * (ValidPointCount - 1). It is also numerically the EndTime - StartTime. + If valid point count is 0 or 1, the value shall be zero. This value is set by the waveform Configure method. + + + + + The time that this measurement was triggered. Note that this differs from Start Time in that the trigger + may have occurred at some time other than when the first data point was captured, as in pre-trigger or + post-trigger applications. This value is set by the Configure method. + + + + + The actual number of valid elements in the waveform. This count does not include any points occurring + before FirstValidPoint. + + + + + A public, in-memory array containing elements of type T that contains the explicit waveform data. + Clients can use the Data property to directly access the in-memory data without copying data. + + + + + The purpose of the .NET Session Factory is to provide to the client + application a simple mechanism for creating instances of IVI.NET drivers. + Additionally, the activation mechanism of the + .NET Session Factory provides a means of interchanging IVI.NET drivers + without modifying the client program source code. + + + The present design of the .NET Session Factory relies on the + IVI Configuration Store to associate logical names or driver session names with + the specific drivers intended for use. The .NET Session Factory relies + on these mappings to resolve logical names or driver session names provided by a client + programmer to an assortment of initial settings provided in the + configuration store. Once the .NET Session Factory has instantiated a + driver according to the data in the configuration + store, then the client program communicates directly with the component, + with no intermediate run-time layer required to invoke methods. + + + + + Creates an instance of an IVI.NET driver and returns + an Object Reference to the caller. The creation process uses the + Configuration Server to map the provided Logical Name or Driver Session name to the .NET Type + of the corresponding driver. The .NET Type used to activate the driver + is retrieved from the appropriate IviDriverSession entry in the + configuration store. + Optionally performs a Reset and queries the instrument to + validate the instrument model. + + Logical Name or driver session name of the IVI.NET driver to create. + + An IIviDriver interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Creates an instance of an IVI.NET driver and returns + an Object Reference to the caller. The creation process uses the + Configuration Server to map the provided Logical Name or Driver Session name to the .NET Type + of the corresponding driver. The .NET Type used to activate the driver + is retrieved from the appropriate IviDriverSession entry in the + configuration store. + Optionally performs a Reset and queries the instrument to + validate the instrument model. + + Logical Name or driver session name of the IVI.NET driver to create. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + The user can use the OptionsString parameter to specify the initial values of + certain IVI inherent properties for the session. The format of an assignment in the OptionsString parameter + is "Name=Value", + where Name is one of: RangeCheck, QuerytInstrStatus, Cache, Simulate, RecordCoercions, InterchangeCheck, + or DriverSetup. Value is either true or false except for DriverSetup. + If the Options String parameter contains an assignment for the Driver Setup property, + the Initialize function assumes that everything following "DriverSetup=" is part of the assignment. + + An IIviDriver interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Creates an instance of an IVI.NET driver and returns + an Object Reference to the caller. The creation process uses the + Configuration Server to map the provided Logical Name or Driver Session name to the .NET Type + of the corresponding driver. The .NET Type used to activate the driver + is retrieved from the appropriate IviDriverSession entry in the + configuration store. + Optionally performs a Reset and queries the instrument to + validate the instrument model. + + Logical Name or driver session name of the IVI.NET driver to create. + Specifies whether to verify the ID of the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + Specifies whether to reset the instrument. + The user can use the OptionsString parameter to specify the initial values of + certain IVI inherent properties for the session. The format of an assignment in the OptionsString parameter + is "Name=Value", + where Name is one of: RangeCheck, QuerytInstrStatus, Cache, Simulate, RecordCoercions, InterchangeCheck, + or DriverSetup. Value is either true or false except for DriverSetup. + If the Options String parameter contains an assignment for the Driver Setup property, + the Initialize function assumes that everything following "DriverSetup=" is part of the assignment. + + An IIviDriver interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Creates an instance of an IVI.NET driver and returns + an Object Reference to the caller. The creation process uses the + Configuration Server to map the provided Logical Name or Driver Session name to the .NET Type + of the corresponding driver. The .NET Type used to activate the driver + is retrieved from the appropriate IviDriverSession entry in the + configuration store. + Optionally performs a Reset and queries the instrument to + validate the instrument model. + + The type interface to retrieve from the specific driver. Typically, this is a root interface reference, such as IIviScope. + Logical Name or Driver Session name of the IVI.NET driver to create. + + An IIviDriver interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Creates an instance of an IVI.NET driver and returns + an Object Reference to the caller. The creation process uses the + Configuration Server to map the provided Logical Name or Driver Session name to the .NET Type + of the corresponding driver. The .NET Type used to activate the driver + is retrieved from the appropriate IviDriverSession entry in the + configuration store. + Optionally performs a Reset and queries the instrument to + validate the instrument model. + + The type interface to retrieve from the specific driver. Typically, this is a root interface reference, such as IIviScope. + Logical Name or Driver Session name of the IVI.NET driver to create. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + + An IIviDriver interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Creates an instance of an IVI.NET driver and returns + an Object Reference to the caller. The creation process uses the + Configuration Server to map the provided Logical Name or driver session name to the .NET Type + of the corresponding driver. The .NET Type used to activate the driver + is retrieved from the appropriate IviDriverSession entry in the + configuration store. + Optionally performs a Reset and queries the instrument to + validate the instrument model. + + The type interface to retrieve from the specific driver. Typically, this is a root interface reference, such as IIviScope. + Logical Name or driver session name of the IVI.NET driver to create. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + The user can use the OptionsString parameter to specify the initial values of + certain IVI inherent properties for the session. The format of an assignment in the OptionsString parameter + is "Name=Value", + where Name is one of: RangeCheck, QuerytInstrStatus, Cache, Simulate, RecordCoercions, InterchangeCheck, + or DriverSetup. Value is either true or false except for DriverSetup. + If the Options String parameter contains an assignment for the Driver Setup property, + the Initialize function assumes that everything following "DriverSetup=" is part of the assignment. + + An interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Creates an instance of an IVI.NET driver and returns + an Object Reference to the caller. The creation process uses the + Configuration Server to map the provided Logical Name or driver session name to the .NET Type + of the corresponding driver. The .NET Type used to activate the driver + is retrieved from the appropriate IviDriverSession entry in the + configuration store. + Optionally performs a Reset and queries the instrument to + validate the instrument model. + + The type interface to retrieve from the specific driver. Typically, this is a root interface reference, such as IIviScope. + Logical Name or driver session name of the IVI.NET driver to create. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + The user can use the OptionsString parameter to specify the initial values of + certain IVI inherent properties for the session. The format of an assignment in the OptionsString parameter + is "Name=Value", + where Name is one of: RangeCheck, QuerytInstrStatus, Cache, Simulate, RecordCoercions, InterchangeCheck, + or DriverSetup. Value is either true or false except for DriverSetup. + If the Options String parameter contains an assignment for the Driver Setup property, + the Initialize function assumes that everything following "DriverSetup=" is part of the assignment. + + An interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Load the configuration store into memory. It loads it from the + process default location if it is specified, otherwise it loads + it from the master location. + + Deserialized configuration store. + + + + Specifies the type of synchronization lock to acquire on the driver session. + + + + + The lock protects simultaneous access to the driver session amongst multiple threads within the same .NET AppDomain. + + + + + The lock protects simultaneous access to the driver session amongst multiple threads within a process, + as well as amongst multiple processes. + + + + + The LockManager class is used by driver developers to implement multithread safety. Driver implementation code internally creates + a single instance of this class and uses it to acquire a lock for the duration of individual method calls. The LockManager class + is also used by driver developers to implement the IIviDriverUtility.Lock method. + + + + + Creates an instance of the LockManager. The LockManager should be instantiated within the driver constructor and only a + single instance of the LockManager should be instantiated for a particular driver instance. The constructor of the LockManager + automatically determines what type of lock (.NET AppDomain-wide or machine-wide) will be created based upon the requested lock type + and access key as well as other driver instances that have already been created with the same access key. + + A reference to the driver that is using the LockManager. + The type of lock to create. Note that the actual type created can differ. See IVI-3.2 for details. + A user-specified access key. + + + + This method is used to implement the IIviDriverUtility.Lock method. Driver implementations should directly delegate + to this method from their implementation of IIviDriverUtility. The calling code is blocked until the lock is acquired. + + An instance of a class that holds the lock and will release it upon a call to IIviDriverLock.Unlock. + + + + This method is used to implement the IIviDriverUtility.Lock method. Driver implementations should directly delegate + to this method from their implementation of IIviDriverUtility. The calling code is blocked until the lock is acquired. + + The maximum amount of time to wait to acquire the lock. An exception is thrown if the + lock cannot be acquired within the time limit specified. + An instance of a class that holds the lock and will release it upon a call to IIviDriverLock.Unlock. + + + + Disposes of the LockManager class. This method should be called from the owning driver's Dispose implementation. + + + + + Disposes of the LockManager class. This method should be called from the owning driver's Dispose implementation. + Derived classes can override this method to dispose of their resources while ensuring that the LockManager + class resources are also properly disposed. + + Indicates if the Dispose call is occurring as a result of an explicit call to Dispose. This + determines whether or not it is safe to dispose of managed resources. True indicates that managed resources can + be disposed as the call is coming from an explicit call to Dispose. A value of False for this parameter indicates + that Dispose was called from the Finalizer, in which case it is not safe to Dispose of any managed resources held by this class. + + + + Represents an instant in time, typically expressed as a date and time of day, with resolution + suitable for LxiSync times. + + + Instruments sometimes require an absolute time which exceeds the resolution of the .NET Framework DateTime + struct. To address these cases, IVI.NET provides the PrecisionDateTime struct, which provides a level of + resolution similar to that defined by the IEEE 1588 standard. PrecisionDateTime supports a range of dates + from January 1, 1970 through December 31, 9999. Time is internally represented in seconds since January 1, + 1970 (the IEEE 1588 epoch 0). PrecisionDateTime stores date and time with femtosecond (1.0e-15 second) + resolution. The PrecisionDateTime struct is always based on the Gregorian calendar. Time may be UTC time, + local time, or unspecified. + + + + + This constructor exists to create a NotATime "value" for PrecisionDateTime. + + + + + This constructor exists to set the DateTimeKind and initialize other variables used to calculate times. + + The DateTimeKind of the PrecisionDateTime instance. Values may be UTC, local, or unspecified. + + + + Create a PrecisionDateTime instance from a .NET Framework DateTime parameter. The number of ticks + (100-nanosecond intervals) in the DateTime object is used to initialize the PrecisionDateTime object. Since + the DateTime class only supports a resolution of 100 nanoseconds, the seconds parameter allows increased + resolution. The range of valid dates is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 + 23:59:59.999999999999999 UTC. If the resulting date is out of range, the constructor throws an error. + + A .NET Framework DateTime object. + The number of seconds added to the time represented by dateTime. + If the Kind of the DateTime object is UTC, then the Kind of the new PrecisionDateTime is UTC. + Otherwise, the Kind of the new PrecisionDateTime object is Local. PrecisionDateTime does not support + Unspecified DateTimekind. + + + + + Create a PrecisionDateTime instance from a .NET Framework DateTime parameter. The number of ticks + (100-nanosecond intervals) in the DateTime object is used to initialize the PrecisionDateTime object. Since + the DateTime class only supports a resolution of 100 nanoseconds, the seconds parameter allows increased + resolution. The range of valid dates is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 + 23:59:59.999999999999999 UTC. If the resulting date is out of range, the constructor throws an error. + + A .NET Framework DateTime object. + If the Kind of the DateTime object is UTC, then the Kind of the new PrecisionDateTime is UTC. + Otherwise, the Kind of the new PrecisionDateTime object is Local. PrecisionDateTime does not support + Unspecified DateTimekind. + + + + + Create a PrecisionDateTime instance from a decimal number of seconds parameter. The range of valid dates + is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 23:59:59.999999999999999 UTC. If the resulting date is + out of range, the constructor throws an error. + + The number of seconds (including fractional seconds) since 1/1/1970 00:00:00.0. Must + be positive. + The DateTimeKind of the PrecisionDateTime instance. Values may be UTC, Local, or + Unspecified, but Unspecified is coerced to Local. + + + + Create a PrecisionDateTime instance from a decimal number of seconds parameter. The range of valid dates + is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 23:59:59.999999999999999 UTC. If the resulting date is + out of range, the constructor throws an error. Time is Local time. + + The number of seconds (including fractional seconds) since 1/1/1970 00:00:00.0 UTC. + + + + Create a PrecisionDateTime instance from two LxiSync doubles that represent the number of seconds since 1/1/1970. + The range of valid dates is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 23:59:59.999999999999999 UTC. If + the resulting date is out of range, the constructor throws an error. + + The total number of seconds since the beginning of the IEEE 1588 epoch (that + is, the total number of seconds since 1/1/1970), rounded down to the nearest second. + A fractional number of seconds (greater than or equal to 0.0, and less + than 1.0) added to the time represented by lxiBaseSeconds. This parameter provides for femtosecond resolution + to the right of the decimal. Resolution finer than femtoseconds will be rounded down. Must be positive. + The DateTimeKind of the PrecisionDateTime instance. Values may be UTC, Local, or + Unspecified, but Unspecified is coerced to Local. + + + + Create a PrecisionDateTime instance from two LxiSync doubles that represent the number of seconds since 1/1/1970. + The range of valid dates is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 23:59:59.999999999999999 UTC. If + the resulting date is out of range, the constructor throws an error. Time is Local time. + + The total number of seconds since the beginning of the IEEE 1588 epoch (that + is, the total number of seconds since 1/1/1970), rounded down to the nearest second. + A fractional number of seconds (greater than or equal to 0.0, and less + than 1.0) added to the time represented by lxiBaseSeconds. This parameter provides for femtosecond resolution + to the right of the decimal. Resolution finer than femtoseconds will be rounded down. Must be positive. + + + + Create a PrecisionDateTime instance from a string that represents the number of seconds since 1/1/1970. + The range of valid dates is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 23:59:59.999999999999999 UTC. If + the resulting date is out of range, the constructor throws an error. + + The number of seconds (including fractional seconds) since 1/1/1970. Must be positive. + The expected format is a sequence of digits followed by a decimal point, followed by another series of digits. For + example, "123456.12345678". + The DateTimeKind of the PrecisionDateTime instance. Values may be UTC, local, or unspecified. + + + + Create a PrecisionDateTime instance from two LxiSync doubles that represent the number of seconds since 1/1/1970. + The range of valid dates is between 1/1/1970 00:00:00.0 UTC and 12/31/9999 23:59:59.999999999999999 UTC. If + the resulting date is out of range, the constructor throws an error. Time is Local time. + + The number of seconds (including fractional seconds) since 1/1/1970. Must be positive. + The expected format is a sequence of digits followed by a decimal point, followed by another series of digits. For + example, "123456.12345678". + + + + Determines if the given date time falls during daylight savings, otherwise false. + + True if the given date time falls during daylight savings, otherwise false. + + + + Determines the UTC offset of this precision date time. + + Returns a TimeSpan object with the UTC offset. + + + + The PrecisionDateTime internal representation of femtoseconds. + + + + + Adds the value of the specified PrecisionTimeSpan to the value of this instance. This method does not change + the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result + of this operation. + + The PrecisionTimeSpan instance to be added to this instance. + A new PrecisionDateTime instance that is the sum of this instance and pts. + + + + Adds the value of the specified TimeSpan to the value of this instance. This method does not change + the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result + of this operation. + + The TimeSpan instance to be added to this instance. + A new PrecisionDateTime instance that is the sum of this instance and ts. If this instance is set + to Not a Time, the method returns Not a Time. + + + + Adds the specified number of days to the value of this instance. This method does not change the value of + this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result of this + operation. + + The number of days to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional days added. If this instance is set to Not a + Time, the method returns Not a Time. + + + + Adds the specified number of femtoseconds to the value of this instance. A femtosecond is 1.0e-15 second. + This method does not change the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned + whose value is the result of this operation. + + The number of femtoseconds to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional femtoseconds added. + + + + Adds the specified number of hours to the value of this instance. This method does not change the value of + this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result of this + operation. + + The number of hours to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional hours added. + + + + Adds the specified number of microseconds to the value of this instance. A microsecond is 1.0e-6 second. + This method does not change the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned + whose value is the result of this operation. + + The number of microseconds to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional microoseconds added. + + + + Adds the specified number of milliseconds to the value of this instance. A millisecond is 1.0e-3 second. + This method does not change the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned + whose value is the result of this operation. + + The number of milliseconds to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional millioseconds added. + + + + Adds the specified number of minutes to the value of this instance. This method does not change the value of + this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result of this + operation. + + The number of minutes to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional minutes added. + + + + Adds the specified number of months to the value of this instance. This method does not change the value of + this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result of this + operation. + + The number of months to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional months added. + + + + Adds the specified number of nanoseconds to the value of this instance. A nanosecond is 1.0e-9 second. + This method does not change the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned + whose value is the result of this operation. + + The number of nanoseconds to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional nanoseconds added. + + + + Adds the specified number of picoseconds to the value of this instance. A picosecond is 1.0e-12 second. + This method does not change the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned + whose value is the result of this operation. + + The number of picoseconds to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional picoseconds added. + + + + Adds the specified number of seconds to the value of this instance. This method does not change the value of + this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result of this + operation. + + The number of seconds to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional seconds added. + + + + Adds the specified number of seconds to the value of this instance. This method does not change the value of + this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result of this + operation. + + The number of seconds to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional seconds added. + + + + Adds the specified number of years to the value of this instance. This method does not change the value of + this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result of this + operation. + + The number of years to be added to the DateTime. + A new PrecisionTimeSpan instance with the additional years added. + + + + Compares two instances of PrecisionDateTime and returns an indication of their relative values. Before + comparing DateTime objects, both are converted to UTC time. + + A PrecisionDateTime. + A PrecisionDateTime. + A signed number indicating the relative values of pdt1 and pdt2. If the return value is less + than zero, then pdt1 falls before pdt2. If the return value is equal to zero, then pdt1 and pdt2 are + the same date and time. If the return value is greater than zero, then pdt1 falls after pdt2. + + + + Compares this instance to a specified PrecisionDateTime object and returns an indication of their relative + values. Before comparing DateTime objects, both are converted to UTC time. + + A PrecisionDateTime object. + A signed number indicating the relative values of this instance and 'other'. If the return value is less + than zero, then this instance falls before 'other'. If the return value is equal to zero, then this instance and + 'other' are the same date and time. If the return value is greater than zero, then this instance falls after 'other'. + + + + Compares this instance to a specified PrecisionDateTime object and returns an indication of their relative + values. Before comparing DateTime objects, both are converted to UTC time. + Any instance of DateTime, regardless of its value, is considered greater than a null reference. + + A boxed PrecisionDateTime object to compare, or a null reference. + A signed number indicating the relative values of this instance and 'obj'. If the return value is + less than zero, then this instance falls before 'obj'. If the return value is equal to zero, then this + instance and 'obj' are the same date and time. If the return value is greater than zero, then this instance + falls after 'obj'. + + + + Tests whether the another PrecisionDateTime refers to this instance. + + A PrecisionDateTime object. + True if this instance and the 'other' instance are the same instance of PrecisionDateTime. + + + + Subtracts the value of the specified PrecisionTimeSpan from the value of this instance. This method does not change + the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result + of this operation. + + The PrecisionTimeSpan instance to be subtracted from this instance. + A new PrecisionDateTime instance that is the difference of this instance and the pts. + + + + Subtracts the value of the specified TimeSpan from the value of this instance. This method does not change + the value of this PrecisionDateTime. Instead, a new PrecisionDateTime is returned whose value is the result + of this operation. + + The TimeSpan instance to be subtracted from this instance. + A new PrecisionDateTime instance that is the difference of this instance and ts. + + + + Returns a new DateTime with the value of this instance of PrecisionDateTime, with femtoseconds rounded down + to the nearest 100 nanoseconds. The DateTimeKind for the new DateTime is the same as for this instance + of PrecisionDateTime. + + A DateTime whose value is the date and time represented by this instance with femtoseconds + rounded down to the nearest 100 nanoseconds. + + + + Returns a new Decimal whose value is the value of this instance of PrecisionDateTime in seconds, with + resolution to the nearest femtosecond. + + A Decimal whose value represents the interval from 1/1/1970 to the date and time represented + by this instance in seconds with femtosecond resolution. + + + + Returns a new PrecisionDateTime whose value is the value of this instance of PrecisionDateTime converted + to local time (if needed). If DateTimeKind is unspecified in this instance, it is treated as local time. + + A PrecisionDateTime whose value is the date and time represented by this instance, converted to + local time (if needed). + + + + Converts the value of the current PrecisionDateTime object to its equivalent string representation. The + string is a subset of the string returned by this.ToDateTime().ToString(), with the addition of fractional + seconds to femtosecond resolution whenever long times are used. + + A PrecisionDateTime format string, which may be a single standard PrecisionDateTime + format specifier, or a format string composed of custom PrecisionDateTime format specifier(s). + A formatted string representation of the value of the current PrecisionDateTime object. + + + + Returns a new PrecisionDateTime whose value is the value of this instance of PrecisionDateTime converted + to universal time (if needed). If DateTimeKind is unspecified in this instance, it is treated as local time. + + A PrecisionDateTime whose value is the date and time represented by this instance, converted to + universal time (if needed). + + + + Adds a specified time interval to a specified date and time, yielding a new date and time. + + A PrecisionDateTime that contains the date and time to be added to. + A PrecisionTimeSpan that contains the interval to add. + A PrecisionDateTime whose value is the sum of the date and time represented by pdt and the time interval + represented by pts. + + + + Adds a specified time interval to a specified date and time, yielding a new date and time. + + A PrecisionDateTime that contains the date and time to be added to. + A TimeSpan that contains the interval to add. + A PrecisionDateTime whose value is the sum of the date and time represented by pdt and the time + interval represented by ts. + + + + Subtracts a specified time interval from a specified date and time, yielding a new PrecisionDateTime. + + A PrecisionDateTime that contains the date and time to be subtracted from. + A PrecisionTimeSpan that contains the interval to subtract. + A PrecisionDateTime whose value is the difference of the date and time represented by pdt and the + time interval represented by pts. + + + + Subtracts a specified time interval from a specified date and time, yielding a new PrecisionDateTime. + + A PrecisionDateTime that contains the date and time to be subtracted from. + A TimeSpan that contains the interval to subtract. + A PrecisionDateTime whose value is the difference of the date and time represented by pdt and the + time interval represented by ts. + + + + Subtracts a specified date and time from another specified date and time, yielding a time interval that + is the interval between the two. + + A PrecisionDateTime that contains the date and time to be subtracted from. + A PrecisionDateTime that contains the date and time to be subtracted. + A PrecisionTimeSpan whose value is the difference of the date and time represented by pdt and the + date and time represented by pdt2. + + + + Subtracts a specified date and time from another specified date and time, yielding a time interval that + is the interval between the two. + + A PrecisionDateTime that contains the date and time to be subtracted from. + A DateTime that contains the date and time to be subtracted. + A PrecisionTimeSpan whose value is the difference of the date and time represented by pdt and the + date and time represented by dt. + + + + Determines whether two specified instances of PrecisionDateTime are equal. + + A PrecisionDateTime. + A PrecisionDateTime. + true if pdt1 and pdt2 represent the same date and time; otherwise, false. + + + + Determines whether two specified instances of PrecisionDateTime are not equal. + + A PrecisionDateTime. + A PrecisionDateTime. + true if pdt1 and pdt2 represent different date and times; otherwise, false. + + + + Determines whether one specified PrecisionDateTime is later than or equal to another specified + PrecisionDateTime. + + A PrecisionDateTime. + A PrecisionDateTime. + true if pdt1 and pdt2 represent the same date and time, or if pdt1 is later than pdt2, otherwise + false. + + + + Determines whether one specified PrecisionDateTime is earlier than or equal to another specified + PrecisionDateTime. + + A PrecisionDateTime. + A PrecisionDateTime. + true if pdt1 and pdt2 represent the same date and time, or if pdt1 is earlier than pdt2, otherwise + false. + + + + Determines whether one specified PrecisionDateTime is later than another specified PrecisionDateTime. + + A PrecisionDateTime. + A PrecisionDateTime. + true if pdt1 is later than pdt2, otherwise false. + + + + Determines whether one specified PrecisionDateTime is earlier than another specified PrecisionDateTime. + + A PrecisionDateTime. + A PrecisionDateTime. + true if if pdt1 is earlier than pdt2, otherwise false. + + + + Determines whether two specified instances of PrecisionDateTime represent the same precision date and time. + + A boxed PrecisionDateTime object to compare, or a null reference. + True if this instance and the 'obj' instance represent the same precision date and time. + + + + Returns the hash code for this instance. + + A 32-bit signed integer hash code. + + + + Converts the value of the current PrecisionDateTime object to its equivalent string representation using the + default “G” format specifier. + + The formatted date and time. + + + + The difference between UTC and local time in seconds for this precision date time. + + + + + The PrecisionDateTime internal representation of integer seconds from the start of the year 0 to the start + of the year 1970. + + + + + The day of the month represented by this instance, expressed as an integer value between 1 and 31. + + + + + A DayOfWeek enumerated constant that indicates the day of the week of this DateTime value. + + + + + The day of the year represented by this instance, expressed as an integer value between 1 and 366. + + + + + The femtosecond component of the date and time represented by this instance, expressed as an integer value + between 0 and 999,999,999,999,999. + + + + + The hour component of the date represented by this instance, expressed as an integer value between 0 and 23. + + + + + Indicates whether this instance represents Not a Time. + + + + + The hour component of the date represented by this instance, expressed as an integer value between 0 and 23. + + + + + The largest possible value of PrecisionDateTime. The value of this constant is equivalent to + 23:59:59.999999999999999, December 31, 9999, exactly one femtosecond before 00:00:00, January 1, 10000. + This property is read-only. + + + + + The microsecond component of the date and time represented by this instance, expressed as a value + between 0 and 999,999. + + + + + The millisecond component of the date and time represented by this instance, expressed as a value + between 0 and 999,999. + + + + + The minute component of the date represented by this instance, expressed as an integer value between 0 and + 59. + + + + + Represents the smallest possible value of PrecisionDateTime. The value of this constant is equivalent to + 00:00:00.000000000000000, January 1, 0001. This property is read-only. + + + + + The month component of the date represented by this instance, expressed as an integer value between 0 and 12. + + + + + The nanosecond component of the date and time represented by this instance, expressed as a value + between 0 and 999,999,999. + + + + + A PrecisionDateTime instance that represents NaT (Not a Time). + + + + + The PrecisionDateTime object that is set to the current date and time on this computer, expressed as the + local time, to DateTime resolution. + + + + + The picosecond component of the date and time represented by this instance, expressed as a value + between 0 and 999,999,999,999. + + + + + The second component of the date represented by this instance, expressed as an integer value between 0 and 59. + + + + + The fractional portion (remainder) since the end of the last whole second. The value will always be less + than 1. + + + + + The total number of seconds since the beginning of the IEEE 1588 epoch (that is, the total number of seconds + since 1/1/1970), rounded down to the nearest second. + + The value does not have a fractional part. For the fractional part of the total number of seconds + since the beginning of the IEEE 1588 epoch, see the SecondsFractional property. + + + + + The year component of the date represented by this instance, expressed as an integer value between 1970 and + 9999. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to en-US. + + + + + Looks up a localized string similar to PrecisionDateTime does not support dates earlier than 1/1/1970.. + + + + + Looks up a localized string similar to PrecisionDateTime does not support dates later than 12/31/9999.. + + + + + Looks up a localized string similar to M/d/yyyy. + + + + + Looks up a localized string similar to NaT. + + + + + Looks up a localized string similar to Not a UTC date and time.. + + + + + Looks up a localized string similar to yyyy-MM-dd HH:mm:ss.fffffffffffffff Z. + + + + + Looks up a localized string similar to h:m tt. + + + + + Looks up a localized string similar to h:m:s.fffffffffffffff tt. + + + + + Looks up a localized string similar to The format of the input string is invalid.. + + + + + Looks up a localized string similar to This instance of PrecisionDateTime is NaT.. + + + + + Looks up a localized string similar to The parameter must be a boxed PrecisionDateTime object.. + + + + + Looks up a localized string similar to The parameter must be less than 1.0.. + + + + + Looks up a localized string similar to The parameter must be zero or positive.. + + + + + Looks up a localized string similar to Unexpected error. + + + + + Looks up a localized string similar to The parameter cannot be converted to a System.Decimal number due to a formatting error.. + + + + + Looks up a localized string similar to en-US. + + + + + Looks up a localized string similar to PrecisionTimeSpan overflowed because the duration is too long.. + + + + + Looks up a localized string similar to The multiplier is too large for the given time span.. + + + + + Looks up a localized string similar to The parameter must be a boxed PrecisionTimeSpan object.. + + + + + Looks up a localized string similar to The secondsFractional parameter must be between -1.0 and +1.0, exclusive.. + + + + + Looks up a localized string similar to The parameter cannot be converted to a System.Decimal number due to an overflow.. + + + + + Represents a time span with resolution suitable for LxiSync times. + + + Instruments sometimes require a time span which exceeds the resolution of the .NET Framework TimeSpan struct. + To address these cases, IVI.NET provides the PrecisionTimeSpan struct, which provides a level of resolution + similar to that defined by the IEEE 1588 standard. PrecisionTimeSpan supports positive and negative time spans, + with a maximum length exactly equal to the number of seconds from the start of day, January 1, 1970 through the + end of day, December 31, 9999. Time is internally represented in seconds. PrecisionTimeSpan stores time with + femtosecond (1.0e-15 second) resolution. + + + + + This constructor exists to initialize variables used to calculate times. + + Here only because struct constructors must have a parameter. It is not used. + + + + Create a PrecisionTimeSpan instance from a .NET Framework TimeSpan parameter. Since the TimeSpan class + only supports a resolution of 100 nanoseconds, the deltaSeconds parameter allows the user to specify + additional resolution. + + A .NET Framework TimeSpan object that refers to an interval shorter than the absolute + value of PrecisionTimeSpan.MaxValue. The number of ticks (100-nanosecond intervals) in the TimeSpan object + is used to initialize the PrecisionTimeSpan object. + The number of seconds added to the time represented by span. + If the resulting precision time span is greater than the absolute value of + PrecisionTimeSpan.MaxValue, the constructor throws an error. + + + + Create a PrecisionTimeSpan instance from a .NET Framework TimeSpan parameter. + + A .NET Framework TimeSpan object that refers to an interval shorter than the absolute + value of PrecisionTimeSpan.MaxValue. The number of ticks (100-nanosecond intervals) in the TimeSpan object + is used to initialize the PrecisionTimeSpan object. + If the resulting precision time span is greater than the absolute value of + PrecisionTimeSpan.MaxValue, the constructor throws an error. + + + + Create a PrecisionTimeSpan instance from a number of seconds. + + The number of seconds in the time span. + If the resulting precision time span is greater than the absolute value of + PrecisionTimeSpan.MaxValue, the constructor throws an error. + + + + Create a PrecisionTimeSpan instance from two LxiSync doubles that represent the number of seconds in the time + span. + + The total number of seconds in the time span. + A fractional number of seconds (between -1.0 and 1.0, exclusive) added to + the time represented by secondsTotal. + If the resulting precision time span is greater than the absolute value of + PrecisionTimeSpan.MaxValue, the constructor throws an error. + + + + Create a PrecisionTimeSpan instance from a string that represents a number of seconds. + + The number of seconds in the time span. Must be positive. The expected format is a + sequence of digits followed by a decimal point, followed by another series of digits. For example, + "123456.12345678". + If the resulting precision time span is greater than the absolute value of + PrecisionTimeSpan.MaxValue, the constructor throws an error. + + + + Adds the value of the specified PrecisionTimeSpan to the value of this instance. This method does not change + the value of this PrecisionTimeSpan. Instead, a new PrecisionTimeSpan is returned whose value is the result + of this operation. + + The PrecisionTimeSpan instance to be added to this instance. + A new PrecisionTimeSpan instance that is the sum of this instance and pts. + + + + Adds the value of the specified TimeSpan to the value of this instance. This method does not change + the value of this PrecisionTimeSpan. Instead, a new PrecisionTimeSpan is returned whose value is the result + of this operation. + + The TimeSpan instance to be added to this instance. + A new PrecisionTimeSpan instance that is the sum of this instance and ts. + + + + Compares two instances of PrecisionTimeSpan and returns an indication of their relative values. + + A PrecisionTimeSpan. + A PrecisionTimeSpan. + A signed number indicating the relative values of pts1 and pts2. If the return value is less + than zero, then pts1 falls before pts2. If the return value is equal to zero, then pts1 and pts2 are + the same. If the return value is greater than zero, then pts1 falls after pts2. + + + + Compares this instance to a specified PrecisionTimeSpan object and returns an indication of their relative + values. + + A PrecisionTimeSpan. + A signed number indicating the relative values of this instance and pts. If the return value is less + than zero, then this instance falls before pts. If the return value is equal to zero, then this instance and + pts are the same. If the return value is greater than zero, then this instance falls after pts. + + + + Compares this instance to a specified PrecisionTimeSpan object and returns an indication of their relative + values. Any instance of PrecisionTimeSpan, regardless of its value, is considered greater than a null reference. + + A boxed PrecisionTimeSpan object to compare, or a null reference. + A signed number indicating the relative values of this instance and pts. If the return value is less + than zero, then this instance falls before pts. If the return value is equal to zero, then this instance and + pts are the same. If the return value is greater than zero, then this instance falls after pts. + + + + Returns the absolute value of this instance. This method does not change the value of this PrecisionTimeSpan. + Instead, a new PrecisionTimeSpan is returned whose value is the result of this operation. + + A new PrecisionTimeSpan instance that is the negative of this instance. + + + + Determines whether two specified instances of PrecisionTimeSpan represent the same precision time span. + + A PrecisionTimeSpan. + True if this instance and the 'other' instance represent the same precision time span. + + + + Returns a new PrecisionTimeSpan instance with a length in days equal to the input parameter. + + A number of days. + A new PrecisionTimeSpan instance with a length in days equal to the input parameter. + + + + Returns a new PrecisionTimeSpan instance with a length in hours equal to the input parameter. + + A number of hours. + A new PrecisionTimeSpan instance with a length in hours equal to the input parameter. + + + + Returns a new PrecisionTimeSpan instance with a length in microseconds equal to the input parameter. + + A number of microseconds. + A new PrecisionTimeSpan instance with a length in microseconds equal to the input parameter. + + + + Returns a new PrecisionTimeSpan instance with a length in milliseconds equal to the input parameter. + + A number of milliseconds. + A new PrecisionTimeSpan instance with a length in milliseconds equal to the input parameter. + + + + Returns a new PrecisionTimeSpan instance with a length in minutes equal to the input parameter. + + A number of minutes. + A new PrecisionTimeSpan instance with a length in minutes equal to the input parameter. + + + + Returns a new PrecisionTimeSpan instance with a length in nanoseconds equal to the input parameter. + + A number of nanoseconds. + A new PrecisionTimeSpan instance with a length in nanoseconds equal to the input parameter. + + + + Returns a new PrecisionTimeSpan instance with a length in picoseconds equal to the input parameter. + + A number of picoseconds. + A new PrecisionTimeSpan instance with a length in picoseconds equal to the input parameter. + + + + Returns a new PrecisionTimeSpan instance with a length in seconds equal to the input parameter. + + A number of seconds. + A new PrecisionTimeSpan instance with a length in seconds equal to the input parameter. + + + + Multiplies the value of this TimeSpan by an integer. This method does not change the value of this + PrecisionTimeSpan. Instead, a new PrecisionTimeSpan is returned whose value is the result of this operation. + + The integer by which this instance is to be multiplied. + A new PrecisionTimeSpan instance that is the product of this instance and factor. + + + + Negates this instance. This method does not change the value of this PrecisionTimeSpan. Instead, a new + PrecisionTimeSpan is returned whose value is the result of this operation. + + A new PrecisionTimeSpan instance that is the negative of this instance. + + + + Unary plus. This method does not change the value of this PrecisionTimeSpan. Instead, a new + PrecisionTimeSpan is returned whose value is the result of this operation. + + A new PrecisionTimeSpan instance with the same value as this instance. + + + + Subtracts the value of the specified PrecisionTimeSpan from the value of this instance. This method does not change + the value of this PrecisionTimeSpan. Instead, a new PrecisionTimeSpan is returned whose value is the result + of this operation. + + The PrecisionTimeSpan instance to be subtracted from this instance. + A new PrecisionTimeSpan instance that is the difference of this instance and the pts. + + + + Subtracts the value of the specified TimeSpan from the value of this instance. This method does not change + the value of this PrecisionTimeSpan. Instead, a new PrecisionTimeSpan is returned whose value is the result + of this operation. + + The TimeSpan instance to be subtracted from this instance. + A new PrecisionTimeSpan instance that is the difference of this instance and ts. + + + + Returns a new Decimal whose value is the value of this instance of PrecisionTimeSpan in seconds, with + resolution to the nearest femtosecond. + + A Decimal whose value is the value of this instance of PrecisionTimeSpan in seconds, with + resolution to the nearest femtosecond. + + + + Converts the value of the current PrecisionTimeSpan object to its equivalent string representation. The + string is similar to the string returned by this.ToTimeSpan().ToString(), with the addition of fractional + seconds to femtosecond resolution. + + A PrecisionTimeSpan format string, which is composed of custom PrecisionTimeSpan + format specifier(s). + A formatted string representation of the value of the current PrecisionTimeSpan object. + + + + Returns a new TimeSpan with the value of this instance of PrecisionTimeSpan, with femtoseconds rounded down + to the nearest 100 nanoseconds. + + A TimeSpan whose value is the date and time represented by this instance with femtoseconds + rounded down to the nearest 100 nanoseconds. + + + + Returns pts. + + A PrecisionTimeSpan. + A PrecisionTimeSpan with the same numeric value as the original PrecisionTimeSpan. + + + + Returns a PrecisionTimeSpan with the same numeric value as pts, but the opposite sign. + + A PrecisionTimeSpan. + A PrecisionTimeSpan with the same numeric value as the original PrecisionTimeSpan, but the opposite sign. + + + + Adds a PrecisionTimeSpan to another PrecisionTimeSpan, yielding a new PrecisionTimeSpan. + + A PrecisionTimeSpan that contains the time span to be added to. + A PrecisionTimeSpan that contains the time span to add. + A PrecisionTimeSpan whose value is the sum of the time spans represented by pts1 and pts2. + + + + Adds a PrecisionTimeSpan to a TimeSpan, yielding a new PrecisionTimeSpan. + + A PrecisionTimeSpan that contains the time span to be added to. + A TimeSpan that contains the time span to add. + A PrecisionTimeSpan whose value is the sum of the time spans represented by pts and ts. + + + + Adds a PrecisionTimeSpan to a TimeSpan, yielding a new PrecisionTimeSpan. + + A PrecisionTimeSpan that contains the time span to be added to. + A TimeSpan that contains the time span to add. + A PrecisionTimeSpan whose value is the sum of the time spans represented by pts and ts. + + + + Subtracts a PrecisionTimeSpan from another PrecisionTimeSpan, yielding a new PrecisionTimeSpan. + + A PrecisionTimeSpan that contains the time span to be subtracted from. + A PrecisionTimeSpan that contains the time span to subtract. + A PrecisionTimeSpan whose value is the difference between the time spans represented by pts1 and pts2. + + + + Subtracts a TimeSpan from a PrecisionTimeSpan, yielding a new PrecisionTimeSpan. + + A PrecisionTimeSpan that contains the time span to be subtracted from. + A TimeSpan that contains the time span to subtract. + A PrecisionTimeSpan whose value is the sum of the time spans represented by pts and ts. + + + + Subtracts a TimeSpan from a PrecisionTimeSpan, yielding a new PrecisionTimeSpan. + + A TimeSpan that contains the time span to be subtracted from. + A PrecisionTimeSpan that contains the time span to subtract. + A PrecisionTimeSpan whose value is the sum of the time spans represented by pts and ts. + + + + Multiplies a PrecisionTimeSpan by a numeric multiplier, yielding a new PrecisionTimeSpan whose length is + the product of the multiplier and the number of seconds in the original time span. + + A PrecisionTimeSpan. + The multiplier. + A PrecisionTimeSpan whose length is the product of the multiplier and the number of seconds in + the original time span. + + + + Determines whether two specified instances of PrecisionTimeSpan are equal. + + A PrecisionTimeSpan. + A PrecisionTimeSpan. + true if pts1 and pts2 represent the same time span; otherwise, false. + + + + Determines whether two specified instances of PrecisionTimeSpan are not equal. + + A PrecisionTimeSpan. + A PrecisionTimeSpan. + true if pts1 and pts2 represent different time spans; otherwise, false. + + + + Determines whether one specified PrecisionTimeSpan is greater than or equal to another specified + PrecisionTimeSpan. + + A PrecisionTimeSpan. + A PrecisionTimeSpan. + true if pts1 and pts2 represent the same time span, or if pts1 is greater than pts2, otherwise + false. + + + + Determines whether one specified PrecisionTimeSpan is less than or equal to another specified + PrecisionTimeSpan. + + A PrecisionTimeSpan. + A PrecisionTimeSpan. + true if pts1 and pts2 represent the same time span, or if pts1 is less than pts2, otherwise + false. + + + + Determines whether one specified PrecisionTimeSpan is greater than another specified PrecisionTimeSpan. + + A PrecisionTimeSpan. + A PrecisionTimeSpan. + true if pts1 is greater than pts2, otherwise false. + + + + Determines whether one specified PrecisionTimeSpan is less than another specified PrecisionTimeSpan. + + A PrecisionTimeSpan. + A PrecisionTimeSpan. + true if pts1 is less than pts2, otherwise false. + + + + Determines whether two specified instances of PrecisionTimeSpan represent the same precision time span. + + A boxed PrecisionTimeSpan object to compare, or a null reference. + True if this instance and the 'obj' instance represent the same precision time span. + + + + Returns the hash code for this instance. + + A 32-bit signed integer hash code. + + + + Converts the value of the current PrecisionTimeSpan object to its equivalent string representation using the + default "d.hh:mm:ss.fffffffffffffff" format specifier. + + The formatted time span string. + + + + The days component of the time span represented by this instance, expressed as an integer. + + + + + The fractional seconds represented as femtoseconds for the time span represented by this instance, expressed + as a value between -999,999,999,999,999 and 999,999,999,999,999. + + + + + The hours component of the time span represented by this instance, expressed as an integer between -23 and + 23. + + + + + The largest possible value of PrecisionTimeSpan. The value of this constant is equivalent to + exactly the number of femtoseconds between the start of day, 1/1/1970 inclusive, and the end of day, + 12/31/9999, exclusive. The value is positive. This property is read-only. + + + + + The fractional seconds represented as microseconds for the time span represented by this instance, expressed + as a value between -999,999 and 999,999. + + + + + The fractional seconds represented as milliseconds for the time span represented by this instance, expressed + as a value between -999 and 999. + + + + + The minutes component of the time span represented by this instance, expressed as an integer between -59 and + 59. + + + + + The largest possible value of PrecisionTimeSpan. The value of this constant is equivalent to + exactly the number of femtoseconds between the end of day, 12/31/9999, exclusive, and the start + of day, 1/1/1970, inclusive. The value is negative. This property is read-only. + + + + + The fractional seconds represented as nanoseconds for the time span represented by this instance, expressed + as a value between -999,999,999 and 999,999,999. + + + + + The fractional seconds represented as picoseconds for the time span represented by this instance, expressed + as a value between -999,999,999,999 and 999,999,999,999. + + + + + The seconds component of the time span represented by this instance, expressed as an integer between -59 and + 59. + + + + + The fractional portion (remainder) of the total number of seconds in the time span, expressed as a value + between -1 and 1, exclusive. + + + + + A value that represents the integer portion of the total number of seconds in the interval. Any digits to + the right of the decimal point are truncated. + + + + + A value that represents the value of the current PrecisionTimeSpan object expressed in whole and + fractional days. + + + One value of type Double cannot represent the full resolution of a precision time span object. The full + resolution is represented by the SecondsTotal and SecondsFractional properties taken together. + + + + + A value that represents the value of the current PrecisionTimeSpan object expressed in whole and + fractional hours. + + + One value of type Double cannot represent the full resolution of a precision time span object. The full + resolution is represented by the SecondsTotal and SecondsFractional properties taken together. + + + + + A value that represents the value of the current PrecisionTimeSpan object expressed in whole and + fractional milliseconds. + + + One value of type Double cannot represent the full resolution of a precision time span object. The full + resolution is represented by the SecondsTotal and SecondsFractional properties taken together. + + + + + A value that represents the value of the current PrecisionTimeSpan object expressed in whole and + fractional minutes. + + + One value of type Double cannot represent the full resolution of a precision time span object. The full + resolution is represented by the SecondsTotal and SecondsFractional properties taken together. + + + + + A value that represents the value of the current PrecisionTimeSpan object expressed in whole and + fractional seconds. + + + One value of type Double cannot represent the full resolution of a precision time span object. The full + resolution is represented by the SecondsTotal and SecondsFractional properties taken together. + + + + + A PrecisionTimeSpan with no length. This property is read-only. + + + + + The default implementation of the IVI.NET spectrum class. + + Int64, Int32, Int16, Byte, Single, or Double. + + + + Initializes a new instance of the Ivi.Driver.Spectrum class. This constructor creates an empty spectrum with implicit axes copied from another spectrum. + + A spectrum whose implicit axis information will be copied into this spectrum. + + + + Initializes a new instance of the Ivi.Driver.Spectrum class. This constructor initializes an empty spectrum. + + The frequency of the first valid data point in the data array. + The frequency of the last valid data point in the data array + + + + Initializes a new instance of the Ivi.Driver.Spectrum class. This constructor initializes an empty spectrum. + + The frequency of the first valid data point in the data array. + The frequency of the last valid data point in the data array + The capacity of the spectrum data array + + + + Initializes a new instance of the Ivi.Driver.Spectrum class. This constructor initializes an empty spectrum. + + The frequency of the first valid data point in the data array. + The frequency of the last valid data point in the data array + The time of the trigger associated with the acquisition of the spectrum + + + + Initializes a new instance of the Ivi.Driver.Spectrum class. This constructor initializes the spectrum + with user data. + + The frequency of the first valid data point in the data array. + The frequency of the last valid data point in the data array + The time of the trigger associated with the acquisition of the spectrum + The capacity of the spectrum data array + + + + The Configure method defines the frequency (implicit) axis and number of data points in the spectrum. Because of + the interaction between these values, they are set as a group with this method or when the spectrum is + initially created. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the spectrum is not changed. + + The frequency of the first valid data point in the spectrum (required). + The frequency of the last valid data point in the spectrum (required). + The time that this measurement was triggered. + The actual number of elements in the spectrum. + The Configure method does not change any of the explicit data in the Spectrum. The capacity of the spectrum does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the frequency (implicit) axis and number of data points in the spectrum. Because of + the interaction between these values, they are set as a group with this method or when the spectrum is + initially created. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the spectrum is not changed. + + The frequency of the first valid data point in the spectrum (required). + The frequency of the last valid data point in the spectrum (required). + The time that this measurement was triggered. + The Configure method does not change any of the explicit data in the Spectrum. The capacity of the spectrum does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the frequency (implicit) axis and number of data points in the spectrum. Because of + the interaction between these values, they are set as a group with this method or when the spectrum is + initially created. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the spectrum is not changed. + + The frequency of the first valid data point in the spectrum (required). + The frequency of the last valid data point in the spectrum (required). + The actual number of elements in the spectrum. + The Configure method does not change any of the explicit data in the Spectrum. The capacity of the spectrum does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the frequency (implicit) axis and number of data points in the spectrum. Because of + the interaction between these values, they are set as a group with this method or when the spectrum is + initially created. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the spectrum is not changed. + + The frequency of the first valid data point in the spectrum (required). + The frequency of the last valid data point in the spectrum (required). + The Configure method does not change any of the explicit data in the Spectrum. The capacity of the spectrum does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + GetAllElements returns a copy of the entire data array in the template data type. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + A copy of the entire data array in the template data type. + If the array is too large, this method will throw an Out Of Memory exception. + + + + GetElements returns a copy of a portion of the entire data array in the template data type, starting at the + specified index and including the number of elements specified by count. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + The index in the spectrum that will be the first element in the returned array. That is, + element zero in the returned array is at this index in the spectrum. + The number of elements to be returned. + A copy of a portion of the entire data array in the template data type, starting at the specified + index and including the number of elements specified by count. + + + + GetScaled returns one element of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the returned value. + + The index of the data element to return. + One element of the data array as a Double. + + + + GetScaled returns all or part of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the values in the returned array. + + The index of the first element in the array to return. + The number of data points to include in the returned array. + All or part of the data array as a Double. + + + + PutElements sets all or part of the data array in a spectrum, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the spectrum + data array to receive the new data. If the array passed extends beyond the end of the spectrum, an + ArgumentException will be thrown. The implicit axis of the spectrum is not changed by PutElements. + + The data to be placed into the spectrum array. + + + + PutElements sets all or part of the data array in a spectrum, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the spectrum + data array to receive the new data. If the array passed extends beyond the end of the spectrum, an ArgumentException + will be thrown. The implicit axis of the spectrum is not changed by PutElements. + + The index of the first element of the data array to change. + The data to be placed into the spectrum array. + + + + PutElements sets all or part of the data array in a spectrum, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the spectrum + data array to receive the new data. If the array passed extends beyond the end of the spectrum, only + the elements up to the length of the spectrum are copied. The implicit axis of the spectrum is not + changed by PutElements. + + The index of the first element of the data array to change. + The data to be placed into the spectrum array. + + + + A public, in-memory array containing elements of type T that contains the explicit spectrum data. + Clients can use the Data property to directly access the in-memory data without copying data. + + Setting this property does not make a copy of the array specified. + + + + This returns the data element at the specified index in the spectrum. Note that for scaled (that is, + integer) types, the scaling must be applied to the returned data element to convert it to a physical value + by the calling program. + + The index of the data element to be returned from the spectrum array. + The data element to be returned from the spectrum array. + + + + The number of elements that the spectrum array can store. Use ValidPointCount to get the + actual number of elements in this spectrum. + + + + + True if one or more points in the spectrum array are not valid, otherwise false. + + If the elements are composed of a floating point type, ContainsInvalidElement returns + true if at least one element is set to NaN. If the elements are not composed of floating point types, + setting and reading ContainsInvalidElement will throw a Property Not Implemented exeption. + + + + + True if one or more points in the spectrum array are out of range. Out of range values are too large or too + small to represent. Numbers that are too close to zero to represent are not considered out of range. + + If the elements are composed of a floating point type, ContainsOutOfRangeElement will return true if + at least one element is set to +Inf or -Inf. If the elements are not composed of floating point + types, setting and reading ContainsOutOfRangeElement will throw a Ivi.Driver.OperationNotSupportedException exeption. + + + + + For waveforms that contain invalid padding data at the beginning of the data array, FirstValidPoint indicates + the first element in the data array with valid data. If there is no padding data at the beginning of the data + array, FirstValidPoint will be zero. + + + + + FrequencyStep is the frequency difference between subsequent points in the data array. This value is set by the Configure method. If there are no valid points, frequencystep is 0. + + + + + The offset to apply to scale integer values. To convert an integer data array element to a physical value + first it is multiplied by the scale, and then the offset is added. If the integers in the data array do + not have an offset, the offset property is 0. If the contents of the data array are floating point scalars, + the offset property is set to 0. If the contents of the data array are some other type, the use of the offset + is dependent on that driver and data type. + + + + + The factor to apply to scale integer values. To convert an integer data array element to a physical value + the element is multiplied by scale, and then the offset is added. If the integers in the data array do not + have an offset, the scale property is set to 1. If the contents of the data array are floating point + scalars, the scale property is set to 1. If the contents of the data array are some other type, the use of + the scale is dependent on that driver and data type. + + + + + StartFrequency is the frequency of the first valid point in the data array. This value is set by the Configure method. + + + + + StopFrequency is the frequency of the last valid point in the data array. This value is set by the Configure method. + + + + + The time that this measurement was triggered. This value is set by the Configure method. + + + + + The actual number of elements in the spectrum. Use Capacity to get the number of elements + that the spectrum can store. + + + + + Result of an error query operation. + + + + + Constructor. + + Instrument error code. + Instrument error message. + + + + Compares two instances for equality. + + The instance to compare with the current instance. + true if the two instances represent the same result; otherwise, false. + + + + Returns the hash code for the result. + + An containing the hash value generated for this result. + + + + Determines whether two instances have the same value. + + A instance to compare with result2. + A instance to compare with result1. + true if the instances are equivalent; otherwise, false. + + + + Determines whether two instances do not have the same value. + + A instance to compare with result2. + A instance to compare with result1. + true if the two instances are not equal; otherwise, false. If either parameter is null, this method returns true. + + + + Instrument error code. + + + + + Instrument error message. + + + + + IVI Component identity interface. + + + + + A brief description of the implementing component. + + + + + The revision of the implementing component. Refer to IVI 3.2, + Section 3.1.2.2, for a description of revision syntax and semantics. + + + + + The name of the vendor that supplies the implementing component. + + + + + IVI Driver root interface. + + + + + Closes the I/O session to the instrument, as well as other unmanaged + resources. The behavior is the same as IDisposable.Dispose. + + + + + Reference to the IIviDriverOperation interface. + + + + + Reference to the IIviDriverIdentity interface. + + + + + Reference to the IIviDriverUtility interface. + + + + + IVI Driver identity interface. + + + + + Returns the list of instrument models that the IVI specific + driver can control. The string does not include an abbreviation + for the manufacturer if it is the same for all models. + + Array of instrument models. + + + + Returns the list of the class capability groups implemented by the + driver. Capability group names are documented in the IVI class + specifications. If the driver is not class compliant, the driver + returns an empty array. + + Array of class capability groups. + + + + The name of the manufacturer reported by the physical instrument. + If Simulation is enabled or the instrument is not capable of + reporting the name of the manufacturer, a string is returned that + explains the condition. + + + + + The model number or name reported by the physical instrument. + If Simulation is enabled or the instrument is not capable of + reporting the model number or name, a string is returned that + explains the condition. + + + + + The firmware revision reported by the physical instrument. If + Simulation is enabled or the instrument is not capable of + reporting the firmware revision, a string is returned that + explains the condition. + + + + + The case-sensitive unique identifier of the implementing IVI.NET + instrument driver. + + + + + For IVI class-compliant drivers, the major version number of the + instrument class specification. If the driver is not class + compliant, the driver returns zero. + + + + + For IVI class-compliant drivers, the minor version number of the + instrument class specification. If the driver is not class + compliant, the driver returns zero. + + + + + IVI Driver operation interface. + + + + + Resets the interchangeability checking algorithms of the driver + so that methods and properties that executed prior to calling this + method have no affect on whether future calls to the driver + generate interchangeability warnings. + + + + + Invalidates all of the driver's cached values. + + + + + Logical Name identifies a driver session in the Configuration Store. + If Logical Name is not empty, the driver was initialized from + information in the driver session. If it is empty, the driver was + initialized without using the Configuration Store. + + + + + The resource descriptor specifies the connection to a physical + device. It is either specified in the Configuration Store or + passed in the resource name at initialization. + + + + + Drivers may choose to always cache some instrument settings, never + cache others, and optionally cache others, to avoid unecessary I/O + to the instrument. If True, the driver caches optionally cached + instrument settings. + + + + + If True, the driver queries the instrument status at the end of + each method or property that performs I/O to the instrument. If + an error is reported, use ErrorQuery to retrieve error messages + one at a time from the instrument. + + + + + Drivers may choose to always validate some property/parameter + values, never validate others, and optionally validate others, + to avoid sending invalid commands to the instrument. If True, + the driver performs optional validations. + + + + + If True, the driver does not perform I/O to the instrument, and + returns simulated values for output parameters. + + + + + The driver setup string. It is either specified in the + Configuration Store or passed via the optionString parameter to a driver constructor. + + + + + Warning event. + + + + + Coercion record event. + + + + + Interchange check warning event. + + + + + IVI Driver utility interface. + + + + + Queries the instrument and returns instrument specific error + information. + + + + + + Performs an instrument self test, waits for the instrument to + complete the test, and queries the instrument for the results. + If the instrument passes the test, TestResult is zero and + TestMessage is 'Self test passed'. + + + + + + Quickly places the instrument in a state where it has no, or + minimal, effect on the external system to which it is connected. + This state is not necessarily a known state. + + + + + Does the equivalent of Reset and then, (1) disables class + extension capability groups, (2) sets properties to initial + values defined by class specs, and (3) configures the driver + to option string settings used in the driver constructor. + + + + + Places the instrument in a known state and configures instrument + options on which the IVI specific driver depends (for example, + enabling/disabling headers). For an IEEE 488.2 instrument, + Reset sends the command string *RST to the instrument. + + + + + Attempts to acquire a synchronization lock on this instance of the driver. The calling thread is blocked + indefinitely until the lock is acquired. This method is useful for gaining exclusive access to the driver + instance across a series of methods calls. The user must call the Unlock method on the returned lock to + relinquish the lock and allow other threads to access this instance of the driver. + + A reference to the acquired lock. Unlock is called on the returned reference. + This is not an I/O lock, such as a VISA lock. It is a thread synchronization lock for this instance + of the specific driver in the process. + + + + Attempts to acquire a synchronization lock on this instance of the driver. The calling thread is blocked + until either the lock is acquired or maxTime expires. If the lock is not acquired within the interval specified + by maxTime, an exception is thrown. This method is useful for gaining exclusive access to the driver instance + across a series of methods calls. The user must call the Unlock method on the returned lock to relinquish the + lock and allow other threads to access this instance of the driver. + + Specifies the maximum amount of time to wait to acquire the lock. + A reference to the acquired lock. Unlock is called on the returned reference. + This is not an I/O lock, such as a VISA lock. It is a thread synchronization lock for this instance + of the specific driver in the process. + + + + IVI Driver repeated capability collection interface. + + + + + The number of repeated capability instances. + + + + + Returns the repeated capability instance for a given repeated + capability identifier. + + Repeated capability identifier. + Repeated capability instance. + + + + IVI Driver repeated capability identification interface. + + + + + The repeated capability physical identifier. + + + + + Interchange check warning event arguments. + + + + + Constructor. + + Warning message. + + + + Warning message. + + + + + Result of a self test operation. + + + + + Constructor. + + The numeric result from the self test operation. 0 = no error (test passed). + The self test status message. + + + + Compares two instances for equality. + + The instance to compare with the current instance. + true if the two instances represent the same result; otherwise, false. + + + + Returns the hash code for the result. + + An containing the hash value generated for this result. + + + + Determines whether two instances have the same value. + + A instance to compare with result2. + A instance to compare with result1. + true if the instances are equivalent; otherwise, false. + + + + Determines whether two instances do not have the same value. + + A instance to compare with result2. + A instance to compare with result1. + true if the two instances are not equal; otherwise, false. If either parameter is null, this method returns true. + + + + The numeric result from the self test operation. 0 = no error (test passed). + + + + + The self test status message. + + + + + Standard values for trigger sources, events, and various other sources and sinks. + + + + + Determines whether two strings represent the same trigger source. The comparison is case-insensitive + and considers all valid values for TriggerSource.None to be equal. + + First string to compare. + Second string to compare. + True if the strings represent the same trigger source. + + + + No interface (normally applies only to triggers) + + + + + Trigger immediately (normally applies only to triggers) + + + + + External source, not an interface (normally applies only to triggers) + + + + + Internal source, not an interface (normally applies only to triggers) + + + + + Software source, not an interface (normally applies only to triggers) + + + + + Group Execute Trigger + + + + + AC line interface + + + + + Trigger at set intervals + + + + + LAN0 (LXI defined 'LAN0' LAN message) + + + + + LAN1 (LXI defined 'LAN1' LAN message) + + + + + LAN2 (LXI defined 'LAN2' LAN message) + + + + + LAN3 (LXI defined 'LAN3' LAN message) + + + + + LAN4 (LXI defined 'LAN4' LAN message) + + + + + LAN5 (LXI defined 'LAN5' LAN message) + + + + + LAN6 (LXI defined 'LAN6' LAN message) + + + + + LAN7 (LXI defined 'LAN7' LAN message) + + + + + LXI Trigger Bus Line 0 + + + + + LXI Trigger Bus Line 1 + + + + + LXI Trigger Bus Line 2 + + + + + LXI Trigger Bus Line 3 + + + + + LXI Trigger Bus Line 4 + + + + + LXI Trigger Bus Line 5 + + + + + LXI Trigger Bus Line 6 + + + + + LXI Trigger Bus Line 7 + + + + + TTL Interface 0 + + + + + TTL Interface 1 + + + + + TTL Interface 2 + + + + + TTL Interface 3 + + + + + TTL Interface 4 + + + + + TTL Interface 5 + + + + + TTL Interface 6 + + + + + TTL Interface 7 + + + + + ECL Line 0 + + + + + ECL Line 1 + + + + + PXI 10MHz Clock Line + + + + + PXI Star Interface + + + + + PXI Trigger Bus Line 0 + + + + + PXI Trigger Bus Line 1 + + + + + PXI Trigger Bus Line 2 + + + + + PXI Trigger Bus Line 3 + + + + + PXI Trigger Bus Line 4 + + + + + PXI Trigger Bus Line 5 + + + + + PXI Trigger Bus Line 6 + + + + + PXI Trigger Bus Line 7 + + + + + PXI Express 100MHz Clock Line + + + + + PXI Express DStar Line A + + + + + PXI Express DStar Line B + + + + + PXI Express DStar Line C + + + + + RTSI Bus Line 0 + + + + + RTSI Bus Line 1 + + + + + RTSI Bus Line 2 + + + + + RTSI Bus Line 3 + + + + + RTSI Bus Line 4 + + + + + RTSI Bus Line 5 + + + + + RTSI Bus Line 6 + + + + + RTSI Bus Line 7 (Clock) + + + + + Warning event arguments. + + + + + Constructor. + + Warning code. + + + + Constructor. + + Warning code. + Text description of the warning. + + + + Warning code. + + + + + Text description of the warning. + + + + + Warning codes. + + + + + ID query operation not supported. + + + + + Self test operation not supported. + + + + + Error query operation not supported. + + + + + Revision query not supported. + + + + + The default implementation of the IVI.NET waveform class. + + Int64, Int32, Int16, Byte, Single, or Double. + + + + Initializes a new instance of the Ivi.Driver.Waveform class. This constructor creates an empty waveform with implicit axis copied from another waveform. + + A waveform implementing the IWaveform interface to be copied + + + + Initializes a new instance of the Ivi.Driver.Waveform class. This constructor initializes an empty waveform. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The absolute time of the trigger in the waveform. + + + + Initializes a new instance of the Ivi.Driver.Waveform class. This constructor initializes an empty waveform. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + + + + Initializes a new instance of the Ivi.Driver.Waveform class. This constructor initializes an empty waveform. + + The amount of time between data points in the waveform (required). + + + + Initializes a new instance of the Ivi.Driver.Waveform class. This constructor initializes an empty waveform. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The absolute time of the trigger in the waveform. + The capacity of the of the waveform data array. + + + + Initializes a new instance of the Ivi.Driver.Waveform class. This constructor initializes an empty waveform. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The capacity of the of the waveform data array. + + + + Initializes a new instance of the Ivi.Driver.Waveform class. This constructor initializes an empty waveform. + + The amount of time between data points in the waveform (required). + The capacity of the of the waveform data array. + + + + RescaleData rebalances the resolution and dynamic range of integer IWaveforms by changing + the underlying data and setting IWaveform.Scale and IWaveform.Offset to the specified + values. The data is changed in such a way that the voltages returned by the GetScaled + method are the same before and after RescaleData is called, within the limits of the + mathematical precision of the operation. + + The new Scale value. + The new Offset value. + The number of new data values that were out of range when recalculated, and set + to T.MinValue or T.MaxValue as a result. + + + + Scale Data scales the waveform by applying a multiplier and adding an offset. + ScaleData is applicable to all types T supported by the Waveform class. + For integer types, ScaleData modifies the values of the voltages in the waveform + by multiplying and applying an offset. For floating point waveforms this modifies + each data element by multiplying by the multiplier and adding the offset. + + The multiplier used to modify the waveform voltages. + The offset to be added to the wavefrom voltages. + The number of new data values that were out of range when recalculated, + and set to T.MinValue or T.MaxValue as a result. + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The actual number of elements in the waveform. + The time that this measurement was triggered. + The Configure method does not change any of the explicit data in the Waveform. The capacity of the waveform does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The actual number of elements in the waveform. + The Configure method does not change any of the explicit data in the Waveform. The capacity of the waveform does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The Configure method does not change any of the explicit data in the Waveform. The capacity of the waveform does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the waveform is not changed. + + The amount of time between data points in the waveform (required). + The actual number of elements in the waveform. + The Configure method does not change any of the explicit data in the Waveform. The capacity of the waveform does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the waveform is not changed. + + The amount of time between data points in the waveform (required). + The Configure method does not change any of the explicit data in the Waveform. The capacity of the waveform does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + The Configure method defines the time (implicit) axis and number of data points in the waveform. Because of + the interaction between these values, they are set as a group with this method or when the waveform is + initially created. If startTime is not specified, it defaults to Zero. If triggerTime is not specified, + it defaults to Not A Time. If validPointCount is not specified, the number of elements in the waveform is not changed. + + The time of the first data point in the waveform relative to the trigger time. + The amount of time between data points in the waveform (required). + The time that this measurement was triggered. + The Configure method does not change any of the explicit data in the Waveform. The capacity of the waveform does + not change as a side effect of the Configure method. If the validPointCount exceeds the data array size, an + Insufficient Capacity exception is thrown. + + + + + GetAllElements returns a copy of the entire data array in the template data type. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + A copy of the entire data array in the template data type. + If the array is too large, this method will throw an Out Of Memory exception. + + + + GetElements returns a copy of a portion of the entire data array in the template data type, starting at the + specified index and including the number of elements specified by count. Note that for scaled (that + is, integer) types, the scaling must be applied to the returned data elements to convert them to physical + values by the calling program. + + The index in the Waveform that will be the first element in the returned array. That is, + element zero in the returned array is at this index in the Waveform. + The number of elements to be returned. + A copy of a portion of the entire data array in the template data type, starting at the specified + index and including the number of elements specified by count. + + + + GetScaled returns one element of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the returned value. + + The index of the data element to return. + One element of the data array as a Double. + + + + GetScaled returns all or part of the data array as a Double. If the internal data array is an integer, the + scaling is applied to the values in the returned array. + + The index of the first element in the array to return. + The number of data points to include in the returned array. + All or part of the data array as a Double. + + + + PutElements sets all or part of the data array in a waveform, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the waveform + data array to receive the new data. If the array passed extends beyond the end of the Waveform, an + ArgumentException will be thrown. The implicit axis of the waveform is not changed by PutElements. + + The data to be placed into the waveform array. + + + + PutElements sets all or part of the data array in a waveform, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the waveform + data array to receive the new data. If the array passed extends beyond the end of the Waveform, an ArgumentException + will be thrown. The implicit axis of the waveform is not changed by PutElements. + + The index of the first element of the data array to change. + The data to be placed into the waveform array. + + + + PutElements sets all or part of the data array in a waveform, starting at the element specified by index, or + (by default, if index is not used) at the beginning of the array. index is the first element of the waveform + data array to receive the new data. If the array passed extends beyond the end of the Waveform, only + the elements up to the length of the waveform are copied. The implicit axis of the waveform is not + changed by PutElements. + + The index of the first element of the data array to change. + The data to be placed into the waveform array. + + + + A public, in-memory array containing elements of type T that contains the explicit waveform data. + Clients can use the Data property to directly access the in-memory data without copying data. + + Setting this property does not make a copy of the array specified. + + + + This returns the data element at the specified index in the waveform. Note that for scaled (that is, + integer) types, the scaling must be applied to the returned data element to convert it to a physical value + by the calling program. + + The index of the data element to be returned from the waveform array. + The data element to be returned from the waveform array. + + + + The number of elements that the waveform array can store. Use ValidPointCount to get the + actual number of elements in this waveform. + + + + + True if one or more points in the waveform array are not valid, otherwise false. + + If the elements are composed of a floating point type, ContainsInvalidElement will be true if at least + one element is set to NaN. If the elements are not composed of floating point types, + setting and reading ContainsInvalidElement will throw a Ivi.Driver.OperationNotSupportedException exception. + + + + + True if one or more points in the waveform array are out of range. Out of range values are too large or too + small to represent. Numbers that are too close to zero to represent are not considered out of range. + + If the elements are composed of a floating point type, ContainsOutOfRangeElement will be true if at least + one element is set to +Inf or -Inf. If the elements are not composed of floating point + types, setting and reading ContainsOutOfRangeElement will throw a Ivi.Driver.OperationNotSupportedException exception. + + + + + The time between the last valid data point in the waveform and the TriggerTime. Positive + values of EndTime indicate that the End Time occurred after the trigger. + This value is set by the Configure method. + + + + + For waveforms that contain invalid padding data at the beginning of the data array, FirstValidPoint indicates + the first element in the data array with valid data. If there is no padding data at the beginning of the data + array, FirstValidPoint will be zero. + + + + + The amount of time between data points in the data array. This value is set by the Configure method. + + + + + The offset to apply to scale integer values. To convert an integer data array element to a physical value + first it is multiplied by the scale, and then the offset is added. If the integers in the data array do + not have an offset, the offset property is 0. If the contents of the data array are floating point scalars, + the offset property is set to 0. If the contents of the data array are some other type, the use of the offset + is dependent on that driver and data type. + + + + + The factor to apply to scale integer values. To convert an integer data array element to a physical value + the element is multiplied by scale, and then the offset is added. If the integers in the data array do not + have an offset, the scale property is set to 1. If the contents of the data array are floating point + scalars, the scale property is set to 1. If the contents of the data array are some other type, the use of + the scale is dependent on that driver and data type. + + + + + The time between the first valid data point (that is the data point at index FirstValidPoint) in the waveform and the + trigger. Positive values indicate that the StartTime occurred after the trigger. + This value is set by the Configure method. + + + + + The timespan represented by the waveform. Numerically, it is equivalent to the end time minus the start + time. This value is set by the Configure method. + + + + + The time that this measurement was triggered. Note that this differs from Start Time in that the trigger + may have occurred at some time other than when the first data point was captured, as in pre-trigger or + post-trigger applications. This value is set by the Configure method. + + + + + The actual number of elements in the waveform. Use Capacity to get the number of elements + that the waveform can store. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Fgen.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Fgen.dll new file mode 100644 index 0000000..d3eb341 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Fgen.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Fgen.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Fgen.xml new file mode 100644 index 0000000..4388b7b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Fgen.xml @@ -0,0 +1,1797 @@ + + + + Ivi.Fgen + + + + IVI Fgen class-compliant values for AM source + + + The AM source is internal + + + The AM source is external + + + IVI Fgen class-compliant values for binary alignment. + + + The left-most bit is treated as the most significant bit of the data. + + + The right-most bit is treated as the most significant bit of the data. + + + IVI Fgen class-compliant values for FM source + + + The FM source is internal + + + The FM source is external + + + IVI Fgen class-compliant values for data marker polarity. + + + When the data bit is 1 (high), the marker output level is high. + + + When the data bit is 1 (high), the marker output level is low. + + + IVI Fgen class-compliant values for sample clock source + + + The internal sample clock is used. + + + An external sample clock is used. + + + IVI Fgen class-compliant values for terminal configuration. + + + Output terminal is single-ended. + + + Output terminal is differential. + + + IVI Fgen class-compliant values for trigger slope + + + The generator triggers on a positive slope. + + + The generator triggers on a negative slope. + + + The generator triggers on either a positive or a negative slope. + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Configured on channel: . + + + + + Looks up a localized string similar to Created on channel: . + + + + + Looks up a localized string similar to The waveform was created on one channel and is being configured on another.. + + + + + Looks up a localized string similar to No sequences are available.. + + + + + Looks up a localized string similar to No waveforms are available.. + + + + + Looks up a localized string similar to The specified sequence is in use.. + + + + + Looks up a localized string similar to Sequence name: . + + + + + Looks up a localized string similar to The specified waveform is in use.. + + + + + Looks up a localized string similar to Waveform name: . + + + + + The waveform was created on a different channel than the one for which it is being configured. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + The name of the channel on which the waveform was created. + The name of the channel on which the waveform is being configured. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the channel on which the waveform was created. + + + + + The name of the channel on which the waveform is being configured. + + + + + Gets the error message. + + + + IVI Fgen class-compliant root interface + + + If the function generator is in the Configuration State, this method moves the function generator to the + Output Generation State. If the function generator is already in the Output Generation State, this method does + nothing and returns Success. + + + If the function generator is in the Output Generation State, this method moves the function generator to + the Configuration State. If the function generator is already in the Configuration State, the method does nothing + and returns Success. + + + Gets the mode that determines how the function generator produces waveforms. Operation mode determines + which extension group's methods and properties are used to configure the waveform the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The mode that determines how the function generator produces waveforms. Operation mode determines + which extension group's methods and properties are used to configure the waveform the function generator produces. + + + Sets the mode that determines how the function generator produces waveforms. Operation mode determines + which extension group's methods and properties are used to configure the waveform the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The mode that determines how the function generator produces waveforms. Operation mode determines + which extension group's methods and properties are used to configure the waveform the function generator produces. + + + The source of the reference clock. The function generator derives frequencies and sample rates that it + uses to generate waveforms from the reference clock. + Each driver determines what values are valid based on the capabilities of supported instruments. The IVI + Foundation defines a set of standard trigger source values in IVI-3.3, Standard Cross Class Capabilities. If the driver + supports one of the sources documented in IVI-3.3, it must support the standard string value for that source. + + + A reference to the IIviFgenOutput interface + + + A reference to the IIviFgenTrigger interface + + + A reference to the IIviFgenStandardWaveform interface + + + A reference to the IIviFgenArbitrary interface + + + A reference to the IIviFgenAM interface + + + A reference to the IIviFgenFM interface + + + A reference to the IIviFgenDataMarkerCollection interface + + + A reference to the IIviFgenSparseMarkerCollection interface + + + A reference to the IIviFgenSampleClock interface + + + IVI Fgen class-compliant AM interface + + + Configures the depth, waveform function, and frequency for the function generator's internal amplitude modulating + waveform source. + Specifies the internal modulation depth. Refer to the InternalDepth property for + details. + Specifies the standard waveform the function generator uses for the internal + modulating waveform source. Refer to the InternalWaveformFunction property for details. + Specifies the frequency of the internal modulating waveform source. Refer to the + InternalFrequency property for details. + Attempting to set waveform to StandardWaveform.DC will result in a System.ArgumentException. + + + Gets the enabled/disabled state of the function generator amplitude modulation. If enabled, the function + generator applies amplitude modulation to the signal that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + If true, the function generator applies amplitude modulation to the signal that the function + generator produces. + + + Sets the enabled/disabled state of the function generator amplitude modulation. If enabled, the function + generator applies amplitude modulation to the signal that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + If true, the function generator applies amplitude modulation to the signal that the function + generator produces. + + + Gets the source of the signal that the function generator uses as the modulating waveform. Applies only when + the GetEnabled method returns True. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The source of the signal that the function generator uses as the modulating waveform. + + + Sets the source of the signal that the function generator uses as the modulating waveform. Applies only when + the GetEnabled method returns True. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The source of the signal that the function generator uses as the modulating waveform. + + + The extent of modulation the function generator applies to the carrier waveform when the GetSource method + returns AMSource.Internal. The unit is percentage. Applies only when the GetSource method returns AMSource.Internal. + + + The frequency of the internal modulating waveform source. The units are Hertz. Applies only when the GetSource + method returns AMSource.Internal. + + + The standard waveform of the internal modulating waveform source. Applies only when the GetSource method + returns AMSource.Internal. + Attempting to set this property to StandardWaveform.DC will result in a System.ArgumentException. + + + IVI Fgen class-compliant arbitrary sequence and waveform common interface + + + Removes all previously created arbitrary waveforms and sequences from the function generator's + memory and invalidates all waveform and sequence handles. + + + Gets the gain of the arbitrary waveform the function generator produces. This value is unitless. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The gain of the arbitrary waveform the function generator produces. This value is unitless. + + + Sets the gain of the arbitrary waveform the function generator produces. This value is unitless. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The gain of the arbitrary waveform the function generator produces. This value is unitless. + + + Gets the offset of the arbitrary waveform the function generator produces. The units are volts. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The offset of the arbitrary waveform the function generator produces. The units are volts. + + + Sets the offset of the arbitrary waveform the function generator produces. The units are volts. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The offset of the arbitrary waveform the function generator produces. The units are volts. + + + The sample rate of the arbitrary waveforms the function generator produces. The units are samples per second. + + + Identifies whether the arbitrary waveform generator treats binary data provided to the + IIviFgenArbitraryWaveform methods as left-justified or right-justified. This is only relevant if the + generator supports bit-depths less than 16, or less than 32 if the generator supports bit-depths greater + than 16. For a 16-bit or a 32-bit generator, this method can return either value. + + + The number of significant bits that the generator supports in an arbitrary waveform. Together with + the binary alignment, this allows the user to know the range and resolution of the integers in the waveform. + + + A mask that determines what bits of the output data are masked out. This is especially useful + when combined with Data Markers so that the bits embedded with the data to be used for markers are not + actually output by the generator. + + + Reference to the class-compliant IIviFgenArbitrarySequence interface + + + Reference to the class-compliant IIviFgenArbitraryWaveform interface + + + IVI Fgen class-compliant arbitrary sequence interface + + + Configures channel, waveform handle, gain, and offset for arbitrary sequence generation. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + Specifies the handle that identifies the arbitrary sequence to produce. + Specifies the arbitrary waveform gain. Refer to the IIviFgenArbitrary.GetGain and + IIviFgenArbitrary.SetGain methods for details. + Specifies the arbitrary waveform offset. Refer to the IIviFgenArbitrary.GetOffset + and IIviFgenArbitrary.SetOffset methods for details. + + + Removes a previously created arbitrary sequence from the function generator's memory and invalidates the + sequence's handle. + Specifies the handle that identifies the arbitrary sequence to clear. + + + Creates an arbitrary waveform sequence from an array of waveform handles and a corresponding array of loop counts, + and returns a handle that identifies the sequence. The handle is used by the Configure, and Clear methods. + Specifies the array of waveform handles for the new arbitrary sequence. Each WfmHandle array + element has a corresponding LoopCount array element that specifies how many times that waveform is repeated. + Specifies the array of loop counts for the new arbitrary sequence. Each LoopCount array element + corresponds to a WfmHandle array element and indicates how many times to repeat that waveform. Each element of the + LoopCount array must be less than or equal to the maximum number of loop counts the function generator allows. To + determine the function generator's maximum loop count, use the LoopCountMax property. + Returns the handle that identifies the new arbitrary sequence. + + + Gets the arbitrary sequence that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The handle for the arbitrary sequence that the function generator produces. + + + Sets the arbitrary sequence that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The handle for the arbitrary sequence that the function generator produces. + + + + The maximum sequence depth - that is, the number of times a sequence can include other sequences + recursively. A depth of zero indicates the generator supports waveforms only. A depth of 1 indicates + a generator supports sequences of waveforms, but not sequences of sequences. A depth of 2 or greater + indicates that the generator supports sequences of sequences. + + + Note that if the MaxSequenceDepth is 2 or greater, the driver must return unique handles for + waveforms and sequences so that a sequence may contain both waveform and sequence handles. + + + + The maximum number of arbitrary waveforms that the function generator allows in an arbitrary sequence. + + + The minimum number of arbitrary waveforms that the function generator allows in an arbitrary sequence. + + + The maximum number of times that the function generator can repeat a waveform in a sequence. + + + The maximum number of arbitrary sequences that the function generator allows. + + + IVI Fgen class-compliant arbitrary waveform interface + + + Configures channel name, waveform handle, gain, and offset for arbitrary waveform generation. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + Specifies the handle that identifies the arbitrary waveform to produce. + Specifies the arbitrary waveform gain. Refer to the IIviFgenArbitrary.GetGain and + IIviFgenArbitrary.SetGain methods for details. + Specifies the arbitrary waveform offset. Refer to the IIviFgenArbitrary.GetOffset + and IIviFgenArbitrary.SetOffset methods for details. + + + Removes a previously created arbitrary waveform from the function generator's memory and invalidates the + waveform's handle. + Specifies the handle that identifies the arbitrary waveform to clear. + + + Creates a channel-specific waveform and returns a handle to it. The handle is used by the + Configure, Clear, and IIviFgenArbitrarySequence.Create methods. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + 16-bit binary waveform data. If the arbitrary waveform generator supports formats + less than 16 bits, call the BinaryAlignment property to determine whether to left or right justify the + data before passing it to this call. + Returns the handle that identifies the new arbitrary waveform. + + + Creates a channel-specific waveform and returns a handle to it. The handle is used by the + Configure, Clear, and IIviFgenArbitrarySequence.Create methods. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + 32-bit binary waveform data. If the arbitrary waveform generator supports formats + less than 32 bits, call the BinaryAlignment property to determine whether to left or right justify the + data before passing it to this call. + Returns the handle that identifies the new arbitrary waveform. + + + Creates a channel-specific waveform and returns a handle to it. The handle is used by the + Configure, Clear, and IIviFgenArbitrarySequence.Create methods. + Specifies the type of the data in the waveform parameter. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + A waveform object that implements IWaveform. The waveform array must have at least + as many elements as the value in the Size parameter. The waveform's elements must be between -1.00 and +1.00 + (after scaling, for integers). + Returns the handle that identifies the new arbitrary waveform. + + + Gets the rate at which an entire arbitrary waveform is generated. The units are in Hertz. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The rate at which an entire arbitrary waveform is generated. The units are in Hertz.. + + + Sets the rate at which an entire arbitrary waveform is generated. The units are in Hertz. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The rate at which an entire arbitrary waveform is generated. The units are in Hertz. + + + Gets the arbitrary waveform that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The handle for the arbitrary waveform that the function generator produces. + + + Sets the arbitrary waveform that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The handle for the arbitrary waveform that the function generator produces. + + + The maximum number of arbitrary waveforms that the function generator allows. + + + The quantum value the function generator allows. For example, if this property returns a value + of 8, all waveform sizes must be a multiple of 8. The size of each arbitrary waveform must be a multiple + of a quantum value. + + + The maximum number of points the function generator allows in an arbitrary waveform. + + + The minimum number of points the function generator allows in an arbitrary waveform. + + + IVI Fgen class-compliant data marker interface + + + + Configure the data marker. + + The channel whose data bit will be output as a marker. + The bit position of the waveform data bit that will be output as a data marker. + A value of 0 indicates the least significant bit. + The destination terminal for the data marker. + + + + The amplitude of the data marker output. The units are volts. + + + + + The bit position of the binary representation of the waveform data that will be output as a data + marker. A value of 0 indicates the least significant bit. + + + + + The amount of delay applied to the data marker output with respect to the analog data output. A value + of zero indicates the marker is aligned with the analog data output. + + + + + The destination terminal for the data marker output. + + + + + The polarity of the data marker output. + + + + + The channel whose data bit will be output as a marker. + + + + + IviFgen class-compliant IIviFgenDataMarkerCollection interface + + + + + Disable all of the data markers by setting their Data Marker Destination attribute to None. + + + + IVI Fgen class-compliant FM interface + + + Configures the deviation, waveform function, and frequency for the internal frequency modulating waveform + source. + Specifies the internal modulation deviation. Refer to the InternalDeviation + property for details. + Specifies the standard waveform the function generator uses for the internal + modulating waveform source. Refer to the InternalWaveform property for details. + Specifies the frequency of the internal modulating waveform source. Refer to the + InternalFrequency property for details. + Attempting to set waveform to StandardWaveform.DC will result in a System.ArgumentException. + + + Gets the enabled/disabled state of the function generator frequency modulation. If enabled, the function + generator applies frequency modulation to the signal that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + If true, the function generator applies frequency modulation to the signal that the function + generator produces. + + + Sets the enabled/disabled state of the function generator frequency modulation. If enabled, the function + generator applies frequency modulation to the signal that the function generator produces. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + If true, the function generator applies frequency modulation to the signal that the function + generator produces. + + + Gets the source of the signal that the function generator uses as the modulating waveform. + Applies only when the GetEnabled method returns True. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The source of the signal that the function generator uses as the modulating waveform. Applies only + when the GetEnabled method returns True. + + + Sets the source of the signal that the function generator uses as the modulating waveform. + Applies only when the GetEnabled method returns True. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The source of the signal that the function generator uses as the modulating waveform. Applies only + when the GetEnabled method returns True. + + + The maximum frequency deviation the function generator applies to the carrier waveform when the GetSource + method returns FMSource.Internal. Applies only when the GetSource method returns FMSource.Internal. + + + The frequency of the internal modulating waveform source. The units are hertz. Applies only when the + GetSource method returns FMSource.Internal. + + + The standard waveform of the internal modulating waveform source. Applies only when the GetSource method + returns FMSource.Internal. + Attempting to set this property to StandardWaveform.DC will result in a System.ArgumentException. + + + IVI Fgen class-compliant output interface + + + Gets the enabled/disabled state of the function generator output. If enabled, the signal the function + generator produces appears at the output connector. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + If true, the signal the function generator produces appears at the output connector. + + + Sets the enabled/disabled state of the function generator output. If enabled, the signal the function + generator produces appears at the output connector. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + If true, the signal the function generator produces appears at the output connector. + + + Gets the impedance of the output channel. The units are Ohms. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The impedance of the output channel. The units are Ohms. + + + Sets the impedance of the output channel. The units are Ohms. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The impedance of the output channel. The units are Ohms. + + + Gets the terminal configuration, which determines whether the generator will run in single-ended + or differential mode, and whether the output gain and offset values will be analyzed based on single-ended + or differential operation. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The mode in which the generator will run. Choices are single-ended and differential operation. + + + Sets the terminal configuration, which determines whether the generator will run in single-ended + or differential mode, and whether the output gain and offset values will be analyzed based on single-ended + or differential operation. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The mode in which the generator will run. Choices are single-ended and + differential operation. + + + Gets the name of the channel that corresponds to the index into the collection of channels. + An index in the collection of channels, between 0 and Count-1. + The name of the channel that corresponds to the index in the collection of channels. + + + The mode that determines how the function generator produces waveforms. This property determines + which extension group's methods and properties are used to configure the waveform the function generator produces. + + + The number of output channels supported by the instrument. + + + + IVI Fgen class-compliant sample clock interface + + + + + Specifies the clock used for the waveform generation. Note that when using an external sample clock, + the IIviFgenArbitrary.SampleRate property must be set to the corresponding frequency of the external + sample clock. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + If true, the sample clock appears at the sample clock output of the generator, otherwise false. + + + + IVI Fgen class-compliant sparse marker interface + + + + Configure the sparse marker. + + The waveform to whose indices the sparse marker refers. + The sample numbers of the specified waveform on which markers will be output. + These indexes may be coerced by the driver. + The destination terminal for the sparse marker. + + + + Gets the coerced indexes associated with the sparse marker. These indexes are specied by either the + Add method or the SetIndexes method. + + The sample numbers on which markers will be output. + + + + Set the indexes associated with the sparse marker. These indexes may be coerced by the driver. Use the + GetIndexes method to find the coerced values. + + The sample numbers on which markers will be output. + + + + The amplitude of the sparse marker output. The units are volts. + + + + + The amount of delay applied to the sparse marker output with respect to the analog data output. A value + of zero indicates the marker is aligned with the analog data output. + + + + + The destination terminal for the sparse marker output. + + + + + The polarity of the sparse marker output. + + + + + Specifies the waveform to whose indexes the sparse marker refers. + + + + + IviFgen class-compliant IIviFgenSparseMarkerCollection interface + + + + + Disable all of the sparse markers by setting their Sparse Marker Destination attribute to None. + + + + IVI Fgen class-compliant standard waveform interface + + + Configures the channel, waveform function, amplitude, DC offset, frequency, and start phase for + standard waveform generation. When the waveformFunction parameter is set to Waveform DC, this method + ignores the amplitude, frequency, and start phase parameters. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + Specifies the standard waveform function. Refer to the GetWaveformFunction + and SetWaveformFunction methods for details. + Specifies the waveform amplitude. Refer to the GetAmplitude and Set Amplitude + methods for details. + Specifies the waveform's DC offset. Refer to the GetDCOffset and SetDCOffset + methods for details. + Specifies the waveform frequency. Refer to the GetFrequency and SetFrequency + methods for details. + Specifies the waveform start phase. Refer to the GetStartPhase and GetStartPhase + methods for details. + + + Gets the duty cycle for a square waveform. This property affects function generator behavior only + when the GetWaveformFunction method returns StandardWaveform.Square. The value is expressed as a + percentage. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The duty cycle for a square waveform. This property affects function generator behavior only when + the GetWaveformFunction method returns StandardWaveform.Square. The value is expressed as a percentage. + + + Sets the duty cycle for a square waveform. This property affects function generator behavior only + when the GetWaveformFunction method returns StandardWaveform.Square. The value is expressed as a + percentage. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The duty cycle for a square waveform. This property affects function generator + behavior only when the GetWaveformFunction method returns StandardWaveform.Square. The value is expressed + as a percentage. + + + Gets the amplitude of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the amplitude does not affect signal output. + The units are volts. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The amplitude of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the amplitude does not affect signal output. + The units are volts. + + + Sets the amplitude of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the amplitude does not affect signal output. + The units are volts. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The amplitude of the standard waveform output by the function generator. + GetWaveformFunction method returns StandardWaveform.DC, the amplitude does not affect signal output. + The units are volts. + + + Gets the DC offset of the standard waveform output by the function generator. If the + GetWaveformFunction method returns StandardWaveform.DC, the DC offset specifies the DC level the function + generator produces. The units are volts. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The DC offset of the standard waveform output by the function generator. If the + GetWaveformFunction method returns StandardWaveform.DC, the DC offset specifies the DC level the function + generator produces. The units are volts. + + + Sets the DC offset of the standard waveform output by the function generator. If the + GetWaveformFunction method returns StandardWaveform.DC, the DC offset specifies the DC level the function + generator produces. The units are volts. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The DC offset of the standard waveform output by the function generator. If the + GetWaveformFunction method returns StandardWaveform.DC, the DC offset specifies the DC level the function + generator produces. The units are volts. + + + Gets the frequency of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the frequency does not affect signal output. + The units are Hertz. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The frequency of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the frequency does not affect signal output. + The units are Hertz. + + + Sets the frequency of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the frequency does not affect signal output. + The units are Hertz. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The frequency of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the frequency does not affect signal output. + The units are Hertz. + + + Gets the start phase of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the start phase does not affect signal output. + The units are degrees. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The start phase of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the start phase does not affect signal output. + The units are degrees. + + + Sets the start phase of the standard waveform output by the function generator. When the + GetWaveformFunction method returns StandardWaveform.DC, the start phase does not affect signal output. + The units are degrees. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The start phase of the standard waveform output by the function generator. When + the GetWaveformFunction method returns StandardWaveform.DC, the start phase does not affect signal output. + The units are degrees. + + + Gets the standard waveform function being output by the function generator. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The standard waveform function being output by the function generator. + + + Sets the standard waveform function being output by the function generator. + A string that uniquely identifies a channel. It may be defined by the driver + or supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The standard waveform function being output by the function generator. + + + IVI Fgen class-compliant trigger interface. + + + A reference to the IIviFgenTriggerStart interface. + + + A reference to the IIviFgenTriggerStop interface. + + + A reference to the IIviFgenTriggerHold interface. + + + A reference to the IIviFgenTriggerResume interface. + + + A reference to the IIviFgenTriggerAdvance interface. + + + The rate at which the function generator's internal trigger source produces a trigger, in triggers per second. + + + IVI Fgen class-compliant advance trigger interface. + + + + Configure the advance trigger properties. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The source of the advance trigger. Refer to the Get and Set Source methods for details. + The source of the advance trigger. Refer to the Get and Set Slope methods for details. + + + + Send a software-generated advance trigger to the instrument. + + + + + Get an additional length of time to delay from the advance trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the advance trigger to the first point in the waveform + generation. + + + + Set an additional length of time to delay from the advance trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the advance trigger to the first point in the waveform + generation. + + + + Get the slope of the advance trigger. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the advance trigger. + + + + Set the slope of the advance trigger. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the advance trigger. + + + + Get the source of the advance trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the advance trigger. + + + + Set the source of the advance trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the advance trigger. + + + + Get the voltage threshold for the advance trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the advance trigger. The units are volts. + + + + Set the voltage threshold for the advance trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the advance trigger. The units are volts. + + + IVI Fgen class-compliant hold trigger interface. + + + + Configure the hold trigger properties. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The source of the hold trigger. Refer to the Get and Set Source methods for details. + The source of the hold trigger. Refer to the Get and Set Slope methods for details. + + + + Send a software-generated hold trigger to the instrument. + + + + + Get an additional length of time to delay from the hold trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the hold trigger to the first point in the waveform + generation. + + + + Set an additional length of time to delay from the hold trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the hold trigger to the first point in the waveform + generation. + + + + Get the slope of the hold trigger. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the hold trigger. + + + + Set the slope of the hold trigger. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the hold trigger. + + + + Get the source of the hold trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the hold trigger. + + + + Set the source of the hold trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the hold trigger. + + + + Get the voltage threshold for the hold trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the hold trigger. The units are volts. + + + + Set the voltage threshold for the hold trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the hold trigger. The units are volts. + + + IVI Fgen class-compliant resume trigger interface. + + + + Configure the resume trigger properties. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The source of the resume trigger. Refer to the Get and Set Source methods for details. + The source of the resume trigger. Refer to the Get and Set Slope methods for details. + + + + Send a software-generated resume trigger to the instrument. + + + + + Get an additional length of time to delay from the resume trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the resume trigger to the first point in the waveform + generation. + + + + Set an additional length of time to delay from the resume trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the resume trigger to the first point in the waveform + generation. + + + + Get the slope of the resume trigger. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the resume trigger. + + + + Set the slope of the resume trigger. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the resume trigger. + + + + Get the source of the resume trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the resume trigger. + + + + Set the source of the resume trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the resume trigger. + + + + Get the voltage threshold for the resume trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the resume trigger. The units are volts. + + + + Set the voltage threshold for the resume trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the resume trigger. The units are volts. + + + IVI Fgen class-compliant start trigger interface. + + + + Configure the start trigger properties. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The source of the start trigger. Refer to the Get and Set Source methods for details. + The source of the start trigger. Refer to the Get and Set Slope methods for details. + + + Sends a software trigger, which will cause the function generator to generate output. + + + Gets the number of waveform cycles that the function generator produces after it receives a trigger. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The number of waveform cycles that the function generator produces after it receives a trigger. + + + Sets the number of waveform cycles that the function generator produces after it receives a trigger. + A string that uniquely identifies a channel. It may be defined by the driver or supplied + as a virtual name in the configuration store. For single output instruments, the driver may define the empty string + as a valid channel name. + The number of waveform cycles that the function generator produces after it receives a trigger. + + + + Get an additional length of time to delay from the start trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the start trigger to the first point in the waveform + generation. + + + + Set an additional length of time to delay from the start trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the start trigger to the first point in the waveform + generation. + + + + Get the slope of the trigger that starts the generator. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the trigger that starts the generator. + + + + Set the slope of the trigger that starts the generator. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the trigger that starts the generator. + + + + Get the source of the start trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the start trigger. + + + + Set the source of the start trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the start trigger. + + + + Get the voltage threshold for the start trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the start trigger. The units are volts. + + + + Set the voltage threshold for the start trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the start trigger. The units are volts. + + + IVI Fgen class-compliant stop trigger interface. + + + + Configure the stop trigger properties. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver may + define the empty string as a valid channel name. + The source of the stop trigger. Refer to the Get and Set Source methods for details. + The source of the stop trigger. Refer to the Get and Set Slope methods for details. + + + + Send a software-generated stop trigger to the instrument. + + + + + Get an additional length of time to delay from the stop trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the stop trigger to the first point in the waveform + generation. + + + + Set an additional length of time to delay from the stop trigger to the first point in the waveform + generation. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + An additional length of time to delay from the stop trigger to the first point in the waveform + generation. + + + + Get the slope of the trigger that stops the generator. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the trigger that stops the generator. + + + + Set the slope of the trigger that stops the generator. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The slope of the trigger that stops the generator. + + + + Get the source of the stop trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the stop trigger. + + + + Set the source of the stop trigger. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The source of the stop trigger. + + + + Get the voltage threshold for the stop trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the stop trigger. The units are volts. + + + + Set the voltage threshold for the stop trigger. The units are volts. + + A string that uniquely identifies a channel. It may be defined by the driver or + supplied as a virtual name in the configuration store. For single output instruments, the driver mayg + define the empty strin as a valid channel name. + The voltage threshold for the stop trigger. The units are volts. + + + + The IviFgen class allows clients to create instances of drivers that implement the class-compliant + IviFgen interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviFgen drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviFgen class-compliant driver and return an IIviFgen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviFgen driver to be created. + + An IIviFgen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviFgen class-compliant driver and return an IIviFgen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviFgen driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviFgen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviFgen class-compliant driver and return an IIviFgen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviFgen driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviFgen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviFgen class-compliant driver and return an IIviFgen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviFgen driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviFgen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + There are no sequences available. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + There are no waveforms available. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + IVI Fgen class-compliant values for output operation mode. + + + The Fgen outputs waveforms or sequences continuously. + + + The Fgen outputs waveforms or sequences in a burst. + + + IVI Fgen class-compliant values for output mode + + + The Fgen outputs a function waveform. + + + The Fgen outputs arbitrary waveforms and sequences. + + + The Fgen outputs sequences. + + + + The sequence is is use. + + + + + Initializes a new instance of the class with a specified error message ans sequence name. + + The message that describes the error. + The name of the sequence in use. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the sequence in use. + + + + + Gets the error message. + + + + IVI Fgen class-compliant values for standard waveform function + + + A sinusoid waveform. + + + A square waveform. + + + A triangular waveform. + + + A positive ramp waveform. + + + A negative ramp waveform. + + + A constant voltage waveform. + + + + The waveform is in use. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + The name of the waveform in use. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the waveform in use. + + + + + Gets the error message. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.LxiSync.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.LxiSync.dll new file mode 100644 index 0000000..19104ae Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.LxiSync.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.LxiSync.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.LxiSync.xml new file mode 100644 index 0000000..463102a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.LxiSync.xml @@ -0,0 +1,968 @@ + + + + Ivi.LxiSync + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to The specified alarm has not been defined.. + + + + + Looks up a localized string similar to The specified alarm already exists.. + + + + + Looks up a localized string similar to Alarm name: . + + + + + Looks up a localized string similar to Alarm time: . + + + + + Looks up a localized string similar to The alarm time is invalid.. + + + + + Looks up a localized string similar to The reserved repeated capability cannot be removed from the collection.. + + + + + Looks up a localized string similar to The specified event source has not been defined.. + + + + + Looks up a localized string similar to The specified event source already exists.. + + + + + Looks up a localized string similar to Event source name: . + + + + + Looks up a localized string similar to The event source has not been specified.. + + + + + Looks up a localized string similar to The specified event source is not valid.. + + + + + Looks up a localized string similar to Out of event resources.. + + + + + Looks up a localized string similar to Repeated capability: . + + + + + Looks up a localized string similar to Repeated capability instance: . + + + + + Looks up a localized string similar to The event source cannot operate in driven mode while serving as the wired-OR bias.. + + + + + A specified alarm has not been defined. + + + + + Initializes a new instance of the class with a specified error message and alarm name. + + The message that describes the error. + The alarm name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The alarm name. + + + + + Gets the error message. + + + + + A specified alarm already exists. + + + + + Initializes a new instance of the class with a specified error message and alarm name. + + The message that describes the error. + The alarm name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The alarm name. + + + + + Gets the error message. + + + + + An alarm time is invalid. + + + + + Initializes a new instance of the class with a specified error message. + + The alarm name. + The specified (invalid) time. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The alarm name. + + + + + The specified (invalid) time. + + + + + Gets the error message. + + + + Defined values for the style of arm source detection. + + + The LXI device will arm on the rising edge of the arm source. + + + The LXI device will arm on the falling edge of the arm source. + + + The LXI device will arm while the arm source is high, that is, while it remains true. + + + The LXI device will arm while the arm source is low, that is, while it remains false. + + + + A reserved repeated capability cannot be removed from one of the IviLxiSync collections. + + + + + Initializes a new instance of the class with a specified repeated capability and repeated capability + instance. + + The name of the repeated capability. + The repeated capability instance that is reserved. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the repeated capability.. + + + + + The repeated capability instance that is reserved. + + + + + Gets the error message. + + + + Event driver mode. + + + Events are enabled in driven mode. + + + Events are not enabled in any mode. + + + Events are enabled in wired-OR mode. + + + + A specified event source is not defined. + + + + + Initializes a new instance of the class with a specified error message and event source name. + + The message that describes the error. + The name of the event source. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the event source. + + + + + Gets the error message. + + + + + A specified event source already exists. + + + + + Initializes a new instance of the class with a specified error message and event source name. + + The message that describes the error. + The name of the event source. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the event source. + + + + + Gets the error message. + + + + + The event source has not been specified. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + LxiSync root interface. + + + Reference to the ILxiSyncArm interface. + + + Reference to the ILxiSyncEventLog interface. + + + Reference to the ILxiSyncEvents interface. + + + Reference to the ILxiSyncTime interface. + + + Reference to the ILxiSyncTrigger interface. + + + LxiSync arm interface. + + + Reference to the ILxiSyncArmSources interface. + + + Specifies the number of times the arm has to occur to complete the arm loop; that is, the number of arms + that are accepted before the measurement must be initiated again. + + + Specifies the delay from when the arm logic satisfied until the waiting for trigger state is entered. + + + Reference to the ILxiSyncArmAlarms interface. + + + LxiSync arm alarm interface. + + + Configures the most commonly configured properties of the arm alarm sub-system. + If true, the arm alarm is enabled. Refer to the Enabled property. + Specifies the 1588 time. + The period of the arm alarm. Refer to the Period property for details. + The number of times to repeat the trigger. Refer to the RepeatCount property + for details. + + + The 1588 time at which the alarm will go off. + + + The period of the arm alarm; that is, the amount of time that transpires before the alarm + repeats. + + + The number of times to repeat the trigger at the period specified by the Period + property. + + + If true, the arm alarm is enabled. + + + LxiSync repeated capability interface containing methods and properties that apply to all arm alarms + defined for the device. A particular arm alarm can be accessed using the Item property. + + + Disables all arm alarms. + + + Creates a new arm alarm + + The name of the arm alarm to create. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A reference to the new arm alarm object. + + + Removes an arm alarm. + Specifies the name of the arm alarm to remove. + + + Removes all of the custom arm alarms that were added using the Add method. + + + LxiSync arm source interface. + + + Configures the most commonly configured properties of the arm source sub-system. + Enables or disables the arm source. Refer to the Enabled property. + The style of arm source detection. Refer to the Detection property. + + + If true, the arm source is enabled. + + + The style of arm source detection. + + + A filter for restricting arm sources. + + + The LAN event identifier that is associated with this arm source. LAN Events with this + identifier are accepted from the source described in the filter. + + + LxiSync repeated capability interface containing methods and properties that apply to all arm sources + defined for the device. A particular arm source can be accessed using the Item property. + + + Creates a new arm source. + + The name of the arm source to create. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A reference to the new arm source object. + + + Removes an arm source. + The name of the arm source to remove. + + + Disables all arm sources. + + + Removes all of the custom arm sources that were added using the Add method. + + + If true, OR-summing of the arm sources is enabled. + + + LxiSync event interface. + + + Configures the most commonly configured properties of the event sub-system. + The event mode. Refer to the DriveMode property for details. + The signal which causes an event to be transmitted. Refer to the Source property. + The list of places to send the event. Refer to the DestinationPath property. + The slope of the event signal. Refer to the Slope property for details. + + + The signal which causes an event to be transmitted. + + + The list of places to send the event. + + + The slope of the inbound event that will cause the generation of an outbound event. + + + The event mode - that is, how the event is transmitted. + + + LxiSync event log interface. + + + Removes all existing entries from the event log. + + + Retrieves and clears the oldest event log entry for the IVI session. + + + + Returns the number of event log entries available. + + + if true, the event logging feature is enabled. + + + LxiSync repeated capability interface containing methods and properties that apply to all events defined + for the device. A particular event can be accessed using the Item property. + + + Disables all events. + + + Creates a new event. + The name of the event to create. + A reference to the new event object. + + + Removes an event. + The name of the event to remove. + + + Removes all of the custom events that were added using the Add function. + + + The Wired-Or Bias Mode interface lines for which the LXI device will serve as the wired-OR bias. + + + LxiSync time interface. + + + The current 1588 time. + + + Indicates if this device is the 1588 master. + + + Indicates if the device is synchronized. + + + LxiSync trigger interface. + + + Reference to the ILxiSyncTriggerSources interface. + + + Specifies the number of times a trigger has to occur to complete a measurement; that is, the number of + triggers that are accepted before the measurement must be armed again. + + + Reference to the ILxiSyncTriggerAlarms interface. + + + + Specifies which of the available trigger sources to use as the signal for triggering the device-specific + operation (for example, a measurement). + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + LxiSync trigger alarm interface. + + + Configures the most commonly configured properties of the trigger alarm sub-system. + The 1588 time of the trigger alarm. Refer to the Time parameter for details. + The period of the trigger alarm. Refer to the Period parameter for details. + The number of times to repeat the trigger at the period specified by the + period parameter. Refer to the RepeatCount property. + + + The period of the trigger alarm; that is, the amount of time that transpires before the alarm + repeats. + + + The number of times to repeat the trigger at the period specified by the Period property. + + + The time at which the alarm will go off. + + + If true, the trigger alarm is enabled. + + + LxiSync repeated capability interface containing methods and properties that apply to all trigger alarms + defined for the device. A particular trigger alarm can be accessed using the Item property. + + + This function creates a new trigger alarm + + Specifies the name of the trigger alarm to create. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A reference to the new trigger alarm object. + + + This function disables all trigger alarms. + + + This function removes a trigger alarm. + Specifies the name of the trigger alarm to remove. + + + This function removes all of the trigger alarms that were added using the Add Trigger Alarm function. + + + LxiSync trigger source interface. + + + Configures the most commonly configured properties of the trigger source sub-system. + The trigger source delay. Refer to the Delay property for details. + The slope of the trigger source. Refer to the Detection property. + + + The trigger source delay from when the trigger logic is satisfied until the device specific + action (for instance a measurement) is triggered. A negative value implies pre-trigger acquisition. + + + The slope of the trigger source. + + + The LAN event identifier that is associated with this trigger source. + + + The filter for restricting trigger sources. + + + + LxiSync repeated capability interface containing methods and properties that apply to all trigger sources + defined for the device. A particular trigger source can be accessed using the Item property. + + + + + This function creates a new trigger source. + + + Specifies the name of the trigger source to create. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + A reference to the new trigger source object. + + + This function removes a trigger source. + Specifies the name of the trigger source to remove. + + + This function removes all of the custom trigger sources that were added using the Add Trigger Source + function. + + + + A specified event source is not valid. + + + + + Initializes a new instance of the class with a specified error message and event source name. + + The message that describes the error. + The name of the event source. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the event source. + + + + + Gets the error message. + + + + Defined values for the Wired-Or Bias Mode interface lines. + + + No LXI lines. + + + Line LXI0. + + + Line LXI1. + + + Line LXI2. + + + Line LXI3. + + + Line LXI4. + + + Line LXI5. + + + Line LXI6. + + + Line LXI7. + + + + The event source cannot operate in driven mode while serving as the wired-OR bias. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The channel is not enabled. + + + + + The driver is out of event resources. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + IVI LxiSync values for Slope. + + + + Positive slope. + + + + + Negative slope. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.PwrMeter.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.PwrMeter.dll new file mode 100644 index 0000000..4863f97 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.PwrMeter.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.PwrMeter.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.PwrMeter.xml new file mode 100644 index 0000000..1575085 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.PwrMeter.xml @@ -0,0 +1,626 @@ + + + + Ivi.PwrMeter + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Channel name: . + + + + + Looks up a localized string similar to The channel is not enabled for measurement.. + + + + + IVI PwrMeter class-compliant root interface. + + + + + A reference to the IIviPwrMeterChannels interface. + + + + + A reference to the IIviPwrMeterMeasurement interface. + + + + + A reference to the IIviPwrReferenceOscillator interface. + + + + + A reference to the IIviPwrMeterTrigger interface. + + + + + IVI PwrMeter class-compliant averaging interface. + + + + + If true, auto-averaging is enabled for a particular input channel, otherwise it is disabled. + + + + + The averaging count. When the CountAuto property is set to false, the driver filters the input signal + by averaging it the number of times specified by this property. + + + + + IVI PwrMeter class-compliant channel interface. + + + + + Performs a calibration on a particular channel and sensor. This method returns only after calibration is + complete. + + + + + Performs a zero operation on a particular channel. + + + + + A reference to the IIviPwrMeterAveraging interface. + + + + + The frequency of the input signal in Hertz. The instrument uses this value to determine the appropriate + correction factor for the sensor. + + + + + A reference to the IIviPwrMeterDutyCycleCorrection interface. + + + + + If true, the power meter should take a measurement on a particular input channel. The power meter will + take a measurement on a channel only if that channel is enabled. + + + + + The status of the measurement initiated by the Initiate function. The driver returns OperationState.Complete + only when measurements are complete on all enabled channels. + + + + + The offset to be added to the measured value in units of dB. This property can be used to compensate + for system losses or gains between the unit under test and the power sensor. + + + + + A reference to the IIviPwrMeterRange interface. + + + + + IVI PwrMeter class-compliant channels interface. A particular channel can be referenced using the indexer. + + + + + Performs a zero operation on all enabled channels + + + + + Returns the status of all calibration operations initiated by the Calibrate function. The driver returns + OperationState.Complete only when calibration is complete on all enabled channels. If some calibration + operations are still in progress on one or more channels, the driver returns OperationState.InProgress. + If the driver cannot query the instrument to determine its state, the driver returns OperationState.Unknown. + + The driver does not check the instrument status to determine the measurement state. Typically, the + end-user accesses this property only in a sequence of other driver calls. The sequence performs one + operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the + instrument. To check the instrument status, call the Error Query function at the conclusion of the sequence. + + + + The status of all zero correction operations initiated by the Zero or Zero All Channel functions. The + driver returns OperationState.Complete only when zero corrections are complete on all enabled channels. + If some zero correction operations are still in progress on one or more channels, the driver returns + OperationState.InProgress. If the driver cannot query the instrument to determine its state, the driver + returns OperationState.Unknown. + + The driver does not check the instrument status to determine the measurement state. Typically, the + end-user accesses this property only in a sequence of other driver calls. The sequence performs one + operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the + instrument. To check the instrument status, call the Error Query function at the conclusion of the sequence. + + + + Specifies the unit to which the RF power is converted after measurement + + + + + IVI PwrMeter class-compliant duty cycle correction interface. + + + + + Enables or disables duty cycle correction and sets the duty cycle for pulse power measurements + + If true, duty cycle correction is enabled. Refer to the Enabled property for + details. + The duty cycle correction value. Refer to the Value property for details. + + + + If true, duty cycle correction is enabled for the particular channel. + + + + + The duty cycle correction the power meter uses to calculate the pulse power of a pulse-modulated signal. + The value of this property is specified as a percentage. The power meter measures the average power of + the pulsed input signal and then divides the result by the value specified for this attribute to obtain + a pulse power reading. + + + + + IVI PwrMeter class-compliant internal trigger interface. + + + + + Configures the internal trigger event source and slope. + + The name of the channel to use as the internal trigger event source. Refer to + the EventSource property for details. + The internal trigger slope. Refer to the Slope property for details. + + + + The channel that the power meter uses to monitor the internal trigger event + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The trigger level for the measurement signal. The value of this property is specified in the same unit + as the value of the IIviPwrMeterChannel.Units property + + + + + The trigger slope. The power meter may trigger on the rising or falling edge of the measurement signal. + + + + + IVI PwrMeter class-compliant measurement interface. + + + + + Aborts all previously initiated measurements and returns the power meter to the Idle state. + + + + + Configures the instrument to take single or dual channel measurements + + The math function applied to the operands. + The name of the channel from which the value for the first operand of the math + function is measured. + The name of the channel from which the value for the second operand of the math + function is measured. + + + + Returns the result of a previously configured and initiated 1 or 2 channel measurement. The Configure + method can be used to set up the measurement. The Initiate method initiates that measurement. The + meaurement result will be returned in the units specified by the IIviPwrMeterChannelCollection.Units + property. + + Measured value + + + + Returns the result from a previously initiated measurement on a specified channel. The Initiate method + initiates that measurement. The meaurement result will be returned in the units specified by the + IIviPwrMeterChannelCollection.Units property. + + The name of the channel from which to fetch the measurement. + Measured value + + + + Initiates a measurement on all enabled channels. When this method executes, the power meter leaves the + Idle state + + + + + Returns the status of the measurement initiated by the Initiate function. The driver returns + OperationState.Complete only when measurements are complete on all enabled channels. + + + + + Initiates a previously configured measurement, waits until the power meter has returned to the Idle state, + then returns the result of that measurement. The Configure method can be used to set up the measurement. + The meaurement result will be returned in the units specified by the IIviPwrMeterChannelCollection.Units + property. + + The maximum time to wait for a return value. + Measured value. + + + + Initiates a previously configured measurement, waits until the power meter has returned to the Idle state, + then returns the result of the measurement on the specified channel. The meaurement result will be + returned in the units specified by the IIviPwrMeterChannelCollection.Units property. + + The name of the channel from which to take the measurement. + The maximum time to wait for a return value. + Measured value. + + + + Sends a software trigger to the instrument + + + + + IVI PwrMeter class-compliant meter and sensor range selection interface. + + + + + Configures the lower and upper range values for a particular channel + + The lower limit of the expected value of the measurement. Refer to the Lower + property for details. + The upper limit of the expected value of the measurement. Refer to the Upper + property for details. + + + + Configures the lower and upper range values for a particular channel + + If True, the instrument automatically sets the best range for the measurement. If + False, the range is set using the Upper and Lower properties. + + + + If True, the instrument automatically sets the best range for the measurement. If False, the range is + set using the Upper and Lower properties. + + + + + The lower limit (minimum) of the expected value of the measurement. The value of this property is + specified in the same units as the value of the IIviPwrMeterChannelCollection.Units property + + + + + The upper limit (maximum) of the expected value of the measurement. The value of this property is + specified in the same units as the value of the IIviPwrMeterChannelCollection.Units property + + + + + IVI PwrMeter class-compliant reference oscillator interface. + + + + + Configures the frequency and power level of the signal generated by the reference oscillator. + + The frequency of the reference oscillator. Refer to the Frequency property for + details. + The power level of the reference oscillator. Refer to the Level property for details. + + + + If true, the internal reference oscillator is enabled, otherwise it is not enabled. + + + + + The frequency of the signal generated by the reference oscillator in Hertz. + + + + + The power level of the signal generated by the reference oscillator in dBm. + + + + + IVI PwrMeter class-compliant trigger interface. + + + + + The trigger source that the power meter monitors for a trigger event. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + A reference to the IIviPwrMeterInternalTrigger interface. + + + + + The channel is not enabled. + + + + + Initializes a new instance of the class with a specified channel name. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified channel name. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified channel name and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + The IviPwrMeter class allows clients to create instances of drivers that implement the class-compliant + IviPwrMeter interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviPwrMeter drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviPwrMeter class-compliant driver and return an IIviPwrMeter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviPwrMeter driver to be created. + + An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviPwrMeter class-compliant driver and return an IIviPwrMeter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviPwrMeter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviPwrMeter class-compliant driver and return an IIviPwrMeter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviPwrMeter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviPwrMeter class-compliant driver and return an IIviPwrMeter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviPwrMeter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + IVI PwrMeter class-compliant values for measurement operator + + + + + No operation - the measurement returns the first operand. + + + + + Subtraction - the measurement returns the difference between the first operand and the second operand. + + + + + Addition - the measurement returns the sum of the first operand and the second operand. + + + + + Division - the measurement returns first operand divided by the second operand + + + + + IVI PwrMeter class-compliant values for operation state + + + + + The power meter is still performing the operation. + + + + + The power meter has completed the operation. + + + + + The power meter cannot determine the status of the operation. + + + + + IVI PwrMeter class-compliant values for units + + + + + dBm. + + + + + dB millivolts. + + + + + dB microvolts. + + + + + Watts. + + + + IviPwrMeter class defined values for slope. + + + + A positive (rising edge) slope. + + + + + A negative (falling edge) slope. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.RFSigGen.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.RFSigGen.dll new file mode 100644 index 0000000..e938fb0 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.RFSigGen.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.RFSigGen.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.RFSigGen.xml new file mode 100644 index 0000000..555aecf --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.RFSigGen.xml @@ -0,0 +1,1672 @@ + + + + Ivi.RFSigGen + + + + + Values for the AM scaling mode. + + + + + Enables linear attenuation for amplitude modulation. + + + + + Enables logarithmic attenuation for amplitude modulation. + + + + + Values for digital modulation base data source. + + + + + The data from an external device connected to the instrument is used. + + + + + The internal PRBS (Pseudo Random Binary Sequence) generator is used as data source. + + + + + A constant bit sequence is used as data source and repeated continuously. + + + + + Values for digital modulation base external clock type. + + + + + The external clock frequency is equal to the bit clock frequency of the digital modulation. + + + + + The external clock frequency is equal to the symbol clock frequency of the digital modulation. + + + + + Values for digital modulation base PRBS type. + + + + + Length of PRBS sequence is 2^9 - 1 + + + + + Length of PRBS sequence is 2^11 - 1 + + + + + Length of PRBS sequence is 2^15 - 1 + + + + + Length of PRBS sequence is 2^16 - 1 + + + + + Length of PRBS sequence is 2^20 - 1 + + + + + Length of PRBS sequence is 2^21 - 1 + + + + + Length of PRBS sequence is 2^23 - 1 + + + + + Values for the AM external coupling. + + + + + The external source is coupled for AC only. + + + + + The external source is coupled for both DC and AC + + + + + Values for the frequency step scaling mode. + + + + + Enables linear scaling. + + + + + Enables logarithmic scaling. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to List name: . + + + + + Looks up a localized string similar to The selected list is not defined.. + + + + + IVI RFSigGen class-compliant root interface. + + + + + Sends a software trigger, which will cause the signal generator to start signal generation. + + + + + Reference to the class-compliant IIviRFSigGenRF interface. + + + + + Reference to the class-compliant IIviRFSigGenAlc interface. + + + + + Reference to the class-compliant IIviRFSigGenLFGenerator interface. + + + + + Reference to the class-compliant IIviRFSigGenPulseGenerator interface. + + + + + Reference to the class-compliant IIviRFSigGenSweep interface. + + + + + Reference to the class-compliant IIviRFSigGenReferenceOscillator interface. + + + + + Reference to the class-compliant IIviRFSigGenAnalogModulation interface. + + + + + Reference to the class-compliant IIviRFSigGenPulseModulation interface. + + + + + Reference to the class-compliant IIviRFSigGenDigitalModulation interface. + + + + + Reference to the class-compliant IIviRFSigGenIQ interface. + + + + + IVI RFSigGen class-compliant Automatic Level Control (ALC) interface. + + + + + Configures the ALC (Automatic Level Control) of the signal generator's RF output. + + The driver uses this value to set the ALC Source property. + The driver uses this value to set the ALC Bandwidth property. + + + + Specifies the source of the controlling voltage for the Automatic Level Control. + The RF level at the sensor point is held constant. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies the bandwidth of the level control. Narrow bandwidth impoves noise and allows AM with modulation + frequencies beyond bandwidth frequency. The value is coerced to reflect the ability of the current RF signal generator. + The units are Hertz. + + + + + If set to True, enables Automatic Level Control (ALC). If set to False, disables Automatic Level Control (ALC). + + + + + IVI RFSigGen class-compliant analog modulation interface. + + + + + Configures the attributes that control the signal generator's amplitude modulation. + + The source of the signal that is used as the modulating signal. Refer to the Source property for more details. + The scaling for amplitude modulation. Refer to the Scaling property for more details. + The modulation depth the signal generator applies to the RF-signal. Refer to the Depth property for more details. + + + + Specifies the source of the signal that is used as the modulating signal. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies linear or logarithmic characteristic for amplitude modulation. The units of the AM Depth attribute is changed with this setting. + + + + + Specifies the extent of modulation the signal generator applies to the RF-signal (carrier waveform) + with the modulating signal as a result of summing all sources, internal and external. + The amount of the specified modulation depth is achieved with a modulating voltage of AM Nominal Voltage. + If the AM Scaling attribute is set to Linear, then the units are percent (%). If the AM Scaling attribute is set to logarithmic, + then the units are dBm. + + + + + Returns the voltage at which the instrument achieves the amount of modulation specified by the AM Depth attribute. The units are Volts. + + + + + If set to True, the RF signal generator applies amplitude modulation to the RF output signal. + If set to False, the RF signal generator does not apply amplitude modulation to the output signal. + + + + + Specifies the coupling (AC, DC) of the external source of the modulating signal. + + + + + IVI RFSigGen class-compliant analog modulation interface. + + + + + Reference to the class-compliant IIviRFSigGenAM interface. + + + + + Reference to the class-compliant IIviRFSigGenFM interface. + + + + + Reference to the class-compliant IIviRFSigGenPM interface. + + + + + Reference to the class-compliant IIviRFSigGenAnalogModulationSource interface. + + + + + IVI RFSigGen class-compliant modulation source interface. + + + + Returns the name of a particular modulation source. + The index of the particular modulation source whose name is being returned. The index is zero-based. + The name of a particular modulation source. + + + Specifies how many modulation sources are available. + + + + IVI RFSigGen class-compliant ARB generator interface. + + + + Configures the Arb generator. Specified is the sample frequency the waveform is generated with together + with the cut-off frequency of the low pass filter which is used for antialiasing the output waveform. + The filter frequency normally is lower than the clock frequency. + The sample frequency. Refer to the ClockFrequency property for more details. + The cut off frequency of the low pass filter. Refer to the FilterFrequency property for more details. + + + Stores the waveform in the driver's or instrument's memory. IQ Waveform data is represented as two + waveforms, one for I data and one for Q data. The two waveforms must have the same number of waveform + elements. + Specifies the waveform name. + Array of Double I data for this IQ waveform. + Array of Double Q data for this IQ waveform. + Specifies whether more data is pending for this waveform. + + + Deletes all waveforms from the pool of waveforms. + + + Specifies the selected waveform from the pool of available waveforms. + + + Specifies the sample frequency. The waveform is generated with this clock frequency. The units are Hertz. + + + Specifies the cut-off frequency of the low pass filter. The waveform is filtered before output with this filter for antialiasing. + The filter frequency normally is lower than the clock frequency. The units are Hertz. + + + Specifies the max number of waveforms the instrument can hold in the memory. + The number may depend on the length of the waveform already in the pool of waveforms stored in the instrument. + + + The waveform length (the number of samples) shall be a multiple of this quantum. + If it is 1, there is no restriction on the length - other than min and max size - for the waveform. + + + The waveform length (the number of samples) shall be equal or greater than min size. + If it is 1, there is no restriction on the length - other than max size and quantum - for the waveform. + + + The waveform length (the number of samples) shall be equal or less than max size. + + + Specifies the way to start the Arb waveform or running it continuously. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + Specifies whether the trigger event occurs on the rising or falling edge of the input signal. + + + + IVI RFSigGen class-compliant CDMA base interface. + + + + + This property returns a collection of the currently defined Digital Modulation CDMA Standard identifiers. + + + + + Specifies the actual standard used by the instrument. The modulation type, bit clock frequency and filter + together with the according filter. parameters are set as defined in the selected standard. + + + + + This property returns a collection of the currently defined Digital Modulation CDMA Test Model identifiers. + + + + + Specifies the actual CDMA test model used by the instrument. + + + + + Specifies the source of the trigger signal that starts the channel coding generation. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies whether the trigger event occurs on the rising or falling edge of the input signal. + + + + + Specifies the source of the clock signal used to generate the digital modulation according to the selected standard. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + IVI RFSigGen class-compliant digital modulation interface. + + + + + Reference to the class-compliant IIviRFSigGenArb interface. + + + + + Reference to the class-compliant IIviRFSigGenDigitalModulationBase interface. + + + + + Reference to the class-compliant IIviRFSigGenTdma interface. + + + + + Reference to the class-compliant IIviRFSigGenCdma interface. + + + + + IVI RFSigGen class-compliant digital modulation base interface. + + + + + Configures the DigitalModulationBase clock source. + + The clock source for the digital modulation. Refer to the ClockSource property for more details. + The type of the external clock signal used to generate the digital modulation. + Type is ignored if Source is set to Internal. Refer to the ExternalClockType property for more details. + + + + Writes the bit sequence used as data for the digital modulation. + The sequence is repeated continuously. The string consists of binary values (8 bit in 1 char/byte). + + Specifies the bit sequence name. + The number of bits in the sequence. + The driver uses this array as stream of bits. The size of the array is bitCount. + Specifies whether more data is pending for this bit sequence. + + + + Clears (deletes) all named bit sequences. + + + + + This property returns a collection of the currently defined Digital Modulation Base Standard identifiers. + + + + + Specifies the actual standard used by the instrument. The coding, mapping, symbol rate or bit clock frequency, + filter together with the according filter. parameters, FSK deviation or ASK depth (in case of FSK or ASK modulation) + are set as defined in the selected standard. + + + + + Specifies the source of data. The data is used to modulate the RF signal according to the standard selected with + the DigitalModulationBase Selected Standard attribute. + + + + + Specifies the type of the PRBS as defined in the CCITT-V.52 standard. The PRBS (Pseudo Random Binary Sequence) + is used only if DigitalModulationBase Data Source is set to PRBS. + + + + + Specifies name of the bit sequence (stream) used as data for digital modulation. + The sequence is used only if DigitalModulationBase Data Source is set to BitSequence. + + + + + Specifies the source of the clock signal used to generate the digital modulation according to the selected standard. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies the type of the external clock signal used to generate the digital modulation. + This value is used only if the DigitalModulationBase Clock Source attribute is set to External. + + + + + IVI RFSigGen class-compliant frequency modulation interface. + + + + + Configures the properties that control the signal generator's frequency modulation. + + The source of the signal that is used as the modulating signal. Refer to the Source property for more details. + The extent of modulation (peak frequency deviation) the signal generator + applies to the RF-signal. Refer to the Deviation property for more details. + + + + Specifies the source of the signal that is used as the modulating signal. If more than one source is specified, + the voltages of all sources (internal and external) are summed. Multiple source names are separated by commas. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies the extent of modulation (peak frequency deviation) the signal generator applies to the RF-signal (carrier waveform) + with the modulating signal as a result of summing all sources, internal and external. + The amount of the specified FM modulation deviation is achieved with a modulating voltage of FM Nominal Voltage.The units are Hertz. + + + + + Returns the voltage at which the instrument achieves the amount of modulation specified by the FM Deviation attribute. The units are Volts. + + + + + If set to True, the RF signal generator applies frequency modulation to the RF output signal. + If set to False, the RF signal generator does not apply frequency modulation to the RF output signal. + + + + + Specifies the coupling (AC, DC) of the external source of the modulating signal. + + + + + IVI RFSigGen class-compliant frequency step interface. + + + + + Configures the properties that control the step frequencies of the generator's RF output signal. + If the stop frequency is less than the start frequency, the frequency decreases during the sweep. + + The start frequency of the stepped sweep. Refer to the Start property for more details. + The stop frequency of the stepped sweep. Refer to the Stop property for more details. + The spacing of the steps. Refer to the Scaling property for more details. + The step size. Refer to the Size property for more details. + + + + Configures the properties that control frequency stepping. + + Turns single step on/off. Refer to the SingleStepEnabled property for more details. + Specifies the duration of one step. Refer to the Dwell property for more details. + + + + Resets the current frequency step to the frequency step start value. + + + + + Specifies the start frequency of the stepped sweep. + If the stop frequency is less than the start frequency, the frequency decreases during the sweep. The units are Hertz. + + + + + Specifies the stop frequency of the stepped sweep. + If the stop frequency is less than the start frequency, the frequency decreases during the sweep. The units are Hertz. + + + + + Specifies the spacing (linear, logarithmic) of the steps. + + + + + Specifies the step size. The units are Hertz if Scaling is set to Linear and is unitless (factor) + if Scaling is set to Logarithmic. + + + + + If set to True, Frequency Step Single Step is enabled, and the frequency sweep will advance when the next trigger event occurs. + If set to False, Frequency Step Single Step is disabled, and the frequency sweep will advance immediatly after the dwell time ends. + + + + + Specifies the duration of one step. Dwell time starts immediately after trigger or next step; no settling time is added. + This attribute is ignored if the Frequency Step Single Step Enabled attribute is set to True. + + + + + IVI RFSigGen class-compliant frequency sweep interface. + + + + + Configures the center frequency and the frequency span for the sweep. + This function modifies the properties as follows: + Frequency Sweep Start = Center - Span / 2 + Frequency Sweep Stop = Center + Span / 2 + + The center frequency of the sweep. + The frequency span of the sweep. + + + + Configures the start and the stop frequency for the sweep. + If the stop frequency is less than the start frequency, the frequency decreases during the sweep. + + The start frequency of the sweep. Refer to the Start property for more details. + The stop frequency of the sweep. Refer to the Stop property for more details. + + + + Specifies the start frequency of the sweep. + If the stop frequency is less than the start frequency, the frequency decreases during the sweep. The units are Hertz. + + + + + Specifies the stop frequency of the sweep. + If the stop frequency is less than the start frequency, the frequency decreases during the sweep. The units are Hertz. + + + + + Specifies the duration of one sweep from start to stop frequency. + + + + + IVI RFSigGen class-compliant IQ modulation interface. + + + + + Configures the properties that control the signal generator's IQ modulation. + + The source of the signal that the signal generator + uses for IQ modulation. Refer to the Source property for more details. + Enables or disables the inverse phase rotation of + the IQ signal by swapping the I and Q inputs. Refer to the SwapEnabled property for more details. + + + + This function calibrates the IQ modulator. + + + + + Reference to the class-compliant IIviRFSigGenIQImpairment interface. + + + + + Specifies the source of the signal that the signal generator uses for IQ modulation. + Defined values: DigitalModulationBase, CDMABase, TDMABase, ArbGenerator, External. + + + + + If set to True, the RF signal generator applies inverse phase rotation of the IQ signal. + If set to False, the RF signal generator applies non-inverse phase rotation of the IQ signal. + + + + + Returns the voltage at which the instrument achieves full modulation. The value is calculated by SQRT(I^2 + Q^2). The units are Volts. + + + + + If set to True, the RF signal generator applies IQ modulation to the RF output signal. + If set to False, the RF signal generator does not apply IQ modulation to the RF output signal. + + + + + IVI RFSigGen class-compliant IQ modulation impairment interface. + + + + + Configures the properties that simulate or correct impairment for the signal generator's IQ modulation. + These properties are only used, if IQ Impairment Enabled property is set to True. + + The offset voltage to the I signal. Refer to the IOffset property for more details. + The offset voltage to the Q signal. Refer to the QOffset property for more details. + The gain imbalance between the I and Q channels. Refer to the Ratio property for more details. + The adjustment of the phase angle between the I and Q vectors. Refer to the Skew property for more details. + + + + If set to True, the RF signal generator applies all IQ impairment attributes to the IQ modulation. + If set to False, the RF signal generator does not apply any IQ impairment attributes to the IQ modulation. + + + + + Specifies an origin offset voltage to the I signal. The range of values allowed is -100% to +100%. The value is expressed as percentage (%). + + + + + Specifies an origin offset voltage to the Q signal. The range of values allowed is -100% to +100%. The value is expressed as percentage (%). + + + + + Specifies the gain imbalance between the I and Q channels. For no imbalance this value is set to 0 %. The value is expressed as percentage (%). + + + + + Specifies the adjustment of the phase angle between the I and Q vectors. If this skew is zero, the phase angle is 90 degrees. + The units are degrees. + + + + + IVI RFSigGen class-compliant LF generator interface. + + + + + Configures the LF generator output frequency and waveform. + + The frequency of the LF generator. Refer to the Frequency property for more details. + The waveform of the LF generator. Refer to the Waveform property for more details. + + + This function returns the specific driver defined LF generator source name that corresponds to the index that the user specifies. + If the driver defines a qualified LF generator name, this property returns the qualified name. + The index of the LF generator whose name is being returned. The index is zero-based. + The name of the particular LF generator for the given index. + + + + Reference to the class-compliant IIviRFSigGenLFGeneratorOutput interface. + + + + + Specifies the frequency of the active LF generator. The units are Hertz. + + + + + Specifies the waveform of the active LF generator. + Defined values: Sine, Square, Triangle, Ramp Up, Ramp Down. + + + + + Specifies the LF generator which is currently active. The values for this property correspond to the LFGenerator repeated capability. + If the driver defines a qualified LF generator name, this property returns the qualified name. + + + + + Returns the number of LF generator sources available for a particular instrument. + + + + + IVI RFSigGen class-compliant LF generator output interface. + + + + + Configures the properties of the LF generator output (within the RF signal generator). + + The output voltage of the LF generator. Refer to the Amplitude property for more details. + Enables or disables the external LF generator output. Refer to the Enabled property for more details. + + + + If set to True, the LF generator applies a signal to the output. + If set to False, the LF generator does not apply a signal to the output. + + + + + Specifies the output voltage the of the LF generator. The units are Volts, peak-to-peak. + + + + + IVI RFSigGen class-compliant sweep list interface. + + + + + Configures the properties that control the list stepping. + + Turns single step on/off. Refer to the SingleStepEnabled property for more details. + The duration of one step. Refer to the Dwell property for more details. + + + + Deletes all lists from the pool of available lists. + + + + + Creates a named list of frequency values. + + Specifies the name of the list to be created. + The array of frequency values to become elements of the list. The units are Hertz. + + + + Creates a named list of power values. + + Specifies the name of the list to be created. + The array of power values to become elements of the list. The units are dBm. + + + + Creates a named list of frequency and power value pairs. + + Specifies the name of the list to be created. + The array of frequency values to become elements of the list. The units are Hertz. + The array of power values to become elements of the list. The units are dBm. + + + + Resets the current list to the first entry value. + + + + + If set to True, the list will advance when the next trigger event occurs. + If set to False, the list will advance immediatly after the dwell time ends. + + + + + Specifies the duration of one step. This property is ignored if the SingleStepEnabled property is set to True. + + + + + Specifies the name of the selected list to become active. The name shall be one of the lists created. + + + + + IVI RFSigGen class-compliant phase modulation interface. + + + + + Configures the properties that control the signal generator's phase + modulation. + + The source of the signal that is used as the modulating signal. + Refer to the Source property for more details. + The extent of modulation (peak phase deviation) + the signal generator applies to the RF-signal. Refer to the Deviation property for more details. + + + + Specifies the source of the signal that is used as the modulating signal. If more than one source is specified, + the voltages of all sources (internal and external) are summed. Multiple source names are separated by commas. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies the extent of modulation (peak phase deviation) the signal generator applies to the RF-signal (carrier waveform) + with the modulating signal as a result of summing all sources, internal and external. + The amount of the specified PM modulation deviation is achieved with a modulating voltage of PM Nominal Voltage. The units are radians. + + + + + Returns the voltage at which the instrument achieves the amount of modulation specified by the PM Deviation attribute. The units are Volts. + + + + + If set to True, the RF signal generator applies phase modulation to the RF output signal. + If set to False, the RF signal generator does not apply phase modulation to the RF output signal. + + + + + Specifies the coupling (AC, DC) of the external source of the modulating signal. + + + + + IVI RFSigGen class-compliant power step interface. + + + + + Configures the properties that control the power steps of the generator's RF output signal. + + The start power of the stepped sweep. Refer to the Start property for more details. + The stop power of the stepped sweep. Refer to the Stop property for more details. + The step size. Refer to the Size property for more details. + + + + Configures the properties that control the power stepping. + + Turns single step on/off. Refer to the SingleStepEnabled property for more details. + The duration of one step. Refer to the Dwell property for more details. + + + + Resets the stepping if single step is enabled. + + + + + Specifies the start power of the stepped sweep. + If the stop power is less than the start power, the power decreases in value during the sweep. The units are dBm. + + + + + Specifies the stop power of the stepped sweep. + If the stop power is less than the start power, the power decreases in value during the sweep. The units are dBm. + + + + + Specifies the step size. The units are dBm. + + + + + If set to True, the power sweep will advance when the next trigger event occurs. + If set to False, the power sweep will advance immediately after the dwell time ends. + + + + + Specifies the duration of one step. This property is ignored if SingleStepEnabled is set to True. + + + + + IVI RFSigGen class-compliant power sweep interface. + + + + + Configures the properties that control the power sweep of the generator's output signal. + + The start power of the sweep. Refer to the Start property for more details. + The stop power of the sweep. Refer to the Stop property for more details. + + + + Specifies the start power of the sweep. + If the stop power is less than the start power, the power decreases in value during the sweep. The units are dBm. + + + + + Specifies the stop power of the sweep. + If the stop power is less than the start power, the power decreases in value during the sweep. The units are dBm. + + + + + Specifies the duration of one sweep from start to stop power. + + + + + IVI RFSigGen class-compliant pulse generator interface. + + + + + Configures the trigger source, pulse width and gating enabled for the pulse generator. + + Specifies the source of the signal the pulse generator uses to generate one pulse. + Refer to the TriggerSource property for more details. + Specifies the width of the output pulse. + Refer to the Width property for more details. + Enables or disables trigger gating. + Refer to the GatingEnabled property for more details. + + + + Configures the triggering of the pulse generator within the RF signal generator. + Specifies the external trigger slope and the delay time for starting the pulse after the trigger pulse. + + Specifies whether the event occurs on the rising or falling edge of the trigger input signal. + Refer to the ExternalTriggerSlope property for more details. + The delay for starting the output signal with respect to the trigger input. + Refer to the ExternalTriggerDelay property for more details. + + + + Reference to the class-compliant IIviRFSigGenPulseGeneratorDouble interface. + + + + + Reference to the class-compliant IIviRFSigGenPulseGeneratorOutput interface. + + + + + Specifies the period of the pulse generator output signal when TriggerSource is set to Internal. + + + + + Specifies the width of the output pulse. + + + + + If set to True, enables the pulse trigger gating. + If set to False, disables the pulse trigger gating. + + + + + Specifies the source of the trigger signal the pulse generator uses to generate one pulse. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Specifies whether the event occurs on the rising or falling edge of the trigger input signal. + + + + + Specifies the delay for starting the output pulse with respect to the trigger input. + + + + + IVI RFSigGen class-compliant pulse double generator interface. + + + + + Configures the double pulse state and delay. + + Turns double pulse mode on/off. Refer to the Enabled property for more details. + The delay of the second pulse. Refer to the Delay property for more details. + + + + If set to True, the double pulse mode is enabled. + If set to False, the double pulse mode is disabled. + + + + + Specifies the delay of the second pulse from the falling edge of the first pulse. + The second pulse has the same width as the first. + + + + + IVI RFSigGen class-compliant pulse generator output interface. + + + + + Configures the output and polarity of the pulse generator within the RF signal generator. + + Specifies the polarity of the output signal. Refer to the Polarity property for more details. + Enables or disables the pulse generator external output. Refer to the Enabled property for more details. + + + + Specifies the polarity of the output signal. + Defined values: Normal, Inverse. + + + + + If set to True, the pulse generator's external output is enabled. + If set to False, the pulse generator's external output is disabled. + + + + + IVI RFSigGen class-compliant pulse modulation interface. + + + + + If set to True, enables pulse modulation of the RF output signal. + If set to False, disables pulse modulation of the RF output signal. + + + + + Specifies the source of the signal that is used as the modulating signal. + Defined values: Internal, External. + + + + + Specifies the polarity of the external source signal. + Defined values: Normal, Inverse. + + + + + IVI RFSigGen class-compliant reference oscillator interface. + + + + + Configures the signal generator's reference oscillator. + + The reference oscillator source. Refer to the Source property for more details. + The frequency of the external signal, which is used as reference for internal RF frequency generation. + This property is only used if the Source is set to External. Refer to the ExternalFrequency property for more details. + + + + Specifies the reference frequency source used to generate the exact RF output frequency. + Defined values are Internal, External. Ivi.Driver.TriggerSource may be used to provide these values. + + + + + Specifies the frequency of the external signal, which is used as reference for internal RF frequency generation. + This value is used only if Reference Oscillator Source is set to External. The units are Hertz. + + + + + IVI RFSigGen class-compliant RF interface. + + + + + Configures the frequency and the power level of the RF output signal. + + The frequency of the generated RF output signal. Refer to the Frequency property for more details. + The power level of the RF output signal. Refer to the Level property for more details. + + + + Queries if the RF output signal is currently settled. + + + + + This method waits until the state of the RF output signal has settled. + + The maximum time the method waits for the output to be settled. If the maximum time + is exceeded, this method generates the Max Time Exceeded exception. + + + + Disables all currently enabled modulations (e.g. analog, pulse, IQ, and digital modulation). + + + + + Specifies the frequency of the generated RF output signal. The units are Hertz. + + + + + Specifies the power level of the RF output signal. The units are dBm. + + + + + If set to True, the signal the RF signal generator produces appears at the output connector. + If set to False, the signal the RF signal generator produces does not appear at the output connector. + + + + + IVI RFSigGen class-compliant sweep interface. + + + + + Configures the signal generator whether the RF output signal is a continuous wave + or the frequency, the power level or both are swept or stepped. + + Specifies whether the RF output signal is a continuous wave or the frequency, + the power level or both are swept or stepped. Refer to the Mode property for more details. + Specifies the way to start the sweep or run the sweep continuously. + Refer to the TriggerSource property for more details. + + + + Reference to the class-compliant IIviRFSigGenFrequencySweep interface. + + + + + Reference to the class-compliant IIviRFSigGenPowerSweep interface. + + + + + Reference to the class-compliant IIviRFSigGenFrequencyStep interface. + + + + + Reference to the class-compliant IIviRFSigGenPowerStep interface. + + + + + Reference to the class-compliant IIviRFSigGenList interface. + + + + + Specifies the sweep mode applied to the output signal. + Defined values: None, FrequencySweep, FrequencyStep, PowerSweep, PowerStep, List. + + + + + Specifies the trigger used to start a sweep operation. + Defined values include Immediate, External, Software Trigger. Ivi.Driver.TriggerSource may be + used to provide these values.] + + + The trigger source. + + + + + IVI RFSigGen class-compliant TDMA base interface. + + + + + Configures the TDMA clock source. + + Specifies the source of the clock signal used to generate the digital + modulation according to the selected standard. Refer to the ClockSource property for more details. + Specifies the type of the external clock signal used to generate the digital + modulation. Refer to the ExternalClockType property for more details. + + + + This property returns a collection of the currently defined Digital Modulation TDMA Standard identifiers. + + + + + Specifies the actual standard used by the instrument. The coding, mapping, symbol rate or bit clock frequency, + filter together with the according filter. parameters, FSK deviation or ASK depth (in case of FSK or ASK modulation) + are set as defined in the selected standard. + + + + + This property returns a collection of the currently defined Digital Modulation TDMA Frame identifiers. + + + + + Specifies the actual frame used by the instrument. It is selected from the list queried with the function Get TDMA Frame Names. + + + + + Specifies the source of the trigger signal that starts the frame/slot generation. Defined values are + Immediate, External, and Software Trigger. [Ivi.Driver.TriggerSource may be used to provide these values.] + + + + + Specifies whether the trigger event occurs on the rising or falling edge of the trigger input signal. + + + + + Specifies the source of the clock signal used to generate the digital modulation according to the selected standard. + Defined values are Internal, External. [Ivi.Driver.TriggerSource may be used to provide these values.] + + + + + Specifies the type of the external clock signal used to generate the digital modulation. + + + + + Values for the IQ modulation source. + + + + + The signal generator uses the internally generated digital modulation signal to apply IQ modulation to the output RF signal. + + + + + The signal generator uses the internally generated CDMA signal to apply IQ modulation to the output RF signal. + + + + + The signal generator uses the internally generated TDMA signal to apply IQ modulation to the output RF signal. + + + + + The signal generator uses the internally generated Arb signal to apply IQ modulation to the output RF signal. + + + + + The signal generator uses data from an external source for IQ modulation. + + + + + The IviRFSigGen class allows clients to create instances of drivers that implement the class-compliant + IviRFSigGen interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviRFSigGen drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviRFSigGen class-compliant driver and return an IIviRFSigGen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviRFSigGen driver to be created. + + An IIviRFSigGen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviRFSigGen class-compliant driver and return an IIviRFSigGen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviRFSigGen driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviRFSigGen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviRFSigGen class-compliant driver and return an IIviRFSigGen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviRFSigGen driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviRFSigGen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviRFSigGen class-compliant driver and return an IIviRFSigGen reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviRFSigGen driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviRFSigGen interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Values for the LFGenerator waveform. + + + + + Configures the LF generator to produce a sinusoidal waveform + + + + + Configures the LF generator to produce a square waveform + + + + + Configures the LF generator to produce a triangle waveform + + + + + Configures the LF generator to produce a rising ramp waveform + + + + + Configures the LF generator to produce a falling ramp waveform + + + + + The specified list is unknown. + + + + + Initializes a new instance of the class with a specified error message and list name. + + The message that describes the error. + The list name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The list name. + + + + + Gets the error message. + + + + + Values for the pulse modulation external polarity. + + + + + The signal generator modulates the carrier signal with normal pulse polarity. + + + + + The signal generator modulates the carrier signal with inverted pulse polarity. + + + + + Values for the pulse modulation source. + + + + + The internal pulse generator is used for modulation. + + + + + An external generator is used for modulation. + + + + + Values for the pulse output polarity. + + + + + Specifies normal polarity. + + + + + Specifies inverted polarity. + + + + + Values for the sweep mode. + + + + + The RF output of the signal generator is a non-swept signal (Continuous Wave). + + + + + The signal generator sweeps the RF output signal's frequency in an analog form (non-stepped). + + + + + The signal generator sweeps the RF output signal's power in an analog form (non-stepped). + + + + + The signal generator sweeps the RF output signal's frequency in steps. + + + + + The signal generator sweeps the RF output signal's power level in steps. + + + + + The signal generator uses two lists with frequency and power level values to sweep the RF output signal. + + + + + Values for TDMA external clock type. + + + + + The external clock frequency is equal to the bit clock frequency of the digital modulation. + + + + + The external clock frequency is equal to the symbol clock frequency of the digital modulation. + + + + IVI RFSigGen values for Slope. + + + + Sets positive slope. + + + + + Sets negative slope. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Scope.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Scope.dll new file mode 100644 index 0000000..2153dc4 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Scope.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Scope.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Scope.xml new file mode 100644 index 0000000..f967a26 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Scope.xml @@ -0,0 +1,1739 @@ + + + + Ivi.Scope + + + + + IVI Scope class-compliant values for AC line trigger Slope. + + + + + Positive triggers on positive slope zero + crossings of the network supply voltage. + + + + + Negative triggers on negative slope zero + crossings of the network supply voltage. + + + + + Either triggers on either positive or + negative slope zero crossings of the network supply voltage. + + + + + IVI Scope class-compliant values for the status parameter of the + acquisition Status method. + + + + + The oscilloscope has completed the acquisition. + + + + + The oscilloscope is still acquiring data. + + + + + The oscilloscope cannot determine the status of the acquisition. + + + + + IVI Scope class-compliant values for Acquisition Type. + + + + + The Normal acquisition type acquires one sample for each point + in the waveform record. The oscilloscope uses real-time or + equivalent time sampling. + + + + + The peak-detect acquisition mode oversamples the input signal + and keeps the minimum and maximum values that correspond to each position + in the waveform record. The oscilloscope uses only real-time sampling. + + + + + The HighResolution acquisition mode calculates the average value + that corresponds to each position in the waveform record. + The oscilloscope uses only real-time sampling. + + + + + The Envelope acquisition mode acquires multiple waveforms and keeps the minimum and + maximum voltages it acquires for each point in the waveform record. + The end-user specifies the number of waveforms the oscilloscope + acquires with the Number of Envelopes property. The oscilloscope + can use real-time or equivalent-time sampling. + + + + + The Average acquisition mode acquires multiple waveforms and + calculate the average value for each point in the waveform record. + The end-user specifies the number of waveforms to acquire with the + Number of Averages property. The oscilloscope uses real-time or + equivalent time sampling. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Acquisition type: . + + + + + Looks up a localized string similar to Channel name: . + + + + + Looks up a localized string similar to The channel is not enabled for measurement.. + + + + + Looks up a localized string similar to The acquisition type is invalid.. + + + + + Looks up a localized string similar to Measurement function: . + + + + + Looks up a localized string similar to Unable to perform the specified measurement.. + + + + + Specified channel is not enabled. + + + + + Initializes a new instance of the class with a specified channel name. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified channel name. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified channel name and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + IVI Scope class-compliant values for glitch trigger Condition. + + + + + The oscilloscope triggers when the pulse width is less than the + value you specify with the Glitch Width property. + + + + + The oscilloscope triggers when the pulse width is greater than + the value you specify with the Glitch Width property. + + + + + The IviScope class allows clients to create instances of drivers that implement the class-compliant + IviScope interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviScope drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviScope class-compliant driver and return an IIviScope reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviScope driver to be created. + + An IIviScope interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviScope class-compliant driver and return an IIviScope reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviScope driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviScope interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviScope class-compliant driver and return an IIviScope reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviScope driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviScope interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviScope class-compliant driver and return an IIviScope reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviScope driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviScope interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Minimum/maximum waveform pair. + + + + + Constructor. + + Minimum value waveform object. + Maximum value waveform object. + + + + Returns the hash code for the result. + + An containing the hash value generated for this result. + + + + Minimum value. + + + + + Maximum value. + + + + + IVI Scope class-compliant values for the polarity of glitch, runt, and width triggers. + + + + + The oscilloscope triggers on a positive polarity. + + + + + The oscilloscope triggers on a negative polarity. + + + + + The oscilloscope triggers on either a positive or negative polarity. + + + + + IVI Scope class-compliant root interface. + + + + + Reference to the class-compliant IIviScopeAcquisition interface. + + + + + Reference to the class-compliant IIviScopeChannels interface. + + + + + Reference to the class-compliant IIviScopeMeasurement interface. + + + + + Reference to the class-compliant IIviScopeReferenceLevel interface. + + + + + Reference to the class-compliant IIviScopeTrigger interface. + + + + + IVI Scope class-compliant acquisition interface. + + + + + Configures the most commonly used properties of the oscilloscope's acquisition subsystem: time per record, + minimum record length, and the acquisition start time. + + Specifies the time per record. Refer to the + property for details. + Specifies the minimum number of points the end-user allows in the waveform + recorded. Refer to the property for details. + Specifies the position of the first point in the waveform record relative + to the trigger event. Refer to the property for details. + + The order in which the timePerRecord, minimumNumberPoints, and acquisitionStartTime are set is + implementation dependent. + + + + + The number of waveforms the oscilloscope acquires and averages before returning to the idle state. + Applies only when the Acquisition Type is Average. + + + + + The number of waveforms the oscilloscope acquires and analyzes to create the minimum and maximum waveforms, + before returning to the idle state. Applies only when acquisition Type is Envelope. + + + + + The oscilloscope uses the interpolation method when it cannot sample a voltage for every point in the + waveform record. + + + + + The actual number of points the oscilloscope acquires for each channel. It is equal to or greater than + the minimum number of points specified with the Horizontal Minimun Number of Points property. + + + + + The sample mode the oscilloscope is currently using. + + + + + The effective digitizing rate using the current configuration. The units are samples per second. + + + + + How the oscilloscope acquires data and fills the waveform record. When set to Envelope or Peak Detect, the + oscilloscope acquires minimum and maximum waveforms. + + + + + The minimum number of points which can be in a waveform record for each channel. It configures the record + length that the oscilloscope uses for waveform acquisition. The Record Length property returns the + actual record length. + + + + + The length of time from the trigger event to the first point in the waveform record. If positive, the first + point in the waveform occurs after the trigger. If negative, the first point in the waveform occurs before + the trigger. + + + + + The time that corresponds to the record length. + + + + + IVI Scope class-compliant channel interface. + + + + + Configure the electrical characteristics of the channel - the input impedance and the maximum frequency + of the input signal. + + The input impedance for the channel. Refer to the + property for details. + The maximum input frequency for the channel. Refer to the + property for details. + + The order in which the impedance and maximum frequencies are set is implementation dependent. + + + + + Configure the most commonly used properties of an oscilloscope channel - the range, offset, coupling, + probe attenuation, and whether the channel is enabled. + + Specifies the vertical range. Refer to the property for + details. + Specifies the vertical offset. Refer to the property for + details. + Specifies how to couple the input signal. Refer to the + property for details. + Specifies the probe attenuation. Refer to the + property for details. + Iff true, the channel is enabled for acquisition. Refer to the + property for details. + + The order in which the range, offset, coupling, probe attenuation are set, and the channel is + enabled, is implementation dependent. + + + + + Configure the most commonly used properties of an oscilloscope channel - the range, offset, coupling, + probe attenuation, and whether the channel is enabled. + + The vertical range. Refer to the property for details. + The vertical offset. Refer to the property for details. + How to couple the input signal. Refer to the property + for more details. + Iff true, automatic probe sensing is enabled. Refer to the + property for details. + Iff true, the channel is enabled for acquisition. Refer to the + property for details. + + The order in which the range, offset, coupling, probe attenuation auto are set, and the channel is + enabled, is implementation dependent. + + + + + How the oscilloscope couples the input signal for the channel. + + + + + If True, the oscilloscope acquires a waveform for this channel when the Initiate Acquisition, Read + Waveform, Read Min Max Waveform, or Read Waveform Measurement methods are called. + + If True, the oscilloscope acquires a waveform for this channel when one of the following methods is called: + - IIviScopeMeasurement.Initiate + - IIviScopeChannelMeasurement.ReadWaveform + - IIviScopeChannelMeasurement.ReadWaveformMinMax + - IIviScopeChannelMeasurement.ReadWaveformMeasurement + + + + + The maximum input frequency, in hertz, of this channel. It is the frequency at + which the input circuitry attenuates the input signal by 3 dB. + + + + + The input impedance of this channel. The units are ohms. + + + + + The location of the center of the range that you specify with the + Range property. The units are volts, with respect to ground. + For example, to acquire a sine wave spanning 0.0 to 10.0 volts, + set Offset to 5.0 volts. + + + + + The scaling factor by which the probe attenuates the input signal. + For example, with a 10:1 probe, the value is 10.0. + + + + If set to True, automatic probe sensing is enabled. If set to False, automatic probe sensing is + disabled. + You can obtain the actual value of the probe attenuation by querying the + property. If set to False, automatic probe sensing is disabled, the + property (understood to be the manual probe attenuation) is set to + the last automatically determined value, and querying the property + subsequently returns the current manual probe attenuation. + + + + The absolute value of the input range the oscilloscope can acquire + for the channel. The units are volts. For example, to acquire a + sine wave spanning -5.0 to 5.0 volts, set Range to 10.0 volts. + + + + + Reference to the class-compliant IIviScopeChannelMeasurement interface. + + + + + IVI Scope class-compliant channel collection interface. + + + + + IVI Scope class-compliant measurement interface. + + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the measurement for this + channel. Call FetchWaveformMeasurement to obtain other measurements + for this or other channels. + + Function of the acquired waveform to be measured. + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, + and PrecisionTimeSpan.MaxValue is used for infinite. + The measured value. The units depend on the measurement + that the user specifies with the measFunction parameter. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the time span measurement for this + channel. Call FetchWaveformMeasurement to obtain other measurements + for this or other channels. + + Function (measured as a time span) of the acquired waveform to be measured. + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, + and PrecisionTimeSpan.MaxValue is used for infinite. + The measured time span value. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the waveform for this + channel. Call FetchWaveform to obtain the waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, + and PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the waveform for this + channel. Call FetchWaveform to obtain the waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, + and PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the waveform for this + channel. Call FetchWaveform to obtain the waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, + and PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the waveform for this + channel. Call FetchWaveform to obtain the waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, + and PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the min/max waveforms + for this channel. Call FetchMinMaxWaveform to obtain the min/max + waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, and + PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the min/max waveforms + for this channel. Call FetchMinMaxWaveform to obtain the min/max + waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, and + PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the min/max waveforms + for this channel. Call FetchMinMaxWaveform to obtain the min/max + waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, and + PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Initiates an acquisition on all enabled channels, waits (up to maximumTime) + for the acquisition to complete, and returns the min/max waveforms + for this channel. Call FetchMinMaxWaveform to obtain the min/max + waveforms for other channels. + + Specifies the maximum time the end-user allows + for this method to complete. PrecisionTimeSpan.Zero is used for immediate, and + PrecisionTimeSpan.MaxValue is used for infinite. + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns a previously acquired waveform measurement for this channel. + The acquisition must be made prior to calling this method. + Call this method separately for each measurement. + + Characteristic of the acquired waveform to be measured. + The measured value. The units depend on the measurement + that the user specifies with the measFunction parameter. + + + + Returns a previously acquired waveform measurement for this channel. + The acquisition must be made prior to calling this method. + Call this method separately for each measurement. + + Function (measured as a time span) of the acquired waveform to be measured. + The measured time span value. + + + + Returns a previously acquired waveform for this channel. The + acquisition must be made prior to calling this method. + Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns a previously acquired waveform for this channel. The + acquisition must be made prior to calling this method. + Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns a previously acquired waveform for this channel. The + acquisition must be made prior to calling this method. + Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns a previously acquired waveform for this channel. The + acquisition must be made prior to calling this method. + Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns the previously acquired minimum and maximum waveforms for + this specified channel. The acquisition must be made prior to + calling this method. Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns the previously acquired minimum and maximum waveforms for + this specified channel. The acquisition must be made prior to + calling this method. Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns the previously acquired minimum and maximum waveforms for + this specified channel. The acquisition must be made prior to + calling this method. Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + Returns the previously acquired minimum and maximum waveforms for + this specified channel. The acquisition must be made prior to + calling this method. Call this method separately for each channel. + + The waveform object to store the measurement data into. + This can be null, in which case a waveform will be created by the driver. + + Waveform object containing the measurement data. + + + + IVI Scope class-compliant measurement interface. + + + + + Aborts an acquisition and returns the oscilloscope to the Idle state. + + + + + Automatically configures all the oscilloscopes settings based on the input signals. + + + + + Creates a waveform object of type Double that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform + with a number of samples based on the current driver configuration. + Waveform object with elements of type Double. + + + + Creates a waveform object of type Int32 that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform + with a number of samples based on the current driver configuration. + Waveform object with elements of type Int32. + + + + Creates a waveform object of type Int16 that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform + with a number of samples based on the current driver configuration. + Waveform object with elements of type Int16. + + + + Creates a waveform object of type Byte that can be used with Read and Fetch methods. + + Number of elements in the waveform. If zero, the driver will create a waveform + with a number of samples based on the current driver configuration. + Waveform object with elements of type Byte. + + + + Initiates a waveform acquisition. The oscilloscope leaves the Idle state and waits for a trigger. The + oscilloscope acquires a waveform for each enabled channel. + + + + + Returns whether an acquisition is in progress, complete, or if the status is unknown. + + + + + + IVI Scope class-compliant reference level interface. + + + + + Configures the reference levels for waveform measurements, low, mid, and high. + + Measurement low reference. Refer to the property for details. + Measurement mid reference. Refer to the property for details. + Measurement high reference. Refer to the property for details. + + + + The high reference for waveform measurements. It is a percentage of the difference between the Voltage High + and Voltage Low. Voltage High and Voltage Low may be calculated using either the min/max or histogram methods. + + + + + The low reference for waveform measurements. It is a percentage of the difference between the Voltage High + and Voltage Low. Voltage High and Voltage Low may be calculated using either the min/max or histogram methods. + + + + + The mid reference for waveform measurements. It is a percentage of the difference between the Voltage High + and Voltage Low. Voltage High and Voltage Low may be calculated using either the min/max or histogram methods. + + + + + IVI Scope class-compliant trigger interface. + + + + + Configures trigger Type and Holdoff. Holdoff units are seconds. + + Specifies the trigger type. Refer to the property for details. + Specifies the trigger hold-off. Refer to the property for + details. + + + + If True, the oscilloscope waits trigger holdoff seconds after a waveform acquisition is complete and then + immediatley enters the wait for trigger state without passing through the idle state. + + + + + How the oscilloscope couples the trigger source. + + + + + The voltage threshold for the trigger subsystem. The units are volts. This property affects instrument behavior + only when the Trigger Type is set to one of the following values: Edge Trigger, Glitch Trigger, or Width Trigger. + + + + + The trigger modifier determines the oscilloscope's behavior in the absence of a trigger. + + + + + The signal the oscilloscope monitors for a trigger. It can be channel or one of many other values. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + The length of time the oscilloscope waits after it fills the acquisition buffer until the oscilloscope + enables the trigger subsystem to detect another trigger. + + + + + The kind of event that triggers the oscilloscope. + + + + + Reference to the class-compliant IIviScopeTriggerACLine interface. + + + + + Reference to the class-compliant IIviScopeTriggerEdge interface. + + + + + Reference to the class-compliant IIviScopeTriggerGlitch interface. + + + + + Reference to the class-compliant IIviScopeTriggerRunt interface. + + + + + Reference to the class-compliant IIviScopeTriggerTv interface. + + + + + Reference to the class-compliant IIviScopeTriggerWidth interface. + + + + + IVI Scope class-compliant AC line trigger interface. + + + + + The slope of the zero crossing upon which the scope triggers. + + + + + IVI Scope class-compliant edge trigger interface. + + + + + Configures the conidtions for edge trigger. An edge trigger occurs when the trigger source signal passes + through the trigger level with the specified slope. + + Specifies the trigger source. Refer to the + property for details. + Specifies the trigger level. Refer to the + property for details. + Specifies the trigger slope. Refer to the + property for details. + + + + The slope, a rising or a falling edge, that triggers the oscilloscope. + + + + + IVI Scope class-compliant glitch trigger interface. + + + + + Configure the glitch trigger Source, Level, Width, Polarity, and + Condition. A glitch trigger occurs when the edge of a pulse that + matches the Width and Polarity crosses the specified Level (in Volts). + + Specifies the trigger source. Refer to the + property for details. + Specifies the trigger level. Refer to the + property for details. + Specifies the glitch triggering glitch width in seconds. Refer to the + property for details. + Specifies the glitch polarity. Refer to the property for + details. + Specifies the glitch condition. Refer to the property for + details. + + + + The glitch condition detemermines whether the oscilloscope triggers on a a pulse with a width less than or + greater than the glitch width value. + + + + + The polarity of the glitch that triggers the oscilloscope. + + + + + The glitch width. + + + + + IVI Scope class-compliant runt trigger interface. + + + + + Configures the runt trigger Source, ThresholdLow, ThresholdHigh, and Polarity. A runt trigger occurs when + the trigger signal crosses one of the runt thresholds twice without crossing the other runt threshold. + + Specifies the trigger source. Refer to the + property for details. + Sets the runt triggering low threshold in volts. Refer to the + property for details. + Sets the runt triggering high threshold in volts. Refer to the + property for details. + Sets the runt polarity. Refer to the property for details. + + + + The polarity of the runt that triggers the oscilloscope. + + + + + The high threshold the oscilloscope uses for runt triggering. The units are volts. + + + + + The low threshold the oscilloscope uses for runt triggering. The units are volts. + + + + + IVI Scope class-compliant TV trigger interface. + + + + + Configures the TV trigger source, signal format, event and polarity. + + Specifies the trigger source. Refer to the + property for details. + Specifies the TV trigger signal format. Refer to the + property for details. + Specifies the TV trigger event. Refer to the + property for details. + Specifies the polarity of the TV trigger. Refer to the + property for details. + + + + The line on which the oscilloscope triggers. The line number is absolute and not relative to the field + of the TV signal. + + + + + The event on which the oscilloscope triggers. + + + + + The polarity of the TV signal. + + + + + The format of the TV signal on which the oscilloscope triggers. + + + + + IVI Scope class-compliant width trigger interface. + + + + + Configures the width trigger Source, Level, ThresholdLow, + ThresholdHigh, Polarity, and Condition. A width trigger occurs + when a pulse, that passes through Level, with a width between or + outside, the width thresholds is detected. + + The trigger source. Refer to the + property for details. + The trigger level. Refer to the + property for details. + The width triggering low threshold. Refer to the + property for details. + The width triggering high threshold. Refer to the + property for details. + The width polarity. Refer to the + property for details. + Specifies whether a pulse that is within or outside the user-specified thresholds + trigger waveform acquisition. Refer to the property for details. + + + + The condition of a pulse that triggers the oscilloscope. The condition is either inside or outside of the + high and low thresholds. + + + + + The polarity of the pulse that triggers the oscilloscope. + + + + + The low width threshold time. + + + + + The high width threshold time. + + + + + IVI Scope class-compliant values for acquisition Interpolation. + + + + + The oscilloscope does not interpolate points in the waveform. + Instead, the driver sets every element in the waveform record for + which the oscilloscope cannot receive a value to an IEEE-defined + NaN (Not-a-Number) value. Use the Is Waveform Element Invalid + method to determine if the waveform record element is invalid. + + + + + The oscilloscope uses a sine(x)/x calculation to interpolate a + value when it cannot resolve a voltage in the waveform record. + + + + + The oscilloscope uses a linear approximation to interpolate a + value when it cannot resolve a voltage in the waveform record. + + + + + Invalid acquisition type. + + + + + Initializes a new instance of the class with a specified error message and acquisition type. + + The message that describes the error. + The acquisition type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The acquisition type. + + + + + Gets the error message. + + + + + IVI Scope class-compliant values for the MeasurementFunction parameter of the + IIviScopeChannelMeasurement ReadWaveformMeasurement and FetchWaveformMeasurement methods. + + + + + The length of time for a rising edge of the signal to rise from the + low reference level to the high reference level. Units are in seconds. + + + + + The length of time for a falling edge of the signal to fall from + the high reference level to the low reference level. Units are in seconds. + + + + + The frequency of one complete cycle in the waveform. + The units are Hertz. + + + + + The length of time of one complete cycle in the waveform. Units are in seconds. + + + + + The true Root Mean Square voltage of the entire waveform. + The units are Volts. + + + + + The absolute difference between the Voltage Max and the Voltage Min. + The units are Volts. + + + + + The maximum amplitude found in the entire waveform. + The units are Volts. + + + + + The minimum amplitude found in the entire waveform. + The units are Volts. + + + + + The voltage that corresponds to 100% when using the reference levels. + The oscilloscope calculates this value using either the min/max or + histogram methods. The min/max method uses the maximum value found. + The histogram method uses a common value found above the middle of + the waveform. The units are Volts. + + + + + The voltage that corresponds to 0% when using the reference levels. + The oscilloscope calculates this value using either the min/max or + histogram methods. The min/max method uses the minimum value found. + The histogram method uses a common value found below the middle of + the waveform. The units are Volts. + + + + + The arithmetic average in volts measured over the entire waveform. + The units are Volts. + + + + + The length of time between the mid reference level points of a + negative pulse in the waveform. Units are in seconds. + + + + + The length of time between the mid reference level points of a + positive pulse in the waveform. Units are in seconds. + + + + + The ratio of Width Negative to the Period of an integer number of + cycles in the waveform, expressed as a percentage. + + + + + The ratio of Width Positive to the Period of an integer number of + cycles in the waveform, expressed as a percentage. + + + + + The Voltage High less the Voltage Low in Volts over the entire + waveform. + + + + + The true Root Mean Square voltage over an integer number of cycles + in the waveform. The units are Volts. + + + + + The arithmetic average in Volts over an integer number of cycles + in the waveform. The units are Volts. + + + + + The relative waveform distortion that follows an edge transition. + + + + + The relative waveform distortion that precedes an edge transition. + + + + + IVI Scope class-compliant values for acquisition SampleMode. + + + + + Indicates that the oscilloscope is using real-time sampling. + + + + + Indicates that the oscilloscope is using equivalent time sampling. + + + + + IVI Scope class-compliant values for the timeMeasurementFunction parameter of the + IIviScopeChannelMeasurement ReadWaveformMeasurement and FetchWaveformMeasurement methods. + + + + + The length of time for a rising edge of the signal to rise from the + low reference level to the high reference level. + + + + + The length of time for a falling edge of the signal to fall from + the high reference level to the low reference level. + + + + + The length of time of one complete cycle in the waveform. + + + + + The length of time between the mid reference level points of a + negative pulse in the waveform. + + + + + The length of time between the mid reference level points of a + positive pulse in the waveform. + + + + + IVI Scope class-compliant values for trigger Coupling. + + + + + The oscilloscope AC couples the trigger signal. + + + + + The oscilloscope DC couples the trigger signal. + + + + + The oscilloscope filters out the high frequencies from the + trigger signal. + + + + + The oscilloscope filters out the low frequencies from the + trigger signal. + + + + + The oscilloscope filters out the noise from the trigger signal. + + + + + IVI Scope class-compliant values for trigger Modifier. + + + + + The oscilloscope waits until the trigger the end-user specifies occurs. + + + + + The oscilloscope automatically triggers if the configured trigger does + not occur within the oscilloscope's timeout period. + + + + + The oscilloscope adjusts the trigger level if the trigger the end-user + specifies does not occur. + + + + + IVI Scope class-compliant values for trigger Type. + + + + + Configures the oscilloscope for edge triggering. An edge trigger + occurs when the trigger signal specified with the Trigger Source + property passes the voltage threshold specified with the + Trigger Level property and has the slope specified with the + Trigger Slope property. + + + + + Configures the oscilloscope for width triggering. Use the + IviScopeWidthTrigger extension properties and methods to configure + the trigger. + + + + + Configures the oscilloscope for runt triggering. Use the + IviScopeRuntTrigger extension properties and methods to configure + the trigger. + + + + + Configures the oscilloscope for glitch triggering. Use the + IviScopeGlitchTrigger extension properties and methods to + configure the trigger. + + + + + Configures the oscilloscope for triggering on TV signals. Use the + IviScopeTVTrigger extension properties and methods to configure + the trigger. + + + + + Configures the oscilloscope for immediate triggering. The + oscilloscope does not wait for trigger of any kind upon + initialization. + + + + + Configures the oscilloscope for AC Line triggering. Use the + IviScopeACLineTrigger extension properties and methods to configure + the trigger. + + + + + IVI Scope class-compliant values for TV trigger SignalFormat. + + + + + The oscilloscope triggers on the NTSC signal format. + + + + + The oscilloscope triggers on the PAL signal format. + + + + + The oscilloscope triggers on the SECAM signal format. + + + + + IVI Scope class-compliant values for TV trigger Event. + + + + + The oscilloscope triggers on field 1 of the video signal. + + + + + The oscilloscope triggers on field 2 of the video signal. + + + + + The oscilloscope triggers on any field. + + + + + The oscilloscope triggers on any line. + + + + + The oscilloscope triggers on a specific line number you specify + with the TV Trigger Line Number property. + + + + + IVI Scope class-compliant values for TV trigger Polarity. + + + + + The oscilloscope triggers on a positive video sync pulse. + + + + + The oscilloscope triggers on a negative video sync pulse. + + + + + Unable to perform desired measurement operation. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + IVI Scope class-compliant values for channel Coupling. + + + + + The oscilloscope AC couples the input signal. + + + + + The oscilloscope DC couples the input signal. + + + + + The oscilloscope couples the channel to the ground. + + + + + IVI Scope class-compliant values for width trigger Condition. + + + + + Configures the oscilloscope to trigger on pulses that have a width + that is less than the high threshold and greater than the low + threshold. The end-user specifies the high and low thresholds with + the Width High Threshold and Width Low Threshold properties. + + + + + Configures the oscilloscope to trigger on pulses that have a width + that is either greater than the high threshold or less than a low + threshold. The end-user specifies the high and low thresholds with + the Width High Threshold and Width Low Threshold properties. + + + + IVI Scope values for Slope. + + + + The positive slope triggers the oscilloscope at rising edge. + + + + + The Negative slope triggers the oscilloscope at falling edge. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.SpecAn.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.SpecAn.dll new file mode 100644 index 0000000..1f44832 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.SpecAn.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.SpecAn.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.SpecAn.xml new file mode 100644 index 0000000..dc05615 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.SpecAn.xml @@ -0,0 +1,1369 @@ + + + + Ivi.SpecAn + + + + + Acquisition status. + + + + + The spectrum analyzer has completed the acquisition. + + + + + The spectrum analyzer is still acquiring data. + + + + + The spectrum analyzer cannot determine the status of the acquisition. + + + + + Amplitude units. + + + + + Sets the spectrum analyzer to measure in decibels relative to 1 milliwatt. + + + + + Sets the spectrum analyzer to measure in decibels relative to 1 millivolt. + + + + + Sets the spectrum analyzer to measure in decibels relative to 1 microvolt. + + + + + Sets the spectrum analyzer to measure in volts. + + + + + Sets the spectrum analyzer to measure in watts. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to The active marker is not enabled.. + + + + + Looks up a localized string similar to The active marker is not a delta marker.. + + + + + The IviSpecAn class allows clients to create instances of drivers that implement the class-compliant + IviSpecAn interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviSpecAn drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviSpecAn class-compliant driver and return an IIviSpecAn reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSpecAn driver to be created. + + An IIviSpecAn interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviSpecAn class-compliant driver and return an IIviSpecAn reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSpecAn driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviSpecAn interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviSpecAn class-compliant driver and return an IIviSpecAn reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSpecAn driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviSpecAn interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviSpecAn class-compliant driver and return an IIviSpecAn reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSpecAn driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviSpecAn interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Marker horizontal position and amplitude. + + + + + Constructor. + + The horizontal position. + The amplitude value. + + + + Compares two instances for equality. + + The instance to compare with the current instance. + true if the two instances represent the same result; otherwise, false. + + + + Returns the hash code for the result. + + An containing the hash value generated for this result. + + + + Determines whether two instances have the same value. + + A instance to compare with info2. + A instance to compare with info1. + true if the instances are equivalent; otherwise, false. + + + + Determines whether two instances do not have the same value. + + A instance to compare with info2. + A instance to compare with info1. + true if the two instances are not equal; otherwise, false. If either parameter is null, this method returns true. + + + + The horizontal position. + + + + + The amplitude value (Amplitude Units or + relative amplitude units for delta markers). + + + + + The Active Marker is not a delta marker. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The Active Marker is not enabled. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + Detector type. + + + + + Allows the detector to capture better readings by using both + positive and negative peak values when noise is present. + + + + + Average value of samples taken within the bin for a dedicated + point on the display. + + + + + Obtains the maximum video signal between the last display point + and the present display point. + + + + + Obtains the minimum video signal between the last display point + and the present display point. + + + + + Pick one point within a bin. + + + + + RMS value of samples taken within the bin for a dedicated point + on the display. + + + + + Vertical scale. + + + + + Sets the vertical scale in linear units. + + + + + Sets the vertical scale in logarithmic units. + + + + + Trace type. + + + + + Sets the spectrum analyzer to clear previous sweep data off the + display before performing a sweep. Subsequent sweeps may or may + not clear the display first, but the data array at the end of the + sweep is entirely new. + + + + + Sets the spectrum analyzer to keep the data from either the + previous data or the new sweep data, which ever is higher. + + + + + Sets the spectrum analyzer to keep the data from either the + previous data or the new sweep data, which ever is lower. + + + + + Sets the spectrum analyzer to maintain a running average of the + swept data. + + + + + Disables acquisition into this trace but displays the existing + trace data. + + + + + Disables acquisition and disables the display of the existing + trace data. + + + + + Marker type. + + + + + Regular marker used to make absolute measurements. + + + + + Marker used in conjunction with the reference marker to make relative measurements. + + + + + Marker search options. + + + + + Sets marker search for the highest amplitude. + + + + + Sets marker search for the minimum amplitude. + + + + + Sets marker search for the next highest peak. + + + + + Sets marker search for the next peak left of the current marker position. + + + + + Sets marker search for the next peak right of the current marker position. + + + + + Instrument setting. + + + + + Sets the center frequency with the Active Marker frequency. + + + + + If the Active Marker is a Delta Marker, this sets the frequency + span with the Active Marker frequency and the center frequency at + the midpoint between the Active Marker and its reference. + + + + + Sets the Frequency Start with the Active Marker frequency. + + + + + Sets the Frequency Stop with the Active Marker frequency. + + + + + Sets the Reference Level with the Active Marker amplitude. + + + + + IVI SpecAn class-compliant trigger video interface. + + + + + This method specifies at which level and slope of the video signal, acquisition is triggered. + This is applicable when the Trigger Source property is set to Video. + + The video level for triggering. Refer to the Level property for more details. + The video level slope for triggering. Refer to the Slope property for more details. + + + + Specifies the level that the video signal shall reach to trigger the acquisition. + The units are specified by the Amplitude Units attribute. + + + + + Specifies which slope of the video signal triggers the acquisition. + Defined values: Positive, Negative. + + + + + IVI SpecAn class-compliant trigger external interface. + + + + + This method specifies at which level and slope of the external trigger signal, acquisition is triggered. + This is applicable when the Trigger Source property is set to External. + + The external level for triggering. Refer to the Level property for more details. + The external slope for triggering. Refer to the Slope property for more details. + + + + Specifies the level, in Volts, that the external trigger signal shall reach to trigger the acquisition. + + + + + Specifies which slope of the external trigger signal triggers the acquisition. + Defined values: Positive, Negative. + + + + + IVI SpecAn class-compliant trigger interface. + + + + + Specifies the source for the trigger signal that causes the analyzer to leave the Wait-For-Trigger state. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + Reference to the class-compliant IIviSpecAnTriggerExternal interface. + + + + + Reference to the class-compliant IIviSpecAnTriggerVideo interface. + + + + + IVI SpecAn class-compliant traces math interface. + + + + + This method modifies a trace to be the point by point sum of two other traces. Any data in the destination trace is deleted. + DestinationTrace = Trace1 + Trace2 + + Name of the trace into which the added traces are stored. + Name of one of the two traces to be added. + Name of the second trace to be added. + + + + This method copies the data array from one trace into another trace. Any data in the Destination Trace is deleted. + + Name of the trace into which the array is stored. + Name of the trace to be copied. + + + + This method exchanges the data arrays of two traces. + + Name of one of the two traces to be exchanged. + Name of the second trace to be exchanged. + + + + This method modifies a trace to be the point by point difference of two other traces. Any data in the destination trace is deleted. + DestinationTrace = Trace1 - Trace2 + + Name of the trace into which the subtracted traces are stored. + Name of the first trace to be subtracted. + Name of the second trace to be subtracted. + + + + IVI SpecAn class-compliant trace collection interface. + + + + + This method aborts a previously initiated measurement and returns the spectrum analyzer to the idle state. + + This method does not check instrument status. + + + + This method creates a spectrum object that can be passed to Read and Fetch routines. This is used for performance optimization + to control when memory is allocated. + If size is zero, the driver shall allocate the spectrum memory with a size based on the current driver configuration. + + The number of points (of type double) in the spectrum. + Trace spectrum that is allocated. + + + + This method initiates an acquisition. After calling this method, the spectrum analyzer leaves the idle state. + + This function does not check the instrument status. The user calls the Acquisition Status function to determine when + the acquisition is complete. + + + + This method determines and returns the status of an acquisition. + + Acquisition status. + + + + Generates a software trigger. + + + + + Reference to the class-compliant IIviSpecAnTracesMath interface. + + + + + IVI SpecAn class-compliant trace interface. + + + + + This method initiates a signal acquisition based on the present instrument configuration. + It then waits for the acquisition to complete, and returns the trace as an array of amplitude values. + The amplitude array returns data that represent the amplitude of the signals obtained by sweeping from the start frequency + to the stop frequency (in frequency domain, in time domain the amplitude array is ordered from beginning of sweep to end). + The Amplitude Units property determines the units of the points in the amplitude array. This function resets the sweep count. + + Specifies the maximum time the end-user allows for this method to complete. + Previously allocated spectrum, or null. + Trace spectrum. + + + + This method initiates a signal acquisition based on the present instrument configuration. + It then waits for the acquisition to complete, and returns the trace as an array of amplitude values. + The amplitude array returns data that represent the amplitude of the signals obtained by sweeping from the start frequency + to the stop frequency (in frequency domain, in time domain the amplitude array is ordered from beginning of sweep to end). + The Amplitude Units property determines the units of the points in the amplitude array. This function resets the sweep count. + + Specifies the maximum time the end-user allows for this method to complete. + Previously allocated waveform, or null. + Trace waveform. + + + + This method returns the trace the spectrum analyzer acquires. The trace is from a previously initiated acquisition. + The user calls the Initiate function to start an acquisition. The user calls the Acquisition Status function to determine + when the acquisition is complete. + + Previously allocated spectrum, or null. + Trace spectrum. + + + + This method returns the trace the spectrum analyzer acquires. The trace is from a previously initiated acquisition. + The user calls the Initiate function to start an acquisition. The user calls the Acquisition Status function to determine + when the acquisition is complete. + + Previously allocated spectrum, or null. + Trace waveform. + + + + Specifies the representation of the acquired data. + Defined values: ClearWrite, MaxHold, MinHold, VideoAverage, View, Store. + + + + + IVI SpecAn class-compliant sweep coupling interface. + + + + + This method configures the coupling and sweeping attributes. + + Turns resolution bandwidth auto coupling on/off. + Refer to the ResolutionBandwidthAuto property for more details. + Turns video bandwidth auto coupling on/off. + Refer to the VideoBandwidthAuto property for more details. + Turns sweep time coupling on/off. + Refer to the SweepTimeAuto property for more details. + + + + This method configures the coupling and sweeping attributes. + + Turns resolution bandwidth auto coupling on/off. + Refer to the ResolutionBandwidthAuto property for more details. + Turns video bandwidth auto coupling on/off. + Refer to the VideoBandwidthAuto property for more details. + Specifies the length of time to sweep from the beginning to the end of the current domain. + This value is ignored when SweepTimeAuto is True. Refer to the SweepTime property for more details. + + + + This method configures the coupling and sweeping attributes. + + Turns resolution bandwidth auto coupling on/off. + Refer to the ResolutionBandwidthAuto property for more details. + Specifies the video bandwidth of the post-detection filter in Hertz. + This value is ignored when VideoBandwidthAuto is True. Refer to the VideoBandwidth property for more details. + Turns sweep time coupling on/off. + Refer to the SweepTimeAuto property for more details. + + + + This method configures the coupling and sweeping attributes. + + Turns resolution bandwidth auto coupling on/off. + Refer to the ResolutionBandwidthAuto property for more details. + Specifies the video bandwidth of the post-detection filter in Hertz. + This value is ignored when VideoBandwidthAuto is True. Refer to the VideoBandwidth property for more details. + Specifies the length of time to sweep from the beginning to the end of the current domain. + This value is ignored when SweepTimeAuto is True. Refer to the SweepTime property for more details. + + + + This method configures the coupling and sweeping attributes. + + Specifies the measurement resolution bandwidth in Hertz. + This value is ignored when ResolutionBandwidthAuto is True. Refer to the ResolutionBandwidth property for more details. + Turns video bandwidth auto coupling on/off. + Refer to the VideoBandwidthAuto property for more details. + Turns sweep time coupling on/off. + Refer to the SweepTimeAuto property for more details. + + + + This method configures the coupling and sweeping attributes. + + Specifies the measurement resolution bandwidth in Hertz. + This value is ignored when ResolutionBandwidthAuto is True. Refer to the ResolutionBandwidth property for more details. + Turns video bandwidth auto coupling on/off. + Refer to the VideoBandwidthAuto property for more details. + Specifies the length of time to sweep from the beginning to the end of the current domain. + This value is ignored when SweepTimeAuto is True. Refer to the SweepTime property for more details. + + + + This method configures the coupling and sweeping attributes. + + Specifies the measurement resolution bandwidth in Hertz. + This value is ignored when ResolutionBandwidthAuto is True. Refer to the ResolutionBandwidth property for more details. + Specifies the video bandwidth of the post-detection filter in Hertz. + This value is ignored when VideoBandwidthAuto is True. Refer to the VideoBandwidth property for more details. + Turns sweep time coupling on/off. + Refer to the SweepTimeAuto property for more details. + + + + This method configures the coupling and sweeping attributes. + + Specifies the measurement resolution bandwidth in Hertz. + This value is ignored when ResolutionBandwidthAuto is True. Refer to the ResolutionBandwidth property for more details. + Specifies the video bandwidth of the post-detection filter in Hertz. + This value is ignored when VideoBandwidthAuto is True. Refer to the VideoBandwidth property for more details. + Specifies the length of time to sweep from the beginning to the end of the current domain. + This value is ignored when SweepTimeAuto is True. Refer to the SweepTime property for more details. + + + + If set to True, the resolution bandwidth is automatically selected. + If set to False, the resolution bandwidth is manually selected. + + + + + Specifies the width of the IF filter in Hertz. + + + + + If set to True, the video bandwidth is automatically selected. If set to False, the video bandwidth is manually selected. + + + + + Specifies the video bandwidth of the post-detection filter in Hertz. + + + + + If set to True, the sweep time is automatically selected If set to False, the sweep time is manually selected. + + + + + Specifies the length of time to sweep from the left edge to the right edge of the current domain. + + + + + IVI SpecAn class-compliant preselector interface. + + + + + This method adjusts the preselector to obtain the maximum readings for the current start and stop frequency. + This method may affect the marker configuration. + + + + + IVI SpecAn class-compliant marker frequency counter interface. + + + + + This method sets the marker frequency counter resolution and enables or disables the marker frequency counter. + + Turns marker frequency counter on/off. Refer to the Enabled property for more details. + Specifies the frequency counter resolution in hertz. This value is ignored when markerFrequencyCounter is False. + This value is restricted to a power of ten. An attempt to set this to other than a power of ten results in an error without the value + being changed. Refer to the Resolution property for more details. + + + + Enables/disables the marker frequency counter for greater marker measurement accuracy. + If set to True, the marker frequency counter is enabled. If set to False, the marker frequency counter is disabled. + This property returns the Marker Not Enabled error if the Marker Enabled property is set to False. + + + + + Specifies the resolution of the frequency counter in Hertz. + The measurement gate time is the reciprocal of the specified resolution. + + + + + IVI SpecAn class-compliant marker interface. + + + + + This method enables the active marker on the specified Trace. + + Turns the active marker on/off. Refer to the Enabled property for more details. + The trace name. Refer to the Trace property for more details. + + + + This method configures the Peak Excursion and Marker Threshold property values. + + Minimum amplitude below which a peak will not be found. + Refer to the PeakExcursion property for more details. + Minimum amplitude variation of the signal that the marker can recognize as a peak in dB. + Refer to the Threshold property for more details. + + + + This method disables all markers. + + + + + Specifies whether the active marker is a delta marker. + + True to make the marker a delta marker. + + + + This method specifies the type of marker search and performs the search. + This method returns the Marker Not Enabled error if the Marker Enabled property is set to False. + + Specifies the type of marker search. + Defined Values for SearchType Parameter: Highest, Minimum, NextPeak, NextPeakLeft, NextPeakRight. + + + + + This method returns the specific driver defined marker name that corresponds to the zero-based index that the user specifies. + If the driver defines a qualified marker name, this method returns the qualified name. + If the value that the user passes for the Index parameter is less then zero or greater than the value of the Marker Count attribute, + the method returns an empty string in the Name parameter and returns the Invalid Value error. + + Index (x-based) into the collection of markers. + The string associated by the driver to the value of Index without ever referring to the configuration store. + + + + Queries the horizontal position and the marker + amplitude level of the Active Marker. + + Marker horizontal position and the marker amplitude level. + + + + This method returns the horizontal position and the amplitude level of the active marker. + + Marker horizontal position and the marker amplitude level. + + + + This method uses the Marker Position or Marker Amplitude attributes to configure the spectrum analyzer setting + specified by the InstrumentSetting parameter. + + Specifies the instrument setting to be set from the marker position. + This method may set the Frequency Start, Frequency Stop, or Reference Level properties. + If the Marker Enabled property is set to False, this method returns the Marker Not Enabled error. + If the Marker Type property is not Delta and the InstrumentSetting parameter is Frequency Span, the method returns + the Delta Marker Not Enabled error. + + + + Reference to the class-compliant IIviSpecAnMarkerFrequencyCounter interface. + + + + + Specifies the marker which is currently active. The values for this property correspond to the Marker repeated capability. + If the driver defines a qualified Marker name, this property returns the qualified name. + + + + + Returns the amplitude of the active marker. The units are specified by the Amplitude Units property, + except when the Marker Type property is set to Delta. Then the units are dB. If the Marker Enabled property is set to False, + any attempt to read this property returns the Marker Not Enabled error. + + + + + If set to True , the active marker is enabled. + When False, the active marker is disabled. + + + + + Specifies the marker type of the active marker. + + + + + Specifies the number of markers available for a particular instrument. + + + + + Specifies the minimum amplitude variation of the signal in dB that the Marker Search method can identify as a peak. + + + + + Specifies the frequency in Hertz or time position in seconds of the active marker (depending on the mode in which the analyzer + is operating, frequency or time-domain). This attribute returns the Marker Not Enabled error if the active marker is not enabled. + + + + + Returns the reference marker position when the active marker is a delta marker. + + + + + Returns the reference marker amplitude when the active marker is a delta marker. + + + + + If set to True, the spectrum analyzer centers the signal after each sweep. This process invalidates the Frequency Start and + Frequency Stop attributes. If set to False, the spectrum analyzer does not center the signal after each sweep. + + Operations on this attribute return the Marker Not Enabled error if the active marker is not enabled. + + + + Specifies the lower limit of the search domain vertical range for the Marker Search method. + + + + + Specifies the trace for the active marker. + + + + + IVI SpecAn class-compliant level interface. + + + + + Configures the vertical properties of the IviSpecAn. + + The amplitude units for input, output and display. Refer to the AmplitudeUnits property for more details. + The input impedance. Refer to the InputImpedance property for more details. + The amplitude value of the reference level. Refer to the Reference property for more details. + The offset value to the reference level. Refer to the ReferenceOffset property for more details. + Turns auto attenuation on/off. Refer to the AttenuationAuto property for more details. + + + + Configures the vertical properties of the IviSpecAn. + + The amplitude units for input, output and display. Refer to the AmplitudeUnits property for more details. + The input impedance. Refer to the InputImpedance property for more details. + The amplitude value of the reference level. Refer to the Reference property for more details. + The offset value to the reference level. Refer to the ReferenceOffset property for more details. + The attenuation level. If AttenuationAuto is True then this parameter is ignored. + Refer to the Attenuation property for more details. + + + + Specifies the amplitude units for input, output and display amplitude. + + + + + Specifies the value of input impedance, in ohms, expected at the active input port. This is typically 50 ohms or 75 ohms. + + + + + The calibrated vertical position of the captured data used as a reference for amplitude measurements. + This is typically set to a value slightly higher than the highest expected signal level. + The units are determined by the AmplitudeUnits property. + + + + + Specifies an offset for the Reference Level property. + This value is used to adjust the reference level for external signal gain or loss. + A positive value corresponds to a gain while a negative number corresponds to a loss. The unit is dB. + + + + + If set to True, attenuation is automatically selected. + If set to False, attenuation is manually selected. + + + + + Specifies the input attenuation (in positive dB). + + + + + IVI SpecAn class-compliant frequency interface. + + + + + This method configures the frequency range defining the center frequency and the frequency span. + If the span corresponds to zero Hertz, then the spectrum analyzer operates in time-domain mode. + Otherwise, the spectrum analyzer operates in frequency-domain mode. + + The center frequency of the frequency sweep (in Hertz). + The frequency span of the frequency sweep (in Hertz). + + If span corresponds to zero hertz, then the spectrum analyzer is in time-domain. + The method modifies the Frequency Start and Frequency Stop properties as follows: + Frequency Start = CenterFrequency - Span / 2 + Frequency Stop = CenterFrequency + Span / 2 + In auto-coupled mode, RBW, VBW and sweep time may be affected by this method. + + + + + Configures the frequency range of the IviSpecAn using + start frequency and stop frequency. + + The start frequency of the sweep. The unit is Hertz. Refer to the Start property for more details. + The stop frequency of the sweep. The unit is Hertz. Refer to the Stop property for more details. + + If start frequency is equal to the stop frequency, then the spectrum + analyzer is in time-domain mode. In auto-coupled mode, resolution + bandwidth (RBW), video bandwidth (VBW), and sweep time may be + affected by this method. + + + + + Specifies the left edge of the frequency domain in Hertz. This is used in conjunction with the Frequency Stop property + to define the frequency domain. If the Frequency Start property value is equal to the Frequency Stop property value + then the spectrum analyzer's horizontal properties are in time-domain. + + + + + Specifies the right edge of the frequency domain in Hertz. This is used in conjunction with the Frequency Start property + to define the frequency domain. If the Frequency Start property value is equal to the Frequency Stop property value + then the spectrum analyzer's horizontal properties are in time-domain. + + + + + Specifies an offset value, in Hertz, that is added to the frequency readout. The offset is used to compensate for external + frequency conversion. This changes the driver's Frequency Start and Frequency Stop properties. + + + + + IVI SpecAn class-compliant external mixer conversion loss table interface. + + + + + This method configures the conversion loss table by specifying a series of frequency and a power loss pairs. + + Specifies the frequency values for the pairs. + Specifies the conversion loss values for the pairs. + + + + If set to True, the conversion loss table is enabled. + If set to False, the conversion loss table is disabled. + + + + + IVI SpecAn class-compliant external mixer bias interface. + + + + + Configures the external mixer bias and the external mixer bias limit. + + The bias current. Refer to the Level property for more details. + The bias current limit. Refer to the Limit property for more details. + + + + Specifies the bias current. The unit is Ampere. + + + + + Specifies the bias current limit. The unit is Ampere. + + + + + If set to True, the external mixer bias is enabled. + If set to False, the external mixer bias is disabled. + + + + + IVI SpecAn class-compliant external mixer interface. + + + + + Specifies the mixer harmonic number and average conversion loss. + + Specifies harmonic number. Refer to the Harmonic property for more details. + Specifies the average conversion loss. + Refer to the AverageConversionLoss property for more details. + + + + Reference to the class-compliant IIviSpecAnExternalMixerBias interface. + + + + + Reference to the class-compliant IIviSpecAnExternalMixerConversionLossTable interface. + + + + + Specifies the order n of the harmonic used for conversion. + + + + + Specifies the average conversion loss. + + + + + If set to True, the external mixer is enabled. + If set to False, the external mixer is disabled. + + + + + Specifies the number of mixer ports. + + + + + IVI SpecAn class-compliant display interface. + + + + + Specifies the number of vertical units in one screen division. + This property is typically used in conjunction with the Reference Level property to set the vertical range of the spectrum analyzer. + + + + + Returns the number of vertical screen divisions. + + + + + IVI SpecAn class-compliant acquisition interface. + + + + + Configures the acquisition properties of the IviSpecAn. + + Enables or disables continuous sweeping. + Refer to the SweepModeContinuous property for more details. + The number of sweeps to take. Refer to the NumberOfSweeps property for more details. + Enables or Disables the auto detector. Refer to the DetectorTypeAuto property for more details. + Specifies the vertical scale. Refer to the VerticalScale property for more details. + + + + Configures the acquisition properties of the IviSpecAn. + + Enables or disables continuous sweeping. + Refer to the SweepModeContinuous property for more details. + The number of sweeps to take. Refer to the NumberOfSweeps property for more details. + Specifies the method of capturing and processing signal data. + Refer to the DetectorType property for more details. + Specifies the vertical scale. Refer to the VerticalScale property for more details. + + + + If set to True, the sweep mode is continuous. If set to False, the sweep mode is not continuous. + + + + + This property defines the number of sweeps. + This property value has no effect if the Trace Type property is set to the value Clear Write. + + + + + If set to True, the detector type is automatically selected.The relationship between Trace Type and Detector Type is not defined by + the specification when the Detector Type Auto is set to True. If set to False, the detector type is manually selected. + + + + + Specifies the detection method used to capture and process the signal. This governs the data acquisition for a particular sweep, + but does not have any control over how multiple sweeps are processed. + + + + + Specifies the vertical scale of the measurement hardware + (use of log amplifiers vs. linear amplifiers). + + + + + IVI SpecAn class-compliant root interface. + + + + + Reference to the class-compliant IIviSpecAnFrequency interface. + + + + + Reference to the class-compliant IIviSpecAnSweepCoupling interface. + + + + + Reference to the class-compliant IIviSpecAnLevel interface. + + + + + Reference to the class-compliant IIviSpecAnAcquisition interface. + + + + + Reference to the class-compliant IIviSpecAnDisplay interface. + + + + + Reference to the class-compliant IIviSpecAnExternalMixer interface. + + + + + Reference to the class-compliant IIviSpecAnTrigger interface. + + + + + Reference to the class-compliant IIviSpecAnTraces interface. + + + + + Reference to the class-compliant IIviSpecAnMarker interface. + + + + + Reference to the class-compliant IIviSpecAnPreselector interface. + + + + + Warning codes. + + + + + The instrument was in an uncalibrated state when the measurement + was taken. + + + + + The measurement taken was over the instrument's range. + + + + IVI SpecAn values for Slope. + + + + Sets positive slope. + + + + + Sets negative slope. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Swtch.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Swtch.dll new file mode 100644 index 0000000..cbfd6c5 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Swtch.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Swtch.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Swtch.xml new file mode 100644 index 0000000..621f952 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Swtch.xml @@ -0,0 +1,1414 @@ + + + + Ivi.Swtch + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to A connection between two different sources is not allowed.. + + + + + Looks up a localized string similar to The path contains a leg with two channels that cannot be directly connected.. + + + + + Looks up a localized string similar to A channel cannot be connected to itself.. + + + + + Looks up a localized string similar to Channel 1 name: . + + + + + Looks up a localized string similar to Channel 2 name: . + + + + + Looks up a localized string similar to The two channels in the leg are the same.. + + + + + Looks up a localized string similar to A channel name is duplicated in the path.. + + + + + Looks up a localized string similar to Channel name: . + + + + + Looks up a localized string similar to A leg in the path contains two channels that are already directly connected.. + + + + + Looks up a localized string similar to No scan list is specified.. + + + + + Looks up a localized string similar to The switch path is empty.. + + + + + Looks up a localized string similar to An explicit connection between the channels already exists.. + + + + + Looks up a localized string similar to The given scan list string does not have the correct syntax, or the scan list syntax cannot be implemented by the switch.. + + + + + Looks up a localized string similar to An explicit connection to a configuration channel is not allowed.. + + + + + Looks up a localized string similar to The switch is not currently scanning through the scan list.. + + + + + Looks up a localized string similar to No explicit path exists between the channels.. + + + + + Looks up a localized string similar to One of the non-terminal channels in the path is not a configuration channel.. + + + + + Looks up a localized string similar to No path was found between the channels.. + + + + + Looks up a localized string similar to One of the channels in the path is a configuration channel that is in use.. + + + + + Looks up a localized string similar to The switch is currently scanning through the scan list.. + + + + + Looks up a localized string similar to Scan list: . + + + + + A connection between two different sources is not allowed. + + + + + Initializes a new instance of the class with two specified channels. + + The name of the first channel. + The name of the second channel. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the first channel. + + + + + The name of the second channel. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + The path contains a leg with two channels that cannot be directly connected. + + + + + Initializes a new instance of the class with two specified channels. + + The name of the first channel. + The name of the second channel. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the first channel. + + + + + The name of the second channel. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + A channel cannot be connected to itself. + + + + + Initializes a new instance of the class with a specified error message and channel name. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + The two channels in the leg are the same. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + A channel name is duplicated in the path. + + + + + Initializes a new instance of the class with a specified error message and channel name. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + A leg in the path contains two channels that are already directly connected. + + + + + Initializes a new instance of the class with two specified channels. + + The name of the first channel. + The name of the second channel. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the first channel. + + + + + The name of the second channel. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + No scan list is specified. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + The switch path is empty. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + An explicit connection between the channels already exists. + + + + + Initializes a new instance of the class with two specified channels. + + The name of the first channel. + The name of the second channel. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the first channel. + + + + + The name of the second channel. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + IVI Swtch class-compliant scan interface + + + Sets a scan list that specifies actions to take while scanning, the scan mode for the list, and the order + in which the actions are executed. The format of this array is described in the IviSwtch specification. + + A complete array list of actions to be performed while scanning. The array must be a complete + list because the driver does not expose a reference to the array for additional modifications. + Scanning mode. + + + Configures the scan Delay, Input trigger, and ScannerAdvancedOutput trigger properties, in order to + set the trigger behavior for the scan list established with the ConfigureList method. + The minimum length of time you want the instrument to wait from the time the + instrument creates a path until it asserts a trigger on the Scan Advanced output line. The driver uses + this value to set the Scan Delay property. See the property description for more details. + Each driver determines what values are valid based on the capabilities of supported instruments. + The IVI Foundation defines a set of standard trigger values in IVI-3.3, Standard Cross Class Capabilities. If the driver + supports one of the sources documented in IVI-3.3, it must support the standard string value for that source. + Scan advanced output. The driver uses this value to set the Scan Advanced + Output property. See the property description for more details. + + + Initiates the scan based on the current List property, and returns once the scan has begun. To + stop scanning, call Abort. When the switch is scanning, operations other than reading properties, + SendSoftwareTrigger and Abort are invalid. + + + Stops the scan that begun with Initiate method and returns the switch to the Idle state. This operation + does not reset or initialize the state of the switch. To determine the status of the scan, call the + IsScanning method. + + + Sends a software trigger, which causes the switch to advance to the next entry in the scan List. + + + Waits up to maxTime for the instrument to stop scanning through the scan List. + Maximum time to wait for the scan to complete. + + + A scan list that specifies actions to take while scanning, and the order in which the actions are + executed. The format of this string is described in the IviSwtch specification. + + + If True, the switch module is currently scanning through the scan list. + + + If True, the switch module should scan continuously through the scan list, otherwise it should + only scan once through the scan list. + + + The maximum number of channels on the column of a matrix or scanner. If the switch module is a + scanner, this value is the number of input channels. The number returned is dependent on the WireMode + property. + + + The maximum number of channels on the row of a matrix or scanner. If the switch module is a scanner, + this value is the number of output channels (commons). The number returned is dependent on the WireMode property. + + + + The destination of the scan's advanced output trigger. This trigger is asserted each time a path is + created. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + The minimum length of time from creating the path to asserting the scan's advanced output trigger. + The actual time may be longer. + + + + The source of the trigger input. Input triggers tell the switch module to advance to the next entry + in the scan list and close the specified channel. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + The connection breaking behavior of the switch during a scan. Previous paths may be broken before + making new ones, after making new ones, or not broken at all. + + + IVI Swtch class-compliant root level interface + + + A reference to the class-compliant IIviSwtchChannels interface + + + A reference to the class-compliant IIviSwtchPath interface + + + A reference to the class-compliant IIviSwtchScan interface + + + IVI Swtch class-compliant channel interface + + + If True, the channel is no longer accessible to the user and can be used by the specific + driver for path creation. If false, the channel is considered a standard channel and can be + explicitly connected to another channel. + Once a channel has been configured as a configuration channel, then no operation can be performed + on that channel, except for reading and writing the Is Configuration Channel property. + + + If True, the channel is a source channel. Two channels that are either sources or have their own + connections to sources, may not be connected. This prevents connections that might cause damage to channels, + devices, or system. + The intention of this property is to prevent channels from being connected that may cause damage to + the channels, devices, or system. Notice that GROUND can be considered a source in some circumstances. + + + A reference to the class-compliant IIviSwtchCharacteristics interface + + + IVI Swtch class-compliant channel collection interface + + + IVI Swtch class-compliant channel characteristics interface + + + The maximum AC current the channel can carry, in amperes RMS. + + + The maximum AC current the channel can switch, in amperes RMS. + + + The maximum AC power the channel can carry, in volt-amperes. + + + The maximum AC power the channel can switch, in volt-amperes. + + + The maximum AC voltage the channel can handle, in volts RMS. + + + The maximum frequency signal, in Hertz, that you can pass through the channel without attenuating it + by more than 3dB. + Values for this property are on per-channel basis and may not take into account the other switches + that make up a path to or from this channel. + + + The maximum DC current the channel can carry, in amperes. + + + The maximum DC current the channel can switch, in amperes. + + + The maximum DC power the channel can handle, in watts. + + + The maximum DC power the channel can switch, in watts. + + + The maximum DC voltage the channel can handle, in volts. + + + The characteristic impedance of the channel, in ohms. + + + The maximum total settling time for the channel before the signal going through it is considered + stable. This includes both the activation time for the channel as well as any debounce time. + + + The number of conductors in the current channel. Values for this property are on per-channel + basis and may not take into account the other switches that make up a path to or from this channel. + + + IVI Swtch class-compliant path interface + + + Without actually creating the path, this reports whether the switch module can create a given path. + This method takes existing paths into account. + A string indicating one of the channels of the path. + A string indicating one of the channels of the path. + Indicates whether a path is valid and/or possible. See the spec for definitions + + + Creates a path between the two channels. If the path already exists, the operation does not count + the number of calls. All paths are assumed to be bi-directional. + A string indicating one of the channels of the path. + A string indicating one of the channels of the path. + + + Destroys the path between the two channels. The order of the two channels need not be the same as + the connect operation. If no explict path exists between the two channels, this function + returns the error No Such Path without performing any disconnection operation + A string indicating one of the channels of the path. + A string indicating one of the channels of the path. + + + Disconnect all paths created since Initialize or Reset have been called. If any paths remain, + this method returns a Path Remains warning. + + + Returns an array of channels that have been connected in order to create the path between the + specified channels. The only valid paths that can be returned are ones that have been explicitly set via + Connect and SetPath methods. + A string indicating one of the channels of the path. + A string indicating one of the channels of the path. + An driver-allocated array of channels used to create a path between channel1 and channel 2. + + + Creates a path given a pathList of path legs defined by a start and end channel pair. The end + channels are the first and last channels in the array. All other channels are intermediate channels. + Channels are connected in the order in which they occur in the array. + Array of channels indicating the path. + + + Wait time until all the signals flowing through the switch have settled. If the signals do not settle + within MaxTime, the method returns a Max Time Exceeded error. + Maximum time to wait for the debounce operation to complete. + + + If True, the switch module has settled from previous switching commands and completed debounce. + This indicates that the signal going through the switch module is valid, assuming that the switches in the + path have the correct characteristics. + + + + The given scan list string does not have the correct syntax, or the scan list syntax + cannot be implemented by the switch. + + + + + Initializes a new instance of the class with a specified error message and scan list. + + The message that describes the error. + The scan list. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + An explicit connection to a configuration channel is not allowed. + + + + + Initializes a new instance of the class with a specified error message and channel name. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + The IviSwtch class allows clients to create instances of drivers that implement the class-compliant + IviSwtch interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviSwtch drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviSwtch class-compliant driver and return an IIviSwtch reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSwtch driver to be created. + + An IIviSwtch interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviSwtch class-compliant driver and return an IIviSwtch reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSwtch driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviSwtch interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviSwtch class-compliant driver and return an IIviSwtch reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSwtch driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviSwtch interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviSwtch class-compliant driver and return an IIviSwtch reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviSwtch driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviSwtch interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Ivi.Swtch warning codes. + + + + + The implicit connection exists between the channels. + + + + + Some connections remain after disconnecting. + + + + + The switch is not currently scanning through the scan list. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + + No explicit path exists between the channels. + + + + + Initializes a new instance of the class with two specified channels. + + The name of the first channel. + The name of the second channel. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the first channel. + + + + + The name of the second channel. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + One of the non-terminal channels in the path is not a configuration channel. + + + + + Initializes a new instance of the class with a specified error message and channel name. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + IVI Swtch class-compliant values for PathCapability + + + The driver can create a path at this time. + + + The explicit path between the channels already exists. + + + Although path is valid, the instrument is not capable of creating a path between the two channels, + because the switch module is currently using one or more of the required channels to create another path. + You must destroy the other path before creating this one. + + + Although the path is valid, the driver cannot create the path at this moment because the switch module + is currently using one or more of the required channels to create another path. You must destroy the other path + before creating this one. + + + The instrument cannot create a path between the two channels because both are connected to a different + source channel. + + + The driver cannot create a path between the two channels because one of the channels is a configuration + channel and thus unavailable for external connections. + + + + No path was found between the channels. + + + + + Initializes a new instance of the class with two specified channels. + + The name of the first channel. + The name of the second channel. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The name of the first channel. + + + + + The name of the second channel. + + + + + Create the exception message string based on the message and the stored exception parameters. + + + + + One of the channels in the path is a configuration channel that is in use. + + + + + Initializes a new instance of the class with a specified error message and channel name. + + The message that describes the error. + The channel name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The channel name. + + + + + Gets the error message. + + + + + The switch is currently scanning through the scan list. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + Gets the error message. + + + + IVI Swtch class-compliant values for Scan Mode + + + Indicates that no action should be taken on the previous paths. + + + Tells the card to break the previous paths before making the new paths. + + + Tells the driver to make new paths before breaking the previous paths. + + + + No explicit path exists between the channels. (This exception was made + obsolete in version 1.3.0 of the IVI .NET Shared Components. It was never + used and was unintentionally included in version 1.0.) + + + + + Initializes a new instance of the class. (This exception was made + obsolete in version 1.3.0 of the IVI .NET Shared Components. It was + never used and was unintentionally included in version 1.0.) + + + + + Initializes a new instance of the class with a specified error message. + (This exception was made obsolete in version 1.3.0 of the IVI .NET + Shared Components. It was never used and was unintentionally included + in version 1.0.) + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error + message and a reference to the inner exception that is the cause + of this exception. (This exception was made obsolete in version + 1.3.0 of the IVI .NET Shared Components. It was never used and + was unintentionally included in version 1.0.) + + + The error message that explains the reason for the exception. + + + The exception that is the cause of the current exception, + or a null reference if no inner exception is specified. + + + + + Initializes a new instance of the class with serialized data. (This + exception was made obsolete in version 1.3.0 of the IVI .NET Shared + Components. It was never used and was unintentionally included in + version 1.0.) + + + The that holds the serialized + object data about the exception being thrown. + + + The that contains contextual + information about the source or destination. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Upconverter.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Upconverter.dll new file mode 100644 index 0000000..aa64857 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Upconverter.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Upconverter.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Upconverter.xml new file mode 100644 index 0000000..a2e0ce1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/Ivi.Upconverter.xml @@ -0,0 +1,1369 @@ + + + + Ivi.Upconverter + + + + + Defined values for selecting the ALC source. + + + + + The ALC is controlled by an internal measurement source. + + + + + The ALC is controlled by an external voltage. + + + + + Values for AM, FM, and PM external coupling and IF input coupling. + + + + + The external source is coupled for AC only. + + + + + The external source is coupled for both DC and AC + + + + + A frequency and gain value pair. + + + + + Constructs a frequency/gain value pair. + + A frequency value. The units are Hertz. + A gain value. The units are dBm. + + + + A frequency value. + + + + + A gain value. + + + + + A frequency and power value pair. + + + + + Constructs a frequency/power value pair. + + A frequency value. The units are Hertz. + A power value. The units are dBm. + + + + Returns an array of frequency values. + + + + + Returns an array of power values. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to List name: . + + + + + Looks up a localized string similar to The selected list is not defined.. + + + + + The IviUpconverter class allows clients to create instances of drivers that implement the class-compliant + IviUpconverter interfaces, based on information in the IVI configuration store. This allows clients to + interchange IVI.NET class-compliant IviUpconverter drivers without modifying or rebuilding the client program + source code. + + + + + Create an instance of an IviUpconverter class-compliant driver and return an IIviUpconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviUpconverter driver to be created. + + An IIviUpconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviUpconverter class-compliant driver and return an IIviUpconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery and reset parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviUpconverter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + + An IIviUpconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + + + Create an instance of an IviUpconverter class-compliant driver and return an IIviUpconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviUpconverter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviUpconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Create an instance of an IviUpconverter class-compliant driver and return an IIviUpconverter reference to the + caller. The creation process uses the IVI configuration store to map a logical name or driver session + name to the main driver class of the corresponding specific driver. The driver is initialized using + information from the IVI configuration store and the idQuery, reset, and options parameters. + + An IVI configuration store logical name or driver session name that refers to the + IVI.NET class-compliant IviUpconverter driver to be created. + If true, verify the ID of the instrument. + If true, reset the instrument. + Specifies whether to use .NET AppDomain-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances + that are created with the same accessKey will be protected from simultaneous access by multiple threads + within a process or across processes, depending upon the value of the lockType parameter. + A comma-separated list of option assignments. An options assignment has the form + "OptionName=Value", where OptionName is one of: 'Cache', 'InterchangeCheck', 'QueryInstrStatus', + 'RangeCheck', 'RecordCoercions', 'Simulate', or 'DriverSetup'. With the exception of DriverSetup, all + of the options accept values of 'true' or 'false'. 'DriverSetup' is a string, and must be last in the + list. The method assumes that everything following 'DriverSetup=' is part of the assignment. The + DriverSetup string is meaningful only to the specific driver being instantiated. + + + An IIviUpconverter interface reference for the specific driver that is referred to by the provided IVI + configuration store logical name or driver session name. + + + Examples of legal values for the options parameter are: + * "" + * "Simulate=true" + * "Simulate=true,Cache=false,QueryInstrStatus=false" + * "Simulate=true,Cache=false,DriverSetup=Trace=false" + Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while + 'Trace=false' is meaningful only to the specific driver being instantiated. + + + + + Values for the AM and frequency step scaling modes. + + + + + Linear attenuation for amplitude modulation. + + + + + Logarithmic attenuation for amplitude modulation. + + + + + Defined values for the calibration status. + + + + + The upconverter has completed the calibration. + + + + + The upconverter is still performing the calibration. + + + + + The upconverter cannot determine the status of the calibration. + + + + + The upconverter calibration failed. + + + + + IviUpconverter class-compliant root interface. + + + + + Sends a software trigger. Refer to IVI-3.3: Standard Cross Class Capabilities, Section 2 Software + Triggering Capability for the complete description of this function. + + + + + A reference to the IIviUpconverterAlc interface. + + + + + A reference to the IIviUpconverterAnalogModulation interface. + + + + + A reference to the IIviUpconverterExternalLO interface. + + + + + A reference to the IIviUpconverterIFInput interface. + + + + + A reference to the IIviUpconverterIQ interface. + + + + + A reference to the IIviUpconverterPulseModulation interface. + + + + + A reference to the IIviUpconverterReferenceOscillator interface. + + + + + A reference to the IIviUpconverterRFOutput interface. + + + + + A reference to the IIviUpconverterSweep interface. + + + + + IviUpconverter class-compliant ALC interface. + + + + + Configures ALC source and ALC bandwidth for the upconverter's RF output. + + The source for the ALC. Refer to the Source property for details. + The ALC bandwidth. Refer to the Bandwidth property for details. + + + + The bandwidth of the level control. Narrow bandwidth impoves noise and allows AM with modulation + frequencies beyond bandwidth frequency. The units are Hertz. + + + + + True if the Automatic Level Control (ALC) is enabled, otherwise false. + + + + + The source of the controlling voltage for the Automatic Level Control. The RF level at the sensor point + is held constant. + + + + + IviUpconverter class-compliant analog modulation interface. + + + + + Configures the signal source, scaling, and depth for the upconverter's amplitude modulation. + + The source of the signal that the signal generator uses to modulate the output + signal. Refer to the Source property for details. + The scaling of the modulation. Refer to the Scaling property for details. + The extent of modulation. Refer to the Depth property for details. + + + + The extent of modulation the upconverter applies to the RF output signal with the modulating signal as a + result of summing all sources -- internal and external. The amount of the specified modulation depth is + achieved with a modulating voltage indicated by the NominalVoltage property. If the Scaling property is + set to Scaling.Linear, then the units are percent (%). If the Scaling property is set to + Scaling.Logarithmic, then the units are dBm. + + + + + True if the amplitude modulation of the RF output signal is enabled, otherwise false. + + + + + The coupling of the external source of the modulating signal. + + + + + The voltage at which the instrument achieves the amount of modulation specified by the Depth property. + + + + + The characteristic for amplitude modulation - linear or logarithmic. The units of the Depth property are + determined by this property. + + + + + The source of the signal that is used as the modulating signal. Multiple sources are specified by a + comma separated list. The voltages of all specified sources (internal and external) are summed. + + + + + IviUpconverter class-compliant analog modulation interface. + + + + + A reference to the IIviUpconverterAM interface. + + + + + A reference to the IIviUpconverterFM interface. + + + + + A reference to the IIviUpconverterPM interface. + + + + + A reference to the IIviUpconverterAnalogModulationSource interface. + + + + + IviUpconverter class-compliant analog modulation source interface. + + + + + Returns the physical repeated capability identifier defined by the specific driver for the modulation + source that corresponds to the zero-based index that the user specifies. If the user passes an invalid + value for the index parameter, the method returns an empty string. + + A zero-based index that defines which physical repeated capability identifier to + return. Valid values for the Index parameter are between zero and the value of the Analog Modulation + Source Count attribute, minus one. + The physical repeated capability identifier defined by the specific driver for the Modulation + Source that corresponds to the zero-based index that the user specifies. If the user passes an + invalid value for the Index parameter, the method returns an empty string. + + + + Returns the number of analog modulation sources available on the device. + + + + + IviUpconverter class-compliant external local oscillator interface. + + + + + True if the external LO is enabled, otherwise false. + + + + + The frequency of the external LO. The units are Hertz. + + + + + IviUpconverter class-compliant frequency modulation interface. + + + + + Configures deviation for the upconverter's frequency modulation. + + The modulating source. Refer to the Source property for details. + The extent of modulation. Refer to the Deviation attribute property for details. + + + + The extent of modulation (peak frequency deviation) the signal generator applies to the RF-signal (carrier + waveform) with the modulating signal as a result of summing all sources, internal and external. The + amount of the specified FM modulation deviation is achieved with a modulating voltage dicated by the + NominalVoltage property. The units are Hertz. + + + + + True if frequency modulation of the RF output signal is enabled, otherwise false. + + + + + The coupling of the external source of the modulating signal. + + + + + The voltage at which the instrument achieves the amount of modulation specified by the Deviation property. + The units are Volts. + + + + + The source of the signal that is used as the modulating signal. Multiple sources are specified by a + comma separated list. The voltages of all specified sources (internal and external) are summed. + + + + + IviUpconverter class-compliant frequency step interface. + + + + + Configures single step enabling and dwell for frequency stepping. + + If true, the trigger initiates the next step. Refer to the + SingleStepEnabled property for details. + The duration of one frequency step. Refer to the Dwell property for details. + + + + Configures start frequency, stop frequency, scaling, adn step size for the generator's RF output signal. + + The start frequency of the step sweep. Refer to the Start property for details. + The stop frequency of the step sweep. Refer to the Stop property for details. + The scaling of the step sweep. Refer to the Scaling property for details. + The size of one step. Refer to the Size attribute property for details. + + + + Resets the current frequency step to the frequency step start value. + + + + + The duration of one step. Dwell time starts immediately after a trigger or next step; no settling time + is added. This attribute is ignored if the SingleStepEnabled property is set to True. + + + + + Specifies the spacing of the steps as either linear or logarithmic. + + + + + True if single step mode is enabled, otherwise false. + + + + + The step size. The units are Hertz if the Scaling property is set to Scaling.Linear and is unitless + (factor) if the Scaling property is set to Scaling.Logarithmic. + + + + + The start frequency of the stepped sweep. If the stop frequency is less than the start frequency, the + frequency decreases during the sweep. The units are Hertz. + + + + + The stop frequency of the stepped sweep. If the stop frequency is less than the start frequency, the + frequency decreases during the sweep. The units are Hertz. + + + + + IviUpconverter class-compliant frequency sweep interface. + + + + + Configures the center frequency and the frequency span for the sweep. + + The center frequency of the sweep. The center frequency and frequency span + together are used to determine the values of the Start and Stop properties. + The frequency span of the sweep. The center frequency and frequency span + together are used to determine the values of the Start and Stop properties. + + + + Configures the start and the stop frequency for the sweep. + + The start frequency of the sweep. Refer to the Start property for details. + The stop frequency of the sweep. Refer to the Stop property for details. + + + + The start frequency of the sweep. If the stop frequency is less than the start frequency, the frequency + decreases during the sweep. The units are Hertz. + + + + + The stop frequency of the sweep. If the stop frequency is less than the start frequency, the frequency + decreases during the sweep. The units are Hertz. + + + + + The duration of one sweep from start to stop frequency. + + + + + IviUpconverter class-compliant gain step interface. + + + + + Configures single step enabling and dwell for gain stepping. + + If true, the trigger initiates the next step. Refer to the + SingleStepEnabled property for details. + The duration of one gain step. Refer to the Dwell property for details. + + + + Configures start power, stop power, and step size for gain steps of the upconverter. + + The start power of the stepping. Refer to the Start property for details. + The stop power of the stepping. Refer to the Stop property for details. + The size of one step. Refer to the Size property for details. + + + + Resets the stepping if single step is enabled. + + + + + The duration of one step. This property is ignored if the SingleStepEnabled property is set to true. + + + + + True if single step mode is enabled, otherwise false. + + + + + The step size. The units are dB. + + + + + The start gain of the stepped sweep. If the stop gain is less than the start gain, the gain decreases in + value during the sweep. The units are dB. + + + + + The stop gain of the stepped sweep. If the stop gain is less than the start gain, the gain decreases in + value during the sweep. The units are dB. + + + + + IviUpconverter class-compliant gain sweep. + + + + + Configures the start and the stop power for the sweep. + + The start power of the sweep. Refer to the Start property for details. + The stop power of the sweep. Refer to the Stop property for details. + + + + The start power of the sweep. If the stop power is less than the start power, the power decreases in value + during the sweep. The units are dBm. + + + + + The stop power of the sweep. If the stop power is less than the start power, the power decreases in value + during the sweep. The units are dBm. + + + + + The duration of one sweep from start to stop power. + + + + + IviUpconverter class-compliant IF input interface. + + + + + Returns the physical repeated capability identifier defined by the specific driver for the IF input that + corresponds to the zero-based index that the user specifies. If the user passes an invalid value for the + index parameter, the value of this attribute is an empty string. + + A zero-based index that defines which physical repeated capability identifier to + return. Valid values for the index parameter are between zero and the value of the Count property, minus + one. + The physical repeated capability identifier defined by the specific driver for the IF input that + corresponds to the zero-based index that the user specifies. If the user passes an invalid value for the + index parameter, the value of this attribute is an empty string. + + + + The IF input that is currently active. Subsequent calls to functions and attributes that are based on + the IF Input repeated capability will be applied to the Active IF Input specified here. The values for + this property correspond to the allowed repeated capability names for the IF Input repeated capability. + [Use the GetName method or refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + The trigger source. + + + + + The amount of attenuation (or gain) to apply to the IF input of the upconverter. The units are dB. + Positive values for this property represent attenuation while negative values represent gain. + + + + + If true, automatic global corrections are enabled on the device. + + + + + If true, the IF input signal is routed directly to the RF output indicated by the + IIviUpconverterRFOutput.ActiveRFOutput property. If false, the IF input signal is routed into the front + end of the upconverter and follows the normal signal path, as dictated by other downstream path control + properties. + + + + + The number of IF inputs available on the device. + + + + + The coupling applied to IF input. + + + + + The frequency of the IF input. The units are Hertz. + + + + + IviUpconverter class-compliant IQ interface. + + + + + Calibrates of the IQ modulator. + + + + + True if the IQ (vector) modulation of the RF output signal is enabled, otherwise false. + + + + + A reference to the IIviUpconverterIQImpairment interface. + + + + + The voltage at which the instrument achieves full modulation. The value is calculated as SQRT(I2+Q2). + The units are Volts. + + + + + If true, enables the inverse phase rotation of the IQ signal by swapping the I and Q inputs. + + + + + IviUpconverter class-compliant IQ impairment interface. + + + + + Configures iOffset, qOffset, ratio, and skew to simulate or correct impairment for the upconverter's IQ + (vector) modulation. + + An offset to the I-path of IQ signals. Refer to the IOffset property for details. + An offset to the Q-path of IQ signals. Refer to the QOffset property for details. + The gain imbalance to the IQ signals. Refer to the Ratio property for details. + The angle offset to the IQ signals. Refer to the Skew property for details. + + + + True if impairment properties are enabled, otherwise false. + + + + + An origin offset voltage to the I signal. The range of values allowed is -100% to +100%. The value is + expressed as percentage (%). + + + + + An origin offset voltage to the Q signal. The range of values allowed is -100% to +100%. The value is + expressed as percentage (%). + + + + + The gain imbalance between the I and Q channels. For no imbalance this value is set to 0 %. The value is + expressed as percentage (%). + + + + + The adjustment of the phase angle between the I and Q vectors. If zero, the phase angle is 90 degrees. + The units are degrees. + + + + + IviUpconverter class-compliant sweep list interface. + + + + + Deletes all lists from the pool of lists. + + + + + Configures single step enabling and dwell to control the stepping. + + If true, the trigger initiates transitions to the next list step. Refer to + the SingleStepEnabled property for details. + The duration of one list step. Refer to the Dwell property for details. + + + + Creates a named list of frequency values. + + The name of the list to be created. + The array of frequency values to become elements of the list. The units are + Hertz. + + + + Creates a named list of frequency and gain value pairs. + + The name of the list to be created. + A set of frequency and gain value pairs. + + + + Creates a named list of frequency and power value pairs. + + The name of the list to be created. + An array of frequency and power value pairs. + + + + Creates a named list of gain values. + + The name of the list to be created. + The array of gain values to become elements of the list. The units are dB. + + + + Creates a named list of power values. + + The name of the list to be created. + The array of power values to become elements of the list. The units are dB. + + + + Resets the stepping if single step is enabled. + + + + + The duration of one step. This attribute is ignored if the SingleStepEnabled property is set to true. + + + + + The name of the selected list to become active. The name is a list created by the CreateFrequency, + CreateFrequencyGain, CreateFrequencyPower, CreateGain, or CreatePower methods. + + + + + True if single step mode is enabled, otherwise false. + + + + + IviUpconverter class-compliant phase modulation interface. + + + + + Configures the modulating signal source and peak phase deviation for phase modulation. + + The source of the signal the signal generator uses to modulate the output signal. + Refer to the Source property for details. + The extent of modulation. Refer to the Deviation property for details. + + + + The extent of modulation (peak phase deviation) the signal generator applies to the RF-signal (carrier + waveform) with the modulating signal as a result of summing all sources, internal and external. The + amount of the specified PM modulation deviation is achieved with a modulating voltage of PM Nominal + Voltage. The units are radians. + + + + + If true, the upconverter enables phase modulation of the RF output signal. + + + + + The coupling of the external source of the modulating signal. + + + + + The voltage at which the instrument achieves the amount of modulation specified by the PM Deviation + attribute. The units are Volts. + + + + + The source of the signal that is used as the modulating signal. Multiple sources are specified by a + comma separated list. The voltages of all specified sources (internal and external) are summed. + + + + + IviUpconverter class-compliant power step interface. + + + + + Configures single step enabling and dwell for power stepping. + + If true, the trigger initiates the next step. Refer to the + SingleStepEnabled property for details. + The duration of one power step. Refer to the Dwell property for details. + + + + Configures start power, stop power, and step size for the power steps of the generator's RF output signal. + + The start power of the stepping. Refer to the Start property for details. + The stop power of the stepping. Refer to the Stop property for details. + The size of one step. Refer to the Size property for details. + + + + Resets the stepping if single step is enabled. + + + + + The duration of one step. This attribute is ignored if SingleStepEnabled is set to true. + + + + + If true, single step mode is enabled and the trigger initiates the next step, otherwise it is disabled. + + + + + The step size. The units are dBm. + + + + + The start power of the stepped sweep. If the stop power is less than the start power, the power decreases + in value during the sweep. The units are dBm. + + + + + The stop power of the stepped sweep. If the stop power is less than the start power, the power decreases + in value during the sweep. The units are dBm. + + + + + IviUpconverter class-compliant power sweep interface. + + + + + Configures start power and stop power for a power sweep. + + The start power of the sweep. Refer to the Start property for details. + The stop power of the sweep. Refer to the Stop property for details. + + + + The start power of the sweep. If the stop power is less than the start power, the power decreases in value + during the sweep. The units are dBm. + + + + + The stop power of the sweep. If the stop power is less than the start power, the power decreases in value + during the sweep. The units are dBm. + + + + + The duration of one sweep from start to stop power. + + + + + IviUpconverter class-compliant pulse modulation interface. + + + + + True if pulse modulation of the RF output signal is enabled, otherwise false. + + + + + The polarity of the external source signal. + + + + + IviUpconverter class-compliant RF output interface. + + + + + Performs calibration on the entire device. This call can be blocking or can be non-blocking, depending on + the instrument implementation. + + + + + Returns the physical repeated capability identifier defined by the specific driver for the RF Output that + corresponds to the zero-based index that the user specifies. If the user passes an invalid value for the + index parameter, the method returns an empty string. + + A zero-based index that defines which physical repeated capability identifier to + return. Valid values for the index parameter are between zero and the value of the RF Output Count + property, minus one. + Returns the physical repeated capability identifier defined by the specific driver for the RF + Output that corresponds to the zero-based index that the user specifies. If the user passes an invalid + value for the index parameter, the method returns an empty string. + + + + Queries the instrument to determine the status of all calibration operations initiated by the Calibrate + function. + + The calibration status of the device. + + + + Waits until all of the signals flowing through the upconverter have settled. If the signals did not settle + within the time period the user specified with the maximumTime parameter, the method throws + a Max Time Exceeded exception. + + Specifies the maximum time the end-user allows for this function to complete. + PrecisionTimeSpan.MaxValue indicates that the method waits indefinitely for the upconverter to settle. + + + + The RF output that is currently active. Subsequent calls to methods and properties that are based on + the RF Output repeated capability will be applied to the Active RF Output specified here. The values for + this attribute correspond to the allowed repeated capability names for the RF Output repeated capability. + Note that this property does not enable the specified output. This property only controls the RF Output + repeated capability instance to which other methods and properties apply. Use the Enabled property to + route the RF signal to a specific output. + [Use the GetName method or refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + If true, the attenuator hold is enabled, otherwise it is disabled. + + + + + The maximum effective RF signal bandwidth that the upconverter can present to a digitizer. The units + are Hertz. This value is a measure of the spectral width between two points for which the amplitude + profile is 3 dB below a peak close to mid band. + + + + + The number of RF Outputs available on the device. + + + + + if true, the RF output is enabled, otherwise it is disabled. Only a single RF Output can be enabled at a + time. Thus, when this property is set to true for a particular RF output, all other RF outputs are + disabled. + + + + + The frequency of the RF output. The units are Hertz. + + + + + The amount of gain (or attenuation) to apply to the RF output of the upconverter. The units are dB. + Positive values for this property represent signal gain while negative values represent attenuation. + + + + + If true, the upconverter has settled from changes to either the IF input signal or changes to device + control properties, such as Gain, Frequency, or IIviUpconverterIFInput.Attenuation. This property + indicates whether or not the RF output is valid for processing by another downstream system component, + such as a digitizer. + + + + + The amount of gain (or attenuation) to apply to the RF output of the upconverter. The units are dBm. + + + + + The a trigger that should be fired when the RF output has settled to a point that is suitable for + processing by downstream components. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + IviUpconverter class-compliant sweep interface. + + + + + Configures the sweep mode and trigger source for the upconverter. + + The sweep mode of the RF signal generator. Refer to the Mode property for details. + The way to start the sweep or run the sweep continuously. Refer to the + TriggerSource property for details. + + + + A reference to the IIviUpconverterFrequencyStep interface. + + + + + A reference to the IIviUpconverterFrequencySweep interface. + + + + + A reference to the IIviUpconverterGainStep interface. + + + + + A reference to the IIviUpconverterGainSweep interface. + + + + + True if the upconverter is currently sweeping the RF output signal, otherwise false. + + + + + A reference to the IIviUpconverterList interface. + + + + + The mode of operation of the upconverter. The RF output signal may be a continuous wave or the + frequency, the power level or both may be swept or stepped. + + + + + A reference to the IIviUpconverterPowerStep interface. + + + + + A reference to the IIviUpconverterPowerSweep interface. + + + + + The way to start the sweep or run the sweep continuously. + [Refer to the instrument driver documentation for valid values, which may include + one or more of the standard values defined in Ivi.Driver.TriggerSource.] + + + + + IviUpconverter class-compliant reference oscillator interface. + + + + + Configures reference frequency signal source and frequency for the upconverters reference oscillator. + + The source of the reference frequency signal. Refer to the Source property for + details. + The frequency of the external reference oscillator. This parameter is + only used if the Source is set to ReferenceOscillatorSource.External. Refer to the Frequency property + for more details. + + + + The frequency of the external signal that is used as reference for internal RF frequency generation. This + value is used only if Source is set to ReferenceOscillatorSource.External. The units are Hertz. + + + + + True if the Reference output is enabled, otherwise false. Many upconverters support the ability to output + their frequency reference. This attribute allows the user to enable or disable that output. + + + + + Specifies the reference oscillator source used to generate the precise RF output frequency. + + + + + Values for the pulse modulation external polarity. + + + + + The signal generator modulates the carrier signal with normal pulse polarity. Increasing the positive + pulse voltage level results in higher RF level. + + + + + The signal generator modulates the carrier signal with inverted pulse polarity. Increasing the positive + pulse voltage level results in lower RF level. + + + + + Defined values for the reference oscillator source. + + + + + The upconverter uses the internal reference oscillator. + + + + + The upconverter uses an external reference oscillator. + + + + + Values for the sweep mode. + + + + + The RF output of the upconverter is a non-swept signal (Continuous Wave). Frequency and power level settings + from the base capability group are used. + + + + + The upconverter sweeps the RF output signal's frequency in an analog form (non-stepped). Refer to + IviUpconverterFrequencySweep extension group. + + + + + The upconverter sweeps the RF output signal's power in an analog form (non-stepped). Refer to + IviUpconverterPowerSweep extension group. + + + + + The upconverter sweeps the upconverter s gain in an analog form (non-stepped). + + + + + The upconverter sweeps the RF output signal's frequency in steps. Refer to IviUpconverterFrequencyStep + extension group. + + + + + The upconverter sweeps the RF output signal's power level in steps. Refer to IviUpconverterPowerStep + extension group. + + + + + The upconverter sweeps the upconverter s gain in steps. + + + + + The upconverter uses two lists with frequency and power level values to sweep the RF output signal. Refer + to IviUpconverterList extension group. + + + + + Upconverter list is unknown. + + + + + Initializes a new instance of the class with a specified list name. + + The message that describes the error. + The list name. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a specified error message. + + The message that describes the error. + + + + Initializes a new instance of the class with a specified error message and a reference to the inner exception + that is the cause of this exception. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference + if no inner exception is specified. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the + exception being thrown. + The that contains contextual information about the + source or destination. + + + + The list name. + + + + + Gets the error message. + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/IviFoundationSharedComponentsVersion.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/IviFoundationSharedComponentsVersion.dll new file mode 100644 index 0000000..03c4037 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/IviFoundationSharedComponents_1.4.1/IviFoundationSharedComponentsVersion.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Keysight/Agilent.AgM918x.Interop.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Keysight/Agilent.AgM918x.Interop.dll new file mode 100644 index 0000000..7599f07 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Keysight/Agilent.AgM918x.Interop.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.Common.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.Common.dll new file mode 100644 index 0000000..2675245 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.Common.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.ModularInstrumentsSystem.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.ModularInstrumentsSystem.dll new file mode 100644 index 0000000..ffca922 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.ModularInstrumentsSystem.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.dll new file mode 100644 index 0000000..67ebfde Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.msl b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.msl new file mode 100644 index 0000000..d3e2707 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.msl @@ -0,0 +1,26 @@ + + + true + + WindowsFormsApplication2012 + WindowsFormsApplication2013 + + false + Measurement Studio Hardware Class Libraries/NI-DMM Library + Contains classes for configuring and controlling NI digital multimeters using the NI-DMM driver. + NationalInstruments.ModularInstruments.NIDmm.Fx45 + NationalInstruments.ModularInstruments.NIDmm.Fx45 + false + + + NationalInstruments.ModularInstruments.Common + + + + Ivi.Driver + Ivi.Dmm + + + NationalInstruments.ModularInstruments.NIDmm + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.xml new file mode 100644 index 0000000..fad2586 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NIDmm.Fx45.xml @@ -0,0 +1,10234 @@ + + + + NationalInstruments.ModularInstruments.NIDmm.Fx45 + + + + + Specifies the operating mode of the NI 4022. + + By default, + this is set to + . + For the NI 4022 only. + + 3/4/2016 11:17:42 AM + sheien + True + + + + Enables the internal amplifier to be a unity gain buffer for performing a 6-wire + guarded measurement. + + + This is the default operating mode. + + 3/4/2016 11:18:03 AM + sheien + True + + + + Enables the low current amplifier and applies a gain of 1E8 V/A. + + 3/4/2016 11:17:46 AM + sheien + True + + + + Enables the low current amplifier and applies a gain of 1E6 V/A. + + 3/4/2016 11:17:50 AM + sheien + True + + + + Enables the low current amplifier and applies a gain of 1E4 V/A. + + 3/4/2016 11:17:56 AM + sheien + True + + + + Disconnects the +INPUT (positive input terminal) from the analog ground. + + + When one of the current amplification ranges is selected, the +INPUT (positive input terminal) of the amplifier + is tied to the analog ground by default. You can override this default configuration by selecting this option to disconnect the +INPUT, and allow the user to + provide an external reference. Calling one of the current amplification ranges after + using this reconnects the +INPUT to analog ground. + + 3/4/2016 11:17:59 AM + sheien + True + + + + Allows for storing and retrieving the acquisition status. + + + 3/4/2016 11:18:06 AM + sheien + True + + + + The acquisition is in progress. + + 12/28/2009 1:35:17 PM + Staci Heien + True + + + + The acquisition has finished, with a backlog. The backlog specifies the number of measurements available to be read. + + 12/28/2009 1:34:17 PM + Staci Heien + True + + + + The acquisition has finished, with no backlog. The backlog specifies the number of measurements available to be read. + + 12/28/2009 1:34:47 PM + Staci Heien + True + + + + The acquisition is paused. + + 12/28/2009 1:35:07 PM + Staci Heien + True + + + + No acquisition is in progress. + + 12/28/2009 1:34:57 PM + Staci Heien + True + + + + Provides synchronization locks obtained on the driver session. + + + + This class is used to obtain a lock on the driver session allowing for thread safety. + + 3/4/2016 11:05:41 AM + sheien + True + + + + Initializes a new instance of the class. + + + Base interface for synchronization locks obtained on the driver session. + + 3/21/2016 2:39:36 PM + sheien + True + + + + Releases a driver synchronization lock. + + 3/4/2016 11:05:48 AM + sheien + True + + + + Specifies the destination of the Measurement Complete (MC) signal, which is issued when the DMM completes a single measurement. + + + A digital trigger generated after taking a measurement is called Measurement Complete (MC). + + + 3/4/2016 11:09:54 AM + sheien + True + + + + Gets a object + representing no specific trigger destination (None). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:09 AM + sheien + True + + + + Gets a object + representing pin 6 on the AUX connector (External). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:09:59 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 0 (Ttl0). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:13 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 1 (Ttl1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:18 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 2 (Ttl2). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:22 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 3 (Ttl3). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:26 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 4 (Ttl4). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:29 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 5 (Ttl5). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:33 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 6 (Ttl6). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:37 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 7 (Ttl7). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:43 AM + sheien + True + + + + Gets a object + representing the Local Bus Right Trigger Line 0 of a PXI/SCXI combination chassis (LbrTig1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:10:05 AM + sheien + True + + + + 3/4/2016 11:11:00 AM + sheien + True + + + + Returns a object + that represents the specified trigger source. + + + The trigger source specified as a . + + + A object that represents + the specified trigger destination. + + 3/4/2016 11:10:50 AM + sheien + True + + + + Converts this + to a human-readable string. + + + A that corresponds to this + . + + 3/4/2016 11:11:03 AM + sheien + True + + + + Determines whether the specified object is a and is equivalent to this object. + + + The to test. + + + if the specified is a and is equivalent to this object. + + 3/4/2016 11:10:46 AM + sheien + True + + + + Returns a hash code for this object. + + + An integer value that specifies a hash code for this object. + + 3/4/2016 11:10:54 AM + sheien + True + + + + Specifies the measurement function to be used. + + + For more information, refer to the NIDMM_ATTR_FUNCTION + topic in the + NI Digital Multimeters Help. + + + + + + 3/21/2016 4:55:36 PM + sheien + True + + + + DC voltage. + + 3/4/2016 11:19:08 AM + sheien + True + + + + AC voltage. + 3/4/2016 11:18:52 AM + sheien + True + + + + DC current. + + 3/4/2016 11:19:04 AM + sheien + True + + + + AC current. + + 3/4/2016 11:18:45 AM + sheien + True + + + + 2-wire resistance. + + 3/4/2016 11:19:31 AM + sheien + True + + + + 4-wire resistance. + + 3/4/2016 11:19:15 AM + sheien + True + + + + Frequency. + + 3/4/2016 11:19:19 AM + sheien + True + + + + Period. + + 3/4/2016 11:19:26 AM + sheien + True + + + + IVI spec enum value from IviDmm.h IVIDMM_VAL_TEMPERATURE + + 7/29/2017 11:18:57 AM + lnayman + False + + + + AC voltage with DC coupling. + + 3/4/2016 11:18:57 AM + sheien + True + + + + Diode. + + 3/4/2016 11:19:11 AM + sheien + True + + + + Capacitance. + + 3/4/2016 11:19:01 AM + sheien + True + + + + Inductance. + + 3/4/2016 11:19:22 AM + sheien + True + + + + Waveform voltage. + + 3/4/2016 11:19:38 AM + sheien + True + + + + Waveform current. + + 3/4/2016 11:19:34 AM + sheien + True + + + + Configures the RTD (resistance temperature detector) for temperature measurements. + + + + Use to configure the RTD for temperature measurements. + + is returned if the members are accessed after the associated + object has been disposed. + + + 3/21/2016 4:46:04 PM + sheien + True + + + + Gets or sets the Callendar-Van Dusen A coefficient for RTD scaling when + is set to . + + The default value is 3.9083e-3 (Pt3851). + 3/21/2016 4:46:07 PM + sheien + True + + + + Gets or sets the Callendar-Van Dusen B coefficient for RTD scaling when + is set to . + + The default value is -5.775e-7(Pt3851). + 3/21/2016 4:46:10 PM + sheien + True + + + + Gets or sets the Callendar-Van Dusen C coefficient for RTD scaling when + is set to . + + The default value is -4.183e-12(Pt3851). + 3/21/2016 4:46:13 PM + sheien + True + + + + Gets or sets the RTD resistance at 0 degrees Celsius. + + + This applies to all supported RTDs, including custom RTDs. + + The default value is 100 (Ω). + 3/21/2016 4:46:16 PM + sheien + True + + + + Gets or sets the type of RTD used to measure temperature. + + The default value is . + Refer to for additional information + about defined values. + + 3/21/2016 4:46:20 PM + sheien + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + Configures the RTD type and RTD resistance parameters for an RTD. + + + Specifies the type of RTD used to measure the temperature resistance. The default is . + + + Specifies the RTD resistance in ohms at 0 deg C. The default is . + + + The parameter value passed is invalid. + + + The parameter value passed is out of range. + + + 1/11/2010 5:11:00 PM + Staci Heien + True + + + + Configures the A, B, and C parameters for a custom RTD. + + + Specifies the Callendar-Van Dusen A coefficient for RTD scaling when RTD Type parameter is set to Custom in the . The default is 3.9083e-3 (Pt3851). + + + Specifies the Callendar-Van Dusen B coefficient for RTD scaling when RTD Type parameter is set to Custom in the function. The default is -5.775e-7 (Pt3851). + + + Specifies the Callendar-Van Dusen C coefficient for RTD scaling when RTD Type parameter is set to Custom in the function. The default is -4.183e-12 (Pt3851). + + + The parameter value passed is out of range. + + 7/20/2009 10:49:17 AM + Keely Joseph + True + + + + Represents a DMM trigger source. + + + + This class can be used to get a particular DMM trigger source either from the static properties or from a string representation of the trigger source. + + 3/4/2016 11:11:58 AM + sheien + True + + + + Gets a object representing an unspecified trigger source (Immediate). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:09 AM + sheien + True + + + + Gets a object representing Pin 9 on the AUX Connector + (External). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:06 AM + sheien + True + + + + Gets a object representing the software trigger source (Software Trigger). + The sample trigger waits until is called. + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:27 AM + sheien + True + + + + Gets a object representing the Interval trigger source (Interval). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:13 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 0 source (Ttl0). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:30 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 1 source (Ttl1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:34 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 2 source (Ttl2). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:38 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 3 source (Ttl3). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:42 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 4 source (Ttl4). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:50 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 5 source (Ttl5). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:54 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 6 source (Ttl6). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:57 AM + sheien + True + + + + Gets a object representing the PXI Trigger Line 7 source (Ttl7). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:13:01 AM + sheien + True + + + + Gets a object representing the PXI Star trigger source (PxiStar). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:21 AM + sheien + True + + + + Gets a object representing the Local Bus Right Trigger Line 1 of a PXI/SCXI combination chassis + (LbrTig1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:16 AM + sheien + True + + + + Gets a object representing Pin 3 on the AUX Connector + (AuxTrig1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:12:02 AM + sheien + True + + + + 3/4/2016 11:13:18 AM + sheien + True + + + + Returns a object + that represents the specified trigger source. + + + The trigger source specified as a . + + + A object that represents + the specified trigger source. + + 3/4/2016 11:13:09 AM + sheien + True + + + + Converts this + to a human-readable string. + + + A that corresponds to this + . + + 3/4/2016 11:13:22 AM + sheien + True + + + + Determines whether the specified object is a and is equivalent to this object. + + + The to test. + + + if the specified is a and is equivalent to this object. + + 3/4/2016 11:13:05 AM + sheien + True + + + + Returns a hash code for this object. + + + An integer value that specifies a hash code for this object. + + 3/4/2016 11:13:13 AM + sheien + True + + + + Configures the thermocouple for temperature measurements. + + + + Use to configure the thermocouple for temperature measurements. + + is returned if the members are accessed after the associated + object has been disposed. + + + 3/4/2016 11:14:07 AM + sheien + True + + + + Gets or sets the type of reference junction to be used in the reference junction compensation of a thermocouple. + + The only supported value for is . + + + + Reference Junction Type + Description + + + + + + + Fixed reference junction. + + + + + 3/4/2016 11:14:15 AM + sheien + True + + + + Gets or sets the reference junction temperature when a fixed reference junction is used to take a + thermocouple measurement. + + The default value is 25.0 (°C). + 3/4/2016 11:14:11 AM + sheien + True + + + + Gets or sets the type of thermocouple used to measure the temperature. + + + + The default value is . + + 3/4/2016 11:14:19 AM + sheien + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + Configures the thermocouple type and reference junction type for a chosen thermocouple. + + + Specifies the type of thermocouple used to measure the temperature. The default is . + + + Specifies the type of reference junction to be used in the reference junction compensation of a thermocouple measurement. The only supported value is . + + + The parameter value passed is invalid. + + + The parameter value passed is out of range. + + + + 12/18/2009 4:22:54 AM + Keely Joseph + True + + + + Represents a DMM trigger source. + + + + This class can be used to get a particular DMM trigger source either from the static properties or from a string representation of the trigger source. + + 3/4/2016 11:14:44 AM + sheien + True + + + + Gets a object representing an unspecified trigger sample + (Immediate). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:14:58 AM + sheien + True + + + + Gets a object representing Pin 9 on the AUX Connector + (External). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:14:55 AM + sheien + True + + + + Gets a object representing the software trigger source (Software Trigger). + The sample trigger waits until is called. + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:09 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 0 (Ttl0). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:13 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 1 (Ttl1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:17 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 1 (Ttl1). + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:21 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 3 (Ttl3). + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:28 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 4 (Ttl4). + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:32 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 5 (Ttl5). + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:35 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 6 (Ttl6). + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:38 AM + sheien + True + + + + Gets a object + representing PXI Trigger Line 7 (Ttl7). + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:42 AM + sheien + True + + + + Gets a object representing PXI STAR Trigger Line + (PXI Star). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:05 AM + sheien + True + + + + Gets a object representing Local Bus Right Trigger Line 1 of the PXI/SCXI combination chassis + (LbrTig1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:15:02 AM + sheien + True + + + + Gets a object representing Pin 3 on the AUX Connector + (AuxTrig1). + + + Returns an object of type . + + + To determine which values are supported by each device, refer to the + LabVIEW Trigger Routing + topic in the NI Digital Multimeters Help. + + 3/4/2016 11:14:51 AM + sheien + True + + + + 3/4/2016 11:15:58 AM + sheien + True + + + + Returns a object + that represents the specified trigger source. + + + The trigger source specified as a . + + + A object that represents + the specified trigger source. + + 3/4/2016 11:15:50 AM + sheien + True + + + + Converts this + to a human-readable string. + + + A that corresponds to this + . + + 3/4/2016 11:16:04 AM + sheien + True + + + + Determines whether the specified object is a and is equivalent to this object. + + + The to test. + + + if the specified is a and is equivalent to this object. + + 3/4/2016 11:15:46 AM + sheien + True + + + + Returns a hash code for this object. + + + An integer value that specifies a hash code for this object. + + 3/4/2016 11:15:54 AM + sheien + True + + + + Use DmmMeasurementCompleteDestination to specify the destination of the measurement complete signal. + + 9/23/2009 1:38:18 PM + NI + False + + + + No Trigger. + + + + + AUX I/O Connector. + + + + + PXI Trigger Line 0. + + + + + PXI Trigger Line 1. + + + + + PXI Trigger Line 2. + + + + + PXI Trigger Line 3. + + + + + PXI Trigger Line 4. + + + + + PXI Trigger Line 5. + + + + + PXI Trigger Line 6. + + + + + PXI Trigger Line 7. + + + + + Internal Trigger Line of a PXI/SCXI combination chassis. + + + + + Use DmmSampleTrigger to specify the sample trigger value. + + 9/23/2009 1:46:28 PM + NI + False + + + + No Trigger. + + + + + AUX I/O Connector Trigger Line 0. + + + + + Software Trigger. + + + + + Interval Trigger. + + + + + PXI Trigger Line 0. + + + + + PXI Trigger Line 1. + + + + + PXI Trigger Line 2. + + + + + PXI Trigger Line 3. + + + + + PXI Trigger Line 4. + + + + + PXI Trigger Line 5. + + + + + PXI Trigger Line 6. + + + + + PXI Trigger Line 7. + + + + + PXI Star Trigger Line. + + + + + Internal Trigger Line of a PXI/SCXI Combination Chassis. + + + + + AUX I/0 Connector Trigger Line 1. + + + + + Use DmmTriggerSource to specify possible values for trigger source. + + 9/23/2009 1:50:36 PM + NI + False + + + + No Trigger. + + + + + AUX I/O Connector Trigger Line 0. + + + + + Software Trigger. + + + + + PXI Trigger Line 0. + + + + + PXI Trigger Line 1. + + + + + PXI Trigger Line 2. + + + + + PXI Trigger Line 3. + + + + + PXI Trigger Line 4. + + + + + PXI Trigger Line 5. + + + + + PXI Trigger Line 6. + + + + + PXI Trigger Line 7. + + + + + PXI Star Trigger Line. + + + + + Internal Trigger Line of a PXI/SCXI Combination Chassis. + + + + + AUX I/O Connector Trigger Line 1. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to This argument cannot be null.. + + + + + Looks up a localized string similar to The specified argument was out of the range of valid values.. + + + + + Looks up a localized string similar to For DmmAdvanced.NumberOfAverages to be set greater than 1, DmmAdvanced.AutoZero must be set to On and DmmAdvanced.OffsetCompensatedOhms must be set to Off.. + + + + + Looks up a localized string similar to The simulation state cannot be changed.. + + + + + Looks up a localized string similar to Cannot open file.. + + + + + Looks up a localized string similar to The data is not available. It could be caused by calling DmmMeasurement.Fetch() or DmmMeasurement.FetchMultiPoint() before calling DmmMeasurement.Initiate() or after calling DmmMeasurement.Abort().. + + + + + Looks up a localized string similar to Error reading file.. + + + + + Looks up a localized string similar to Error writing file.. + + + + + Looks up a localized string similar to Unable to find the specified file.. + + + + + Looks up a localized string similar to Instrument error detected. Use ErrorQuery() to determine the error(s).. + + + + + Looks up a localized string similar to Instrument ID query failed.. + + + + + Looks up a localized string similar to Instrument reset failed.. + + + + + Looks up a localized string similar to The instrument status is not available.. + + + + + Looks up a localized string similar to Insufficient memory to continue the execution of the program.. + + + + + Looks up a localized string similar to The argument is invalid. + + + + + Looks up a localized string similar to The specified device cannot be configured for Auto Range when a trigger is selected. Set DmmTrigger.Source and/or DmmTrigger.SampleTrigger to Immediate while Auto Ranging.. + + + + + Looks up a localized string similar to The combination of DmmMultiPoint.MeasurementComplete, DmmTrigger.Source, and DmmTrigger.SampleTrigger is invalid. MeasurementComplete cannot have the same value as Source or SampleTrigger.. + + + + + Looks up a localized string similar to The file does not conform to the expected file format.. + + + + + Looks up a localized string similar to The function is not valid for the given NIDmm.OperationMode. This error can be caused by calling DmmWaveformAcquisition.FetchWaveform() or ReadWaveform() while the OperationMode is set to IviDmmMode. Similarly it can also be caused by calling DmmMeasurement.Read(), Fetch(), FetchMultiPoint() or ReadMultiPoint() while the OperationMode is set to WaveformMode.. + + + + + Looks up a localized string similar to The pathName is invalid.. + + + + + Looks up a localized string similar to Invalid repeated capability name in selector.. + + + + + Looks up a localized string similar to Invalid format for repeated capability selector.. + + + + + Looks up a localized string similar to DmmTrigger.Source and DmmTrigger.SampleTrigger cannot be set to External when the device is configured for SCXI control.. + + + + + Looks up a localized string similar to The specified DmmWaveformAcquisition.Rate and DmmWaveformAcquisition.NumberOfPoints results in an acquisition time that is less than the minimum time(8.89 µs) required by the device.. + + + + + Looks up a localized string similar to An instrument I/O error occurred.. + + + + + Looks up a localized string similar to is not one of int, double, bool, string, DmmHandle, Enum.. + + + + + Looks up a localized string similar to Please verify that the sum of the DmmTrigger.Delay and DmmAdvanced.SettleTime, and the sum of the DmmTrigger.SampleInterval and DmmAdvanced.SettleTime do not exceed the maximum allowed time.. + + + + + Looks up a localized string similar to The operation did not complete within the maximum time allowed. Timeout: 2000mS.. + + + + + Looks up a localized string similar to The property is not readable.. + + + + + Looks up a localized string similar to Failure - cannot recover.. + + + + + Looks up a localized string similar to The property is not writeable.. + + + + + Looks up a localized string similar to null. + + + + + Looks up a localized string similar to Operation in progress.. + + + + + Looks up a localized string similar to The method or property is not supported.. + + + + + Looks up a localized string similar to The option string is missing a required option.. + + + + + Looks up a localized string similar to The option string contains an invalid option value.. + + + + + Looks up a localized string similar to or higher version of the NI-DMM driver.. + + + + + Looks up a localized string similar to The previous acquisition has not completed. Call DmmMeasurement.Abort() to stop the previous acquisition.. + + + + + Looks up a localized string similar to A property was invalidated by another setting.. + + + + + Looks up a localized string similar to The property is not supported for this device.. + + + + + Looks up a localized string similar to The repeated capability selector name is required.. + + + + + Looks up a localized string similar to The instrument does not support the reset operation.. + + + + + Looks up a localized string similar to The repeated capability selector has the wrong number of levels.. + + + + + Looks up a localized string similar to The repeated capability selector includes an invalid range or list.. + + + + + Looks up a localized string similar to DmmDriverUtility.SelfTest() for AC measurement failed.. + + + + + Looks up a localized string similar to DmmDriverUtility.SelfTest() for DC measurement failed.. + + + + + Looks up a localized string similar to DmmDriverUtility.SelfTest() for resistance measurement failed.. + + + + + Looks up a localized string similar to The combination of DmmTrigger.Source and DmmTrigger.SampleTrigger is invalid. They must have the same source and slope if both are routed from external sources.. + + + + + Looks up a localized string similar to The NI-DMM driver version found is. + + + + + Looks up a localized string similar to This version of the .NET API for NI-DMM requires. + + + + + Looks up a localized string similar to Too many files are open.. + + + + + Looks up a localized string similar to The trigger source is not set to software trigger.. + + + + + Looks up a localized string similar to Trying to set or get a value of an invalid type.. + + + + + Looks up a localized string similar to The response from the instrument was unexpected.. + + + + + Looks up a localized string similar to The configuration store driver session references a physical name that is not defined by the driver.. + + + + + Looks up a localized string similar to The option string contains an unknown option name. + + + + + Looks up a localized string similar to Value not supported.. + + + + + Looks up a localized string similar to Value should be positive.. + + + + + Looks up a localized string similar to Error query is not supported by this instrument.. + + + + + Looks up a localized string similar to String was truncated because it was too large to fit in the EEPROM.. + + + + + Looks up a localized string similar to Data may not be within recommended specifications unless you apply Self calibration.. + + + + + Looks up a localized string similar to ID Query is not supported by this instrument.. + + + + + Looks up a localized string similar to Firmware revision query is not supported by this instrument.. + + + + + Looks up a localized string similar to Self test is not supported by this instrument.. + + + + + Looks up a localized string similar to Driver is in simulation mode.. + + + + + Looks up a localized string similar to DMM did not detect a base frequency in the input signal, or the capacitance was too small to be measured accurately.. + + + + + Header: //Measurements/DMM/niDmmComponents/nidmmh/export/18.1/18.1.0f0/includes/nidmmh/nidmm.h + + + + + Header: //Measurements/DMM/niDmmComponents/nidmmh/export/18.1/18.1.0f0/includes/nidmmh/nidmm.h + + + + + C Header Attribute: NIDMM_ATTR_BASE + + + + + C Header Attribute: NIDMM_ATTR_PRIVATE_BASE + + + + + C Header Attribute: NIDMM_ATTR_RANGE_CHECK + + + + + C Header Attribute: NIDMM_ATTR_QUERY_INSTRUMENT_STATUS + + + + + C Header Attribute: NIDMM_ATTR_CACHE + + + + + C Header Attribute: NIDMM_ATTR_SIMULATE + + + + + C Header Attribute: NIDMM_ATTR_RECORD_COERCIONS + + + + + C Header Attribute: NIDMM_ATTR_INTERCHANGE_CHECK + + + + + C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_CLASS_SPEC_MAJOR_VERSION + + + + + C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_CLASS_SPEC_MINOR_VERSION + + + + + C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_DESCRIPTION + + + + + C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_PREFIX + + + + + C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_VENDOR + + + + + C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_REVISION + + + + + C Header Attribute: NIDMM_ATTR_CLASS_DRIVER_CLASS_SPEC_MAJOR_VERSION + + + + + C Header Attribute: NIDMM_ATTR_CLASS_DRIVER_CLASS_SPEC_MINOR_VERSION + + + + + C Header Attribute: NIDMM_ATTR_CHANNEL_COUNT + + + + + C Header Attribute: NIDMM_ATTR_SUPPORTED_INSTRUMENT_MODELS + + + + + C Header Attribute: NIDMM_ATTR_GROUP_CAPABILITIES + + + + + C Header Attribute: NIDMM_ATTR_INSTRUMENT_MANUFACTURER + + + + + C Header Attribute: NIDMM_ATTR_INSTRUMENT_MODEL + + + + + C Header Attribute: NIDMM_ATTR_INSTRUMENT_FIRMWARE_REVISION + + + + + C Header Attribute: NIDMM_ATTR_LOGICAL_NAME + + + + + C Header Attribute: NIDMM_ATTR_IO_RESOURCE_DESCRIPTOR + + + + + C Header Attribute: NIDMM_ATTR_DRIVER_SETUP + + + + + C Header Attribute: NIDMM_ATTR_IO_SESSION + + + + + C Header Attribute: NIDMM_ATTR_FUNCTION + + + + + C Header Attribute: NIDMM_ATTR_RANGE + + + + + C Header Attribute: NIDMM_ATTR_RESOLUTION_ABSOLUTE + + + + + C Header Attribute: NIDMM_ATTR_RESOLUTION_DIGITS + + + + + C Header Attribute: NIDMM_ATTR_TRIGGER_DELAY + + + + + C Header Attribute: NIDMM_ATTR_TRIGGER_SOURCE + + + + + C Header Attribute: NIDMM_ATTR_AC_MAX_FREQ + + + + + C Header Attribute: NIDMM_ATTR_AC_MIN_FREQ + + + + + C Header Attribute: NIDMM_ATTR_FREQ_VOLTAGE_RANGE + + + + + C Header Attribute: NIDMM_ATTR_MEAS_COMPLETE_DEST + + + + + C Header Attribute: NIDMM_ATTR_SAMPLE_COUNT + + + + + C Header Attribute: NIDMM_ATTR_SAMPLE_INTERVAL + + + + + C Header Attribute: NIDMM_ATTR_SAMPLE_TRIGGER + + + + + C Header Attribute: NIDMM_ATTR_TRIGGER_COUNT + + + + + C Header Attribute: NIDMM_ATTR_APERTURE_TIME + + + + + C Header Attribute: NIDMM_ATTR_APERTURE_TIME_UNITS + + + + + C Header Attribute: NIDMM_ATTR_AUTO_RANGE_VALUE + + + + + C Header Attribute: NIDMM_ATTR_AUTO_ZERO + + + + + C Header Attribute: NIDMM_ATTR_POWERLINE_FREQ + + + + + C Header Attribute: NIDMM_ATTR_TRIGGER_SLOPE + + + + + C Header Attribute: NIDMM_ATTR_SAMPLE_TRIGGER_SLOPE + + + + + C Header Attribute: NIDMM_ATTR_MEAS_DEST_SLOPE + + + + + C Header Attribute: NIDMM_ATTR_ADC_CALIBRATION + + + + + C Header Attribute: NIDMM_ATTR_OFFSET_COMP_OHMS + + + + + C Header Attribute: NIDMM_ATTR_NUMBER_OF_AVERAGES + + + + + C Header Attribute: NIDMM_ATTR_CURRENT_SOURCE + + + + + C Header Attribute: NIDMM_ATTR_DC_NOISE_REJECTION + + + + + C Header Attribute: NIDMM_ATTR_SETTLE_TIME + + + + + C Header Attribute: NIDMM_ATTR_INPUT_RESISTANCE + + + + + C Header Attribute: NIDMM_ATTR_LATENCY + + + + + C Header Attribute: NIDMM_ATTR_BUFFER_SIZE + + + + + C Header Attribute: NIDMM_ATTR_SHUNT_VALUE + + + + + C Header Attribute: NIDMM_ATTR_OPERATION_MODE + + + + + C Header Attribute: NIDMM_ATTR_WAVEFORM_RATE + + + + + C Header Attribute: NIDMM_ATTR_WAVEFORM_POINTS + + + + + C Header Attribute: NIDMM_ATTR_WAVEFORM_COUPLING + + + + + C Header Attribute: NIDMM_ATTR_FREQ_VOLTAGE_AUTO_RANGE_VALUE + + + + + C Header Attribute: NIDMM_ATTR_CABLE_COMP_TYPE + + + + + C Header Attribute: NIDMM_ATTR_SHORT_CABLE_COMP_REACTANCE + + + + + C Header Attribute: NIDMM_ATTR_SHORT_CABLE_COMP_RESISTANCE + + + + + C Header Attribute: NIDMM_ATTR_OPEN_CABLE_COMP_SUSCEPTANCE + + + + + C Header Attribute: NIDMM_ATTR_OPEN_CABLE_COMP_CONDUCTANCE + + + + + C Header Attribute: NIDMM_ATTR_LC_CALCULATION_MODEL + + + + + C Header Attribute: NIDMM_ATTR_DC_BIAS + + + + + C Header Attribute: NIDMM_ATTR_LC_NUMBER_MEAS_TO_AVERAGE + + + + + C Header Attribute: NIDMM_ATTR_SERIAL_NUMBER + + + + + C Header Attribute: NIDMM_ATTR_CONFIG_PRODUCT_NUMBER + + + + + C Header Attribute: NIDMM_ATTR_TEMP_TRANSDUCER_TYPE + + + + + C Header Attribute: NIDMM_ATTR_TEMP_TC_REF_JUNC_TYPE + + + + + C Header Attribute: NIDMM_ATTR_TEMP_TC_TYPE + + + + + C Header Attribute: NIDMM_ATTR_TEMP_TC_FIXED_REF_JUNC + + + + + C Header Attribute: NIDMM_ATTR_TEMP_RTD_TYPE + + + + + C Header Attribute: NIDMM_ATTR_TEMP_RTD_RES + + + + + C Header Attribute: NIDMM_ATTR_TEMP_RTD_A + + + + + C Header Attribute: NIDMM_ATTR_TEMP_RTD_B + + + + + C Header Attribute: NIDMM_ATTR_TEMP_RTD_C + + + + + C Header Attribute: NIDMM_ATTR_TEMP_THERMISTOR_TYPE + + + + + C Header Attribute: NIDMM_ATTR_TEMP_THERMISTOR_A + + + + + C Header Attribute: NIDMM_ATTR_TEMP_THERMISTOR_B + + + + + C Header Attribute: NIDMM_ATTR_TEMP_THERMISTOR_C + + + + + Obsolete C Header Attribute: NIDMM_ATTR_QUERY_INSTR_STATUS + + + + + Obsolete C Header Attribute: NIDMM_ATTR_DEFER_UPDATE + + + + + Obsolete C Header Attribute: NIDMM_ATTR_RETURN_DEFERRED_VALUES + + + + + Obsolete C Header Attribute: NIDMM_ATTR_PRIMARY_ERROR + + + + + Obsolete C Header Attribute: NIDMM_ATTR_SECONDARY_ERROR + + + + + Obsolete C Header Attribute: NIDMM_ATTR_ERROR_ELABORATION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_NUM_CHANNELS + + + + + Obsolete C Header Attribute: NIDMM_ATTR_SPECIFIC_PREFIX + + + + + Obsolete C Header Attribute: NIDMM_ATTR_RESOURCE_DESCRIPTOR + + + + + Obsolete C Header Attribute: NIDMM_ATTR_VISA_RM_SESSION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_ENGINE_MAJOR_VERSION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_ENGINE_MINOR_VERSION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_MAJOR_VERSION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_DRIVER_MAJOR_VERSION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_SPECIFIC_DRIVER_MINOR_VERSION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_DRIVER_MINOR_VERSION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_DRIVER_REVISION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_ENGINE_REVISION + + + + + Obsolete C Header Attribute: NIDMM_ATTR_ID_QUERY_RESPONSE + + + + + Obsolete C Header Attribute: NIDMM_ATTR_CHAN_NAMES + + + + + Obsolete C Header Attribute: NIDMM_ATTR_AI_NUM_CHANNELS + + + + + Obsolete C Header Attribute: NIDMM_ATTR_FILTER_NOTCH + + + + + Obsolete C Header Attribute: NIDMM_ATTR_CONVER_PER_SAMPLE + + + + + Obsolete C Header Attribute: NIDMM_ATTR_START_TRIGGER + + + + + Obsolete C Header Attribute: NIDMM_ATTR_START_TRIG_SLOPE + + + + + Obsolete C Header Attribute: NIDMM_ATTR_SAMPLE_TRIGGER_DELAY + + + + + Obsolete C Header Attribute: NIDMM_ATTR_OLD_TRIGGER_MODEL + + + + + Obsolete C Header Attribute: NIDMM_ATTR_AI_BUFFER_SIZE + + + + + Obsolete C Header Attribute: NIDMM_ATTR_SAMPLE_DELAY_MODE + + + + + Obsolete C Header Attribute: NIDMM_ATTR_RESOLUTION + + + + + Header: //Measurements/DMM/niDmmComponents/nidmmh/export/18.1/18.1.0f0/includes/nidmmh/nidmm.h + + + + + C Header Error: NIDMM_ERROR_EXT_STATUS_BASE + + + + + C Header Error: NIDMM_ERROR_EXTCAL_ERROR_BASE + + + + + C Header Error: IVI_ERROR_CANNOT_LOAD_IVI_ENGINE + + + + + C Header Error: IVI_ERROR_CANNOT_RECOVER + + + + + C Header Error: IVI_ERROR_INSTR_SPECIFIC + + + + + C Header Error: IVI_ERROR_INSTRUMENT_STATUS + + + + + C Header Error: IVI_ERROR_CANNOT_OPEN_FILE + + + + + C Header Error: IVI_ERROR_READING_FILE + + + + + C Header Error: IVI_ERROR_WRITING_FILE + + + + + C Header Error: IVI_ERROR_DRIVER_MODULE_NOT_FOUND + + + + + C Header Error: IVI_ERROR_CANNOT_OPEN_DRIVER_MODULE + + + + + C Header Error: IVI_ERROR_INVALID_DRIVER_MODULE + + + + + C Header Error: IVI_ERROR_UNDEFINED_REFERENCES + + + + + C Header Error: IVI_ERROR_FUNCTION_NOT_FOUND + + + + + C Header Error: IVI_ERROR_LOADING_DRIVER_MODULE + + + + + C Header Error: IVI_ERROR_INVALID_PATHNAME + + + + + C Header Error: IVI_ERROR_INVALID_ATTRIBUTE + + + + + C Header Error: IVI_ERROR_IVI_ATTR_NOT_WRITABLE + + + + + C Header Error: IVI_ERROR_IVI_ATTR_NOT_READABLE + + + + + C Header Error: IVI_ERROR_INVALID_PARAMETER + + + + + C Header Error: IVI_ERROR_INVALID_VALUE + + + + + C Header Error: IVI_ERROR_FUNCTION_NOT_SUPPORTED + + + + + C Header Error: IVI_ERROR_ATTRIBUTE_NOT_SUPPORTED + + + + + C Header Error: IVI_ERROR_VALUE_NOT_SUPPORTED + + + + + C Header Error: IVI_ERROR_INVALID_TYPE + + + + + C Header Error: IVI_ERROR_TYPES_DO_NOT_MATCH + + + + + C Header Error: IVI_ERROR_MULTIPLE_DEFERRED_SETTING + + + + + C Header Error: IVI_ERROR_ITEM_ALREADY_EXISTS + + + + + C Header Error: IVI_ERROR_INVALID_CONFIGURATION + + + + + C Header Error: IVI_ERROR_VALUE_NOT_AVAILABLE + + + + + C Header Error: IVI_ERROR_ATTRIBUTE_VALUE_NOT_KNOWN + + + + + C Header Error: IVI_ERROR_NO_RANGE_TABLE + + + + + C Header Error: IVI_ERROR_INVALID_RANGE_TABLE + + + + + C Header Error: IVI_ERROR_NOT_INITIALIZED + + + + + C Header Error: IVI_ERROR_NON_INTERCHANGEABLE_BEHAVIOR + + + + + C Header Error: IVI_ERROR_NO_CHANNEL_TABLE + + + + + C Header Error: IVI_ERROR_UNKNOWN_REPEATED_CAPABILITY_NAME + + + + + C Header Error: IVI_ERROR_UNKNOWN_CHANNEL_NAME + + + + + C Header Error: IVI_ERROR_SYS_RSRC_ALLOC + + + + + C Header Error: IVI_ERROR_ACCESS_DENIED + + + + + C Header Error: IVI_ERROR_TOO_MANY_OPEN_FILES + + + + + C Header Error: IVI_ERROR_TOO_MANY_FILES_OPEN + + + + + C Header Error: IVI_ERROR_UNABLE_TO_CREATE_TEMP_FILE + + + + + C Header Error: IVI_ERROR_NO_UNUSED_TEMP_FILENAMES + + + + + C Header Error: IVI_ERROR_DISK_FULL + + + + + C Header Error: IVI_ERROR_CONFIG_FILE_NOT_FOUND + + + + + C Header Error: IVI_ERROR_CANNOT_OPEN_CONFIG_FILE + + + + + C Header Error: IVI_ERROR_ERROR_READING_CONFIG_FILE + + + + + C Header Error: IVI_ERROR_BAD_INTEGER_IN_CONFIG_FILE + + + + + C Header Error: IVI_ERROR_BAD_DOUBLE_IN_CONFIG_FILE + + + + + C Header Error: IVI_ERROR_BAD_BOOLEAN_IN_CONFIG_FILE + + + + + C Header Error: IVI_ERROR_CONFIG_ENTRY_NOT_FOUND + + + + + C Header Error: IVI_ERROR_DRIVER_DLL_INIT_FAILED + + + + + C Header Error: IVI_ERROR_DRIVER_UNRESOLVED_SYMBOL + + + + + C Header Error: IVI_ERROR_CANNOT_FIND_CVI_RTE + + + + + C Header Error: IVI_ERROR_CANNOT_OPEN_CVI_RTE + + + + + C Header Error: IVI_ERROR_CVI_RTE_INVALID_FORMAT + + + + + C Header Error: IVI_ERROR_CVI_RTE_MISSING_FUNCTION + + + + + C Header Error: IVI_ERROR_CVI_RTE_INIT_FAILED + + + + + C Header Error: IVI_ERROR_CVI_RTE_UNRESOLVED_SYMBOL + + + + + C Header Error: IVI_ERROR_LOADING_CVI_RTE + + + + + C Header Error: IVI_ERROR_CANNOT_OPEN_DLL_FOR_EXPORTS + + + + + C Header Error: IVI_ERROR_DLL_CORRUPTED + + + + + C Header Error: IVI_ERROR_NO_DLL_EXPORT_TABLE + + + + + C Header Error: IVI_ERROR_UNKNOWN_DEFAULT_SETUP_ATTR + + + + + C Header Error: IVI_ERROR_INVALID_DEFAULT_SETUP_VAL + + + + + C Header Error: IVI_ERROR_UNKNOWN_MEMORY_PTR + + + + + C Header Error: IVI_ERROR_EMPTY_REPEATED_CAPABILITY_LIST + + + + + C Header Error: IVI_ERROR_EMPTY_CHANNEL_LIST + + + + + C Header Error: IVI_ERROR_DUPLICATE_REPEATED_CAPABILITY_IDENTIFIER + + + + + C Header Error: IVI_ERROR_DUPLICATE_CHANNEL_STRING + + + + + C Header Error: IVI_ERROR_DUPLICATE_VIRT_CHAN_NAME + + + + + C Header Error: IVI_ERROR_MISSING_VIRT_CHAN_NAME + + + + + C Header Error: IVI_ERROR_BAD_VIRT_CHAN_NAME + + + + + C Header Error: IVI_ERROR_UNASSIGNED_VIRT_CHAN_NAME + + + + + C Header Error: IVI_ERROR_BAD_VIRT_CHAN_ASSIGNMENT + + + + + C Header Error: IVI_ERROR_CHANNEL_NAME_REQUIRED + + + + + C Header Error: IVI_ERROR_REPEATED_CAPABILITY_NAME_REQUIRED + + + + + C Header Error: IVI_ERROR_CHANNEL_NAME_NOT_ALLOWED + + + + + C Header Error: IVI_ERROR_REPEATED_CAPABILITY_NAME_NOT_ALLOWED + + + + + C Header Error: IVI_ERROR_ATTR_NOT_VALID_FOR_REPEATED_CAPABILITY + + + + + C Header Error: IVI_ERROR_ATTR_NOT_VALID_FOR_CHANNEL + + + + + C Header Error: IVI_ERROR_ATTR_MUST_BE_REPEATED_CAPABILITY_BASED + + + + + C Header Error: IVI_ERROR_ATTR_MUST_BE_CHANNEL_BASED + + + + + C Header Error: IVI_ERROR_CHANNEL_ALREADY_EXCLUDED + + + + + C Header Error: IVI_ERROR_MISSING_OPTION_NAME + + + + + C Header Error: IVI_ERROR_MISSING_OPTION_VALUE + + + + + C Header Error: IVI_ERROR_BAD_OPTION_NAME + + + + + C Header Error: IVI_ERROR_BAD_OPTION_VALUE + + + + + C Header Error: IVI_ERROR_NOT_CREATED_BY_CLASS + + + + + C Header Error: IVI_ERROR_IVI_INI_IS_RESERVED + + + + + C Header Error: IVI_ERROR_DUP_RUNTIME_CONFIG_ENTRY + + + + + C Header Error: IVI_ERROR_INDEX_IS_ONE_BASED + + + + + C Header Error: IVI_ERROR_INDEX_IS_TOO_HIGH + + + + + C Header Error: IVI_ERROR_ATTR_NOT_CACHEABLE + + + + + C Header Error: IVI_ERROR_ADDR_ATTRS_MUST_BE_HIDDEN + + + + + C Header Error: IVI_ERROR_BAD_REPEATED_CAPABILITY_NAME + + + + + C Header Error: IVI_ERROR_BAD_CHANNEL_NAME + + + + + C Header Error: IVI_ERROR_BAD_PREFIX_IN_CONFIG_FILE + + + + + C Header Error: IVI_ERROR_OUT_OF_MEMORY + + + + + C Header Error: IVI_ERROR_OPERATION_PENDING + + + + + C Header Error: IVI_ERROR_NULL_POINTER + + + + + C Header Error: IVI_ERROR_UNEXPECTED_RESPONSE + + + + + C Header Error: IVI_ERROR_FILE_NOT_FOUND + + + + + C Header Error: IVI_ERROR_INVALID_FILE_FORMAT + + + + + C Header Error: IVI_ERROR_STATUS_NOT_AVAILABLE + + + + + C Header Error: IVI_ERROR_ID_QUERY_FAILED + + + + + C Header Error: IVI_ERROR_RESET_FAILED + + + + + C Header Error: IVI_ERROR_RESOURCE_UNKNOWN + + + + + C Header Error: IVI_ERROR_ALREADY_INITIALIZED + + + + + C Header Error: IVI_ERROR_CANNOT_CHANGE_SIMULATION_STATE + + + + + C Header Error: IVI_ERROR_INVALID_NUMBER_OF_LEVELS_IN_SELECTOR + + + + + C Header Error: IVI_ERROR_INVALID_RANGE_IN_SELECTOR + + + + + C Header Error: IVI_ERROR_UNKOWN_NAME_IN_SELECTOR + + + + + C Header Error: IVI_ERROR_BADLY_FORMED_SELECTOR + + + + + C Header Error: IVI_ERROR_UNKNOWN_PHYSICAL_IDENTIFIER + + + + + C Header Error: IVI_ERROR_CANNOT_MODIFY_REPEATED_CAPABILITY_TABLE + + + + + C Header Error: IVI_ERROR_CANNOT_RESTRICT_ATTRIBUTE_TWICE + + + + + C Header Error: IVI_ERROR_REPEATED_CAPABILITY_ALREADY_EXISTS + + + + + C Header Error: IVI_ERROR_REPEATED_CAPABILITY_NOT_DEFINED + + + + + C Header Error: IVI_ERROR_INVALID_REPEATED_CAPABILITY_NAME + + + + + C Header Error: IVI_ERROR_CONFIG_SERVER_NOT_PRESENT + + + + + Header: //Measurements/DMM/niDmmComponents/nidmmh/export/18.1/18.1.0f0/includes/nidmmh/nidmm.h + + + + + C Header Value: NIDMM_VAL_FUNC_SPECIFIC_EXT_BASE + + + + + C Header Value: NIDMM_VAL_TRIGGER_SOURCE_SPECIFIC_EXT_BASE + + + + + C Header Value: NIDMM_VAL_TYPE_NORMAL + + + + + C Header Value: NIDMM_VAL_TYPE_NAN + + + + + C Header Value: NIDMM_VAL_TYPE_PINF + + + + + C Header Value: NIDMM_VAL_TYPE_NINF + + + + + C Header Value: NIDMM_VAL_DC_VOLTS + + + + + C Header Value: NIDMM_VAL_AC_VOLTS + + + + + C Header Value: NIDMM_VAL_DC_CURRENT + + + + + C Header Value: NIDMM_VAL_AC_CURRENT + + + + + C Header Value: NIDMM_VAL_2_WIRE_RES + + + + + C Header Value: NIDMM_VAL_4_WIRE_RES + + + + + C Header Value: NIDMM_VAL_FREQ + + + + + C Header Value: NIDMM_VAL_PERIOD + + + + + C Header Value: NIDMM_VAL_TEMPERATURE + + + + + C Header Value: NIDMM_VAL_AC_VOLTS_DC_COUPLED + + + + + C Header Value: NIDMM_VAL_DIODE + + + + + C Header Value: NIDMM_VAL_WAVEFORM_VOLTAGE + + + + + C Header Value: NIDMM_VAL_WAVEFORM_CURRENT + + + + + C Header Value: NIDMM_VAL_CAPACITANCE + + + + + C Header Value: NIDMM_VAL_INDUCTANCE + + + + + C Header Value: NIDMM_VAL_AUTO_RANGE_ON + + + + + C Header Value: NIDMM_VAL_AUTO_RANGE_OFF + + + + + C Header Value: NIDMM_VAL_AUTO_RANGE_ONCE + + + + + C Header Value: NIDMM_VAL_AUTO_DELAY + + + + + C Header Value: NIDMM_VAL_AUTO_DELAY_ON + + + + + C Header Value: NIDMM_VAL_AUTO_DELAY_OFF + + + + + C Header Value: NIDMM_VAL_IMMEDIATE + + + + + C Header Value: NIDMM_VAL_EXTERNAL + + + + + C Header Value: NIDMM_VAL_SOFTWARE_TRIG + + + + + C Header Value: NIDMM_VAL_PXI_TRIG0 + + + + + C Header Value: NIDMM_VAL_PXI_TRIG1 + + + + + C Header Value: NIDMM_VAL_PXI_TRIG2 + + + + + C Header Value: NIDMM_VAL_PXI_TRIG3 + + + + + C Header Value: NIDMM_VAL_PXI_TRIG4 + + + + + C Header Value: NIDMM_VAL_PXI_TRIG5 + + + + + C Header Value: NIDMM_VAL_PXI_TRIG6 + + + + + C Header Value: NIDMM_VAL_PXI_TRIG7 + + + + + C Header Value: NIDMM_VAL_PXI_STAR + + + + + C Header Value: NIDMM_VAL_LBR_TRIG1 + + + + + C Header Value: NIDMM_VAL_AUX_TRIG1 + + + + + C Header Value: NIDMM_VAL_NONE + + + + + C Header Value: NIDMM_VAL_LBR_TRIG0 + + + + + C Header Value: NIDMM_VAL_INTERVAL + + + + + C Header Value: NIDMM_VAL_POSITIVE + + + + + C Header Value: NIDMM_VAL_NEGATIVE + + + + + C Header Value: NIDMM_VAL_TRIG_COUNT_INFINITE + + + + + C Header Value: NIDMM_VAL_SAMPLE_COUNT_INFINITE + + + + + C Header Value: NIDMM_VAL_50_HERTZ + + + + + C Header Value: NIDMM_VAL_60_HERTZ + + + + + C Header Value: NIDMM_VAL_SECONDS + + + + + C Header Value: NIDMM_VAL_POWER_LINE_CYCLES + + + + + C Header Value: NIDMM_VAL_APERTURE_TIME_AUTO + + + + + C Header Value: NIDMM_VAL_1_PLC + + + + + C Header Value: NIDMM_VAL_5_PLC + + + + + C Header Value: NIDMM_VAL_6_PLC + + + + + C Header Value: NIDMM_VAL_10_PLC + + + + + C Header Value: NIDMM_VAL_12_PLC + + + + + C Header Value: NIDMM_VAL_100_PLC + + + + + C Header Value: NIDMM_VAL_120_PLC + + + + + C Header Value: NIDMM_VAL_SETTLE_TIME_AUTO + + + + + C Header Value: NIDMM_VAL_AUTO_ZERO_AUTO + + + + + C Header Value: NIDMM_VAL_AUTO_ZERO_OFF + + + + + C Header Value: NIDMM_VAL_AUTO_ZERO_ON + + + + + C Header Value: NIDMM_VAL_AUTO_ZERO_ONCE + + + + + C Header Value: NIDMM_VAL_ADC_CALIBRATION_AUTO + + + + + C Header Value: NIDMM_VAL_ADC_CALIBRATION_OFF + + + + + C Header Value: NIDMM_VAL_ADC_CALIBRATION_ON + + + + + C Header Value: NIDMM_VAL_OFFSET_COMP_OHMS_OFF + + + + + C Header Value: NIDMM_VAL_OFFSET_COMP_OHMS_ON + + + + + C Header Value: NIDMM_VAL_1_MICROAMP + + + + + C Header Value: NIDMM_VAL_10_MICROAMP + + + + + C Header Value: NIDMM_VAL_100_MICROAMP + + + + + C Header Value: NIDMM_VAL_1_MILLIAMP + + + + + C Header Value: NIDMM_VAL_DCNR_AUTO + + + + + C Header Value: NIDMM_VAL_DCNR_NORMAL + + + + + C Header Value: NIDMM_VAL_DCNR_SECOND_ORDER + + + + + C Header Value: NIDMM_VAL_DCNR_HIGH_ORDER + + + + + C Header Value: NIDMM_VAL_1_MEGAOHM + + + + + C Header Value: NIDMM_VAL_10_MEGAOHM + + + + + C Header Value: NIDMM_VAL_GREATER_THAN_10_GIGAOHM + + + + + C Header Value: NIDMM_VAL_RESISTANCE_NA + + + + + C Header Value: NIDMM_VAL_LATENCY_AUTO + + + + + C Header Value: NIDMM_VAL_BUFFER_SIZE_AUTO + + + + + C Header Value: NIDMM_VAL_INTERNAL_AREA + + + + + C Header Value: NIDMM_VAL_EXTERNAL_AREA + + + + + C Header Value: NIDMM_VAL_TIME_LIMIT_AUTO + + + + + C Header Value: NIDMM_VAL_IVIDMM_MODE + + + + + C Header Value: NIDMM_VAL_WAVEFORM_MODE + + + + + C Header Value: NIDMM_VAL_WAVEFORM_COUPLING_AC + + + + + C Header Value: NIDMM_VAL_WAVEFORM_COUPLING_DC + + + + + C Header Value: NIDMM_VAL_CALC_MODEL_AUTO + + + + + C Header Value: NIDMM_VAL_CALC_MODEL_SERIES + + + + + C Header Value: NIDMM_VAL_CALC_MODEL_PARALLEL + + + + + C Header Value: NIDMM_VAL_DC_BIAS_OFF + + + + + C Header Value: NIDMM_VAL_DC_BIAS_ON + + + + + C Header Value: NIDMM_VAL_CABLE_COMP_NONE + + + + + C Header Value: NIDMM_VAL_CABLE_COMP_OPEN + + + + + C Header Value: NIDMM_VAL_CABLE_COMP_SHORT + + + + + C Header Value: NIDMM_VAL_CABLE_COMP_OPEN_AND_SHORT + + + + + C Header Value: NIDMM_VAL_CONTROL_COMMIT + + + + + C Header Value: NIDMM_VAL_THERMOCOUPLE + + + + + C Header Value: NIDMM_VAL_THERMISTOR + + + + + C Header Value: NIDMM_VAL_2_WIRE_RTD + + + + + C Header Value: NIDMM_VAL_4_WIRE_RTD + + + + + C Header Value: NIDMM_VAL_TEMP_REF_JUNC_FIXED + + + + + C Header Value: NIDMM_VAL_TEMP_TC_B + + + + + C Header Value: NIDMM_VAL_TEMP_TC_E + + + + + C Header Value: NIDMM_VAL_TEMP_TC_J + + + + + C Header Value: NIDMM_VAL_TEMP_TC_K + + + + + C Header Value: NIDMM_VAL_TEMP_TC_N + + + + + C Header Value: NIDMM_VAL_TEMP_TC_R + + + + + C Header Value: NIDMM_VAL_TEMP_TC_S + + + + + C Header Value: NIDMM_VAL_TEMP_TC_T + + + + + C Header Value: NIDMM_VAL_TEMP_RTD_CUSTOM + + + + + C Header Value: NIDMM_VAL_TEMP_RTD_PT3750 + + + + + C Header Value: NIDMM_VAL_TEMP_RTD_PT3851 + + + + + C Header Value: NIDMM_VAL_TEMP_RTD_PT3911 + + + + + C Header Value: NIDMM_VAL_TEMP_RTD_PT3916 + + + + + C Header Value: NIDMM_VAL_TEMP_RTD_PT3920 + + + + + C Header Value: NIDMM_VAL_TEMP_RTD_PT3928 + + + + + C Header Value: NIDMM_VAL_TEMP_THERMISTOR_CUSTOM + + + + + C Header Value: NIDMM_VAL_TEMP_THERMISTOR_44004 + + + + + C Header Value: NIDMM_VAL_TEMP_THERMISTOR_44006 + + + + + C Header Value: NIDMM_VAL_TEMP_THERMISTOR_44007 + + + + + Specifies whether calibration is external or self-calibration. + + 12/28/2009 4:25:26 PM + Staci Heien + True + + + + Self-calibration. The NI 4065 does not support self-calibration. + + 12/30/2009 12:24:56 PM + Staci Heien + True + + + + Calibration is external. + + 12/28/2009 4:25:47 PM + Staci Heien + True + + + + Specifies the control action for the driver to perform. + + + 2/10/2010 3:47:05 PM + Measurement Studio + True + + + + Commits to hardware all of the configured attributes associated with the session. + + 7/8/2009 8:13:25 PM + Keely Joseph + True + + + + Specifies the LC calculation model. + + + For the NI 4072 only. + + + 12/29/2009 1:15:15 PM + Staci Heien + True + + + + NI-DMM chooses the algorithm based on function and range. + + 12/1/2009 1:58:41 PM + Staci Heien + True + + + + NI-DMM uses the series impedance model to calculate capacitance and inductance. + + 12/29/2009 1:15:37 PM + Staci Heien + True + + + + NI-DMM uses the parallel admittance model to calculate capacitance and inductance. + + 12/29/2009 1:15:31 PM + Staci Heien + True + + + + Specifies the type of reference junction to be used. Used for thermocouple measurements. + + + 12/30/2009 12:29:21 PM + Staci Heien + True + + + + Fixed reference junction. + + 12/29/2009 4:30:37 PM + Staci Heien + True + + + + Specifies the type of RTD (Resistance Temperature Detector) used. + + + 12/30/2009 12:43:39 PM + Staci Heien + True + + + + User defines Callendar-Van Dusen A, B, and C coefficients with the , + , and attributes, respectively. + + 5/13/2011 5:11:06 PM + NI + True + + + + Most common RTDs. + + 12/1/2009 4:05:15 PM + Staci Heien + True + + + + Low-cost RTD. + + 12/1/2009 4:05:22 PM + Staci Heien + True + + + + JISC 1604. + + 12/1/2009 4:05:28 PM + Staci Heien + True + + + + US Industrial Standard D-100. + + 12/1/2009 4:05:39 PM + Staci Heien + True + + + + Low-cost RTD. + + 3/4/2016 11:19:42 AM + sheien + True + + + + The definition of temperature. + + 12/1/2009 4:05:53 PM + Staci Heien + True + + + + Specifies a delay interval after a sample trigger. + + + For NI 4060 only. + + + 12/28/2009 4:48:01 PM + Staci Heien + True + + + + IVI compliant. Used when the sample trigger is set to Interval. + + 12/30/2009 12:25:56 PM + Staci Heien + True + + + + Not IVI Compliant. Used as a delay after any type of sample trigger. + + 12/28/2009 4:48:19 PM + Staci Heien + True + + + + The result of NI-DMM . + + + Contains the results of a NI-DMM . + Use the code and message to determine if there was an error. + + + 3/21/2016 4:55:23 PM + sheien + True + + + + Initializes a new instance of the struct. + + The numeric result from the self-test operation. 0 = no error (test passed). + The self-test status message. + 3/21/2016 4:54:16 PM + sheien + True + + + + Gets the numeric result from the self-test operation. + + + 0 = no error (test passed). + + 12/30/2009 12:19:16 PM + Staci Heien + True + + + + Gets the string returned from the instrument . + + + String returned from the instrument . + + 1/5/2010 3:08:16 PM + Keely Joseph + True + + + + Determines whether two instances have the same value. + + + A instance to compare with result1. + + + A instance to compare with result2. + + + if the two instances represent the same result; otherwise, . + + 12/30/2009 12:21:41 PM + Staci Heien + True + + + + Compares two instances for equality. + + + A instance to compare with result1. + + + A instance to compare with result2. + + + if the two instances represent the same result; otherwise, . + + 12/30/2009 12:21:48 PM + Staci Heien + True + + + + Compares two instances for equality. + + + if the two instances represent the same result; otherwise, . + + object to compare to. + 3/4/2016 11:17:36 AM + sheien + True + + + + Returns the hash code for the result of the self test. + + An containing the hash value generated for this result. + 3/4/2016 11:17:39 AM + sheien + True + + + + Contains members that are common to all sub-object NI-DMM classes. + + is a base class for all sub-object NI-DMM classes. + + + 3/4/2016 11:13:39 AM + sheien + True + + + + Specifies the type of thermistor used for measurement. + + + 12/30/2009 12:30:59 PM + Staci Heien + True + + + + Custom. + + 12/30/2009 12:31:07 PM + Staci Heien + True + + + + 44004. + + 12/30/2009 12:31:15 PM + Staci Heien + True + + + + 44006. + + 12/30/2009 12:31:19 PM + Staci Heien + True + + + + 44007. + + 12/30/2009 12:31:25 PM + Staci Heien + True + + + + Specifies the type of thermocouple used for temperature measurements. + + + For more information, refer to the + niDMM_ConfigureThermocouple and + Thermocouples topics in the + NI Digital Multimeters Help. + + + 3/4/2016 11:19:48 AM + sheien + True + + + + Type B. + + 12/30/2009 12:34:42 PM + Staci Heien + True + + + + Type E. + + 12/30/2009 12:34:48 PM + Staci Heien + True + + + + Type J. + + 12/30/2009 12:34:54 PM + Staci Heien + True + + + + Type K. + + 12/30/2009 12:35:01 PM + Staci Heien + True + + + + Type N. + + 12/30/2009 12:35:07 PM + Staci Heien + True + + + + Type R. + + 12/30/2009 12:35:13 PM + Staci Heien + True + + + + Type S. + + 12/30/2009 12:35:20 PM + Staci Heien + True + + + + Type T. + + 12/30/2009 12:35:25 PM + Staci Heien + True + + + + Specifies the type of device used for measurement. + + + 12/30/2009 12:35:44 PM + Staci Heien + True + + + + 2-wire RTD. + + 12/30/2009 12:36:14 PM + Staci Heien + True + + + + 4-wire RTD. + + 12/30/2009 12:35:50 PM + Staci Heien + True + + + + Thermistor. + + 12/30/2009 12:35:56 PM + Staci Heien + True + + + + Thermocouple. + + 12/30/2009 12:36:01 PM + Staci Heien + True + + + + Provides warning codes. + + + + For more information, refer to the Error and Warning Codes + topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:16:08 AM + sheien + True + + + + Indicates that the driver is in simulation mode. + + 12/30/2009 12:08:18 PM + Staci Heien + True + + + + Indicates that your data may not be within recommended specifications unless you call . + + 12/30/2009 12:08:05 PM + Staci Heien + True + + + + Indicates that the string was truncated because it was too large to fit in the EEPROM. + + 12/30/2009 12:07:52 PM + Staci Heien + True + + + + Indicates that the DMM did not detect a base frequency in the input signal, or the capacitance was too small to be measured accurately. + + 9/23/2009 4:09:33 PM + Keely Joseph + True + + + + Indicates that the DMM detected a measurement that was outside of its programmed range. + + 9/23/2009 4:09:33 PM + cdelpire + False + + + + Indicates that the DMM does not support reset. + + 9/23/2009 4:09:33 PM + cdelpire + False + + + + Specifies the edge of the signal. + + + + 12/30/2009 12:30:15 PM + Staci Heien + True + + + + Rising edge. + + 12/30/2009 12:30:31 PM + Staci Heien + True + + + + Falling edge. + + 12/30/2009 12:30:22 PM + Staci Heien + True + + + + Represents the root class that is used to identify and control the instrument session. In order to interact with the NI-DMM, you + must create an instance of this class. + + + + For more information, refer to the Programming Flow topic in the + NI Digital Multimeters Help. + + is returned if the members are accessed after the + associated + object has been disposed. + + + 3/4/2016 11:16:50 AM + sheien + True + + + + Initializes a new instance of the class representing the instrument driver session. + + + The name of the device to which the session is opened. + + + If this parameter is set to , this method queries the instrument ID and checks that it is valid for this instrument driver. + + + If this parameter is set to , this method resets the instrument to a known state. Sends initialization commands to set the instrument to the state necessary for the operation of the instrument driver. + + + The resource name passed is null. + + + The device was not recognized. + -or- + The device is not supported for this driver or version. + -or- + The instrument descriptor is invalid. + -or- + The driver setup description is invalid. + -or- + The device is already in use by another process. Verify that all sessions of the device from other processes are properly closed. + + + The resource name specified has been opened for a calibration session. + + 3/21/2016 4:52:58 PM + sheien + True + + + + Initializes a new instance of the class representing the instrument driver session. + + + The name of the device to which the session is opened. + + + If this parameter is set to , this method queries the instrument ID and checks that it is valid for this instrument driver. + + + If this parameter is set to , this method resets the instrument to a known state. Sends initialization commands to set the instrument to the state necessary for the operation of the instrument driver. + + + Sets the initial state of the following session properties: , + , + , + , and + . + + + The or is null. + + + The device was not recognized. + -or- + The device is not supported for this driver or version. + -or- + The instrument descriptor is invalid. + -or- + The driver setup description is invalid. + -or- + The device is already in use by another process. Verify that all sessions of the device from other processes are properly closed. + + + The resource name specified has been opened for a calibration session. + + + 3/21/2016 4:53:38 PM + sheien + True + + + + Initializes a new instance of the class using an existing intrument session handle. + + + A pointer to the instrument handle. + + 3/21/2016 4:52:25 PM + sheien + True + + + + Initializes a new instance of the class representing the instrument driver session. + + + The name of the device to which the session is opened. + + + If this parameter is set to , this method queries the instrument ID and checks that it is valid for this instrument driver. + + + If this parameter is set to , this method resets the instrument to a known state. Sends initialization commands to set the instrument to the state necessary for the operation of the instrument driver. + + + The type of lock to create. Note that the actual type created can differ. See IVI-3.2 for details. + + + A user-specified access key. + + + Sets the initial state of the following session properties: , + , + , + , + . + + + The or is null. + + + The device was not recognized. + -or- + The device is not supported for this driver or version. + -or- + The instrument descriptor is invalid. + -or- + The driver setup description is invalid. + -or- + The device is already in use by another process. Verify that all sessions of the device from other processes are properly closed. + + + The resource name specified has been opened for a calibration session. + + + 2/15/2010 1:45:44 PM + Keely Joseph + False + + + + Gets a value indicating whether the session object is disposed or not. + + + If the value is , it means that the session has already been disposed. + If the value is , it means that the session is not disposed. + + 3/4/2016 11:17:01 AM + sheien + True + + + + Gets the sub-object used to obtain properties that affect operation of the instrument driver. + + + Returns an object of type . + + 1/26/2010 3:47:13 PM + Staci Heien + True + + + + Gets identity information about the instrument you are using. + + + Returns an object of type . + + 1/11/2010 1:56:46 PM + Staci Heien + True + + + + Gets the sub-object. + + + Returns an object of type . + + 1/26/2010 3:48:09 PM + Staci Heien + True + + + + Gets properties applicable to AC measurements. + + + Returns an object of type . + + 1/11/2010 1:55:52 PM + Staci Heien + True + + + + Gets the sub-object used for controlling frequency capabilities. + + + Returns an object of type . + + 1/26/2010 3:49:08 PM + Staci Heien + True + + + + Gets the sub-object used to customize the triggering functionality. + + + Returns an object of type . + + 1/26/2010 3:49:56 PM + Staci Heien + True + + + + Gets additional information concerning the instrument driver session. + + + Returns an object of type . + + 1/11/2010 1:56:09 PM + Staci Heien + True + + + + Gets data from a measurement. + + + Returns an object of type . + + 1/11/2010 5:02:41 PM + Staci Heien + True + + + + Gets the sub-object used to control inductance and capacitance capabilities. + + + For the NI 4072 only. + + + Returns an object of type . + + 3/4/2016 11:16:53 AM + sheien + True + + + + Gets temperature measurements. + + + Returns an object of type . + + 1/11/2010 1:57:44 PM + Staci Heien + True + + + + Gets the sub-object which is used to perform self-calibration or for optional functionality when performing a calibration. + + + Returns an object of type . + + 1/26/2010 3:45:29 PM + Staci Heien + True + + + + Gets the sub-object used for waveform-related operations. + + + Returns an object of type . + + 1/26/2010 3:50:39 PM + Staci Heien + True + + + + Gets or sets the measurement function. + + + If you are configuring by setting properties directly, you must set the + before + setting other properties. If the + is set to , + the only valid types are + and . Set the + to + to set all other values. + For more information, refer to NIDMM_ATTR_FUNCTION topic in the NI Digital Multimeters Help. + + + Returns an object of type . + + 3/4/2016 11:17:05 AM + sheien + True + + + + Gets or sets the measurement range. + + + Use positive values to represent the absolute value of the maximum expected measurement. + + + The value is in units appropriate for the current value of the + . For + example, if is + set to , the units are volts. + The NI 4050 and NI 4060 only support when the trigger and sample trigger is set to Immediate. + performs an before acquiring the measurement. + + sets the to the + current and uses this range + for all subsequent measurements until the measurement configuration is changed. + + performs an before + acquiring the next measurement. The is stored and used for all subsequent measurements until the measurement configuration is changed. + + 3/4/2010 3:41:29 PM + Keely Joseph + True + + + + Gets or sets the measurement resolution in digits. + + + Setting this property to higher values increases the measurement accuracy. Setting this property to lower values increases the measurement speed. + NI-DMM ignores this property for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use . + + + The valid Resolution values and description are shown in the table. + + + Description + DigitsResolution Value + + + + 3.5 + + + Specifies 3.5 digits resolution. + + + + + 4.5 + + + Specifies 4.5 digits resolution. + + + + + 5.5 + + + Specifies 5.5 digits resolution. + + + + + 6.5 + + + Specifies 6.5 digits resolution. + + + + + 7.5 + + + Specifies 7.5 digits resolution. + + + + + 1/5/2010 2:24:20 PM + Keely Joseph + True + + + + Gets or sets the measurement resolution in absolute units. + + + Returns the measurement resolution in absolute units. + + + Setting this property to higher values increases the measurement accuracy. + Setting this property to lower values increases the measurement speed. + NI-DMM ignores this property for capacitance and inductance measurements on the NI 4072. To achieve better + resolution for such measurements, use the + . + + 1/11/2010 5:03:26 PM + Staci Heien + True + + + + Gets or sets the current source provided during diode measurements. + + + The NI 4050 and NI 4060 are not supported. + + + The supported values are 1 microAmp, 10 microAmps, 100 microAmps, and 1 milliAmp. + Refer to the Devices topic in the NI Digital Multimeters Help. + + 3/4/2016 11:16:57 AM + sheien + True + + + + Gets or sets the input resistance of the instrument. + + + The NI 4050 and NI 4060 are not supported. + + + The supported values are 1.000000E+6 (1M Ohm), 1.000000E+7 (10M Ohm), and 1.000000E+10 (input resistance greater than 10 G Ohm). + + 1/11/2010 5:01:41 PM + Staci Heien + True + + + + Gets the number of seconds it takes to make one measurement. + + + Use this right before you begin acquiring dataafter you have completely configured the measurement and after all configuration methods have been called. + + + Returns the amount of time in seconds it takes to complete one measurement with the current configuration. + + 3/4/2016 11:17:08 AM + sheien + True + + + Gets or sets whether the range is set automatically by the instrument. + + + + Value + Description + + + + On + + + NI-DMM driver determines whether the range is set automatically by the instrument before acquiring each measurement. + + + + + Off + + + NI-DMM driver sets the current range value and uses this range for all subsequent measurements until the measurement configuration is changed. + + + + + Once + + + NI-DMM driver determines whether the range is set automatically by the instrument before acquiring the measurement. The range value is stored and used for all subsequent measurements until the measurement configuration is changed. + + + + + 2/5/2010 1:33:02 PM + Measurement Studio + True + + + + Gets or sets how the NI 4065 and NI 4070/4071/4072 acquire data. + + + + controls whether the NI-DMM driver takes standard single or multipoint + measurements or acquires a waveform. + + If you are configuring the driver by setting the properties manually, set this property before setting the other configuration properties. + + + + When you call + + or , + NI-DMM sets this property to . + When you call , + NI-DMM sets this property to . The default value is . + + 3/21/2016 4:24:16 PM + sheien + True + + + + Gets measurement auto range value. + + + The value is in units appropriate for the current value of the + . For + example, if is + set to , the units are volts. + The value of this property is only valid if range was set to auto range and a read/fetch has occurred. + + 6/25/2017 11:48:29 PM + lnayman + false + + + + + + + 9/30/2009 4:19:26 PM + Keely Joseph + True + + + + 9/30/2009 4:19:29 PM + Keely Joseph + True + + + + 9/30/2009 4:19:30 PM + Keely Joseph + True + + + + 9/30/2009 4:19:33 PM + Keely Joseph + True + + + + 9/30/2009 4:19:34 PM + Keely Joseph + True + + + + 3/5/2010 4:27:25 PM + Keely Joseph + True + + + + 9/30/2009 4:19:38 PM + Keely Joseph + True + + + + 9/30/2009 4:19:40 PM + Keely Joseph + True + + + + 9/30/2009 4:19:42 PM + Keely Joseph + True + + + + 9/30/2009 4:19:44 PM + Keely Joseph + True + + + + 10/14/2009 3:21:28 PM + Keely Joseph + True + + + + 10/14/2009 3:23:52 PM + Keely Joseph + True + + + + 10/14/2009 3:24:18 PM + Keely Joseph + True + + + Configures measurements by setting value. + The configured properties include + , + , and + in digits. + + Specifies the used to acquire the measurement. + + + Specifies the + for the function specified in the measurementFunction parameter. When frequency is + specified in the measurementFunction + parameter, you must supply the minimum frequency expected in the range parameter. For + example, you must type in 100 Hz if you + are measuring 101 Hz or higher. + For all other functions, you must supply a range that exceeds the value that you are measuring. For example, you must type in + 10 V if you are measuring 9 V. Range values are coerced up to the closest input range. + The default value is 0.02 V. + + + Specifies the for the + measurement in digits. + The default is 0.001 V. + + + The parameter value passed is invalid. + + + The parameter value passed is out of range. + + + + + The NI 4050, NI 4060, and NI 4065 only support + when the trigger and sample + trigger are set to Immediate. + + NI-DMM ignores the resolutionDigits for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use the + . + + + 3/4/2016 11:17:18 AM + sheien + True + + + + Configures measurements with on. The configured properties include + , + , and in digits. + + + Specifies the used to acquire the measurement. + + + Indicates whether the range is set automatically by the instrument. is set to this value. + + + Specifies the for the + measurement in digits. + This parameter is ignored when the range parameter is set to + or + . The default is 0.001 V. + + + The parameter value passed is invalid. + + + The parameter value passed is out of range. + + + The parameter enum value specified is not supported. + + + The specified device cannot be configured for when a trigger is selected. + Set and/or + to Immediate while autoranging. + + + + The NI 4050, NI 4060, and NI 4065 only support when the trigger and sample trigger are set to Immediate. + + NI-DMM ignores the resolutionDigits for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use + . + + + + 3/21/2016 4:55:32 PM + sheien + True + + + + Configures measurements by setting the value. The configured properties include + , + , + and . + + + Specifies the used to + acquire the measurement. + + + Specifies the for the function + specified in the measurementFunction parameter. When frequency is specified in the + measurementFunction parameter, you must supply the minimum frequency expected in the range + parameter. For example, you must type in 100 Hz if you are measuring 101 Hz or higher. + For all other functions, you must supply a range that exceeds the value that you are measuring. For example, + you must type in 10 V if you are measuring 9 V. Range values are coerced up to the closest input range. + The default value is 0.02 V. + + + Specifies the for the measurement. + The default is 0.001 V. + + + The parameter value passed is invalid. + + + The parameter value passed is out of range. + + + NI-DMM ignores the resolutionAbsolute parameter for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such + measurements, use the + . + + The NI 4050, NI 4060, and NI 4065 only support + when the trigger and sample trigger are set to Immediate. + + + + 3/4/2016 11:17:12 AM + sheien + True + + + + Configures measurements with on. The configured properties include + , + , and + . + + + Specifies the + used to acquire the measurement. + + + Indicates whether the range is set automatically by the instrument. is set to this value. + + + Specifies the for the measurement. + This parameter is ignored when the autoRange parameter is set to + + or . The default is 0.001 V. + + + The parameter value passed is invalid. + + + The resolution specified is invalid for the range. + + + The parameter enum value specified is not supported. + + + The specified device cannot be configured for when a trigger is selected. + Set and/or + to Immediate while autoranging. + + + The NI 4050, NI 4060, and NI 4065 only support when the trigger and sample trigger are set to Immediate. + + NI-DMM ignores the resolutionDigits for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use + . + + + + 3/21/2016 4:51:11 PM + sheien + True + + + + Configures the NI 4070/4071/4072 for waveform acquisitions. + + + Specifies the used in a waveform acquisition. + and are the valid values. + + + Specifies the expected maximum amplitude of the input signal and sets the range for the measurementFunction. + NI-DMM sets + to this value. Range values are + coerced up to the closest input range. The default is 10.0. + For valid ranges refer to the topics in + Devices. + Autoranging is not supported during waveform acquisitions. + + + Specifies the rate of the acquisition in samples per second. NI-DMM sets + to this value. + The valid range is 10.0-1,800,000 S/s. Rate values are coerced to the closest integer divisor of 1,800,000. The default value is 1,800,000. + + + Specifies the number of points to acquire before the waveform acquisition completes. NI-DMM sets + to this value. To calculate the maximum and minimum number of waveform points that you can acquire in one acquisition, refer to the + Waveform Acquisition Measurement Cycle. The default value is 500. + + + The parameter value passed is invalid. + + + The parameter value passed is out of range. + + + The rate selected is invalid with DCNR other than normal. + + + 3/4/2016 11:17:21 AM + sheien + True + + + + Gets the to the instrument session. + + + A to the instrument session. + + + Using the , you can get the to the session; however, there are risks involved with using the . + It is difficult to know the state of the handle, and the handle could be recycled while you are using it. For more information, refer to + . + + 3/4/2016 11:17:24 AM + sheien + True + + + + If not already closed, closes the specified session and deallocates resources that it reserved. + + + The method can be called safely more than once, even if the session has already closed. + + 1/11/2010 5:27:13 PM + Staci Heien + True + + + + 3/5/2010 4:24:29 PM + Keely Joseph + True + + + + 3/5/2010 4:24:34 PM + Keely Joseph + True + + + + 9/30/2009 4:20:26 PM + Keely Joseph + True + + + + Gets the service object of the specified type. + + + An object that specifies the of the object. + + + The object of determined by . + + 3/4/2016 11:17:28 AM + sheien + True + + + + If not already disposed, closes the specified session and deallocates resources that it reserved. + + + The method can be called safely more than once, even if the session has already been disposed. + + 1/11/2010 5:29:24 PM + Staci Heien + True + + + + Provides properties that affect the operation of this instrument driver. + + + Provides properties that affect the operation of this instrument driver. + + is returned if the members are accessed after the associated + object has been disposed. + + + + 3/4/2016 11:05:53 AM + sheien + True + + + + Occurs when a warning is generated. + + 12/29/2009 12:16:51 PM + Staci Heien + True + + + + Occurs when a property is coerced. + + + This event is triggered only if is set to true. + + 6/30/2011 12:49:21 PM + Fadi Yoosuf + True + + + + Occurs when an interchange check warning event is raised. + + + This event is triggered only if is set to true. + + 6/30/2011 12:51:25 PM + Fadi Yoosuf + True + + + + 11/5/2009 1:42:42 PM + Keely Joseph + True + + + + 11/5/2009 1:42:29 PM + Keely Joseph + True + + + + 11/5/2009 1:42:36 PM + Keely Joseph + True + + + + Gets or sets a value indicating whether to cache the value of properties. + + + The default value is True. Use to override this value. + + + When caching is enabled, the instrument driver keeps track of the current instrument settings and avoids sending redundant + commands to the instrument, which significantly increases execution speed. The instrument driver can always cache + or never cache particular attributes regardless of the setting of this property. + + 3/4/2016 11:05:57 AM + sheien + True + + + + Gets the driver setup string that was specified when initializing the driver. + + + Some cases exist where the end-user must specify instrument driver options at initialization time. An example of this is + specifying a particular instrument model from among a family of instruments that the driver supports. This is useful when + using simulation. You can specify driver-specific options using the optionString + parameter to . + + + If the user does not specify a + string, this property returns an empty string. Otherwise this property returns the string that was specified when initializing the driver. + + 3/4/2016 11:06:02 AM + sheien + True + + + + Gets or sets a value indicating whether to perform interchangeability checking and log interchangeability warnings when you call NI-DMM methods. + + + The default value is False. + + + Using your application with a different instrument might cause different behavior, as indicated by an interchangeability warning. + Interchangeability checking examines the properties in a capability group only if you specify a value for at least one property + within that group. Interchangeability warnings occur when a property affects the behavior of the instrument and you have not + set that property, or the property has been invalidated since you set it. + + 3/4/2016 11:06:06 AM + sheien + True + + + + Gets or sets a value indicating whether the instrument driver queries the instrument status after each operation. + + + Querying the instrument status is useful when debugging. After the user program is validated, this property can be set to to + disable status checking and maximize performance. + The instrument driver can choose to ignore status checking for particular properties regardless of the setting of this property. + Use + to override this value. + + + The default value is . + + 3/4/2016 11:06:13 AM + sheien + True + + + + Gets or sets a value indicating whether to validate property values and method parameters. + + + If enabled, the instrument driver validates the parameter values passed to driver functions. Range checking parameters is + useful for debugging. After the user program is validated, this property can be set to to disable range checking and + maximize performance. + The default value is . Use + override this value. + + + The default value is . + + 3/4/2016 11:06:20 AM + sheien + True + + + + Gets or sets a value indicating whether the IVI engine keeps a list of the value coercions it makes for integer and values. + + + The default value is . + + + Use to override this value. + + 3/4/2016 11:06:24 AM + sheien + True + + + + Gets or sets a value indicating whether to simulate instrument driver I/O operations. + + + The default value is . + + + Simulate can only be set within the constructor + for . The property value cannot be changed outside of the + constructor. + + If simulation is enabled, instrument driver functions perform + range checking and get or set properties, but they do not perform instrument I/O. For output parameters that represent instrument data, the + instrument driver functions return calculated values. + Use + + to override this setting. + + 3/21/2016 2:43:06 PM + sheien + True + + + + Gets a string containing the logical name of the instrument. + + + A string containing the logical name of the instrument. + + 1/5/2010 12:57:40 PM + Keely Joseph + True + + + + Gets a string containing the resource descriptor for the instrument. + + + A string containing the resource descriptor for the instrument + + 3/4/2016 11:06:09 AM + sheien + True + + + + Gets or sets a value indicating whether the events and callback delegates are invoked through or + methods. + + + if events and callbacks are invoked through the or + methods; otherwise, events and callbacks are invoked directly. The default value is + . + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/21/2016 2:52:21 PM + sheien + True + + + + 9/30/2009 4:11:34 PM + Keely Joseph + True + + + + 9/30/2009 4:11:29 PM + Keely Joseph + True + + + + 9/30/2009 4:11:18 PM + Keely Joseph + True + + + + 9/30/2009 4:11:40 PM + Keely Joseph + True + + + + 9/30/2009 4:11:46 PM + Keely Joseph + True + + + + 9/30/2009 4:11:54 PM + Keely Joseph + True + + + + 9/30/2009 4:11:25 PM + Keely Joseph + True + + + + 9/30/2009 4:12:20 PM + Keely Joseph + True + + + + 9/30/2009 4:12:13 PM + Keely Joseph + True + + + + Resets the interchangeability checking algorithms of the driver + so that methods and properties that executed prior to calling this + method have no effect on whether future calls to the driver + generate interchangeability warnings. + + 3/4/2016 11:06:37 AM + sheien + True + + + + Invalidates all attributes such that any values set before calling are discarded. + + 3/4/2016 11:06:33 AM + sheien + True + + + + Frees the resources held. + + 11/13/2009 3:41:22 PM + Keely Joseph + True + + + + Provides identity information about the instrument you are using. + + + + Provides identity information about the instrument you are using. + + is returned if the members are accessed after the associated + object has been disposed. + + + 3/4/2016 11:05:26 AM + sheien + True + + + + Gets a string containing the instrument firmware revision number. + + + A string containing the instrument firmware revision number. + + 1/11/2010 2:01:18 PM + Staci Heien + True + + + + Gets a string containing the manufacturer of the instrument. + + + A string containing the manufacturer of the instrument. + + 1/5/2010 12:36:07 PM + Keely Joseph + True + + + + Gets a string containing the instrument model. + + + A string containing the instrument model. + + 1/5/2010 12:37:25 PM + Keely Joseph + True + + + + Gets the case-sensitive unique identifier of the instrument driver. + + + Case-sensitive unique identifier of the instrument driver. + + 3/4/2016 11:05:30 AM + sheien + True + + + + Gets a string containing the serial number of the instrument. + + The serial number of the instrument. + + + This value corresponds to the serial number label that is attached to most products. + + 3/4/2016 11:05:34 AM + sheien + True + + + + Gets the major version number of the class specification for the specific driver. + + + Returns an integer of the major version number of the class specification for the specific driver. + + 1/11/2010 2:34:21 PM + Staci Heien + True + + + + Gets the minor version number of the class specification for the specific driver. + + + Returns the minor version number of the class specification for the specific driver. + + 1/5/2010 12:45:17 PM + Keely Joseph + True + + + + Gets a string containing a description of the specific driver. + + + A string containing a description of the specific driver. + + 1/11/2010 2:01:03 PM + Staci Heien + True + + + + Gets a string that contains additional version information about this specific instrument driver. + + + A string that contains additional version information about this instrument driver. + + 1/5/2010 12:43:01 PM + Keely Joseph + True + + + + Gets a string containing the vendor of the specific driver. + + + A string containing the vendor of the specific driver. + + 1/5/2010 12:48:15 PM + Keely Joseph + True + + + + Gets the prefix for the specific instrument driver. + + + A string containing the prefix for the specific instrument driver. The prefix can be a maximum of eight characters. + + 1/11/2010 2:35:53 PM + Staci Heien + True + + + + Gets the major version number of this instrument driver. + + + Returns the major version number of this instrument driver. + + 2/24/2011 2:25:23 PM + Fadi Yoosuf + True + + + + Gets the minor version number of this instrument driver. + + + Returns the minor version number of this instrument driver. + + 2/24/2011 2:25:42 PM + Fadi Yoosuf + True + + + + 9/30/2009 4:07:08 PM + Keely Joseph + True + + + + 9/30/2009 4:07:16 PM + Keely Joseph + True + + + + 9/30/2009 4:06:52 PM + Keely Joseph + True + + + + 9/30/2009 4:06:39 PM + Keely Joseph + True + + + + 9/30/2009 4:07:24 PM + Keely Joseph + True + + + + 9/30/2009 4:07:29 PM + Keely Joseph + True + + + + 9/30/2009 4:06:11 PM + Keely Joseph + True + + + + 9/30/2009 4:06:21 PM + Keely Joseph + True + + + + 9/30/2009 4:06:28 PM + Keely Joseph + True + + + + 2/15/2010 10:56:47 AM + Keely Joseph + True + + + + 2/15/2010 10:56:39 AM + Keely Joseph + True + + + + Returns the list of the class capability groups implemented by the + driver. + + + An array of class capability groups. + + + Capability group names are documented in the IVI class + specifications. If the driver is not class-compliant, the driver + returns an empty array. + + 12/29/2009 11:43:48 AM + Staci Heien + True + + + + Returns the list of instrument models that the IVI-specific + driver can control. + + + An array of instrument models. + + + The string does not include an abbreviation + for the manufacturer if it is the same for all models. + + 12/29/2009 11:42:03 AM + Staci Heien + True + + + + Provides additional, optional functionality for NI-DMM in your application. + + Provides additional, optional functionality for NI-DMM in your application. + + is returned if the members are accessed after the associated + object has been disposed. + + + + 3/21/2016 4:56:23 PM + sheien + True + + + + Configures the NI 4022 module. + + + The resource name of the device to initialize. + + + The operating mode of the 4022 module. + + 3/4/2016 11:07:03 AM + sheien + True + + + + Resets the instrument to a known state and sends initialization commands to the instrument. + + + The initialization commands set instrument settings to the state necessary for the operation of the instrument driver. + + 12/29/2009 12:59:30 PM + Staci Heien + True + + + + Resets the instrument to a known state and sends initialization commands to the DMM. + + + The initialization commands set the DMM settings to the state necessary for the operation of NI-DMM. + All user-defined default values associated with a logical name are applied after setting the DMM. + + 12/29/2009 12:59:59 PM + Staci Heien + True + + + + Places the instrument in a quiescent state where it has minimal or no impact on the system to which it is connected. + + + If a measurement is in progress when this method is called, the measurement is aborted. + + 12/29/2009 12:53:58 PM + Staci Heien + True + + + + Returns the revision numbers of the instrument driver and instrument firmware. + + + Returns a string containing the instrument driver software revision numbers. + + + Returns a string containing the instrument firmware revision numbers. + + + A failure occurred when reading the firmware revision. + + 12/29/2009 1:00:21 PM + Staci Heien + True + + + + Reads an error code and message from the DMM error queue. + + + Returns the error query result. + + + National Instruments DMMs do not contain an error queue. Errors are reported as they occur. Therefore, + this method does not detect errors; it is included for compliance with the IviDmm Class Specification. + + 3/4/2016 11:06:52 AM + sheien + True + + + + Clears all errors. + + 3/4/2016 11:06:47 AM + sheien + True + + + + Performs a self-test on the DMM to ensure that the DMM is functioning properly. Self-test does not calibrate the DMM. + + + Returns error code and self-test status message. + + + This method calls , and any configurations previous to the call will be lost. All properties will be set to their default values after the call returns. + + + The method failed for AC measurements. + + -or- + + The method failed for DC measurements. + -or- + + The method failed for resistance measurements. + + 3/4/2016 11:07:06 AM + sheien + True + + + + Attempts to acquire a synchronization lock on this instance of the driver. The calling thread is blocked + indefinitely until the lock is acquired. + + + A reference to the acquired lock. + + + Use this method to gain exclusive access to the driver + instance across a series of methods calls. You must call on the returned lock to allow other threads to access this instance of the driver. + + This is not an I/O lock, such as a VISA lock. It is a thread synchronization lock for this instance + of the specific driver in the process. + + 3/4/2016 11:06:55 AM + sheien + True + + + + Attempts to acquire a synchronization lock on this instance of the driver. + + The maximum amount of time to wait to acquire the lock. + + A reference to the acquired lock. + + + The calling thread is blocked + until either the lock is acquired or expires. If the lock is not acquired within the interval specified + by , an exception is returned. This method is useful for gaining exclusive access to the driver instance + across a series of methods calls. The user must call on the returned lock to relinquish the + lock and allow other threads to access this instance of the driver. + + This is not an I/O lock, such as a VISA lock. It is a thread synchronization lock for this instance + of the specific driver in the process. + + 3/4/2016 11:06:59 AM + sheien + True + + + + Imports an attribute configuration to the session from the specified file. + + + You can export and import session attribute configurations only between devices with identical model numbers. + You cannot call this method while the session is in a running state, such as while acquiring a waveform. + Not supported on the PCMCIA-4050 or the PXI/PCI-4060. + Imported and exported attribute configurations contain coerced values for the following NI-DMM devices: + + PXI/PCI/PCIe/USB-4065 + PXI/PCI-4070 + PXI-4071 + PXI-4072 + + NI-DMM coerces attribute values when the value you set is within the allowed range for the attribute but is not one of the discrete valid values the attribute supports. For example, for an attribute that coerces values up, if you choose a value of 4 when the adjacent valid values are 1 and 10, the attribute coerces the value to 10. + + + The absolute path to the file containing the attribute configuration to import. If you specify an empty or relative path, this method returns an error. The default file extension is .nidmmconfig. + + + The method was called after the associated + + object was disposed. + + + The underlying NI-DMM driver returned an error. + + 02/08/2018 3:40:55 PM + NI + False + + + + Exports the attribute configuration of the session to the specified file. + + + You can export and import session attribute configurations only between devices with identical model numbers. + + This method verifies that the attributes you have configured for the session are valid. If the configuration is invalid, NI-DMM returns an error. + Not supported on the PCMCIA-4050 or the PXI/PCI-4060. + Imported and exported attribute configurations contain coerced values for the following NI-DMM devices: + + PXI/PCI/PCIe/USB-4065 + PXI/PCI-4070 + PXI-4071 + PXI-4072 + + NI-DMM coerces attribute values when the value you set is within the allowed range for the attribute but is not one of the discrete valid values the attribute supports. For example, for an attribute that coerces values up, if you choose a value of 4 when the adjacent valid values are 1 and 10, the attribute coerces the value to 10. + + + The absolute path to the file to contain the exported attribute configuration. If you specify an empty or relative path, this method returns an error. The default file extension is .nidmmconfig. + + + The method was called after the associated + + object was disposed. + + + The underlying NI-DMM driver returned an error. + + 02/08/2018 3:40:55 PM + NI + False + + + + Imports an attribute configuration to the session from the specified . + + + You can export and import session attribute configurations only between devices with identical model numbers. + You cannot call this method while the session is in a running state, such as while acquiring a waveform. + Not supported on the PCMCIA-4050 or the PXI/PCI-4060. + Imported and exported attribute configurations contain coerced values for the following NI-DMM devices: + + PXI/PCI/PCIe/USB-4065 + PXI/PCI-4070 + PXI-4071 + PXI-4072 + + NI-DMM coerces attribute values when the value you set is within the allowed range for the attribute but is not one of the discrete valid values the attribute supports. For example, for an attribute that coerces values up, if you choose a value of 4 when the adjacent valid values are 1 and 10, the attribute coerces the value to 10. + + + The byte array that contains the attribute configuration to import. + + + The method was called after the associated + + object was disposed. + + + The underlying NI-DMM driver returned an error. + + 02/08/2018 3:40:55 PM + NI + False + + + + Exports the attribute configuration of the session to the specified array buffer. + + + You can export and import session attribute configurations only between devices with identical model numbers. + + This method verifies that the attributes you have configured for the session are valid. If the configuration is invalid, NI-DMM returns an error. + Not supported on the PCMCIA-4050 or the PXI/PCI-4060. + Imported and exported attribute configurations contain coerced values for the following NI-DMM devices: + + PXI/PCI/PCIe/USB-4065 + PXI/PCI-4070 + PXI-4071 + PXI-4072 + + NI-DMM coerces attribute values when the value you set is within the allowed range for the attribute but is not one of the discrete valid values the attribute supports. For example, for an attribute that coerces values up, if you choose a value of 4 when the adjacent valid values are 1 and 10, the attribute coerces the value to 10. + + + Returns a array containing the attribute configuration. + + + The method was called after the associated + + object was disposed. + + + The underlying NI-DMM driver returned an error. + + 02/08/2018 3:40:55 PM + NI + False + + + + 9/30/2009 4:12:46 PM + Keely Joseph + True + + + + 9/30/2009 4:12:54 PM + Keely Joseph + True + + + + 3/31/2010 11:50:54 PM + Keely Joseph + True + + + + 3/31/2010 11:50:54 PM + Keely Joseph + True + + + + 9/30/2009 4:13:04 PM + Keely Joseph + True + + + + 9/30/2009 4:13:11 PM + Keely Joseph + True + + + + 9/30/2009 4:13:19 PM + Keely Joseph + True + + + + Configures properties applicable only to AC measurements. + + Use DmmAC to configure properties applicable only to AC measurements, such as and . + + is returned if the members are accessed after the associated + object has been disposed. + + + + + 3/4/2016 11:04:10 AM + sheien + True + + + + Gets or sets the maximum frequency component of the input signal for AC measurements. + + + The valid range is 1 Hz–300 kHz for the NI 4070/4071/4072, 10 Hz–100 kHz for the NI 4065, and 20 Hz–25 kHz for the NI 4050 and NI 4060. + + + This property is used only for error checking. This property verifies that the value of this parameter is less than the maximum frequency of the device. + This property affects the DMM only when you set the to AC measurements. + + + 9/2/2010 4:23:14 PM + Keely Joseph + True + + + + Gets or sets the minimum frequency component of the input signal for AC measurements. + + + The valid range is 1 Hz–300 kHz for the NI 4070/4071/4072, 10 Hz–100 kHz for the NI 4065, + and 20 Hz–25 kHz for the NI 4050 and NI 4060. + + + This property affects the DMM only when you set + the to AC measurements. + + + 9/2/2010 4:25:48 PM + Keely Joseph + True + + + + 9/30/2009 4:03:14 PM + Keely Joseph + True + + + + 9/30/2009 4:04:05 PM + Keely Joseph + True + + + + 9/30/2009 4:04:15 PM + Keely Joseph + True + + + + Configures + and + + for AC measurements. + + + The minimum expected frequency component of the input signal in hertz. + + + The maximum expected frequency component of the input signal in hertz within the device limits. + + + The parameter value passed is not positive. + + + + 12/28/2009 1:31:31 PM + Staci Heien + True + + + + + Provides information regarding voltage. + + For more information, refer to the Configuring Frequency Measurements + topic in the + NI Digital Multimeters Help. + + is thrown if members are accessed after the associated + + object has been disposed. + + + 3/4/2016 11:07:10 AM + sheien + True + + + + Gets or sets a value indicating whether the frequency voltage is auto-ranging. + + + , if the frequency voltage is auto-ranging; + , if it is not. + + + + For the NI 4080/4081/4082 and NI 4070/4071/4072 only. + + + 10/31/2017 5:30:00 PM + sheien + True + + + + Gets or sets the maximum amplitude of the input signal for frequency measurements. + + + For the NI 4080/4081/4082 and NI 4070/4071/4072 only. + For more information, refer to the Configuring Frequency Measurements + topic in the + NI Digital Multimeters Help. + + + The maximum amplitude of the input signal for frequency measurements. + + If is set to or if is set to -1.0, the + DMM is configured to take an auto-range measurement to calculate the voltage range before each frequency or period measurement. + If is set to or if is set to -2.0, + auto-ranging is disabled, and NI-DMM sets the voltage range to the last calculated voltage range. + + + 10/31/2017 5:30:00 PM + sheien + True + + + + Gets the measurement auto-range value for frequency voltage range. + + + The value is in units appropriate for the current value of the + . For + example, if is + set to , the units are volts. + The value of this property is only valid if is set to , and a read or fetch has occurred. + + + The measurement auto-range value for the frequency voltage range. + + 10/31/2017 5:30:00 PM + sheien + True + + + + 9/30/2009 4:13:41 PM + Keely Joseph + True + + + + 9/30/2009 4:13:51 PM + Keely Joseph + True + + + + Configures and obtains additional information concerning the instrument driver session. + + Use this class to configure and obtain additional information concerning the instrument driver session. + + is returned if the members are accessed after the associated + + object has been disposed. + + + + 3/21/2016 4:56:26 PM + sheien + True + + + + Gets or sets the measurement aperture time for the current configuration. + + + + On the NI 4070/4071/4072, the minimum aperture time is 8.89 microseconds (µs), and the maximum aperture time is 149 seconds (s). Any number of powerline + cycles (PLCs) within the minimum and maximum ranges is allowed on the NI 4070/4071/4072. + On the NI 4065, the minimum aperture time is 333 µs, and the maximum aperture time is 78.2 s. If setting the number of averages + directly, the total measurement time is aperture time multiplied by the number of averages, which must be less than 72.8 s. The aperture times + allowed are 333 µs, 667 µs, or multiples of 1.11 msfor example 1.11 ms, 2.22 ms, 3.33 ms, and so on. If you set an aperture time + other than 333 µs, 667 µs, or multiples of 1.11 ms, the value will be coerced up to the next supported aperture time. + On the NI 4060, when the powerline frequency is 60 Hz, the PLCs allowed are 1 PLC, 6 PLC, 12 PLC, and 120 PLC. When the powerline + frequency is 50 Hz, the PLCs allowed are 1 PLC, 5 PLC, 10 PLC, and 100 PLC. + + + To override the default aperture, set this property to the desired aperture time after calling . To return to the default, set this property to -1. + For more information, refer to the Aperture Time topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:04:23 AM + sheien + True + + + + Gets or sets the unit of measurement used for aperture time for the current configuration. + + + The NI 4060 does not support an aperture time set in seconds. + + + The default value is . + + 3/4/2016 11:04:26 AM + sheien + True + + + + Gets or sets the number of averages to perform in a measurement. + + + The default is 1. + + + For the NI 4070/4071/4072, applies only when the aperture time is not set to Auto, and is On. + + The NI 4050 and NI 4060 are not supported. + + + 12/28/2009 2:53:04 PM + Staci Heien + True + + + + Gets or sets the settling time in seconds. + + + Use this property to override the default. To return to the default, set this property to Auto (–1). + The NI 4050 and NI 4060 are not supported. + + For more information, refer to the Settling Time topic in the + NI Digital Multimeters Help. + + + The default value is Auto. + + 3/4/2016 11:04:43 AM + sheien + True + + + + Gets or sets the AutoZero mode. + + + Configures the DMM for AutoZero. When AutoZero is ON, the DMM internally disconnects the input signal and takes a zero reading. It + then subtracts the zero reading from the measurement. This prevents offset voltages present on the input circuitry of the DMM + from affecting measurement accuracy. When AutoZero is OFF, the DMM does not compensate for zero reading offset. + + The NI 4050 is not supported. + + + For more information, refer to the Auto Zero topic in the + NI Digital Multimeters Help. + + + + + The default value is Auto. + + 3/4/2016 11:04:31 AM + sheien + True + + + + Gets or sets the powerline frequency. + + + When setting the , select the + number of PLCs for the powerline frequency. For example, if the powerline frequency is 50 Hz (or 20 ms) and aperture time in PLCs is 5, + then aperture time in seconds is 20 ms x 5 PLCs, or 100 ms. Similarly, if powerline frequency is 60 Hz (or 16.667 ms) and aperture + time in PLCs is 6, then aperture time in seconds is 16.667 ms x 6 PLCs, or 100 ms. + + + After configuring powerline frequency, set the to PLCs. + The NI 4050 and NI 4060 use this value to select an aperture time to reject powerline noise by selecting the appropriate internal sample clock and filter. The NI 4065 and NI 4070/4071/4072 use this value to select a timebase for setting the property in powerline cycles (PLCs). + + For more information, refer to the niDMM_ConfigurePowerLineFrequency topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:04:39 AM + sheien + True + + + + Gets or sets the ADC calibration mode. + + + For the NI 4070/4071/4072 only. + + allows the DMM to compensate + for gain drift since the last external calibration or self-calibration. + When is ON, the DMM measures + an internal reference to calculate the correct gain for the measurement. When + is OFF, the DMM does not compensate for changes to the gain. + For more information, refer to the ADC Calibration topic in the + NI Digital Multimeters Help. + + The default is . + 3/4/2016 11:04:19 AM + sheien + True + + + + Gets or sets the DC noise rejection mode. + + + By default, is set to + Auto (–1). When the value is Auto, the driver selects the + setting + based on the resolution you configure. If you configure the NI 4070/4071/4072 with + an absolute resolution that corresponds to 6½ digits (NI 4070/4072) or 7½ digits (NI 4071 only), the driver + uses high-order DC noise rejection. If you configure the NI 4065 with an absolute resolution that corresponds + to 6½ digits, the driver uses second-order DC noise rejection. For lower resolution DC measurements, the driver + uses second-order DC noise rejection for the NI 4070/4071/4072 and normal DC noise rejection for the NI 4065. If + you set the aperture time or configure the device for a waveform acquisition, the driver uses normal DC noise + rejection by default. For AC measurements with the NI 4065, the driver uses second-order DC noise rejection. + + The NI 4050 and NI 4060 are not supported. + + + For more information, refer to the DC Noise Rejection topic in the + NI Digital Multimeters Help. + + + The default value is Auto. + + 3/4/2016 11:04:35 AM + sheien + True + + + + Gets or sets whether the compensated ohms are offset. + + + For NI 4070/4071/4072 only. + + + The default value is Off. + 12/28/2009 2:53:34 PM + Staci Heien + True + + + + Gets or sets the shunt resistance value. + + + For the NI 4050 only. + + The NI 4050 requires an external shunt resistor for current measurements. + + + + The shunt resistance in ohms. + + 3/4/2016 11:04:49 AM + sheien + True + + + + 9/30/2009 3:51:39 PM + Keely Joseph + True + + + + 9/30/2009 3:51:39 PM + Keely Joseph + True + + + + 9/30/2009 3:51:39 PM + Keely Joseph + True + + + + 9/30/2009 3:51:39 PM + Keely Joseph + True + + + + Customizes the triggering functionality for your application. + + + + For more information, refer to the Triggering topic in the + NI Digital Multimeters Help. + + is returned if the members are accessed + after the associated + object has been disposed. + + + 3/4/2016 11:14:24 AM + sheien + True + + + + Gets or sets a value indicating whether the DMM selects the trigger delay automatically. + + + The default value is , which means that the DMM waits before taking the measurement. + When using the NI 4050, this property must be set to . + + + 3/4/2016 11:14:27 AM + sheien + True + + + + Gets or sets the time (in seconds) that the DMM waits after it has received a trigger before taking a measurement. + + + For the NI 4065 and NI 4070/4071/4072, the valid range for trigger delay is 0.0-149.0 seconds and the onboard timing resolution is 34.72 ns. + On the NI 4060, if this property is set to 0, the DMM does not settle before taking the measurement. On the NI 4060, the valid range for is 0.0-12.0 seconds and the onboard timing resolution is 100 ms. + When using the NI 4050, must be + set to . + Use positive values to set the trigger delay in seconds. + The default value for is . + + + The NI 4065 and NI 4070/4071/4072 use the value specified in this property as additional settling time. + + 9/2/2010 4:48:51 PM + Keely Joseph + True + + + + Gets or sets the edge of the signal from the specified trigger source on which the DMM is triggered. + + + + + Slope + Description + + + + + + + The driver triggers on the rising edge of the trigger signal. + + + + + + + + The driver triggers on the falling edge of the trigger signal. + + + + + 1/5/2010 2:59:44 PM + Keely Joseph + True + + + + Gets or sets the trigger source. + + + The following table lists the trigger source and their descriptions. + + + Trigger Source + Description + + + + + + + No trigger specified + + + + + + + + AUX I/O Connector Trigger Line 0 + + + + + + + + Software trigger + + + + + + + + PXI Trigger Line 0 + + + + + + + + PXI Trigger Line 1 + + + + + + + + PXI Trigger Line 2 + + + + + + + + PXI Trigger Line 3 + + + + + + + + PXI Trigger Line 4 + + + + + + + + PXI Trigger Line 5 + + + + + + + + PXI Trigger Line 6 + + + + + + + + PXI Trigger Line 7 + + + + + + + + PXI Star Trigger Line + + + + + + + + Internal Trigger Line of a PXI/SCXI Combination Chassis + + + + + + + + AUX I/O Connector Trigger Line 1 + + + + To determine which values are supported by each device, refer to the + LabWindows/CVI Trigger Routing section in the NI Digital Multimeters Help. + + + When is called, the DMM waits for the trigger specified with this property. After it receives the trigger, the DMM waits the length of time specified with the . The DMM then takes a measurement. + + This property is not supported on the NI 4050. + + 3/4/2016 11:14:36 AM + sheien + True + + + + Gets or sets the destination of the measurement complete (MC) signal. + + + The following table lists the trigger destination and their descriptions. + + + Trigger Destination + Description + + + + + + + No trigger specified + + + + + + + + AUX I/O Connector + + + + + + + + PXI Trigger Line 0 + + + + + + + + PXI Trigger Line 1 + + + + + + + + PXI Trigger Line 2 + + + + + + + + PXI Trigger Line 3 + + + + + + + + PXI Trigger Line 4 + + + + + + + + PXI Trigger Line 5 + + + + + + + + PXI Trigger Line 6 + + + + + + + + PXI Trigger Line 7 + + + + + + + + Internal Trigger Line of a PXI/SCXI Combination Chassis + + + + To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing + section in + the NI Digital Multimeters Help. + + + The NI 4050 is not supported. + + 3/4/2016 11:14:31 AM + sheien + True + + + + Gets or sets the polarity of the generated measurement complete signal. + + + If set to + the driver triggers on the rising edge of the trigger signal. + If set to + the driver triggers on the falling edge of the trigger signal. + + 3/5/2010 4:31:47 PM + Keely Joseph + True + + + + Gets data on multiple triggers and multiple measurements per trigger. + + + Returns an object of type . + + 1/11/2010 1:58:23 PM + Staci Heien + True + + + + 9/30/2009 4:21:46 PM + Keely Joseph + True + + + + 9/30/2009 4:21:30 PM + Keely Joseph + True + + + + 9/30/2009 4:21:57 PM + Keely Joseph + True + + + + 9/30/2009 4:21:42 PM + Keely Joseph + True + + + + 9/30/2009 4:21:52 PM + Keely Joseph + True + + + + 3/5/2010 4:32:06 PM + Keely Joseph + True + + + + 9/30/2009 4:22:14 PM + Keely Joseph + True + + + + 9/30/2009 4:22:10 PM + Keely Joseph + True + + + + Configures trigger-related properties. The properties include and . + + + Specifies the that initiates the acquisition. + Setting to + Software Trigger + configures the DMM to wait until + is called before + triggering the DMM. + + + Specifies the time that the DMM waits after it has received a trigger before taking a measurement. + The is set to this value. + On the NI 4060, if you set to 0, the + DMM does not settle before taking the measurement. The NI 4065 and NI 4070/4071/4072 use the value specified in as additional settling time. + + + The parameter value passed is out of range. + + + When using the NI 4050, must be + set to . + + + 9/2/2010 4:50:20 PM + Keely Joseph + True + + + + Configures trigger-related properties. The properties include and . + + + Specifies the that initiates the acquisition. + Setting to + Software Trigger + configures the DMM to wait until + is called before + triggering the DMM. + + + Indicates whether the driver automatically calculates the appropriate settling time before taking the measurement. + + When using the NI 4050, must be set to . + + + + The parameter value passed is invalid. + + + The parameter value passed is out of range. + + + The parameter enum value specified is not supported. + + + 3/4/2016 11:14:41 AM + sheien + True + + + + Provides properties and methods for acquiring data on multiple triggers and acquiring multiple measurements per trigger. + + + + To configure multiple point acquisitions, first configure the function, range, and resolution with the + object's + , + and then configure the number of points to acquire with the + object's . Multiple point acquisitions are useful + when you need to acquire multiple + measurements with the same configuration. + For more information, refer to the Multiple Point Acquisitions + topic in the + NI Digital Multimeters Help. + + is returned if the members are accessed after the associated + + object has been disposed. + + + + 3/4/2016 11:11:23 AM + sheien + True + + + + Gets or sets the size in samples of the internal data buffer. + + + Maximum is 134,217,727 (Ox7FFFFFF) samples. When set to -1, NI-DMM chooses the buffer size. + + 12/29/2009 4:15:02 PM + Staci Heien + True + + + + Gets or sets the number of measurements transferred at a time from the instrument to an internal buffer. + + + When set to -1, NI-DMM chooses the transfer size. + + 12/29/2009 4:16:39 PM + Staci Heien + True + + + + Gets or sets the number of measurements the DMM takes each time it receives a trigger in a multiple point acquisition. + + + The number of measurements the DMM makes in each measurement sequence + initiated by a trigger. The default is 1. + + 1/5/2010 3:23:27 PM + Keely Joseph + True + + + + Gets or sets a delay interval after an sample external trigger for the NI 4060 only. + + The default value is 0. + + 12/1/2009 3:26:59 PM + Staci Heien + True + + + + Gets or sets the amount of time in seconds the DMM waits between measurement cycles. + + + On the NI 4065 and NI 4070/4071/4072, the onboard timing resolution is 34.72 ns and the valid range is 0-149 s. + Only positive values are valid when setting the sample interval. + + + This property only applies when the is set to Interval. + On the NI 4060, the value for this property is used as the settling time. When this property is set to 0, the NI 4060 does not settle between measurement cycles. The onboard timing resolution is 1 µs on the NI 4060. + The NI 4065 and NI 4070/4071/4072 use the value specified in this property as additional delay. + + The NI 4050 is not supported. + + + 8/17/2011 7:48:00 PM + NI + True + + + + Gets or sets the sample trigger source. + + + To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing + section in + the NI Digital Multimeters Help. + + + The following table lists the trigger source and their descriptions. + + + Trigger Source + Description + + + + + + + No trigger specified + + + + + + + + AUX I/O Connector Trigger Line 0 + + + + + + + + Software trigger + + + + + + + + Interval trigger + + + + + + + + PXI Trigger Line 0 + + + + + + + + PXI Trigger Line 1 + + + + + + + + PXI Trigger Line 2 + + + + + + + + PXI Trigger Line 3 + + + + + + + + PXI Trigger Line 4 + + + + + + + + PXI Trigger Line 5 + + + + + + + + PXI Trigger Line 6 + + + + + + + + PXI Trigger Line 7 + + + + + + + + PXI Star Trigger Line + + + + + + + + Internal Trigger Line of a PXI/SCXI Combination Chassis + + + + + + + + AUX I/O Connector Trigger Line 1 + + + + + 3/4/2016 11:11:28 AM + sheien + True + + + + Gets or sets the edge of the signal from the specified sample trigger source on which the DMM is triggered. + + + + + Slope + Description + + + + + + + The driver triggers on the rising edge of the trigger signal. + + + + + + + + The driver triggers on the falling edge of the trigger signal. + + + + + 1/5/2010 2:58:01 PM + Keely Joseph + True + + + + Gets or sets the number of triggers the DMM receives before returning to the Idle state. + + + This property can be set to any positive value for the NI 4065 and NI 4070/4071/4072. + + + The NI 4050 and NI 4060 support this property being set to 1. + For more information, refer to the Multiple Point Acquisitions + topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:11:32 AM + sheien + True + + + + 9/30/2009 4:18:22 PM + Keely Joseph + True + + + + 9/30/2009 4:18:27 PM + Keely Joseph + True + + + + 9/30/2009 4:18:30 PM + Keely Joseph + True + + + + 9/30/2009 4:18:31 PM + Keely Joseph + True + + + + 9/30/2009 4:18:42 PM + Keely Joseph + True + + + + Configures properties related to multipoint acquisition. + + + Sets the number of triggers you want the DMM to receive before returning to the Idle state. The driver sets to this value. The default value is 1. + + + Sets the number of measurements the DMM makes in each measurement sequence initiated by a trigger. The driver sets to this value. The default value is 1. + + + Specifies the sample trigger source you want to use. The driver sets + to this value. + The default is Immediate. + + + Sets the amount of time in seconds the DMM waits between measurements. The driver sets + to this value. + Specify a sample interval to add settling time between measurements or to decrease the measurement rate. + only applies + when the is set to Interval. + On the NI 4060, the + value is used as the settling time. When sample interval is set to 0, the DMM does not settle between + measurements. The NI 4065 and NI 4070/4071/4072 use the value specified in Sample Interval as additional delay. The default value (PrecisionTimeSpan.MaxValue) + ensures that the DMM settles for a recommended time. This is the same as using an Immediate trigger. + + + The parameter value passed is out of range. + + + The parameter value passed is invalid. + + + An acquisition of less than three samples does not support external triggering or an external measurement complete destination. + + + + Use this method to configure the following properties: + , + , + , and + . + For continuous acquisitions, set + or + to zero. + + This property is not used on the NI 4050. + + To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing + section in + the NI Digital Multimeters Help. + + 3/4/2016 11:11:37 AM + sheien + True + + + + Provides properties to acquire data from a measurement. + + + Provides properties that acquire data from a measurement. + + is returned if the members are accessed after the associated + object has been disposed. + + + 3/4/2016 11:07:19 AM + sheien + True + + + + Occurs when an asynchronous call for the read singlepoint operation completes. + + 3/21/2016 2:54:58 PM + sheien + True + + + + Occurs when an asynchronous call for a fetch multipoint operation completes. + + 3/21/2016 2:54:52 PM + sheien + True + + + + Occurs when an asynchronous call for the read multipoint operation completes. + + 3/21/2016 2:55:05 PM + sheien + True + + + + Gets or sets a value indicating whether the events and callback delegates are invoked through the or + methods. + + + if events and callbacks are invoked through the or + methods; otherwise, events and callbacks are invoked directly. The default value is + . + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/21/2016 2:54:46 PM + sheien + True + + + + Initiates an acquisition. + + + After you call this method, the DMM leaves the Idle state and enters the Wait-for-Trigger state. + If trigger is set to Immediate mode, the DMM begins acquiring measurement data. Use + , + , or + + to retrieve the measurement data, or use or + + in + . + + 3/4/2016 11:08:02 AM + sheien + True + + + + Returns the value from a previously initiated measurement. + + + The measured value returned from the DMM. + + + You must call before calling this method. + -or- + The method is not supported for the given . + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been received, + or if the acquisition did not complete. The DMM calculates + the timeout automatically. + + + You must call + before calling this method. + The maximum time allowed for this method to complete is set to . + + 3/4/2016 11:07:24 AM + sheien + True + + + + Returns the value from a previously initiated measurement. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0–86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + The measured value returned from the DMM. + + + You must call before calling this method. + -or- + The method is not supported for the given . + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + + You must call + before calling this method. + + 3/4/2016 11:07:28 AM + sheien + True + + + + Returns an array of values from a previously initiated multipoint measurement. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is the + (triggerCount x sampleCount) parameters in + . For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + A [] array of measured values. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters of + . + The maximum time allowed for this method to complete is set to . + + + The pointsToFetch parameter value is not positive. + + + You must call to + initiate a measurement before calling this method. + -or- + The method is not supported for the given . + + + The method does not complete within the specified time interval. This exception happens if an external trigger was not received, + or if the acquisition did not complete. The DMM calculates + the timeout automatically. + + 3/4/2016 11:07:32 AM + sheien + True + + + + Returns an array of values from a previously initiated multipoint measurement. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0–86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + A [] array of measured values. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters of + . + + + You must call + to initiate a measurement before calling this method. + -or- + The method is not supported for the given . + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + 3/4/2016 11:07:39 AM + sheien + True + + + + Returns an array of values from a previously initiated multipoint measurement. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is the + (triggerCount x sampleCount) parameters in + . For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + A [] array of measured values. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters of + . + + + The pointsToFetch parameter value is not positive. + + + You must call to + initiate a measurement before calling this method. + -or- + The method is not supported for the given . + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + 3/4/2016 11:07:44 AM + sheien + True + + + + Returns an array of values from a previously initiated multipoint measurement. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0–86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , the length will be resized to . + + + Specifies the actual number of points fetched. + + + A [] array of measured values. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters of + . + + + The pointsToFetch parameter value is not positive. + + + The parameter value passed is null. + + + You must call to initiate a measurement before calling this method. + -or- + The method is not supported for the given . + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + 3/4/2016 11:08:18 AM + sheien + True + + + + Returns an array of values from a previously initiated multipoint measurement. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , the length is resized to . + + + Specifies the actual number of points fetched. + + + A [] array of measured values. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters of + . The maximum time allowed for + this method to complete is set to . + + + The pointsToFetch parameter value is not positive. + + + The parameter value passed is null. + + + You must call to initiate a measurement before calling this method. + -or- + The method is not supported for the given . + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been received, + or if the specified timeout is not long enough for the acquisition to complete. The DMM calculates + the timeout automatically. + + 3/4/2016 11:08:14 AM + sheien + True + + + + Fetches asynchronously from a previously initiated multipoint measurement. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is the + (triggerCount x sampleCount) parameters in + . For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount and sampleCount parameters of + . + is raised once this operation is completed. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after the other. The userState + parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is called, the operation completed event will not be raised. + + Not calling before + calling this method causes an . + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. The DMM calculates the + timeout automatically. + The maximum time allowed for this method to complete is set to . + + The parameter value passed is out of range. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:07:48 AM + sheien + True + + + + Fetches asynchronously from a previously initiated multipoint measurement. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + An object used to associate a client state (such as a task ID) with this particular asynchronous operation. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount and + sampleCount parameters of + . + is raised + once this operation is completed. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after the + other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is + called, the operation completed event will not be raised. + + Not calling before + calling this method causes an . + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:07:56 AM + sheien + True + + + + Fetches asynchronously from a previously initiated multipoint measurement. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is the + (triggerCount x sampleCount) parameters in + . For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters of + + + is raised once this operation is completed. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one + after the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method + is called, the operation completed event will not be raised. + + Not calling before + calling this method causes an . + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. The valid range is 0-86400000 milliseconds. + + + The parameter value passed is out of range. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:07:52 AM + sheien + True + + + + Fetches asynchronously from a previously initiated multipoint measurement. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , it will be resized to . + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount and + sampleCount parameters of + + is + raised once this operation is completed. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one + after the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method + is called, the operation completed event will not be raised. + + Not calling before + calling this method causes an . + You will get an if the method does not complete within the specified time interval. This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. + + + The parameter value passed is out of range. + + + The parameter value passed is null. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:08:28 AM + sheien + True + + + + Fetches asynchronously from a previously initiated multipoint measurement. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , it will be resized to . + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters of + . + is raised + once this operation is completed. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after + the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is + called, the operation completed event will not be raised. + + Not calling before + calling this method causes an . + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. The DMM calculates the + timeout automatically when the maximum time allowed for this method to complete is set to . + + The parameter value passed is out of range. + + + The parameter value passed is null. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:08:24 AM + sheien + True + + + + Acquires a single measurement and fetches the measured value. + + + The measured value returned from the DMM. + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. The DMM calculates the timeout + automatically. + + + The method is not supported for the given . + + + The maximum time allowed for this method to complete is set to . + + 3/4/2016 11:08:48 AM + sheien + True + + + + Acquires a single measurement and returns the measured value. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + The measured value returned from the DMM. + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + The method is not supported for the given . + + 3/4/2016 11:08:53 AM + sheien + True + + + + Acquires multiple measurements and returns an array of values. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous acquisitions, up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The default value is 1. + + + An array of measurement values. + + The size of the reading array must be at least the size that you specify for the pointsToFetch parameter. + + + + The pointsToFetch parameter value is not positive. + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been received, + or if the specified timeout is not long enough for the acquisition to complete. The DMM calculates + the timeout automatically. + + + The method is not supported for the given . + + + The number of points read is not equal to the number of points requested. + -or- + The measurement status returned by the hardware is not valid. Try decreasing the acquisition rate or the acquisition size. Alternatively, you can try upgrading the performance of your system by increasing the processor speed, memory, or both. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount parameters in + . + The maximum time allowed for this method to complete is set to . + + 3/4/2016 11:09:08 AM + sheien + True + + + + Acquires multiple measurements and returns an array of values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + An array of measurement values. + + The size of the reading array must be at least the size that you specify for the pointsToFetch parameter. + + + + The method does not complete within the specified time interval. This exception happens if the specified timeout is not long enough for the acquisition to complete. + + The method is not supported for the given . + + + The number of points read is not equal to the number of points requested. + -or- + The measurement status returned by the hardware is not valid. Try decreasing the acquisition rate or the acquisition size. Alternatively, you can try upgrading the performance of your system by increasing the processor speed, memory, or both. + + + The number of measurements the DMM makes is determined by the values you specify for the + triggerCount and sampleCount parameters + in . + + 3/4/2016 11:09:11 AM + sheien + True + + + + Acquires multiple measurements and returns an array of values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous acquisitions, + up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The + default value is 1. + + + An array of measurement values. + + The size of the reading array must be at least the size that you specify for the pointsToFetch parameter. + + + + The pointsToFetch parameter value is not positive. + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + + The method is not supported for the given . + + + The number of points read is not equal to the number of points requested. + -or- + The measurement status returned by the hardware is not valid. Try decreasing the acquisition rate or the acquisition size. Alternatively, you can try upgrading the performance of your system by increasing the processor speed, memory, or both. + + + The number of measurements the DMM makes is determined by the values you specify for the triggerCount + and sampleCount + parameters in . + + 3/4/2016 11:09:14 AM + sheien + True + + + + Acquires multiple measurements and returns an array of measured values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous acquisitions, up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , the length will be resized to . + + + Specifies the actual number of points fetched. + + + An array of measurement values. + + The size of the reading array must be at least the size that you specify for the + pointsToFetch parameter. + + + + The pointsToFetch parameter value is not positive. + + + The parameter value passed is null. + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + + The method is not supported for the given . + + + The number of points read is not equal to the number of points requested. + -or- + The measurement status returned by the hardware is not valid. Try decreasing the acquisition rate or the acquisition size. Alternatively, you can try upgrading the performance of your system by increasing the processor speed, memory, or both. + + + The number of measurements the DMM makes is determined + by the values you specify for the + parameters in + (triggerCount x sampleCount). + + 3/4/2016 11:08:37 AM + sheien + True + + + + Acquires multiple measurements and returns an array of measured values. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous acquisitions, up to 100,000 points can be returned at once. The number of measurements can be a subset. + The valid range is any positive integer. The default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , the length will be resized to . + + + Specifies the actual number of points fetched. + + + An array of measurement values. + + The size of the reading array + must be at least the size that you specify for the pointsToFetch parameter. + + + + The pointsToFetch parameter value is not positive. + + + The parameter value passed is null. + + + The method does not complete within the specified time interval. This exception happens if an external trigger has not been received, + or if the specified timeout is not long enough for the acquisition to complete. The DMM calculates + the timeout automatically. + + + The method is not supported for the given . + + + The number of points read is not equal to the number of points requested. + -or- + The measurement status returned by the hardware is not valid. Try decreasing the acquisition rate or the acquisition size. Alternatively, you can try upgrading the performance of your system by increasing the processor speed, memory, or both. + + + The number of measurements the DMM makes is determined by the values you specify for the + triggerCount and sampleCount + parameters in . + The maximum time allowed for this method to complete is set to . + + 3/4/2016 11:08:33 AM + sheien + True + + + + Asynchronously acquires a single measurement and returns the measured value. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + is raised after this + operation completes. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after + the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is + called, the operation completed event will not be raised. + + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. The DMM calculates the + timeout automatically when the maximum time allowed for this method to complete is set to . + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:08:57 AM + sheien + True + + + + Acquires a single measurement and returns the measured value. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + is raised once + this operation completes. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after + the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is + called, the operation completed event will not be raised. + + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been + received, or if the specified timeout is not long enough for the acquisition to complete. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:09:03 AM + sheien + True + + + + Asynchronously acquires multiple measurements and returns an array of values. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous + acquisitions, up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is + any positive integer. The default value is 1. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + is + raised once this operation completes. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one + after the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method + is called, the operation completed event will not be raised. + + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. The DMM calculates the + timeout automatically. + A + error occurs if + the number of points read is not equal to the number of points requested, or if the measurement status returned by the hardware is not valid. + The number of measurements the + DMM makes is determined by the values you specify for the triggerCount and sampleCount parameters in + . + The maximum time allowed for this method to complete is set to . + + + The parameter value passed is out of range. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:09:18 AM + sheien + True + + + + Asynchronously acquires multiple measurements and returns an array of values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + + is raised once this operation completes. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur + one after the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method + is called, the operation completed event will not be raised. + + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. + A + error occurs if + the number of points read is not equal to the number of points requested, or if the measurement status returned by the hardware is not valid. + The number of measurements the + DMM makes is determined by the values you specify for the triggerCount and sampleCount parameters in + . + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:09:30 AM + sheien + True + + + + Asynchronously acquires multiple measurements and returns an array of values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous + acquisitions, up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is + any positive integer. The default value is 1. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + + is raised once this operation completes. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur + one after the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method + is called, the operation completed event will not be raised. + + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. + A + error occurs if + the number of points read is not equal to the number of points requested, or if the measurement status returned by the hardware is not valid. + + The number of measurements the + DMM makes is determined by the values you specify for the triggerCount and sampleCount parameters in + . + + + The parameter value passed is out of range. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:09:22 AM + sheien + True + + + + Asynchronously acquires multiple measurements and returns an array of measured values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + If maximumTime is set to , the NI-DMM driver calculates the timeout automatically. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous acquisitions, up to 100,000 points can be returned at once. The number of measurements can be a subset. + The valid range is any positive integer. The default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , the length will be resized to . + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + is + raised once this operation completes. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one + after the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method + is called, the operation completed event will not be raised. + + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. + A + error occurs if + the number of points read is not equal to the number of points requested, or if the measurement status returned by the hardware is not valid. + The number of measurements the + DMM makes is determined by the values you specify for the triggerCount and sampleCount parameters in + . + + + The parameter value passed is out of range. + + + The parameter value passed is null. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:08:44 AM + sheien + True + + + + Asynchronously acquires multiple measurements and fetches an array of measured values. + + + Specifies the number of measurements to acquire. The maximum number of measurements for a finite acquisition is determined by the + parameters in + (triggerCount x sampleCount). + For continuous acquisitions, up to 100,000 points can be returned at once. The number of measurements can be a subset. The valid range is any positive integer. The default value is 1. + + + Specifies the double array where the fetched values will be populated. + If the length of is less than , the length will be resized to . + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + is raised + once this operation completes. + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after + the other. The userState parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is + called, the operation completed event will not be raised. + + You will get an if the method does not complete within the specified time interval. + This exception happens if an external trigger has not been received or if + the specified timeout is not long enough for the acquisition to complete. The DMM calculates the + timeout automatically.A + error occurs if + the number of points read is not equal to the number of points requested, or if the measurement status returned by the hardware is not valid. + + The number of measurements the DMM makes is determined by the values you specify for the + triggerCount and sampleCount + parameters in . + The maximum time allowed for this method to complete is set to . + + + The parameter value passed is out of range. + + + The parameter value passed is null. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:08:41 AM + sheien + True + + + + Aborts a previously initiated measurement and returns the DMM to the idle state. + + 12/29/2009 1:17:15 PM + Staci Heien + True + + + + Returns measurement backlog and acquisition status. + + + The number of measurements available to be read. If the backlog continues to increase, data is eventually overwritten, resulting in an error. + + On the NI 4060, the backlog does not increase + when autoranging. On the NI 4065, the backlog + does not increase when + is , or before the first point is + fetched when is + . These behaviors are due + to the autorange model of the devices. + + + + Indicates the status of the acquisition. + + + The measurement status returned by the hardware is not valid. Try decreasing the acquisition rate or the acquisition size. Alternatively, you can try upgrading the performance of your system by increasing the processor speed, memory, or both. + + + Use this method to determine how many measurements are available before + calling , + , + , + , or + . + + + 3/4/2016 11:09:34 AM + sheien + True + + + + Controls the DMM. + + + The action you want the driver to perform. Only is supported, which commits to hardware all of the + configured properties associated with the session. + + + The parameter value passed is invalid. + + + Calling this method while the DMM is taking measurements results in an error. After the DMM is finished + taking measurements, calling this method will make any unfetched data points unavailable. + + Use this method if you want a parameter change to be + immediately reflected in the hardware. Use this method before calling + to make the initiate call as quickly as possible. + + The NI 4050 and NI 4060 are not supported. + + + + 12/29/2009 1:20:02 PM + Staci Heien + True + + + + Takes a measurement value and determines if the value is a valid measurement or a value indicating that an underrange condition occurred. + + + The measured value returned from the DMM. + + + A indicating whether the measurement value is a valid measurement or a value indicating an underrange condition. + + 3/4/2016 11:08:09 AM + sheien + True + + + + Takes a measurement value and determines if the value is a valid measurement or a value indicating that an overrange condition occurred. + + + The measured value returned from the DMM. + + + A indicating whether the measurement value is a valid measurement or a value indicating an overrange condition. + + 3/4/2016 11:08:06 AM + sheien + True + + + + Sends a command to trigger the DMM. + + + Call this method if you have configured either the + or + . If the + or + is set + to External or TTLn, you can use this method to override the trigger source that you configured and trigger the + NI 4065 and NI 4070/4071/4072. + + + + 3/4/2016 11:09:38 AM + sheien + True + + + + 3/5/2010 4:11:35 PM + Keely Joseph + True + + + + 3/5/2010 4:12:12 PM + Keely Joseph + True + + + + 2/9/2010 2:42:42 PM + Keely Joseph + True + + + + 3/5/2010 4:12:32 PM + Keely Joseph + True + + + + 3/5/2010 4:12:45 PM + Keely Joseph + True + + + + 2/9/2010 2:42:42 PM + Keely Joseph + True + + + + 2/9/2010 2:42:42 PM + Keely Joseph + True + + + + 2/9/2010 2:42:42 PM + Keely Joseph + True + + + + 2/9/2010 2:42:42 PM + Keely Joseph + True + + + + 9/30/2009 4:17:16 PM + Keely Joseph + True + + + + 9/30/2009 4:17:48 PM + Keely Joseph + True + + + + 3/5/2010 4:12:58 PM + Keely Joseph + True + + + + Frees the resources held. + + 11/13/2009 3:40:34 PM + Keely Joseph + True + + + + Provides methods and properties to control inductance and capacitance capabilities. + + + + For the NI-DMM 4072 only. + + For more information, refer to the Capacitance/Inductance topic in the + NI Digital Multimeters Help. + + is returned if the members are accessed after the associated + object has been disposed. + + + + 3/4/2016 11:05:16 AM + sheien + True + + + + Gets the sub-object used to + control open cable compensation. + + + Returns an object of type . + + 1/26/2010 3:31:45 PM + Staci Heien + True + + + + Gets the sub-object used to control short cable compensation. + + Returns an object of type . + 2/15/2010 11:48:32 AM + Keely Joseph + True + + + + Gets additional information specific to capacitance and inductance. + + + Returns an object of type . + + 1/11/2010 1:55:31 PM + Staci Heien + True + + + + Gets or sets the type of cable compensation that is applied to the current capacitance or inductance measurement for the current range. + + + Changing the function or the range through this property or through + resets the value + of this property to the default value. + + + The default value is . + + 1/11/2010 1:59:41 PM + Staci Heien + True + + + + Configures + + and + . + + + Specifies the open cable compensation conductance. + + + Specifies the open cable compensation susceptance. + + + The parameter value passed is out of range. + + + For the NI 4072 only. + + + + 12/28/2009 4:36:43 PM + Staci Heien + True + + + + Configures the + and + . + + + Specifies the short cable compensation resistance. + + + Specifies the short cable compensation reactance. + + + For the NI 4072 only. + + + The parameter value passed is out of range. + + + + 12/28/2009 4:37:06 PM + Staci Heien + True + + + + Performs the open cable compensation measurements for the current capacitance/inductance range, and returns open cable compensation conductance and susceptance values. You can use the return values of this method as inputs to + . + + + Specifies the open cable compensation conductance. + + + Specifies the open cable compensation susceptance. + + + For the NI 4072 only. + + + is not set to or . + + 3/4/2016 11:05:22 AM + sheien + True + + + + Performs the short cable compensation measurements for the current capacitance/inductance range, and returns short cable compensation resistance and reactance values. You can use the return values of this function as inputs to + . + + + Specifies the short cable compensation resistance. + + + Specifies the short cable compensation reactance. + + + is not set to and . + + 9/2/2010 4:47:43 PM + Keely Joseph + True + + + + Controls capacitance and inductance open cable compensation. + + + + Use to control capacitance and inductance open cable compensation. + + is returned if the members are accessed after the associated + object has been disposed. + + + 3/4/2016 11:11:41 AM + sheien + True + + + + Gets or sets the active part (conductance) of the open cable compensation. + + + The valid range is any real number greater than 0. The default value (-1.0) indicates that compensation has not taken place. + + + For the NI 4072 only. + Using this property or + + to change the function or the range resets the value of this property to the default value. + + 3/4/2016 11:11:44 AM + sheien + True + + + + Gets or sets the reactive part (susceptance) of the open cable compensation. + + + The valid range is any real number greater than 0. The default value (-1.0) indicates that compensation has not taken place. + + + For the NI 4072 only. + Using this property or + + to change the function or the range resets the value of this property to the default value. + + 3/4/2016 11:11:49 AM + sheien + True + + + + Controls capacitance and inductance short cable compensation. + + + + Use to control capacitance and inductance short cable compensation. + + is returned if the members are accessed after the associated + object has been disposed. + + + 3/4/2016 11:13:26 AM + sheien + True + + + + Gets or sets the active part (resistance) of the short cable compensation. + + + The valid range is any real number greater than 0. The default value is -1, which indicates that compensation has not taken place. + + + For the NI 4072 only. + + Using this property or + + to change the function or the range resets the value of this property to the default value. + + 3/4/2016 11:13:35 AM + sheien + True + + + + Gets or sets the reactive part (reactance) of the short cable compensation. + + + The valid range is any real number greater than 0. The default value is -1, which indicates that compensation has not taken place. + + + For the NI 4072 only. + Using this property or + + to change the function or the range resets the value of this property to the default value. + + + 3/4/2016 11:13:30 AM + sheien + True + + + + Provides additional information specific to capacitance and inductance. + + + + For NI 4072 only. + is returned if the members are accessed after the associated + object has been disposed. + + 3/4/2016 11:04:53 AM + sheien + True + + + + Gets or sets the type of algorithm the measurement processing uses for capacitance and inductance measurements. + + + For the NI 4072 only. + + + + The default value is Auto. + + 12/28/2009 4:05:48 PM + Staci Heien + True + + + + Gets or sets the available DC bias for capacitance measurements. + + + For NI 4072 only. + When is + On, the high potential appears on the HI terminal. Ensure that the + component is polarized correctly by connecting the negative terminal of the component to the LO terminal. + + + + The DC bias voltage is a fixed value and can only be turned on and off. The nominal voltage value is 0.45 V and can be used for any + capacitance range. The default setting is . + + 1/12/2010 4:09:11 PM + Staci Heien + True + + + + Gets or sets the number of LC measurements that are averaged to produce one reading. + + + For the NI 4072 only. + + + The number of LC measurements that are averaged to produce one reading. + + 1/5/2010 3:21:31 PM + Keely Joseph + True + + + + Configures the DMM for temperature measurements. + + + + Use to configure the DMM for temperature measurements. + + is returned if the members are accessed after the associated + object has been disposed. + + + 3/4/2016 11:13:45 AM + sheien + True + + + + Gets or sets the type of transducer. + + + The default value is . + + + + + Transducer Type + Description + + + + + + + 4-wire RTD + + + + + + + + Thermistor + + + + + + + + Thermocouple + + + + + + + + 2-wire RTD + + + + + 3/4/2016 11:14:04 AM + sheien + True + + + + Gets the object used to control RTD-related values for temperature measurements. + + + Returns an object of type . + + 3/21/2016 4:42:38 PM + sheien + True + + + + Gets the objects used to control the thermocouple-related values for temperature measurements. + + + Returns an object of type . + + 3/21/2016 4:43:18 PM + sheien + True + + + + Gets or sets the Steinhart-Hart A coefficient for thermistor scaling when + is set to . + + The default value is 0.0010295 (44006). + 3/21/2016 4:46:26 PM + sheien + True + + + + Gets or sets the Steinhart-Hart B coefficient for thermistor scaling when + is set to . + + The default value is 0.0002391 (44006). + 3/21/2016 4:46:29 PM + sheien + True + + + + Gets or sets the Steinhart-Hart C coefficient for thermistor scaling when + is set to . + + The default value is 1.568e-7 (44006). + 3/21/2016 4:46:33 PM + sheien + True + + + + Gets or sets the type of thermistor used to measure the temperature. + + The default value is . + Refer to topic for additional information about defined values. + 3/21/2016 4:43:10 PM + sheien + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + 4/19/2011 10:49:17 AM + Raghavendra S Vaidya + True + + + + Configures the A, B, and C parameters for a custom thermistor. + + + Specifies the Steinhart-Hart A coefficient for thermistor scaling when Thermistor Type is set to Custom in the + . The default is 1.0295e-3 (44006). + + + Specifies the Steinhart-Hart B coefficient for thermistor scaling when Thermistor Type is set to Custom in the + . The default is 2.391e-4 (44006). + + + Specifies the Steinhart-Hart C coefficient for thermistor scaling when Thermistor Type is set to Custom in the + . The default is 1.568e-7 (44006). + + + The parameter value passed is out of range. + + 7/20/2009 10:49:53 AM + Keely Joseph + True + + + + Defines methods and properties to perform self-calibration or to provide optional functionality when performing a calibration. + + + External calibration is not supported in the .NET framework. + + For more information, refer to the Self-Calibration + topic in the + NI Digital Multimeters Help. + + is returned if the members are accessed after the associated + object has been disposed. + + + + 3/4/2016 11:04:56 AM + sheien + True + + + + Gets the recommended interval between external recalibration in months. + + + Returns the recommended interval between external recalibration in months. + + + The NI 4050 and NI 4060 are not supported. + + 1/5/2010 11:39:10 AM + Keely Joseph + True + + + + Gets a value indicating whether the DMM device can perform self-calibration. + + + Returns a indicating whether the DMM you are using can perform self-calibration. + + 3/4/2016 11:05:00 AM + sheien + True + + + + Gets or sets the user-defined information to be stored in the EEPROM. + + + The information to be stored in the EEPROM can include the operator who performed the calibration operation or system information. + + + If the string size is larger than the maximum string size, NI-DMM stores as much of the information as possible, truncates the remainder, and returns a warning. + The NI 4050 and NI 4060 are not supported. + + 1/5/2010 11:49:58 AM + Keely Joseph + True + + + + Gets the maximum string length that can be stored in the EEPROM. + + + The maximum string length that can be stored in the EEPROM, given in characters. The value does not include the termination character. + + Use to store user-defined + information. + + 1/11/2010 1:52:54 PM + Staci Heien + True + + + + Returns the calibration count for the specified type of calibration. + + + Specifies the type of calibration performed (external or self-calibration). The default value is . + + + NI 4050 and NI 4060 are not supported. + + + The number of times calibration has been performed. + + + The enum parameter value passed is invalid. + + + 12/28/2009 4:12:26 PM + Staci Heien + True + + + + Gets the date and time of the last calibration performed. + + + Specifies the type of calibration performed (external or self-calibration). The default value is . + + + Returns the date and time of the last calibration performed. + + + The enum parameter value passed is invalid. + + + + The NI 4065 does not support self-calibration. + + The NI 4050 and NI 4060 are not supported. + + + 3/21/2016 2:23:00 PM + sheien + True + + + + Returns the temperature during the last calibration procedure. + + + Specifies the type of calibration performed (external or self-calibration). The default value is . + + + The temperature during the last calibration. + + + The enum parameter value passed is invalid. + + + + NI 4050 and NI 4060 are not supported. + + 12/28/2009 4:16:55 PM + Staci Heien + True + + + + Reverts the device to the calibration constants from the last complete external calibration. + + + For the NI 4070/4071/4072 only. + This method recovers the hardware if a fatal system error occurs during an external or self-calibration procedure. + After calling this method, call + before taking measurements with the device to adjust the device for any temperature drifts since the last external calibration. + + + The password is invalid. + + 3/4/2016 11:05:09 AM + sheien + True + + + + Changes the password required to enable external calibration functionality for the specified instrument. + + + Specifies the current password required to enable external calibration functionality. The maximum password string length is eight characters, excluding the termination character. + + + Specifies the new password required to enable external calibration functionality. The maximum password string length is eight characters, excluding the termination character. + + + The parameter value passed is null/empty. + + + The password is invalid. + + + The maximum password string length is eight characters, excluding the termination character. NI is the default password. + + 12/28/2009 4:22:59 PM + Staci Heien + True + + + + Returns the current temperature of the device in Celsius. + + + Reserved for future use. + + + The current temperature of the device in Celsius. + + + The option string is null. + + 3/4/2016 11:05:05 AM + sheien + True + + + + Executes the self-calibration routine to maintain measurement accuracy. + + + This method calls , and any configurations previous to the call will be lost. All properties will be set to their default values after the call returns. + + For the NI 4070/4071/4072 only. + + For more information, refer to the Self-Calibration topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:05:13 AM + sheien + True + + + + Provides methods and properties for waveform-related operations. + + + Valid only for NI 4070/4071/4072. + For more information, refer to the Waveform Acquisition Fundamentals topic in the + NI Digital Multimeters Help. + + is returned if the members are accessed after the associated + object has been disposed. + + + + 3/4/2016 11:16:12 AM + sheien + True + + + + Occurs when asynchronous call for fetch waveform operation completes. + + 12/30/2009 12:43:23 PM + Staci Heien + True + + + + Occurs when asynchronous call for read waveform operation completes. + + 12/30/2009 12:18:20 PM + Staci Heien + True + + + + Gets or sets the coupling during a waveform acquisition. + + + Valid only for NI 4070/4071/4072. + + + Value is specified by . + + + Value + Description + + + + + + + Specifies AC coupling. + + + + + + + + Specifies DC coupling. + + + + + 1/5/2010 3:05:50 PM + Keely Joseph + True + + + + Gets or sets the number of points to acquire in a waveform acquisition. + + + Valid only for NI 4070/4071/4072. + + + The number of points to acquire in a waveform acquisition. + + 1/5/2010 3:06:59 PM + Keely Joseph + True + + + + Gets or sets the rate of the waveform acquisition in Samples per second (S/s). + + + The valid Range is 10.0-1,800,000 S/s. Values are coerced to the closest integer divisor of 1,800,000. The default value is 1,800,000. + + + Valid only for NI 4070/4071/4072. + + 12/30/2009 12:11:56 PM + Staci Heien + True + + + + Gets or sets a value indicating whether the events and callback delegates are invoked through the or + methods. + + + if events and callbacks are invoked through the or + methods; otherwise, events and callbacks are invoked directly. The default value is + . + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/21/2016 4:17:09 PM + sheien + True + + + + Returns an array of values in the form of a waveform datatype from a previously initiated waveform acquisition. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0–86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + Returns an analog waveform datatype which contains the array of values from a previously initiated waveform acquisition and timing information. + + + For the NI 4070/4071/4072 only. + You must call before calling this method. + + + The value passed for is out of range. + + + The method does not complete within the time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + 3/23/2016 12:42:37 PM + sheien + True + + + + Populates a pre-allocated waveform buffer with values from a previously initiated waveform acquisition. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + The pre-allocated Waveform to be used to return the fetch results. This parameter cannot be null. + + + Returns an analog waveform datatype which contains the array of values from a previously initiated waveform acquisition and timing information. + + + For the NI 4070/4071/4072 only. + You must call before calling this method. + + + The value passed for parameter is not positve. + + + The method does not complete within the time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + + The value for is null. + + 3/23/2016 12:42:41 PM + sheien + True + + + + Acquires and returns a waveform buffer with values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + Returns an analog waveform datatype which contains the array of values from a previously initiated waveform acquisition and timing information. + + + For the NI 4070/4071/4072 only. + The number of elements in the waveform array is determined by the values you specify for the waveformPoints parameter in . + + + The method does not complete within the time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + + The value passed for parameter is out of range. + + 3/23/2016 12:42:56 PM + sheien + True + + + + Acquires and populates a pre-allocated waveform buffer with values. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + The pre-allocated Waveform to be used to return the read results. This parameter cannot be null. + + + Returns an analog waveform datatype which contains the array of values from a previously initiated waveform acquisition and timing information. + + + For the NI 4070/4071/4072 only. + The number of elements in the waveform array is determined by the values you specify for the waveformPoints parameter in . + + + The method does not complete within the time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + + The value passed for parameter is out of range. + + + The value for parameter is null. + + 3/23/2016 12:42:48 PM + sheien + True + + + + Asynchronously populates a pre-allocated waveform buffer with values from a previously initiated waveform acquisition. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + For the NI 4070/4071/4072 only. + Two or more asynchronous methods run concurrently on different threads on the same session. + + If the user calls dispose on the session object while the asynchronous operation is in progress, the operation completed event will not be raised. + + + You must call before calling this method. + + You will get a if the method does not complete within the specified time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + + The value passed for parameter is out of range. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/4/2016 11:16:20 AM + sheien + True + + + + Asynchronously populates a pre-allocated waveform buffer with values from a previously initiated waveform acquisition. + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + The pre-allocated Waveform to be used to return the fetch results. This parameter cannot be null. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + For the NI 4070/4071/4072 only. + Two or more asynchronous methods run concurrently on different threads on the same session. + + If the user calls dispose on the session object while the asynchronous operation is in progress, the operation completed event will not be raised. + + + You must call before calling this method. + + You will get a if the method does not complete within the specified time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + + The value passed for parameter is out of range. + + + The value for parameter is null. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/23/2016 12:42:45 PM + sheien + True + + + + Asynchronously acquires a waveform and fetches data as a waveform data type. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + For the NI 4070/4071/4072 only. + The number of elements in the waveform array is determined by the values you specify for the waveformPoints parameter in . + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after the other. The parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is called, the operation completed event will not be raised. + + You will get a if the method does not complete within the specified time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + + The value passed for parameter is not positve. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/23/2016 12:43:01 PM + sheien + True + + + + Asynchronously acquires a waveform and fetches values into a pre-allocated waveform buffer. + + + Specifies the maximum time allowed for this method to complete. The valid range is 0-86400000 milliseconds. + When set to , the DMM calculates the timeout automatically. + + + Specifies the number of waveform points to return. You specify the total number of points that the DMM acquires in the waveformPoints parameter of . The default value is 1. + + + The pre-allocated waveform to be used to return the read results. This parameter cannot be null. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + For the NI 4070/4071/4072 only. + The number of elements in the waveform array is determined by the values you specify for the waveformPoints parameter in . + If an asynchronous method is called before the completion of a previous asynchronous method, the operation is queued to occur one after the other. + The parameter can be used to distinguish between different asynchronous methods. + + If the user calls dispose on the session object while the asynchronous operation is in progress or before the asynchronous method is called, the operation completed event will not be raised. + + You will get a if the method does not complete within the specified time interval. This exception happens if an external trigger has not been received, or if the specified timeout is not long enough for the acquisition to complete. + + + The value passed for parameter is not positve. + + + The value for is null. + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + 3/23/2016 12:42:53 PM + sheien + True + + + + Frees the resources held. + + 11/13/2009 3:40:50 PM + Keely Joseph + True + + + + Specifies the ADC calibration. + Use for setting . + + + For more information, refer to the ADC Calibration topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:18:10 AM + sheien + True + + + + The DMM enables or disables ADC calibration. + + 12/28/2009 1:43:39 PM + Staci Heien + True + + + + The DMM does not compensate for changes to the gain. + + 3/4/2016 11:18:14 AM + sheien + True + + + + The DMM measures an internal reference to calculate the correct gain for the measurement. + + 3/4/2016 11:18:19 AM + sheien + True + + + + Specifies , + , and + . + 12/28/2009 4:01:26 PM + Staci Heien + True + + + + The driver chooses the + setting based on the configured function and resolution. + + 12/28/2009 4:02:21 PM + Staci Heien + True + + + + Disables . + + 12/28/2009 4:02:33 PM + Staci Heien + True + + + + The DMM device internally disconnects the input signal following each measurement and takes a zero reading. It then subtracts the zero reading from the preceding reading. + + 12/28/2009 4:03:14 PM + Staci Heien + True + + + + The DMM device internally disconnects the input signal for the first measurement and takes a zero reading. It then subtracts the zero reading from the first reading and the following readings. + + 12/28/2009 4:03:53 PM + Staci Heien + True + + + + Specifies values for DC noise rejection. + + + + For more information, refer to the DC Noise Rejection topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:18:34 AM + sheien + True + + + + The driver chooses the DC noise rejection setting based on the configured function and resolution. + + 12/28/2009 4:44:36 PM + Staci Heien + True + + + + All samples are weighed equally. + + 3/4/2016 11:18:38 AM + sheien + True + + + + NI-DMM weighs the samples taken in the middle of the aperture time more than samples taken at the beginning and the end of the measurement using a triangular weighing function. + + 9/23/2009 3:16:56 PM + Keely Joseph + True + + + + NI-DMM weighs the samples taken in the middle of the aperture time more than samples taken at the beginning and the end of the measurement using a bell-curve weighing function. + + 12/28/2009 4:44:52 PM + Staci Heien + True + + + + Enables or disables offset compensation Ohms. + + 12/30/2009 12:27:58 PM + Staci Heien + True + + + + Disables offset compensated Ohms. + + 12/30/2009 12:28:33 PM + Staci Heien + True + + + + Enables offset compensated Ohms. + + 12/30/2009 12:28:27 PM + Staci Heien + True + + + + Specifies the type of cable compensation that is applied to the current capacitance + or inductance measurement for the current range. + + + + For the NI 4072 only. + + 12/28/2009 4:08:01 PM + Staci Heien + True + + + + No cable compensation. + + 12/28/2009 4:08:14 PM + Staci Heien + True + + + + Open cable compensation. + + 12/28/2009 4:08:23 PM + Staci Heien + True + + + + Short cable compensation. + + 12/28/2009 4:08:47 PM + Staci Heien + True + + + + Open and short cable compensation. + + 12/28/2009 4:08:33 PM + Staci Heien + True + + + + Use to specify the DC bias. + + + + For more information, refer to the DC Bias topic in the + NI Digital Multimeters Help. + + 3/4/2016 11:18:23 AM + sheien + True + + + + The device does not use the DC bias. + + 3/4/2016 11:18:27 AM + sheien + True + + + + The device uses the DC bias. + + 3/4/2016 11:18:31 AM + sheien + True + + + + Specifies the unit used when measuring aperture time. + Use for setting . + + 12/28/2009 3:59:48 PM + Staci Heien + True + + + + Aperture time measured in seconds. + + 12/28/2009 4:00:30 PM + Staci Heien + True + + + + Aperture time measured in powerline cycles. + + 12/28/2009 4:00:16 PM + Staci Heien + True + + + + Specifies the mode in which the device acquires data. + + + 12/30/2009 12:28:51 PM + Staci Heien + True + + + + IviDmm mode. + + 12/30/2009 12:29:03 PM + Staci Heien + True + + + + Waveform acquisition mode. + + 12/30/2009 12:29:09 PM + Staci Heien + True + + + + Specifies the coupling during waveform acquisition. + + + 12/30/2009 12:36:49 PM + Staci Heien + True + + + + AC coupled. + + 12/30/2009 12:36:56 PM + Staci Heien + True + + + + DC coupled. + + 12/30/2009 12:37:03 PM + Staci Heien + True + + + + Holds the event data obtained after asynchronous measurement completion. + + + This class derives from that contains + and . + contains the exception that was returned during that operation. + is used to indicate whether the operation was completed or cancelled. + This class also contains readings that are obtained as a result of the operation. + + + + Refers to [] + when used with , , + , or . + Refers to when used with , + , + , or . + + + 3/4/2016 11:11:08 AM + sheien + True + + + + Initializes a new instance of the class. + + + The exception that is returned during the operation. + + + Specifies whether the operation was completed or canceled. + + + An object used to associate client state (such as a task ID) with this particular asynchronous operation. + + + Reading obtained from the measurement operation. + + + Number of points obtained from the measurement operation. + + 3/21/2016 4:48:00 PM + sheien + True + + + + Gets the resulting reading from the measurement operation. + + + contains a single value for a single point measurement, an array of values for a + multipoint measurement, or a waveform datatype for a waveform measurement. + + 3/21/2016 2:55:31 PM + sheien + True + + + + Gets the number of measurement points obtained from the async measurement operation. + + + You can use this property for multipoint methods that take a reading array as a parameter. + This property is 1 for single point measurement and contains the length of the reading array for multipoint methods + that do not take a reading array as a parameter. + + + The number of measured values actually retrieved from the DMM. + + 3/4/2016 11:11:12 AM + sheien + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.dll new file mode 100644 index 0000000..d1d83a1 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.msl b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.msl new file mode 100644 index 0000000..82228b5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.msl @@ -0,0 +1,27 @@ + + + 1 + true + + CppCLI2012 + WindowsFormsApplication2012 + + false + Measurement Studio Hardware Class Libraries/NI-SWITCH Library + Contains classes to control and configure NI switch modules using the NI-SWITCH driver. + NationalInstruments.ModularInstruments.NISwitch.Fx45 + false + + + NationalInstruments.ModularInstruments.Common + + + + Ivi.Driver + Ivi.Swtch + + + NationalInstruments.ModularInstruments.NISwitch + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.xml new file mode 100644 index 0000000..ccf2ad4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.ModularInstruments.NISwitch.Fx45.xml @@ -0,0 +1,8389 @@ + + + + NationalInstruments.ModularInstruments.NISwitch.Fx45 + + + + + Header: //Measurements/switch/niswitchComponents/niswitchHeaders/export/15.1/15.1.0f1/includes/niSwitch.h + + + + + C Header Value: NISWITCH_TOPOLOGY_2599_2_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_2_WIRE_DUAL_4X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2544_8X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2586_10_SPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2535_1_WIRE_4X136_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1127_4_WIRE_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2524_1_WIRE_DUAL_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2737_2_WIRE_4X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_1_WIRE_4X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2525_2_WIRE_DUAL_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2739_2_WIRE_16X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_1_WIRE_4X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1128_1_WIRE_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2522_53_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2576_2_WIRE_QUAD_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1127_2_WIRE_4X8_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2575_2_WIRE_98X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_1_WIRE_OCTAL_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2798_DUAL_TRANSFER + + + + + C Header Value: NISWITCH_TOPOLOGY_2593_DUAL_4X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2565_16_SPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2503_4_WIRE_12X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2584_1_WIRE_DUAL_6X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1129_2_WIRE_QUAD_4X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2570_40_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_1_WIRE_QUAD_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1127_1_WIRE_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_1_WIRE_QUAD_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2556_DUAL_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2554_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2569_100_SPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2569_50_DPST + + + + + C Header Value: NISWITCH_TOPOLOGY_1193_QUAD_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1160_16_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2722_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_1193_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_2_WIRE_QUAD_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2725_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2527_1_WIRE_DUAL_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2510_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2747_DUAL_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_1_WIRE_8X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_SIXTEEN_2X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2526_1_WIRE_158X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2503_2_WIRE_24X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_2_WIRE_4X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1175_2_WIRE_95X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1166_32_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_2_WIRE_128X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2797_6X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2575_1_WIRE_196X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2796_DUAL_6X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_2_WIRE_4X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2521_40_DPST + + + + + C Header Value: NISWITCH_TOPOLOGY_1166_16_DPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2527_4_WIRE_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1175_1_WIRE_196X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2523_26_DPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_DUAL_16X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2531_1_WIRE_8X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_2_WIRE_8X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1128_2_WIRE_4X8_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2549_TERMINATED_2_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_1_WIRE_DUAL_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2584_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_2_WIRE_24X1_AMPLIFIED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2595_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2557_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1128_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2525_2_WIRE_QUAD_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_2_WIRE_24X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2533_1_WIRE_4X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2584_1_WIRE_12X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2591_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_2_WIRE_DUAL_12X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2524_1_WIRE_SIXTEEN_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2576_2_WIRE_OCTAL_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2529_2_WIRE_8X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2564_16_SPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2503_2_WIRE_4X6_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2558_4_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2571_66_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_1190_QUAD_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1193_QUAD_4X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2746_QUAD_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_1_WIRE_OCTAL_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2514_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_4_WIRE_QUAD_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1129_2_WIRE_DUAL_8X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2542_QUAD_2X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1191_QUAD_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_2_WIRE_OCTAL_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2547_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2540_1_WIRE_8X9_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2527_2_WIRE_DUAL_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2524_1_WIRE_OCTAL_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2527_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2576_2_WIRE_DUAL_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_1_WIRE_48X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1163R_OCTAL_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2527_1_WIRE_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_1_WIRE_128X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2738_2_WIRE_8X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2566_8_DPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_QUAD_4X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_2_WIRE_DUAL_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2527_2_WIRE_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_1_WIRE_SIXTEEN_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2727_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2512_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_1_WIRE_DUAL_128X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2594_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2567_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_1193_DUAL_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2593_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2529_2_WIRE_DUAL_4X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2590_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1194_QUAD_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2575_2_WIRE_95X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1127_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_4_WIRE_DUAL_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2525_2_WIRE_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2568_15_DPST + + + + + C Header Value: NISWITCH_TOPOLOGY_1129_2_WIRE_DUAL_4X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1161_8_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_1195_QUAD_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2720_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2593_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2548_4_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2576_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_1175_2_WIRE_98X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2515_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_1193_DUAL_8X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1129_2_WIRE_16X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1192_8_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2531_1_WIRE_SIXTEEN_2X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1128_4_WIRE_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2576_2_WIRE_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_1_WIRE_8X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_1_WIRE_48X1_AMPLIFIED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2529_2_WIRE_4X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2799_2_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2525_2_WIRE_SIXTEEN_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2593_8X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2525_2_WIRE_OCTAL_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_16X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2503_2_WIRE_DUAL_12X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_2_WIRE_16X16_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2531_1_WIRE_4X128_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_8X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2570_20_DPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_2_WIRE_4X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2559_TERMINATED_2_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_2_WIRE_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_4_WIRE_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_4X128_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_1_WIRE_256X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1193_16X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2586_5_DPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2585_1_WIRE_10X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2503_2_WIRE_QUAD_6X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2520_80_SPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2593_DUAL_8X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2566_16_SPDT + + + + + C Header Value: NISWITCH_TOPOLOGY_1167_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2503_1_WIRE_48X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1129_2_WIRE_4X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2597_6X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_CONFIGURED_TOPOLOGY + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_4_WIRE_64X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2524_1_WIRE_QUAD_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2534_1_WIRE_8X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1129_2_WIRE_8X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1130_INDEPENDENT + + + + + C Header Value: NISWITCH_TOPOLOGY_2568_31_SPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2545_4X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_DUAL_4X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2532_1_WIRE_DUAL_8X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2543_DUAL_4X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1127_2_WIRE_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2555_4X1_TERMINATED_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2530_2_WIRE_QUAD_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2546_DUAL_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2524_1_WIRE_128X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1169_50_DPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2748_16X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_2_WIRE_4X6_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2536_1_WIRE_8X68_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1169_100_SPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2526_2_WIRE_79X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_1128_2_WIRE_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2531_1_WIRE_DUAL_4X64_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_1193_32X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2576_2_WIRE_SIXTEEN_4X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_2_WIRE_QUAD_6X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2541_1_WIRE_8X12_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2584_2_WIRE_6X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2531_1_WIRE_DUAL_8X32_MATRIX + + + + + C Header Value: NISWITCH_TOPOLOGY_2564_8_DPST + + + + + C Header Value: NISWITCH_TOPOLOGY_2598_DUAL_TRANSFER + + + + + C Header Value: NISWITCH_TOPOLOGY_2596_DUAL_6X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2501_4_WIRE_12X1_MUX + + + + + C Header Value: NISWITCH_TOPOLOGY_2790_INDEPENDENT + + + + + Gets a value indicating whether handle is invalid. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to ChannelName. + + + + + Looks up a localized string similar to ModularInstruments.NISwitch:. + + + + + Looks up a localized string similar to The argument cannot be empty. + + + + + Looks up a localized string similar to Error Code. + + + + + Looks up a localized string similar to Guid. + + + + + Looks up a localized string similar to The specified index does not exist. + + + + + Looks up a localized string similar to The instrument handle passed is not a valid NI-SWITCH handle.. + + + + + Looks up a localized string similar to Message. + + + + + Looks up a localized string similar to The argument cannot be null or Empty.. + + + + + Looks up a localized string similar to Cannot access a disposed object.. + + + + + Looks up a localized string similar to Value exceeds accuracy/ range supported by Ivi.Driver.PrecisionTimeSpan. + + + + + Looks up a localized string similar to NISwitch Session. + + + + + Looks up a localized string similar to Simulate property cannot be set after construction.. + + + + + Looks up a localized string similar to Unknown channel or repeated capability name.. + + + + + Looks up a localized string similar to Invalid value for the parameter.. + + + + + Looks up a localized string similar to Invalid value for the property.. + + + + + Looks up a localized string similar to Warning Code. + + + + + The switch device does not produce a Scan Advanced Output trigger. + + + + + External Trigger. The switch device produces the Scan Advanced Output trigger on the external trigger output. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG0 line. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG1 line. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG2 line. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG3 line. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG4 line. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG5 line. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG6 line. + + + + + The switch device produces the Scan Advanced Output on the PXI TRIG7 line. + + + + + The switch device produces the Scan Advanced Output trigger on the front connector. + + + + + The switch device produces the Scan Advanced Output trigger on the rear connector. + + + + + The switch module waits until it receives a trigger on the PXI star trigger bus before processing the next entry in the scan list. + + + + + Immediate Trigger. The switch device does not wait for a trigger before processing the next entry in the scan list. + + + + + External Trigger. The switch device waits until it receives a trigger from an external source through the external trigger input before processing the next entry in the scan list. + + + + + The switch device waits until you call the niSwitch_SendSoftwareTrigger function before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG0 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG1 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG2 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG3 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG4 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG5 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG6 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI TRIG7 line before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the PXI STAR trigger bus before processing the next entry in the scan list. + + + + + The switch device waits until it receives a trigger on the rear connector. + + + + + The switch device waits until it receives a trigger on the front connector. + + + + + Provides data for the event. + + + For more information, refer to NI Switches Help. + + 12/12/2012 10:57:45 AM + NI + False + + + + Gets the string containing the description of the coercion event. + + + Returns a string containing the description of the coercion. + + 9/14/2012 10:30:42 AM + NI + False + + + + 6/1/2011 4:22:11 PM + NI + False + + + + 6/1/2011 4:22:29 PM + NI + False + + + + 6/1/2011 4:22:38 PM + NI + False + + + + 6/1/2011 4:22:22 PM + NI + False + + + + 11/13/2011 4:22:22 PM + NI + False + + + + 11/13/2011 4:22:22 PM + NI + False + + + + 11/13/2011 4:22:22 PM + NI + False + + + + 11/13/2011 4:22:22 PM + NI + False + + + + Defines properties and methods that represent the the result of a error query. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:52:16 PM + NI + False + + + + Gets the error code returned by the driver. + + + Returns an representing the error code. + + 10/22/2012 1:31:27 PM + NI + False + + + + Gets the user readable error string. + + + Returns a representing the error string. + + 05/02/2012 4:03:14 PM + NI + False + + + + Determines whether the current instance of and the user specified object are equal. + + Specifies the object to be compared to the current instance of . + if the two instances are equal; otherwise, . + 05/02/2012 4:03:14 PM + NI + False + + + + Determines whether the current instance of and the user specified object are equal. + + Specifies the object to be compared to the current instance of . + + if the two instances are equal; otherwise, + . + 05/02/2012 4:03:14 PM + NI + False + + + Checks whether the two instances of are equal. + Specifies a object. + Specifies a object. + if the two instances are equal; otherwise, . + 05/02/2012 4:03:14 PM + NI + False + + + Checks whether the two instances of are unequal. + Specifies a object. + Specifies a object. + if the two instances are unequal; otherwise, . + + 12/30/2011 5:53:26 PM + NI + True + + + + Returns the hash code for the current instance of . + + Returns an representing the hash value generated for the current instance of . + 12/30/2011 5:53:20 PM + NI + True + + + + Represents the properties for the InterchangeWarning event. + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:27:54 PM + NI + False + + + + Gets the string which provides a description of the InterChangeCheck warning. + + + Returns a which describes the InterChangeCheck warning. + + 10/9/2012 1:44:39 AM + NI + False + + + + Defines properties and methods used to control individual relays and get relay charactereistics. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:28:19 PM + NI + False + + + + Returns the relay name string that is in the relay list at the specified index. + + + A 1-based index into the channel table. The default value is 1. The maximum value is the value of the property. + + + Returns a that indicates the relay name string that is in the relay list at the specified index. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:31:34 PM + NI + False + + + + Returns the number of times the relay has changed from closed to open. + + + The name of the relay. + + + Returns a that indicates the number of times the relay has changed from closed to open. + + + Relay count is useful for tracking relay lifetime and usage. Call before to ensure an accurate count. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:31:28 PM + NI + False + + + + Returns the relay position for the relay specified in the relayName parameter. + + + Name of the relay. + + + Returns a object that indicates the relay position for the relay specified in the relayName parameter. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:31:39 PM + NI + False + + + + Controls individual relays of the switch. + + + Name of the relay or set of relays to control. + + + Specifies whether to open or close a given relay. + Defined values + + + + + + + + + + + + + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:31:48 PM + NI + False + + + + 1/10/2013 12:10:15 PM + NI + False + + + + Returns the coercion information associated with the IVI session. This method retrieves and clears the oldest instance in which the instrument driver coerced a value you specified to another value. + + + This method returns the coercion information associated with the IVI session. This method retrieves and clears the oldest instance in which the instrument driver coerced a value you specified to another value. + + 9/14/2012 10:34:28 AM + NI + False + + + + 6/1/2012 4:49:23 PM + NI + False + + + + 6/1/2012 4:49:46 PM + NI + False + + + + 6/1/2012 4:49:35 PM + NI + False + + + + 6/1/2012 4:49:31 PM + NI + False + + + + 6/1/2012 4:49:40 PM + NI + False + + + + Defines a root class that is used to identify and control the instrument session. + + + All properties, methods, and events fall under either the NISwitch class or are the sub-objects of this class. To interact with the NI-SWITCH, you + must create an instance of this class. + 12/30/2011 5:52:41 PM + NI + True + + + + Creates a new instrument driver session. + + + Specifies the name of the device in which the session is opened. + + + Valid Values: + - (default value) + - Currently unsupported. + + + - Reset device (default value) + - Currently unsupported. The device will not reset. + + 11/7/2012 1:07:16 PM + NI + False + + + + Creates a new instrument driver session and sets the initial state of session properties. + + + Specifies the name of the device in which the session is opened. + + + Valid Values: + - (Default Value) + - Currently unsupported. + + + - Reset Device (Default Value) + - Currently unsupported. The device will not reset. + + + Sets the initial state of the following session properties: , + , + , + , + , + . + + 11/7/2012 1:13:48 PM + NI + False + + + + Creates a new instrument driver session and sets the topology of device. + + Specifies the name of the device in which the session is opened. + + + Pass the topology name you want to use for the switch you specify with the resourceName parameter. All the valid values are defined in . + + + Enables simulation of the switch module specified in the resourceName parameter. + Simulate. + (default) Do not simulate. + + + Specifies whether to reset the switch module during the initialization process. + (default) Reset device. + The device will not reset. + + 11/7/2012 1:15:11 PM + NI + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Creates a new instrument driver session from an existing instrument handle. + + Specifies the pre-existing instrument handle used to create a new instrument driver session. + 11/7/2012 1:01:56 PM + NI + False + + + + Closes the specified session and deallocates the reserved resources, if not already disposed. + + + You can call this method safely more than once, even if the session is already closed. + + A call to this method disposes the SafeHandle class used to hold the instrument handle. If the call to this method fails due to some reason, like the session being closed by some external means, you will not be notified about the failure. + To help you identify failures in the ReleaseHandle method of the SafeHandle class, managed debugging assistant (MDA) is activated. + + + For details refer to . + + + The call to this method fails when you externally close a session by: + + + + Initializing a session with a resource name for which the session is already open, within the same process. This causes the instrument handle held by the existing session to become invalid. + + + + + Getting the instrument handle out using the method and closing this handle directly. + + + + + + 9/12/2012 11:56:11 AM + NI + False + + + + Gets a value that indicates whether the session has been disposed. + + + if the object is disposed; otherwise, . + + 12/5/2012 3:26:40 PM + NI + False + + + + Gets a object that defines the inherent characteristics of the NI-SWITCH driver. + + + Returns a object . + + 9/13/2012 9:36:27 AM + NI + False + + + + Gets a object which represents the Channel Collection and their properties in NI-SWITCH. + + + Returns a object. + + 11/7/2012 3:12:40 PM + NI + False + + + + Gets a object which contains methods and properties used to configure a NI-SWITCH device using a scan list. + + + Returns a object. + + 9/12/2012 3:39:01 PM + NI + False + + + + Gets a object which is used to build a channel path in the NI-SWITCH driver. + + + Returns a object. + + 9/12/2012 3:38:22 PM + NI + False + + + + Gets a object which represent the methods and properties related to the relay operation in the NI-SWITCH driver. + + + Returns a object. + + 9/12/2012 3:38:40 PM + NI + False + + + + 6/1/2012 2:24:12 PM + NI + False + + + + 6/1/2012 2:24:57 PM + NI + False + + + + 6/1/2012 2:24:20 PM + NI + False + + + + 6/1/2012 2:24:20 PM + NI + False + + + + Gets a object to access the utility features on the NI-SWITCH driver. + + + Returns a object. + + 5/24/2013 3:46:23 PM + NI + False + + + + Gets a object which defines the methods and properties for identifying the NI-SWITCH driver. + + + Returns a object. + + 5/24/2013 3:46:40 PM + NI + False + + + + Gets a object that defines methods and properties for common operations on the NI-SWITCH driver. + + + Returns a object. + + 5/24/2013 3:46:59 PM + NI + False + + + + Returns the value of the underlying instrument handle. + + + Returns an representing the value of the underlying instrument handle. + + + The method was accessed after the associated + + object was disposed. + + 12/5/2012 3:27:11 PM + NI + False + + + + Closes the session to the device. + + + 11/8/2012 2:14:51 PM + NI + False + + + + Gets a object that defines methods and properties for common operations on the NI-SWITCH driver. + + + Returns a object. + + 10/9/2012 4:41:23 AM + NI + False + + + + Gets a object to access the utility features on the NI-SWITCH driver. + + + Returns a object. + + 9/12/2012 3:36:57 PM + NI + False + + + + Gets a object which defines the methods and properties for identifying the NI-SWITCH driver. + + + Returns a object. + + 9/12/2012 3:37:51 PM + NI + False + + + + 6/1/2012 2:24:39 PM + NI + False + + + + 6/1/2012 2:24:39 PM + NI + False + + + + 6/1/2012 2:24:46 PM + NI + False + + + + Returns a service object on the basis of the type mentioned in the serviceType parameter. + + + The type of the object to be retrieved. + + + Returns an object on the basis of the type mentioned in the serviceType parameter. + + + The method was accessed after the associated + + object was disposed. + + 12/5/2012 3:27:58 PM + NI + False + + + + Defines the methods and properties that provide information about the instrument and the NI-SWITCH driver. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:14:22 PM + NI + False + + + + Gets a string which contains additional version information about the NI-SWITCH instrument driver. + + + Returns a that contains additional version information about the NI-SWITCH instrument driver. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:25:49 PM + NI + False + + + + Gets the the name of the vendor that supplies the NI-SWITCH driver. + + + Returns a that contains the name of the vendor that supplies the NI-SWITCH driver. + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:26:06 PM + NI + False + + + + Gets a that contains a brief description of the specific driver. + + + Returns a that contains a brief description about the NI-SWITCH driver. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:25:22 PM + NI + False + + + + Gets the name of the instrument manufacturer of the NI-SWITCH device that is currently in use. + + + Returns a that contains the name of the instrument manufacturer of the NI-SWITCH device that is currently in use. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:25:38 PM + NI + False + + + + Gets the that contains an identifier for NI-Switch .NET API. + + Returns a that contains an identifier for NI-Switch .NET API. + 5/21/2012 12:06:19 PM + NI + False + + + + Gets the model number or name of the NI-SWITCH device that is currently in use. + + + Returns a that contains the model number or name of the NI-SWITCH device that is currently in use. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:25:44 PM + NI + False + + + + Gets a string that contains the firmware revision information for the NI-SWITCH device that is currently in use. + + + Returns a that contains the firmware revision information for the NI-SWITCH device that is currently in use. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:25:32 PM + NI + False + + + + Gets the major version number of the IviSwtch class specification. + + + Returns a representing the major version number of the IviSwtch class specification. + + 10/5/2012 3:24:16 PM + NI + False + + + + Gets the minor version number of the class specification with which NI-SWITCH driver is compliant. + + + Returns a representing the minor version number of the class specification with which NI-SWITCH driver is compliant. + + 10/5/2012 3:24:44 PM + NI + False + + + + Returns a list of names of class capability groups that the IVI-specific driver implements. + + Returns a containing the list of names of class capability groups that the IVI-specific driver implements. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:26:13 PM + NI + False + + + + Returns a list of names of instrument models with which the IVI-specific driver is compatible. + Returns a containing the list of names of instrument models with which the IVI-specific driver is compatible. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:26:23 PM + NI + False + + + + 6/1/2011 2:48:18 PM + NI + False + + + + 5/21/2012 1:48:01 PM + NI + False + + + + 5/21/2012 12:07:48 PM + NI + False + + + + 5/21/2012 12:07:54 PM + NI + False + + + + 5/21/2012 12:07:59 PM + NI + False + + + + 5/21/2012 12:08:03 PM + NI + False + + + + 5/21/2012 12:08:07 PM + NI + False + + + + 5/21/2012 12:08:11 PM + NI + False + + + + 5/21/2012 12:07:12 PM + NI + False + + + + 5/21/2012 12:07:37 PM + NI + False + + + + 5/21/2012 12:07:44 PM + NI + False + + + + Defines properties that affect the operation of the instrument driver. + + + + For more information, refer to the NI Switches Help. + + + 12/12/2012 12:15:39 PM + NI + False + + + + Gets or sets whether to perform interchangeability checking and retrieve interchangeability warnings. + + if interchangeability checking is enabled; otherwise . The default value is . + + NI-SWITCH does not support interchangeability check. + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:26:54 PM + NI + False + + + + Gets or sets whether the IVI engine keeps a list of the value coercions it makes for integer and real type properties. + + if the IVI engine keeps a list of the value coercions; otherwise, . + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:27:36 PM + NI + False + + + + Gets the driver setup string used to set the initial values for properties that are specific to NI-SWITCH. + + + Returns a representing the driver setup string that you specified in the IVI configuration store. The default value is an empty string. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:26:48 PM + NI + False + + + + Gets or sets a value which indicates whether to simulate NI-SWITCH I/O operations. + + + + if NI-SWITCH simulates instrument driver I/O operations; + + if NI-SWITCH communicates directly with the instrument. + This property is useful for debugging applications without using hardware. + + + The property was accessed after the associated + + object was disposed. + + 11/28/2012 1:27:07 PM + NI + False + + + + Gets or sets whether to validate proper values and method parameters. If you enable this property, NI-SWITCH validates the parameter values that you pass to NI-SWITCH methods. + + + if validating property values and method parameters is enabled; otherwise, . + + Range checking parameters is very useful for debugging. After you validate your program, you can set this property to to disable range checking and maximize performance. + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:27:30 PM + NI + False + + + + Gets or sets whether NI-SWITCH queries the NI-SWITCH device status after each operation. + + if querying is enabled; otherwise, . + + + NI-SWITCH can choose to ignore status checking for particular properties, regardless of the setting of this property. + + Querying the device status is useful for debugging. After you validate your program, you can set this property to to disable status + checking and maximize performance. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:27:23 PM + NI + False + + + + Gets or sets whether to cache the value of properties. + + + if caching is enabled; otherwise, . + The default value is . + + + If you set this property to , NI-SWITCH tracks the current NI-SWITCH device settings and avoids sending redundant commands to the device. + NI-SWITCH can always cache or never cache particular properties, regardless of the setting of this property. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:26:40 PM + NI + False + + + + Gets the resource name that the NI-SWITCH uses to identify the physical device. + + + Returns a representing the resource descriptor that the user specified for the physical device. + + + If you initialize NI-SWITCH with a logical name, this property contains the resource name that corresponds to the entry in the IVI configuration utility. + If you initialize NI-SWITCH with the resource name, this property contains that value. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:27:00 PM + NI + False + + + + Gets the logical name that you specified when opening the current IVI session. + + Returns a representing the logical name that you specified when opening the current IVI session. + You may pass a logical name to the NI-SWITCH session during initialization of session. The IVI configuration utility must contain an entry for the logical name. + The logical name entry refers to a driver session section in the IVI configuration file. The driver session section specifies a physical device and initial user options. + + The property was accessed after the associated + + object was disposed. + + 11/28/2012 1:27:13 PM + NI + False + + + + Raises the Warning Events. + + Warning Arguments Specifies the details of the warning + + + + Raises IVI Operation Warning Events. + + Passing the GUID code containg the parameter related to warning + + + + Occurs when the driver creates a interchange warning. + + + 5/22/2012 11:07:05 AM + NI + False + + + + + + + + + + + + + Occurs when the driver creates a coercion warning. + + + 5/22/2012 11:04:24 AM + NI + False + + + + + + + + + + Invalidates all properties. + + + The method was accessed after the associated + + object was disposed. + + 10/5/2012 3:49:59 PM + NI + False + + + + Determines whether the test module has dependencies on the operation of previously executed test modules. + + + The interchangeability checking algorithms in the specific driver ignore all previous configuration operations, after calling the function. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:27:47 PM + NI + False + + + Occurs when the NI-SWITCH driver creates a driver warning. + 9/18/2012 3:49:27 PM + NI + False + + + Occurs when the NI-SWITCH driver creates a coercion warning. + 9/18/2012 3:49:38 PM + NI + False + + + Occurs when the NI-SWITCH driver creates a interchange warning. + 9/18/2012 3:49:48 PM + NI + False + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + 12/29/2011 10:24:43 AM + NI + True + + + + + + + + + + 6/1/2011 3:10:00 PM + NI + False + + + + 6/1/2011 3:10:04 PM + NI + False + + + + 6/1/2011 3:11:36 PM + NI + False + + + + 5/21/2012 5:14:30 PM + NI + False + + + + 6/1/2011 3:12:21 PM + NI + False + + + + 6/1/2011 3:12:25 PM + NI + False + + + + 6/1/2011 3:12:29 PM + NI + False + + + + 6/1/2011 4:13:04 PM + NI + False + + + + 6/1/2011 3:12:35 PM + NI + False + + + + Gets or sets how events and callback delegates are invoked. + + + if events and callbacks are invoked through the or + methods; otherwise, events and callbacks are invoked directly. The default value is + . + + Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries + + The property was accessed after the associated + + object was disposed. + + 12/29/2011 10:24:15 AM + NI + True + + + + Defines a class containing a collection of all the channels in the NI-SWITCH driver. The class represents each channel. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 10:51:57 AM + NI + False + + + Gets the number of channels supported by the specified device. + + + Specifies an to indicate the number of channels supported by the specified device. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:04 PM + NI + False + + + + Gets the object which corresponds to the channel name used in the name parameter. + + + Returns the exception when the paramenter name passed is null. + + + Returns the exception when the name is not a valid channel name. + + + Represents the name of the channel in the NI-SWITCH device. + + + Specifies a object of the type + + 10/8/2012 11:45:56 PM + NI + False + + + + Gets the object which corresponds to the channel index used in the index parameter. + + + Represents the index of the channel in the NI-SWITCH device. + + + Specifies a object of the type . + + 9/13/2012 2:47:57 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + Defines the properties which are used to configure the characteristics of a particular channel on a switch device. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 10:51:39 AM + NI + False + + + + Gets or sets a value that specifies whether you want to identify the channel as a source channel. Typically, you set this attribute to when you attach the channel to a power supply, a function generator, or an active measurement point on the unit under test, and you do not want to connect the channel to another source. The driver prevents source channels from connecting to each other. The function returns the + when you attempt to connect two channels that you identify as source channels. + + + if the channel is a source channel; otherwise, . + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:22:34 PM + NI + False + + + + Gets or sets a value that specifies whether to reserve the channel for creating an internal path. A channel that is available for creating the internal path is called a configuration channel. The driver may use configuration channels to create paths between two channels which you specify in the method. Configuration channels are not available for external connections. + Set this attribute to to mark the channel as a configuration channel. Set this attribute to to mark the channel as available for external connections. + After you identify a channel as a configuration channel, you cannot use that channel for external connections. The method returns the + exception when you attempt to establish a connection between a configuration channel and any other channel. + + + if the channel is marked for creating an internal path; otherwise, . + + The was accessed after the associated + + object was disposed. + + 12/5/2012 3:37:17 PM + NI + False + + + + Gets or sets a value that indicates whether an analog bus line is shared, so that multiple NI SwitchBlock devices may connect to it simultaneously. To enable multiple NI SwitchBlock devices to share an analog bus line, set this attribute to for each device on the channel that corresponds with the shared analog bus line. The default value for all devices is , which disables sharing of the analog bus. + + + if the channel is enabled as a shared analog bus line; otherwise, . The default value is . + + + The was accessed after the associated + + object was disposed. + + 12/5/2012 3:28:23 PM + NI + False + + + + Gets the name of the channel as defined in the NI-SWITCH device. + + + Returns the name of the Channel. + + 10/5/2012 12:21:35 PM + NI + False + + + + Gets a object which defines the specific characteristics of a channel. + + + Returns a object. + + 10/30/2012 1:40:39 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + Defines properties used to obtain the characteristics of the NI-SWITCH device. + These attributes are channel-based. The characteristics of all channels in a path determine the characteristics of the path. For example, the maximum current that a path can carry is the minimum of the maximum carry currents of the individual switches in the path. + + + For more information, refer to the NI Switches Help. + 12/12/2012 10:57:07 AM + NI + False + + + + Gets the maximum AC current that the channel can carry. + + Specifies a to indicate the maximum AC current that the channel can carry. + + Returns the value, in Amperes RMS. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:21 PM + NI + False + + + + Gets the maximum AC current that the channel can switch. + + Specifies a to indicate the maximum AC current that the channel can switch. + + Returns the value, in Amperes RMS. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:27 PM + NI + False + + + + Gets the maximum AC power that the channel can carry. + + Specifies a to indicate the maximum AC power that the channel can carry. + + Returns the value, in volt-amperes. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:33 PM + NI + False + + + + Gets the maximum AC power the channel can switch. + + Specifies a to indicate the maximum AC power that the channel can switch. + + Returns the value, in volt-amperes. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:40 PM + NI + False + + + + Gets the maximum AC voltage the channel can switch. + + Specifies a to indicate the maximum AC voltage that the channel can switch. + + Returns the value, in volts RMS. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:45 PM + NI + False + + + + Gets the bandwidth for the channel. + + Specifies a to indicate the bandwidth for the channel. + + Returns the value, in hertz. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:53 PM + NI + False + + + + Gets the maximum DC current the channel can carry. + + Specifies a to indicate the maximum DC current the channel can carry. + + Returns the value, in amperes. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:23:59 PM + NI + False + + + + Gets the maximum DC current that the channel can switch. + + Specifies a to indicate the maximum DC current that the channel can switch. + + Returns the value, in amperes. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:24:05 PM + NI + False + + + + Gets the maximum DC power that the channel can switch. + + Specifies a to indicate maximum DC power that the channel can switch. + + Returns the value, in watts. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:24:21 PM + NI + False + + + + Gets the maximum DC voltage the channel can switch. + + Specifies a to indicate maximum DC voltage the channel can switch. + + Returns the value, in volts. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:24:28 PM + NI + False + + + + Gets or sets the maximum length of time from after you make a connection until the signal flowing through the channel settles. The units are seconds. + NOTE: If you use PXI-2501/2503/2565/2590/2591 the actual delay will always be the greater value of the and the value you specify as the . + + Specifies a to indicate maximum length of time from after you make a connection until the signal flowing through the channel settles. + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:24:46 PM + NI + False + + + + Gets the wire mode of the switch device. + This property affects the values of the and attributes. The actual number of input and output lines on the switch device is fixed, but the number of channels depends on how many lines constitute each channel. + + Specifies an to indicate the wire mode of the switch device. + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:24:54 PM + NI + False + + + + Gets the characteristic impedance for the channel. + + Specifies a to indicate characteristic impedance for the channel. + + Returns the value, in ohms. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:24:36 PM + NI + False + + + + Gets the maximum DC power that the channel can carry. + + Specifies a to indicate the maximum DC power that the channel can carry. + + Returns the value, in watts. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:24:13 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + 5/24/2012 2:48:18 PM + NI + False + + + + Defines the methods and properties that provide information about the inherent characteristics of the NI-SWITCH driver. + + + For more information, refer to NI Switches Help. + + + 12/12/2012 12:28:00 PM + NI + False + + + + Gets or sets a value which indicates whether to power down latching relays after waiting for the relays to settle. + + + if a call to Wait For Debounce ensures that the relays are settled and the latching relays are powered down; otherwise, . + + + The property was accessed after the associated + + object was disposed. + + 11/28/2012 1:29:33 PM + NI + False + + + + Gets the serial number for the switch controlled by NI-SWITCH. + + + Specifies a that indicates the serial number for the switch controlled by the NI-SWITCH driver. + + + If the device does not return a serial number, NI-SWITCH returns the Invalid Attribute error. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:29:48 PM + NI + False + + + + Gets the number of relays. + + + Specifies an which indicates the number of relays. + + + The property was accessed after the associated + + object was disposed. + + 11/28/2012 1:29:17 PM + NI + False + + + + Gets the number of channels on the column of a matrix or scanner. If the switch is a scanner, this value is the number of input channels. + + + Specifies an which indicates the number of channels on the column of a matrix or scanner. + + + The property affects the number of available columns. + + + The property was accessed after the associated + + object was disposed. + + 11/28/2012 1:29:13 PM + NI + False + + + + Gets the number of channels on a row of a matrix or scanner. If the switch is a scanner, this value is the number of output channels. + + + Specifies an which indicates the number of channels on a row of a matrix or scanner. + + + The property affects the number of available columns. + + + The property was accessed after the associated + + object was disposed. + + 11/28/2012 1:29:24 PM + NI + False + + + + Gets the temperature, in degrees Celcius, for the switch module. + + + The property was accessed after the associated + + object was disposed. + + + Specifies a that indicates the temperature, in degrees Celcius, for the switch module. + + 11/28/2012 1:29:40 PM + NI + False + + + + Defines properties and methods which represent the result of the revision query operation. + + + For more information, refer to NI Switches Help. + + + 12/12/2012 12:52:23 PM + NI + False + + + + Gets a string that contains version information about the NI-SWITCH driver. + + + A containing the instrument driver software revision numbers. + + 12/30/2011 5:54:17 PM + NI + True + + + + Gets a string that contains the firmware revision information for the NI-SWITCH instrument that you are currently using. + + + A containing the instrument firmware revision numbers. + + 12/30/2011 5:54:09 PM + NI + True + + + + Determines whether this instance of and the object that you specify are equal. + + The object to be compared to the current instance of . + + if the two instances are equal; otherwise, . + 12/30/2011 5:54:37 PM + NI + True + + + + Determines whether the current instance of and the object that you specify are equal. + + The object to be compared to the current instance of to be compared. + if the two instances are equal; otherwise, . + 12/30/2011 5:55:02 PM + NI + True + + + Checks whether the two instances of are equal. + A object. + + A object. + + if the two instances are equal; otherwise, . + 12/30/2011 5:55:24 PM + NI + True + + + Checks whether the two instances of are unequal. + A object. + A object. + + if the two instances are unequal; otherwise, . + 12/30/2011 5:55:18 PM + NI + True + + + + Returns the hash code for . + + An containing the hash code for . + + 12/30/2011 5:55:11 PM + NI + True + + + + Defines the properties used to configure a switch device using a scan list string. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:28:24 PM + NI + False + + + + This property contains a , which is a string that specifies channel connections and trigger conditions. The function makes or breaks connections and waits for triggers according to the instructions in the . + The is comprised of channel names that you separate with special characters. These special characters determine the operations the scanner performs on the channels when it executes this scan list. + + + + To create a path between two channels, use the following character between the two channel names: + -> (a dash followed by a '>' sign) + Example: "CH1->CH2" tells the switch to make a path from channel CH1 to channel CH2. + + + + + To break or clear a path, use the following character as a prefix before the path: + ~ (tilde) + Example: "~CH1->CH2" tells the switch to break the path from channel CH1 to channel CH2. + + + + + To create a path between two channels, use the following character between the two channel names: + -> (a dash followed by a '>' sign) + Example: "CH1->CH2" tells the switch to make a path from channel CH1 to channel CH2. + + + + + To tell the switch device to create multiple paths simultaneously, use the following character as a separator between the paths: + , (comma) + Example: "A->B;CH1->CH2,CH3->CH4" instructs the scanner to make the path between channels A and B, wait for a trigger, and then simultaneously make the paths between channels CH1 and CH2 and between channels CH3 and CH4. + + + + + + Specifies a that indicates string that specifies channel connections and trigger conditions for scan operation. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:33:27 PM + NI + False + + + + Specifies what happens to existing connections that conflict with the connections you make in a . For example, if CH1 is already connected to CH2 and the instructs the switch to connect CH1 to CH3, this attribute specifies what happens to the connection between CH1 and CH2. + If the value of this attribute is , the switch takes no action on existing paths. If the value is , the switch breaks conflicting paths before making new ones. If the value is , the switch breaks conflicting paths after making new ones. + Most switches support only one of the possible values. In such cases, this attribute serves as an indicator of the device's behavior. + + + The values for the property are defined in . + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:33:36 PM + NI + False + + + + Gets or sets a value that indicates whether a switch device stops scanning at the end of the scan, or continues scanning from the top of the scan list. + Notice that if you set the scan to continuous , the method will always time out and you must call to stop the scan. + + if the switch device stops scanning at the end of the scan, and if the device continues scanning from the top of the scan list. + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:32:35 PM + NI + False + + + + Gets or sets a value which specifies the source of the trigger for which the switch can wait when processing a . The switch waits for a trigger when it encounters a semicolon in a . When the trigger occurs, the switch advances to the next entry in the . + + + The values accepted by this property are defined in . + + + The was accessed after the associated + + object was disposed. + + + + + + : The switch does not wait for a trigger before processing the next entry in the . + + + + + : The switch waits until it receives a trigger from an external source through the "trigger in" connector. + + + + + : The switch waits until you call the method. + + + + + : The switch waits until it receives a trigger on the SCXI or PXI_TRIG0 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the PXI_TRIG1 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the SCXI or PXI_TRIG2 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the PXI_TRIG3 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the PXI_TRIG4 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the PXI_TRIG5 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the PXI_TRIG6 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the PXI_TRIG7 line before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the PXI STAR trigger bus before processing the next entry in the . + + + + + : The switch waits until it receives a trigger on the Rear connector before processing the next entry in the scan list. This value is valid for SCXI scanners that consist of a single device. If more than one device is used, you must use or functions to route a trigger from the connector on another module to one of the TTL lines instead. + + + + + : The switch waits until it receives a trigger on the front connector before processing the next entry in the scan list. When using SCXI scanners, this variable is valid for scanners that consist of a single device. If more than one device is used, you must use the or functions to route a trigger from the connector on another module to one of the TTL lines instead. + + + + + 11/28/2012 1:33:41 PM + NI + False + + + + Gets or sets a value which specifies the method you want to use to notify another instrument that all signals going through the switch have settled following the processing of one entry in the . + + + The values accepted by this property are defined in + + + The was accessed after the associated + + object was disposed. + + + + + + : The switch does not produce a trigger. + + + + + : The switch produces the trigger on the "trigger out" connector. + + + + + : The switch produces the on the SCXI or PXI_TRIG0 line. + + + + + : The switch produces the on the PXI_TRIG1 line. + + + + + : The switch produces the on the SCXI or PXI_TRIG2 line. + + + + + : The switch produces the on the PXI_TRIG3 line. + + + + + : The switch produces the on the PXI_TRIG4 line. + + + + + : The switch produces the on the PXI_TRIG5 line. + + + + + : The switch produces the on the PXI_TRIG6 line. + + + + + : The switch produces the on the PXI_TRIG7 line. + + + + + The switch produces the on the PXI STAR trigger bus. + + + + + : The switch will send its SCANNER ADVANCED output to the front connector. When using SCXI switches as scanners, all the devices that are part of the scanner will send their SCANNER ADVANCED output to their respective front connectors. + + + + + 11/28/2012 1:32:21 PM + NI + False + + + + Gets or sets a value which indicates whether the switch has completed the scan operation. The value indicates that the scan is complete. + + + to indicate that the scan is not complete; otherwise + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:33:03 PM + NI + False + + + + Gets or sets a value which indicates the minimum amount of time, in seconds, the Switch device waits before it asserts the trigger after opening or closing the switch. The switch always before asserting the trigger. + + + Specifies an which indicates the minimum amount of time, in seconds, the SWITCH device waits before it asserts the trigger after opening or closing the switch. The switch always before asserting the trigger. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:32:40 PM + NI + False + + + + In a , a semicolon (;) is used to indicate that at that point in the , the scan engine should pause until a trigger is received from the . If that trigger is user generated through either a hardware pulse or the method, it is necessary for the user to know when the scan engine has reached such a state. + + + the scan engine is waiting for trigger; otherwise + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:33:09 PM + NI + False + + + + Gets or sets a value which indicates whether to apply the pulse width to the . Set the property to to prevent the switch module from being triggered by pulses that are less than 150 ns on PXI trigger lines 0-7. + When this property is set to , noise on the PXI trigger lines might trigger the switch module. If the device triggering the switch module can send pulses greater than 150 ns, do not disable this property. + + + to prevent the switch module from being triggered by pulses that are less than 150 ns on PXI trigger lines 0-7; + otherwise, for noise on the PXI trigger lines might trigger the switch module. If the device triggering the switch module can send pulses greater than 150 ns, do not disable this property. + + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:32:47 PM + NI + False + + + + Gets or sets a value which determines the behavior of the trigger input. + + + The valid values for this property are defined in . + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:33:46 PM + NI + False + + + + Gets or sets a value which specifies how to start handshaking with a measurement device. + + + The values that can be set on this property are defined in . + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:32:54 PM + NI + False + + + + Gets or sets the advance polarity for the scan. + + + The values that can be set for the Advance Polarity are defined in . + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:32:28 PM + NI + False + + + + Takes the provided, programs the switching hardware and initiates the scan. Once initiation is complete, the operation will return. + + + Pass the you want the instrument to use. + + + Use the initiation parameter to specify whether the switch or the measurement device initiates the scan trigger handshake. This parameter determines whether to wait for the scan to reach a trigger point before completing. + If the measurement device initiates the scan, set this parameter to . This method then waits until the switch is waiting for a trigger from the measurement device before completing. + If the switch initiates the scan, set this parameter to . This function then completes immediately after initiating the scan. + You should have already set up your DMM to wait for a trigger before calling this function with Initiation set to . + + The itself is comprised of a list of channel connections separated by semicolons. For example, the following would scan the first three channels of a multiplexer: com0->ch0; com0->ch1; com0->ch2;. Refer to for additional information. To see the status of the scan, you can call either or . Use the method to configure the scan trigger. Use the method to stop the scan if you are in continuous scan mode (Refer to otherwise the scan halts automatically when the end of the scan list is reached. For reference, this operation is equivalent to calling and . + + This exception is used when the driver finds that the given scan list string does not have the correct syntax, or the scan list syntax cannot be implemented by the switch. + + + This exception is used when no explicit path exists between the two channels.. + + + This exception is used when an attempt is made to connect two channels that are already explicitly connected. + + + When an underlying IVI-C driver was called to perform an action, the IVI-C driver action did not succeed. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:34:47 PM + NI + False + + + + Sends a software trigger to the switch specified in the NI-SWITCH session. When the is set to through either the function or the attribute, the scan does not proceed from a semicolon (wait for trigger) until is called. + + + A Send Software Trigger method could not send a software trigger. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:35:20 PM + NI + False + + + + Pauses until the switch stops scanning or until the maximum time has elapsed, when NI-SWITCH returns a timeout error. + + Specifies the maximum length of time to wait for the switch module to stop scanning. If the specified time elapses before the scan ends, a MaxTimeExceededException is returned. The default value is 5000 ms. + + + The operation implemented by the method did not complete within the maximum time allowed. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:35:31 PM + NI + False + + + + Configures the and used for scanning. + Refer to Switch Device Help to determine if the switch module supports scanning. + The is comprised of a list of channel connections separated by semicolons. For example, the following scan list will scan the first three channels of a multiplexer: + com0->ch0; com0->ch1; com0->ch2; + Refer to for more information on scan list syntax. + To see the status of the scan, call either or . Use the method to configure the scan trigger. Use the method to start the scan. + + + The scan list to use. NI-SWITCH uses this value to set the attribute. + + + Specifies how the switch module breaks existing connections when scanning. The driver uses this value to set the attribute. Refer to for more information. The default value is . + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:34:06 PM + NI + False + + + + Configures the scan triggers for the scan list established with . + Refer to Device Help to determine if the switch module supports scanning. + sets the location that the switch expects to receive an input trigger to advance through the . This method also sets the location where it outputs a scan advanced signal after it completes an entry in the scan list. + + + The minimum length of time you want the switch to wait after it creates a path until it asserts a trigger on the scan advanced output line. The driver uses this value to set the attribute. The is in addition to the . + Express this value in seconds. The default value is 0.0 s. + + + Trigger source you want the switch module to use during scanning. The driver uses this value to set the attribute. The switch waits for the trigger you specify when it encounters a semicolon in the scan list. When the trigger occurs, the switch advances to the next entry in the scan list. Refer to for a list of valid values. + + + Output destination of the scan advanced trigger signal. NI-SWITCH uses this value to set the attribute. After the switch processes each entry in the scan list, it waits the length of time you specify in the parameter and then asserts a trigger on the line you specify with this parameter. Refer to for a list of valid values + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:34:12 PM + NI + False + + + + Routes the from the front or rear connector to a trigger bus line (TTLx). To disconnect the route, call this function again and specify for trigger bus line parameter. + + + The location of the source on the switch module. Valid Values are defined in . The default value is . + + + The trigger line to route the . Select to break an existing route. + Valid Values are defined in . + + + If , inverts the input trigger signal from falling to rising or vice versa. The default value is . + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:34:39 PM + NI + False + + + + Routes the from a trigger bus line (TTLx) to the front or rear connector. + + + The scan advanced output trigger destination. + The values are defined in . + + + The trigger line to route the from the front or rear connector. Select to break an existing route. + The Valid Values for this is defined in .: + + + If inverts the input trigger signal from falling to rising or vice versa. The default value is . + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:34:32 PM + NI + False + + + + Aborts the scan in progress. + Initiate a scan with . + If the switch module is not scanning, + exception is returned. + + + This exception is used when the driver expects that the switch is currently scanning through the scan list, but it is not. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:33:56 PM + NI + False + + + + Commits the configured and trigger settings to hardware and initiates the scan. If was called earlier, only initiates the scan and returns immediately. + Once the scanning operation begins, you cannot perform any other operation other than GetAttribute, , or . All other functions return the Exception. + To stop the scanning operation, call . + + + This exception is used when no scan list is specified. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:34:22 PM + NI + False + + + + Downloads the configured and trigger settings to hardware. + + + Calling this method is optional. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:28:05 PM + NI + False + + + + 5/25/2012 12:32:47 PM + NI + False + + + + 5/25/2012 4:43:36 PM + NI + False + + + + 5/25/2012 4:43:44 PM + NI + False + + + + 5/25/2012 4:43:49 PM + NI + False + + + + 5/25/2012 12:32:43 PM + NI + False + + + + 5/25/2012 4:43:54 PM + NI + False + + + + 5/25/2012 12:32:56 PM + NI + False + + + + 5/25/2012 12:33:06 PM + NI + False + + + + 5/25/2012 12:33:11 PM + NI + False + + + + 5/25/2012 12:33:16 PM + NI + False + + + + 5/25/2012 12:33:24 PM + NI + False + + + + 5/25/2012 12:33:36 PM + NI + False + + + + 5/25/2012 12:33:41 PM + NI + False + + + + 5/25/2012 4:44:00 PM + NI + False + + + + 5/25/2012 4:44:05 PM + NI + False + + + + Defines properties and methods which are used to connect and disconnect two channels. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:28:05 PM + NI + False + + + + Gets a value which indicates whether the entire NI-SWITCH device has settled since the last switching command. + + + if all signals going through the NI-SWITCH device are valid; otherwise, . + + + The property was accessed after the associated + + object was disposed. + + 11/28/2012 1:29:57 PM + NI + False + + + + Verifies that you can create a path between channel1 and channel2. + + + Indicates one of the channel name of the desired path. + + + Indicates the name of the other channel name of the desired path. + + + Returns a object indicating whether a path is valid. + + + If a path is possible in the switch module, the availability of that path is returned given the existing connections. If the path is possible but in use, an warning is returned. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:30:07 PM + NI + False + + + + Creates a path between channel1 and channel2. + + + Indicates one of the channel name of the desired path. + + + Indicates the name of the other channel name of the desired path. + + + The two channels are already explicitly connected by calling either the or methods. + + + One of the channels is a configuration channel. + + + Both channels are connected to a different source. + + + channel1 and channel2 are one and the same channel + + + Driver cannot find a path between the two channels. + + + A repeated capability selector is expected, but the driver does not recognise the provided name. + + + When an underlying IVI-C driver was called to perform an action, the IVI-C driver action did not succeed. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:30:15 PM + NI + False + + + + Creates connections between the channels that you specify in connectionList. + Specify connections with two endpoints only or the explicit path between two endpoints. + + + Specifies a list of connections between channels to make. + NI-SWITCH validates the connection list, and aborts execution of the list if errors are returned. + + + If the two channels are already connected. + + + If a channel is a configuration channel. Error elaboration contains information about which of the two channels is a configuration channel. + + + If two channels in a single connection are connected to a different source. Error elaboration contains + information about the connection channel with errors. + + + If two channels in a single connection are the same channel. + + + If the driver cannot find a path between two channels. + + + The was accessed after the associated + + object was disposed. + + 7/9/2013 2:01:03 PM + NI + False + + + + Destroys the path between two channels that you create using the or methods. + + + Indicates one of the channel name of the path to break. + + + Indicates the name of the other channel name of the path to break. + + + A repeated capability selector is expected, but the driver does not recognise the provided name. + + + When an underlying IVI-C driver was called to perform an action, the IVI-C driver action did not succeed. + + + The was accessed after the associated + + object was disposed. + + 10/5/2012 5:48:18 PM + NI + False + + + + Breaks the connections between channels specified in disconnection list. If no connections exist between channels, NI-SWITCH returns an error. + + + Specifies a list of connections between channels to break. NI-SWITCH + validates the disconnection list, and aborts execution of the list if errors are returned. + + + A repeated capability selector is expected, but the driver does not recognise the provided name. + + + No path exists between two channels. + + + The was accessed after the associated + + object was disposed. + + 7/9/2013 2:24:45 PM + NI + False + + + + Breaks all existing paths. + + + If the switch module cannot break all paths, the warning is returned. + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:30:26 PM + NI + False + + + + Pauses until all created paths have settled. + + + Specifies the maximum length of time to wait for all relays in the switch module to activate or deactivate. + + + maximumTime parameter elapses before the switch paths settle + + + The was accessed after the associated + + object was disposed. + + 11/28/2012 1:31:11 PM + NI + False + + + + Connects two channels by specifying an explicit path in the pathList parameter, which is an array of with the source channel as the first element and the destination channel as the next element. + + + A string composed of comma-separated paths will be built from the channels in the array. For example, for the array {"ch0", "com0", "ab0"}, the built string is "ch0->com0, com0->ab0". + + + Represents an array of indicating paths between source channel (channel 1) and destination channel (channel 2). The first and last names in the path are the endpoints of the path. Every other channel in the path are configuration channels. + + + This exception is used when an attempt is made to connect two channels that are already explicitly connected. + + + This exception is used when the driver detects an attempt to explicitly connect to a configuration channel. + + + This exception is used when an attempt is made to connect two channels that are both sources. + + + This exception is used when an attempt is made to connect two channels which cannot be directly connected. + + + This exception is used when the driver finds that one of the channels in the path is a configuration channel that is in use. + + + This exception is used when the driver expects to find a path between two channels, but the path is not found. + + + This exception is used when the driver detects that a channel name is duplicated in the path. + + + When an underlying IVI-C driver was called to perform an action, the IVI-C driver action did not succeed. + + + See the MSDN documentation for System.ArgumentNullException. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:30:47 PM + NI + False + + + + Returns a that identifies the explicit path created with . + + + Indicates one of the channel name of the desired path. + + + Indicates the name of the other channel name of the desired path. + + + Returns a that identifies the path between the desired two channels. + + + This exception is used when no explicit path exists between the two channels.. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:30:35 PM + NI + False + + + + 5/22/2012 1:49:02 PM + NI + False + + + + 5/22/2012 1:49:14 PM + NI + False + + + + 5/22/2012 1:49:19 PM + NI + False + + + + 5/22/2012 1:49:25 PM + NI + False + + + + 5/22/2012 1:49:29 PM + NI + False + + + + 5/22/2012 1:49:53 PM + NI + False + + + + 5/22/2012 1:49:34 PM + NI + False + + + + 5/22/2012 1:49:40 PM + NI + False + + + + Defines synchronization locks obtained on the NI-SWITCH session. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:15:30 PM + NI + False + + + + Constructs an NI-SWITCH driver lock. + + + Specifies the base interface for synchronization locks obtained on the driver session. + + 10/9/2012 12:22:41 AM + NI + False + + + + Releases a driver synchronization lock. + + 1/13/2012 3:54:35 PM + NI + True + + + + Defines the methods that provide a basic set of utility operations. + + + For more information, refer to NI Switches Help. + + + 12/12/2012 12:27:44 PM + NI + False + + + + Reads an error code and a message from the instrument error queue. + + + Returns a object. + + NI-SWITCH does not have an error queue, so this method never returns any errors. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:28:17 PM + NI + False + + + + Verifies that NI-SWITCH device can communicate with the switch. + + + Returns a object. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:28:58 PM + NI + False + + + + Places the instrument in a quiescent state as quickly as possible. + + + In a quiescent state, an instrument has minimal or no effect on the external system to which it is connected. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:28:11 PM + NI + False + + + + Resets the switch module and applies initial settings from the logical name which you used to initialize the session. If the session was created without a logical name, this method is equivalent to + . + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:28:46 PM + NI + False + + + + Returns the revision number of the NI-SWITCH driver. + + + An object of type . + + + + was called after the associated + + or + + object was disposed. + + + The underlying NI-SWITCH driver returned an error. + + + + + Acquires a synchronization lock on this instance of the NI-SWITCH driver. + + + Returns an object of type as a reference to the acquired lock. + + + The method was accessed after the associated + + object was disposed. + + 5/30/2012 4:44:23 PM + NI + False + + + + Acquires a synchronization lock on this instance of the NI-SWITCH driver. + + + Returns an object of type as a reference to the acquired lock. + + + Specifies the maximum amount of time to wait to acquire the lock. + + + The method was accessed after the associated + + object was disposed. + + 5/30/2013 6:28:23 PM + NI + False + + + + Disconnects all created paths and returns the switch module to the initialization state. + + + Configuration channel and source channel settings remain unchanged. + + + The method was accessed after the associated + + object was disposed. + + 11/28/2012 1:28:38 PM + NI + False + + + + 5/30/2013 1:28:31 PM + NI + False + + + + 5/30/2013 6:19:53 AM + NI + False + + + + Defines the values required for the property. + + 11/5/2012 1:09:40 PM + NI + False + + + + Specifies no implicit action on connections when scanning. + + 10/22/2012 4:05:45 PM + NI + False + + + + Specifies that the switch device breaks existing connections before making new connections. + + 10/22/2012 4:05:24 PM + NI + False + + + + Specifies that the switch device breaks existing connections after making new connections. + + 10/22/2012 4:05:12 PM + NI + False + + + + Defines properties that indicate all the values for trigger source that you want the switch module to use during switch scanning operation. The switch waits for the trigger you specify when it encounters a semicolon in the scan list. When the trigger occurs, the switch advances to the next entry in the scan list. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:51:45 PM + NI + False + + + + Gets a value corresponding to an immediate trigger. The switch does not wait for a trigger before processing the next entry in the scan list. + + + Returns the corresponding to the Immediate trigger. + + 11/5/2012 1:47:32 PM + NI + False + + + + Gets a value corresponding to a trigger from an external source through the external trigger input before processing the next entry in the scan list. + + + Returns the corresponding to the External trigger. + + 11/5/2012 1:46:36 PM + NI + False + + + + Gets a value which indicates that the switch waits until you call the method before processing the next entry in the scan list. + + + Returns the corresponding to the Software trigger. + + 11/5/2012 1:48:31 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG0 line. The switch waits until it receives a trigger on the PXI_TRIG0 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl0 trigger. + + 11/5/2012 1:51:25 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG1 line. The switch waits until it receives a trigger on the PXI_TRIG1 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl1 trigger. + + 11/5/2012 1:51:42 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG2 line. The switch waits until it receives a trigger on the PXI_TRIG2 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl2 trigger. + + 11/5/2012 1:51:50 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG3 line. The switch waits until it receives a trigger on the PXI_TRIG3 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl3 trigger. + + 11/5/2012 1:51:59 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG4line. The switch waits until it receives a trigger on the PXI_TRIG4 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl4 trigger. + + 11/5/2012 1:52:17 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG5 line. The switch waits until it receives a trigger on the PXI_TRIG5 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl5 trigger. + + 11/5/2012 1:52:27 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG6 line. The switch waits until it receives a trigger on the PXI_TRIG6 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl6 trigger. + + 11/5/2012 1:52:39 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG7 line. The switch waits until it receives a trigger on the PXI_TRIG7 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl7 trigger. + + 11/5/2012 1:52:49 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI star trigger bus before processing the next entry in the scan list. + + + Returns the corresponding to the PxiStar trigger. + + 11/5/2012 1:47:35 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector. + + + Returns the corresponding to the FrontConnector Trigger. + + 11/5/2012 1:46:49 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector. + + + Returns the corresponding to the RearConnector trigger. + + 11/5/2012 1:47:39 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 1. + + + Returns the corresponding to the RearConnectorModule1 trigger. + + 11/5/2012 1:47:42 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 2. + + + Returns the corresponding to the RearConnectorModule2 trigger. + + 11/5/2012 1:47:56 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 3. + + + Returns the corresponding to the RearConnectorModule3 trigger. + + 11/5/2012 1:48:01 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 4. + + + Returns the corresponding to the RearConnectorModule4 trigger. + + 11/5/2012 1:48:05 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 5. + + + Returns the corresponding to the RearConnectorModule5 trigger. + + 11/5/2012 1:48:09 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 6. + + + Returns the corresponding to the RearConnectorModule6 trigger. + + 11/5/2012 1:48:13 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 7. + + + Returns the corresponding to the RearConnectorModule7 trigger. + + 11/5/2012 1:48:16 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 8. + + + Returns the corresponding to the RearConnectorModule8 trigger. + + 11/5/2012 1:48:19 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 9. + + + Returns the corresponding to the RearConnectorModule9 trigger. + + 11/5/2012 1:48:25 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 10. + + + Returns the corresponding to the RearConnectorModule10 trigger. + + 11/5/2012 1:47:46 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 11. + + + Returns the corresponding to the RearConnectorModule11 trigger. + + 11/5/2012 1:47:50 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector module 12. + + + Returns the corresponding to the RearConnectorModule12 trigger. + + 11/5/2012 1:47:53 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 1. + + + Returns the corresponding to the FrontConnectorModule1 Trigger. + + 11/5/2012 1:46:52 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 2. + + + Returns the corresponding to the FrontConnectorModule2 trigger. + + 11/5/2012 1:47:03 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 3. + + + Returns the corresponding to the FrontConnectorModule3 trigger. + + 11/5/2012 1:47:06 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 4. + + + Returns the corresponding to the FrontConnectorModule4 trigger. + + 11/5/2012 1:47:09 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 5. + + + Returns the corresponding to the FrontConnectorModule5 trigger. + + 11/5/2012 1:47:13 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 6. + + + Returns the corresponding to the FrontConnectorModule6 trigger. + + 11/5/2012 1:47:16 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 7. + + + Returns the corresponding to the FrontConnectorModule7 trigger. + + 11/5/2012 1:47:22 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 8. + + + Returns the corresponding to the FrontConnectorModule8 trigger. + + 11/5/2012 1:47:25 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 9. + + + Returns the corresponding to the FrontConnectorModule9 trigger. + + 11/5/2012 1:47:29 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 10. + + + Returns the corresponding to the FrontConnectorModule10 trigger. + + 11/5/2012 1:46:55 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 11. + + + Returns the corresponding to the FrontConnectorModule11 trigger. + + 11/5/2012 1:46:58 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector module 12. + + + Returns the corresponding to the FrontConnectorModule12 trigger. + + 11/5/2012 1:47:01 PM + NI + False + + + + Defines properties that indicate the output destination of the scan advanced trigger signal. + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:28:30 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI star trigger bus before processing the next entry in the scan list. + + + Returns the corresponding to the PxiStar trigger. + + 11/5/2012 1:47:35 PM + NI + False + + + + Gets a value that indicates no implicit action on scanning connections. + + + Returns the corresponding to the None trigger. + + 11/5/2012 1:43:58 PM + NI + False + + + + Gets a value for the external trigger. The switch waits until it receives a trigger from an external source through the external trigger input before processing the next entry in the scan list. + + + Returns the corresponding to the external trigger. + + 11/5/2012 1:42:33 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG0 line. The switch waits until it receives a trigger on the PXI_TRIG0 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl0 trigger. + + 11/5/2012 1:44:50 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG1 line. The switch waits until it receives a trigger on the PXI_TRIG1 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl1 trigger. + + 11/5/2012 1:44:54 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG2 line. The switch waits until it receives a trigger on the PXI_TRIG2 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl2 trigger. + + 11/5/2012 1:44:57 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG3 line. The switch waits until it receives a trigger on the PXI_TRIG3 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl3 trigger. + + 11/5/2012 1:45:03 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG4 line. The switch waits until it receives a trigger on the PXI_TRIG4 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl4 trigger. + + 11/5/2012 1:45:08 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG5 line. The switch waits until it receives a trigger on the PXI_TRIG5 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl5 trigger. + + 11/5/2012 1:45:12 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG6 line. The switch waits until it receives a trigger on the PXI_TRIG6 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl6 trigger. + + 11/5/2012 1:45:16 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG7 line. The switch waits until it receives a trigger on the PXI_TRIG7 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl7 trigger. + + 11/5/2012 1:45:23 PM + NI + False + + + + Gets a value corresponding to the FrontConnector trigger. The switch waits until it receives a trigger on the front connector. + + + Returns the corresponding to the FrontConnector trigger. + + 11/5/2012 1:42:41 PM + NI + False + + + + Gets a value corresponding to the RearConnector trigger. The switch waits until it receives a trigger on the rear connector. + + + Returns the corresponding to the RearConnector trigger. + + 11/5/2012 1:44:01 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule1 trigger. The switch waits until it receives a trigger on the rear connector module 1. + + + Returns the corresponding to the RearConnectorModule1 Trigger. + + 11/5/2012 1:44:10 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule2 trigger.The switch waits until it receives a trigger on the rear connector module 2. + + + Returns the corresponding to the RearConnectorModule2 trigger. + + 11/5/2012 1:44:20 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule3 trigger. The switch waits until it receives a trigger on the rear connector module 3. + + + Returns the corresponding to the RearConnectorModule3 trigger. + + 11/5/2012 1:44:23 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule4 trigger. The switch waits until it receives a trigger on the rear connector module 4. + + + Returns the corresponding to the RearConnectorModule4 Trigger. + + 11/5/2012 1:44:26 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule5 trigger. The switch waits until it receives a trigger on the rear connector module 5. + + + Returns the corresponding to the RearConnectorModule5 trigger. + + 11/5/2012 1:44:29 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule6 trigger. The switch waits until it receives a trigger on the rear connector module 6. + + + Returns the corresponding to the RearConnectorModule6 trigger. + + 11/5/2012 1:44:32 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule7 trigger. The switch waits until it receives a trigger on the rear connector module 7. + + + Returns the corresponding to the RearConnectorModule7 trigger. + + 11/5/2012 1:44:37 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule8 trigger. The switch waits until it receives a trigger on the rear connector module 8. + + + Returns the corresponding to the RearConnectorModule8 trigger. + + 11/5/2012 1:44:41 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule9 trigger. The switch waits until it receives a trigger on the rear connector module 9. + + + Returns the corresponding to the RearConnectorModule9 trigger. + + 11/5/2012 1:44:45 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule10 trigger.The switch waits until it receives a trigger on the rear connector module 10. + + + Returns the corresponding to the RearConnectorModule10 trigger. + + 11/5/2012 1:44:05 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule11 trigger.The switch waits until it receives a trigger on the rear connector module 11. + + + Returns the corresponding to the RearConnectorModule11 trigger. + + 11/5/2012 1:44:13 PM + NI + False + + + + Gets a value corresponding to the RearConnectorModule12 trigger. The switch waits until it receives a trigger on the rear connector module 12. + + + Returns the corresponding to the RearConnectorModule12 trigger. + + 11/5/2012 1:44:16 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule1 trigger. The switch waits until it receives a trigger on the front connector module 1. + + + Returns the corresponding to the FrontConnectorModule1 trigger. + + 11/5/2012 1:42:49 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule2 trigger. The switch waits until it receives a trigger on the front connector module 2. + + + Returns the corresponding to the FrontConnectorModule2 trigger. + + 11/5/2012 1:43:14 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule3 trigger. The switch waits until it receives a trigger on the front connector module 3. + + + Returns the corresponding to the FrontConnectorModule3 trigger. + + 11/5/2012 1:43:18 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule4 trigger. The switch waits until it receives a trigger on the front connector module 4. + + + Returns the corresponding to the FrontConnectorModule4 trigger. + + 11/5/2012 1:43:24 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule5 trigger. The switch waits until it receives a trigger on the front connector module 5. + + + Returns the corresponding to the FrontConnectorModule5 trigger. + + 11/5/2012 1:43:31 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule6 trigger. The switch waits until it receives a trigger on the front connector module 6. + + + Returns the corresponding to the FrontConnectorModule6 trigger. + + 11/5/2012 1:43:34 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule10 trigger. The switch waits until it receives a trigger on the front connector module 7. + + + Returns the corresponding to the FrontConnectorModule7 trigger. + + 11/5/2012 1:43:38 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule8 trigger. The switch waits until it receives a trigger on the front connector module 8. + + + Returns the corresponding to the FrontConnectorModule8 trigger. + + 11/5/2012 1:43:49 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule10 trigger. The switch waits until it receives a trigger on the front connector module 9. + + + Returns the corresponding to the FrontConnectorModule9 trigger. + + 11/5/2012 1:43:54 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule10 trigger. The switch waits until it receives a trigger on the front connector module 10. + + + Returns the corresponding to the FrontConnectorModule10 trigger. + + 11/5/2012 1:43:03 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule11 trigger. The switch waits until it receives a trigger on the front connector module 11. + + + Returns the corresponding to the FrontConnectorModule11 trigger. + + 11/5/2012 1:43:06 PM + NI + False + + + + Gets a value corresponding to the FrontConnectorModule12 trigger. The switch waits until it receives a trigger on the front connector module 12. + + + Returns the corresponding to the FrontConnectorModule12 trigger. + + 11/5/2012 1:43:10 PM + NI + False + + + + Indicates whether the relay is open or closed. + + 5/23/2012 2:36:29 PM + NI + False + + + + Indicates that the relay is in a open position. + + 5/23/2012 2:37:14 PM + NI + False + + + + Indicates that the relay is in a close position. + + 5/23/2012 2:37:22 PM + NI + False + + + + Specifies whether to open or close a given relay. + + 5/23/2012 2:33:21 PM + NI + False + + + + Specifies that you need to open the relay. + + 10/22/2012 3:51:20 PM + NI + False + + + + Specifies that you need to close the relay. + + 10/22/2012 3:51:02 PM + NI + False + + + + Defines the values for the different types of intiation for . + + 11/9/2012 1:31:21 PM + NI + False + + + + Specifies that the Switch device initiates scanning. + + 11/5/2012 1:03:57 PM + NI + False + + + + Specifies that the measurement device initiates scanning. + + 11/5/2012 1:03:37 PM + NI + False + + + + Defines properties which indicate the location of the input trigger source on the switch module + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:51:57 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector. + + + Returns the corresponding to the FrontConnector trigger. + + 11/5/2012 1:50:38 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector. + + + Returns the corresponding to the RearConnector trigger. + + 11/5/2012 1:50:47 PM + NI + False + + + + Defines properties that indicate the trigger line to route the input trigger. + + + Select to break an existing route. + For more information, refer to NI Switches Help. + + + 12/12/2012 12:51:51 PM + NI + False + + + + Gets a value which indicates no implicit action on connections when scanning. + + + Returns the corresponding to the None trigger. + + 11/5/2012 1:49:58 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG0 line. The switch waits until it receives a trigger on the PXI_TRIG0 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl0 trigger. + + 11/5/2012 1:53:07 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG1 line. The switch waits until it receives a trigger on the PXI_TRIG1 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl1 trigger. + + 11/5/2012 1:53:18 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG2 line. The switch waits until it receives a trigger on the PXI_TRIG2 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl2 trigger. + + 11/5/2012 1:53:28 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG3 line. The switch waits until it receives a trigger on the PXI_TRIG3 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl3 trigger. + + 11/5/2012 1:53:38 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG4 line. The switch waits until it receives a trigger on the PXI_TRIG4 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl4 trigger. + + 11/5/2012 1:53:43 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG5 line. The switch waits until it receives a trigger on the PXI_TRIG5 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl5 trigger. + + 11/5/2012 1:53:54 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG6 line. The switch waits until it receives a trigger on the PXI_TRIG6 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl6 trigger. + + 11/5/2012 1:54:06 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG7 line. The switch waits until it receives a trigger on the PXI_TRIG7 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl7 trigger. + + 11/5/2012 1:54:29 PM + NI + False + + + + Defines properties that indicate the scan advanced output trigger destination used in . + + + + For more information, refer to NI Switches Help. + + 12/12/2012 12:51:40 PM + NI + False + + + + Gets a value corresponding to a trigger on the front connector. + + + Returns the corresponding to the FrontConnector trigger. + + 11/5/2012 1:46:26 PM + NI + False + + + + Gets a value corresponding to a trigger on the rear connector. + + + Returns the corresponding to the RearConnector trigger. + + 11/5/2012 1:46:30 PM + NI + False + + + + Defines properties that indicate the trigger line to route the scan advanced output trigger from the front or rear connector. + + + Select to break an existing route. + For more information, refer to NI Switches Help. + + + 12/12/2012 12:29:38 PM + NI + False + + + + Gets a value that indicates no implicit action on scanning connections. + + + Returns the corresponding to the None trigger. + + 11/5/2012 2:51:29 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG0 line. The switch waits until it receives a trigger on the PXI_TRIG0 line before processing the next entry in the scan list. + + Returns the corresponding to the Ttl0 trigger. + + 11/5/2012 1:45:34 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG1 line. The switch waits until it receives a trigger on the PXI_TRIG1 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl1 trigger. + + 11/5/2012 1:45:38 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG2 line. The switch waits until it receives a trigger on the PXI_TRIG2 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl2 trigger. + + 11/5/2012 1:45:42 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG3 line. The switch waits until it receives a trigger on the PXI_TRIG3 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl3 trigger. + + 11/5/2012 1:45:46 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG4 line. The switch waits until it receives a trigger on the PXI_TRIG4 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl4 trigger. + + 11/5/2012 1:45:50 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG5 line. The switch waits until it receives a trigger on the PXI_TRIG5 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl5 trigger. + + 11/5/2012 1:45:54 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG6 line. The switch waits until it receives a trigger on the PXI_TRIG6 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl6 trigger. + + 11/5/2012 1:45:57 PM + NI + False + + + + Gets a value corresponding to a trigger on the PXI_TRIG7 line. The switch waits until it receives a trigger on the PXI_TRIG7 line before processing the next entry in the scan list. + + + Returns the corresponding to the Ttl7 trigger. + + 11/5/2012 1:46:07 PM + NI + False + + + + Specifies the values. + + 9/13/2012 2:09:22 PM + NI + False + + + + Specifies that the trigger occurs on the rising edge of the signal. + + 10/22/2012 2:36:54 PM + NI + False + + + + Specifies that the trigger occurs on the falling edge of the signal. + + 10/22/2012 2:36:48 PM + NI + False + + + + Defines properties and methods that are common to all sub-object NI-SWITCH classes. + + + + Contains members that are common to all sub-object NI-SWITCH classes. + + 10/26/2012 1:32:19 PM + NI + False + + + + Defines the topology name you want to use for the NI-SWITCH device. See the constructor which takes the topology as one of the parameters in the class for more information about topologies. + + + For more information, refer to NI Switches Help. + + + 12/12/2012 10:57:55 AM + NI + False + + + + Gets a value that indicates the last topology that was configured for the device in MAX. + + + Returns a which represents the last topology that was configured for the device in MAX. + + 12/14/2012 4:37:48 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1127 as a 1-wire 64x1 multiplexer, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:00:07 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1127 as a 2-wire 32x1 multiplexer, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:00:15 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1127 containing a 2-wire 4x8 matrix, while connecting your signals using the NI SCXI-1332 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:00:20 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1127 containing a 4-wire 16x1 matrix, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:00:25 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1127 in the independent topology, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:00:39 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1128 as a 1-wire 64x1 multiplexer, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:01:00 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1128 as a 2-wire 32x1 multiplexer, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:01:05 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1128 containing a 2-wire 4x8 matrix, while connecting your signals using the NI SCXI-1332 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:01:09 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1128 as a 4-wire 16x1 matrix, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:01:15 PM + NI + False + + + + Gets a value that uses the independent topology, while connecting your signals using the NI SCXI-1331 terminal block. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:01:41 PM + NI + False + + + + Gets a value that indicates a topology which uses the SCXI-1129 containing a 16x16 matrix. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:01:48 PM + NI + False + + + + Gets a value that indicates a topology which uses the SCXI-1129 containing a 8x32 matrix. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:02:43 PM + NI + False + + + + Gets a value that indicates a topology which uses the SCXI-1129 containing a 4x64 matrix. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:02:18 PM + NI + False + + + + Gets a value that indicates a topology which uses the SCXI-1129 containing two banks of 8x16 matrices. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:03:26 PM + NI + False + + + + Gets a value that indicates a topology which uses the SCXI-1129 containing two 4x32 matrices. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:03:22 PM + NI + False + + + + Gets a value that indicates a topology which uses the SCXI-1129 containing four banks of 4x16 matrices. + + + Returns a + representing the topology of the device for the session. + + 10/30/2012 2:03:30 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 1-wire 256x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:03:35 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 1-wire 128x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:03:51 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 2-wire 128x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:06 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 4-wire quad 64x1 multiplexer. + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:22 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 1-wire 4x64 matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:03:39 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 1-wire 8x32 matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:03:43 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 1-wire octal 32x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:03:56 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 1-wire quad 64x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:03:59 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as sixteen independent 1-wire 16x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:03 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 2-wire 4x32 matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:09 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 2-wire octal 16x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:12 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 2-wire quad 32x1 multiplexer. + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:17 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1130 as a 4-wire quad 16x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:26 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1130 in the independent topology, while connecting your signals using the NI SCXI-1377 terminal block. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:30 PM + NI + False + + + + Gets a value that indicates a the NI SCXI-1160 in the 16-SPDT general purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:35 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1161 in the 8-SPDT general purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:39 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1163R in the octal 4x1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:04:48 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1166 in the 32-SPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:10 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI SCXI-1166 in the 16-DPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:06 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1167 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:14 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1169 in the 100-SPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:19 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1169 in the 50-SPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:23 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1175 in the 1-wire 196x1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:28 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1175 in the 2-wire 98x1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:39 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1175 in the 2-wire 95x1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:34 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1190 in the quad 4x1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:43 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1191 in the quad 4x1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:47 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1192 in the 8-SPDT general-purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:51 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1193 in the 32x1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:03 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1193 in the dual 16x1 multiplexer topology. + + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:14 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1193 in the quad 8x1 multiplexer topology. + + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:33 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1193 16x1 in the terminated multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:13:55 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1193 in the dual 8x1 terminated multiplexer topology. + + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:17 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1193 in the quad 4x1 terminated multiplexer topology. + + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:28 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1193 in the independent topology. + + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:23 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1194 in the quad 4x1 multiplexer topology. + + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:39 PM + NI + False + + + + Gets a value that indicates the NI SCXI-1195 in the quad 4x1 multiplexer topology. + + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:43 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2501 as a 1-wire 48x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:51 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2501 as a 1-wire 48x1 amplified multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:47 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2501 as a 2-wire 24x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:00 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2501 as a 2-wire 24x1 amplified multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:14:55 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2501 as a 2-wire dual 12x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:13 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2501 as a 2-wire quad 6x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:18 PM + NI + False + + + + Use this topology, when using the NI PXI-2501 as a + 2-wire 4x6 matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:09 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2501 as a 4-wire 12x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:22 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2503 as a 1-wire 48x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:25 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2503 as a 2-wire 24x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:30 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2503 as a 2-wire dual 12x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:27 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2503 as a 2-wire quad 6x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:31 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2503 as a 2-wire 4x6 matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:15:35 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2503 as a 4-wire 12x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:34 PM + NI + False + + + + Gets a value that indicates the NI PXI-2510 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:39 PM + NI + False + + + + Gets a value that indicates the NI PXI-2512 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:43 PM + NI + False + + + + Gets a value that indicates the NI PXI-2514 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:46 PM + NI + False + + + + Gets a value that indicates the NI PXI-2515 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:50 PM + NI + False + + + + Gets a value that indicates the NI PXI-2520 in the 80 SPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:16:57 PM + NI + False + + + + Gets a value that indicates the NI PXI-2521 in the 40 DPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:02 PM + NI + False + + + + Gets a value that indicates the NI PXI-2522 in the 53 SPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:07 PM + NI + False + + + + Gets a value that indicates the NI PXI-2523 in the 26 DPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:12 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2527 as a 1-wire 64x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:18 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2527 as a 1-wire dual 32x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:34 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2527 as a 2-wire 32x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:38 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2527 as a 2-wire dual 16x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:42 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2527 as a 4-wire 16x1 multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:45 PM + NI + False + + + + Gets a value that indicates the NI PXI-2527 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:49 PM + NI + False + + + + Gets a value that indicates the NI PXI-2529 as a 2-wire 8x16 matrix topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:57 PM + NI + False + + + + Gets a value that indicates the NI PXI-2529 as a 2-wire 4x32 matrix topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:17:53 PM + NI + False + + + + Gets a value that indicates the NI PXI-2529 as a 2-wire dual 4x16 + matrix topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:02 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 1-wire 128x1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:07 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 1-wire dual 64x1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:20 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 2-wire 64x1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:36 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 4-wire 32x1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:03 PM + NI + False + + + + Gets a value that indicates the NI PXI-2530 as a 1-wire 4x32 matrix topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:11 PM + NI + False + + + + Gets a value that indicates the NI PXI-2530 as a 1-wire 8x16 + matrix topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:16 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 1-wire octal 16x1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:24 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 1-wire quad 32x1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:28 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 2-wire 4×16 + matrix topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:32 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 2-wire dual 32×1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:47 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 2-wire quad 16×1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:18:56 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2530 as a 4-wire dual 16×1 + multiplexer. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:07 PM + NI + False + + + + Gets a value that uses the NI PXI-2530 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:11 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2531 as a 1-wire 4×128 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:15 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2531 as a 1-wire 8×64 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:19 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2531 as a 1-wire dual 4×64 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:24 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2531 as a 1-wire dual 8×32 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:28 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire 16×32 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:31 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire 4×128 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:35 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire 8×64 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:39 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire dual 16×16 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:43 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire dual 4×64 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:47 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire dual 8×32 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:51 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire quad 4×32 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:19:56 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 1-wire sixteen 2×16 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:00 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 2-wire 16×16 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:05 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 2-wire 4×64 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:08 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 2-wire 8×32 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:17 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2532 as a 2-wire dual 4×32 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:23 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2533 as a 1-wire 4×64 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:28 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2534 as a 1-wire 8×32 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:32 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2535 as a 1-wire 4×136 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:36 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2536 as a 1-wire 8×68 + matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:41 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2540 as a 1-wire 8x9 matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:45 PM + NI + False + + + + Gets a value that indicates a topology which uses the NI PXI-2541 as a 1-wire 8x12 matrix. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:48 PM + NI + False + + + + Gets a value that indicates the NI PXI-2543 in the dual 4×1 terminated multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:53 PM + NI + False + + + + Gets a value that indicates the NI PXI-2545 in the terminated 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:20:56 PM + NI + False + + + + Gets a value that indicates the NI PXI-2546 in the dual 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:00 PM + NI + False + + + + Gets a value that indicates the NI PXI-2547 in the 8×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:04 PM + NI + False + + + + Gets a value that indicates the NI PXI-2548 in the quad SPDT general-purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:09 PM + NI + False + + + + Gets a value that indicates the NI PXI-2549 in the dual terminated SPDT general-purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:13 PM + NI + False + + + + Gets a value that indicates the NI PXI-2554 in the 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:22 PM + NI + False + + + + Gets a value that indicates the NI PXI-2555 in the 4×1 terminated multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:41 PM + NI + False + + + + Gets a value that indicates the NI PXI-2556 in the dual 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:45 PM + NI + False + + + + Gets a value that indicates the NI PXI-2557 in the dual 8×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:50 PM + NI + False + + + + Gets a value that indicates the NI PXI-2558 in the quad SPDT general-purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:54 PM + NI + False + + + + Gets a value that indicates the NI PXI-2559 in the dual terminated SPDT + general-purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:21:59 PM + NI + False + + + + Gets a value that indicates the NI PXI-2564 in the 16-SPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:03 PM + NI + False + + + + Gets a value that indicates the NI PXI-2564 in the 8-DPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:07 PM + NI + False + + + + Gets a value that indicates the NI PXI-2565 in the 16-SPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:12 PM + NI + False + + + + Gets a value that indicates the NI PXI-2566 in the 16-SPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:16 PM + NI + False + + + + Gets a value that indicates the NI PXI-2566 in the 8-DPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:20 PM + NI + False + + + + Gets a value that indicates the NI PXI-2567 + in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:25 PM + NI + False + + + + Gets a value that indicates the NI PXI-2568 in the 31-SPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:40 PM + NI + False + + + + Gets a value that indicates the NI PXI-2568 in the 15-DPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:30 PM + NI + False + + + + Gets a value that indicates the NI PXI-2569 in the 100-SPST + topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:44 PM + NI + False + + + + Gets a value that indicates the NI PXI-2569 in the 50-DPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:51 PM + NI + False + + + + Gets a value that indicates the NI PXI-2570 in the 40-SPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:59 PM + NI + False + + + + Gets a value that indicates the NI PXI-2570 in the 20-DPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:22:54 PM + NI + False + + + + Gets a value that indicates the NI PXI-2571 in the 66-SPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:06 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2575 (NI 2575) in the 1-wire 196×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:10 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2575 (NI 2575) in the 2-wire 98×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:38 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2575 (NI 2575) in the 2-wire 95×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:15 PM + NI + False + + + + Gets a value that indicates the NI PXI-2576 in the 2-wire 64×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:47 PM + NI + False + + + + Gets a value that indicates the NI PXI-2576 in the 2-wire dual 32×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:51 PM + NI + False + + + + Gets a value that indicates the NI PXI-2576 in the 2-wire octal 8×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:54 PM + NI + False + + + + Gets a value that indicates the NI PXI-2576 in the 2-wire quad 16×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:23:58 PM + NI + False + + + + Gets a value that indicates the NI PXI-2576 in the 2-wire sixteen 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:24:02 PM + NI + False + + + + Gets a value that indicates the NI PXI-2576 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:24:12 PM + NI + False + + + + Gets a value that indicates the NI PXI-2584 in the 1-wire 12×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:24:07 PM + NI + False + + + + Gets a value that indicates the NI PXI-2584 in the 1-wire dual 6×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:12 PM + NI + False + + + + Gets a value that indicates the NI PXI-2584 in the 2-wire 6×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:18 PM + NI + False + + + + Gets a value that indicates the NI PXI-2584 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:24 PM + NI + False + + + + Gets a value that indicates the NI PXI-2585 in the 1-wire 10×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:33 PM + NI + False + + + + Gets a value that indicates the NI PXI-2586 in the 10-SPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:37 PM + NI + False + + + + Gets a value that indicates the NI PXI-2586 in the 5-DPST topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:42 PM + NI + False + + + + Gets a value that indicates the NI PXI-2590 in the 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:45 PM + NI + False + + + + Gets a value that indicates the NI PXI-2591 in the 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:49 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2593 (NI 2593) as a 16×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:26:53 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2593 (NI 2593) as a dual 8×1 + multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:10 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2593 (NI 2593) as a 8×1 terminated + multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:01 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2593 (NI 2593) as a dual 4×1 terminated + multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:06 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2593 (NI 2593) in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:14 PM + NI + False + + + + Gets a value that indicates the NI PXI-2594 in the 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:18 PM + NI + False + + + + Gets a value that indicates the NI PXI-2595 in the 4×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:24 PM + NI + False + + + + Gets a value that indicates the NI PXI-2596 in the dual 6×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:32 PM + NI + False + + + + Gets a value that indicates the NI PXI-2597 in the 6×1 terminated multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:44 PM + NI + False + + + + Gets a value that indicates the NI PXI-2598 in the dual transfer switch topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:49 PM + NI + False + + + + Gets a value that indicates the NI PXI-2599 in the 2-SPDT general-purpose topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:53 PM + NI + False + + + + Gets a value that indicates the NI PXI-2720 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:27:57 PM + NI + False + + + + Gets a value that indicates the NI PXI-2722 + in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:01 PM + NI + False + + + + Gets a value that indicates the NI PXI-2725 + in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:08 PM + NI + False + + + + Gets a value that indicates the NI PXI-2727 + in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:13 PM + NI + False + + + + Gets a value that indicates the NI PXI-2790 in the independent topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:17 PM + NI + False + + + + Gets a value that indicates the NI PXI-2796 in the dual 6×1 multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:22 PM + NI + False + + + + Gets a value that indicates the NI PXI-2797 in the 6x1 terminated multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:27 PM + NI + False + + + + Gets a value that indicates the NI PXI-2798 in the dual transfer topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:32 PM + NI + False + + + + Gets a value that indicates the NI PXI-2799 in the 2-SPDT topology. + + + Returns a representing the topology of the device for the session. + + 10/30/2012 2:28:36 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2542 in the quad 2×1 terminated multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 7/11/2013 4:08:36 PM + NI + False + + + + Gets a value that indicates the NI PXI/PXIe-2544 in the 8×1 terminated multiplexer topology. + + + Returns a representing the topology of the device for the session. + + 7/11/2013 4:08:12 PM + NI + False + + + + Gets a value that indicates the NI 2865 in the 4×84 terminated matrix topology. + + + Returns a representing the topology of the device for the session. + + 7/11/2013 4:08:12 PM + NI + False + + + + Gets the value that indicates the NI PXIe-2524 1 wire dual 64x1 multiplexer topology. + + + The value that indicates the NI PXIe-2524 1 wire dual 64x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2737 2 wire 4x64 matrix topology. + + + The value that indicates the NI PXIe-2737 2 wire 4x64 matrix topology. + + + + + Gets the value that indicates the NI PXIe-2525 2 wire dual 32x1 multiplexer topology. + + + The value that indicates the NI PXIe-2525 2 wire dual 32x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2739 2 wire 16x16 matrix topology. + + + The value that indicates the NI PXIe-2739 2 wire 16x16 matrix topology. + + + + + Gets the value that indicates the NI PXIe-2747 dual 8x1 multiplexer topology. + + + The value that indicates the NI PXIe-2747 dual 8x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2526 1 wire 158x1 multiplexer topology. + + + The value that indicates the NI PXIe-2526 1 wire 158x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2525 2 wire quad 16x1 multiplexer topology. + + + The value that indicates the NI PXIe-2525 2 wire quad 16x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2524 1 wire sixteen 8x1 multiplexer topology. + + + The value that indicates the NI PXIe-2524 1 wire sixteen 8x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2746 quad 4x1 multiplexer topology. + + + The value that indicates the NI PXIe-2746 quad 4x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2524 1 wire octal 16x1 multiplexer topology. + + + The value that indicates the NI PXIe-2524 1 wire octal 16x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2738 2 wire 8x32 matrix topology. + + + The value that indicates the NI PXIe-2738 2 wire 8x32 matrix topology. + + + + + Gets the value that indicates the NI PXIe-2525 2 wire 64x1 multiplexer topology. + + + The value that indicates the NI PXIe-2525 2 wire 64x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXI/PXIe-2531 1 wire sixteen 2x16 matrix topology. + + + The value that indicates the NI PXI/PXIe-2531 1 wire sixteen 2x16 matrix topology. + + + + + Gets the value that indicates the NI PXIe-2525 2 wire sixteen 4x1 multiplexer topology. + + + The value that indicates the NI PXIe-2525 2 wire sixteen 4x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2525 2 wire octal 8x1 multiplexer topology. + + + The value that indicates the NI PXIe-2525 2 wire octal 8x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2524 1 wire quad 32x1 multiplexer topology. + + + The value that indicates the NI PXIe-2524 1 wire quad 32x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2524 1 wire 128x1 multiplexer topology. + + + The value that indicates the NI PXIe-2524 1 wire 128x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2748 16x1 multiplexer topology. + + + The value that indicates the NI PXIe-2748 16x1 multiplexer topology. + + + + + Gets the value that indicates the NI PXIe-2526 2 wire 79x1 multiplexer topology. + + + The value that indicates the NI PXIe-2526 2 wire 79x1 topology. + + + + + Defines the values required for the property. + + 11/5/2012 1:12:15 PM + NI + False + + + + Specifies that the trigger occurs on the rising edge of the signal. + + 10/22/2012 4:06:02 PM + NI + False + + + + Specifies that the trigger occurs on the falling edge of the signal. + + 10/22/2012 4:05:56 PM + NI + False + + + + Specifies the status of a path between two channels. + + 10/22/2012 2:37:17 PM + NI + False + + + + Specifies that NI-SWITCH can create the path at this time. + + 10/22/2012 2:37:32 PM + NI + False + + + + Specifies that the path already exists. + + 10/22/2012 2:37:50 PM + NI + False + + + + Specifies that the instrument is not capable of creating a path between the channels you specify. + + 10/22/2012 2:38:32 PM + NI + False + + + + Specifies that although the path is valid, NI-SWITCH cannot create the path at this moment because the switch is currently using one or more of the required channels to create another path. You must destroy the other path before creating this one. + + 10/22/2012 2:38:12 PM + NI + False + + + + Specifies that the instrument cannot create a path because both channels are connected to different source channels. + + 10/22/2012 2:38:23 PM + NI + False + + + + Specifies that NI-SWITCH cannot create a path between the two channels because one of the channels is a configuration channel and unavailable for external connections. + + 10/22/2012 2:37:42 PM + NI + False + + + + Provides data for the event. + + + + For more information, refer to NI Switches Help. + + 12/14/2012 4:32:36 PM + NI + False + + + + Gets the warning set in the Warning Event Args. + + + Returns an object of type . + + 11/5/2012 12:48:32 PM + NI + False + + + + Gets the Warning Event Args code. + + + Returns the GUID code of the warning. + + 12/30/2011 5:44:13 PM + NI + True + + + + Gets the Warning Event Args message. + + + Returns a representing the message. + + 12/30/2011 5:44:36 PM + NI + True + + + + Defines properties and methods which provide warning codes for the warnings raised by the underlying driver. + + + + Represents the list of warnings returned by the driver. + For more information, refer to NI Switches Help. + + 12/12/2012 12:52:07 PM + NI + False + + + + Gets the GUID code assigned to the warning. + + + Returns the GUID code of the warning. + + 11/5/2012 12:46:43 PM + NI + False + + + + Gets the message related to the warning. + + + Returns the warning message. + + 11/7/2012 12:23:58 PM + NI + False + + + + Gets the warning code if the card is not capable of removing all paths and always leaves at least one connected. + + + Returns the GUID ("2733A6B6-13E2-4480-9D60-B97FC11B68FC") of the warning. + + 10/23/2012 1:58:36 PM + NI + False + + + + Gets the warning code if the path between the channels is not available, the channels are not explicitly connected, but the implicit connection exists between them. + + + Returns the GUID ("C18A9B2D-C352-4331-A8B5-79BC532923CE") of the warning. + + 10/23/2012 1:55:55 PM + NI + False + + + + Gets the warning code for an unexpected driver warning. + + + Returns the GUID ("9E568AC9-7D95-406d-8971-D98185DE921C") of the warning. + + 12/30/2011 5:38:14 PM + NI + True + + + + + + + + + + + + + + + + + + + Determines whether the current instance of and the object that you specify are equal. + + + Specifies the object to be compared to the current instance of . + + + if the two instances are equal; otherwise, . + + 12/30/2011 5:38:48 PM + NI + True + + + + Determines whether the current instance of and the object that you specify are equal. + + + Specifies the object to be compared to the current instance of . + + + if the two instances are equal; otherwise, . + + 12/30/2011 5:39:31 PM + NI + True + + + + Checks if the two objects are equal by considering whether warning message should be compared or not. + + + Specifies the object to which this object is compared. + + + Specifies if the warning message must be ignored. If the warning message is to be ignored,then value of ignoreWarningMessage is . + If warning message is to be compared then value of ignoreWarningMessage is . + + + if the two instances are equal; otherwise, . + + 10/22/2012 1:29:47 PM + NI + False + + + + Checks whether the two instances of are equal. + + + Specifies a object. + + + Specifies a object for the comparison. + + + if the two instances are equal; otherwise, . + + 12/30/2011 5:39:55 PM + NI + True + + + + Checks whether the two instances of are unequal. + + + Specifies a object. + + + Specifies a object. + + + if the two instances are unequal; otherwise, . + + 12/30/2011 5:39:51 PM + NI + True + + + + Returns the hash code for the current instance of . + + + Returns an that represents the hash code for the current instance of . + + 12/30/2011 5:39:47 PM + NI + True + + + + Converts the current instance of to string. + + + Returns a string that represents the current instance of . + + 12/30/2011 5:39:59 PM + NI + True + + + + Defines the values required for the property. + + 11/5/2012 1:14:40 PM + NI + False + + + + Specifies that the switch device is in a 1-WireMode. + + 10/22/2012 4:06:33 PM + NI + False + + + + Specifies that the switch device is in a 2-WireMode. + + 10/22/2012 4:06:44 PM + NI + False + + + + Specifies that the switch device is in a 4-WireMode. + + 10/22/2012 4:06:22 PM + NI + False + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.dll new file mode 100644 index 0000000..ac20248 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.msl b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.msl new file mode 100644 index 0000000..af20135 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.msl @@ -0,0 +1,21 @@ + + + true + + CppCLI2012 + WindowsFormsApplication2012 + + true + Measurement Studio Hardware Class Libraries/NI-488.2 Library + Contains objects that communicate with GPIB instruments, control GPIB boards, and acquire GPIB status information. + NationalInstruments.NI4882 + false + + + NationalInstruments.Common + + + + NationalInstruments.NI4882 + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.xml new file mode 100644 index 0000000..215f12d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/NationalInstruments.NI4882.xml @@ -0,0 +1,13867 @@ + + + + NationalInstruments.NI4882 + + + + Used to specify the address of a GPIB device. + + + + Initializes the GPIB device address with the given primary address. + + + Primary address of the device. + + + + Initializes the GPIB device address with the given primary and secondary addresses. + + + Primary address of the device. + + + Secondary address of the device. + + + + Overrides ToString. + Returns a string representation of the object. + + + Gets or sets the primary address of the GPIB device. + + + + + Gets or sets the secondary address of the GPIB device. + + + + + Creates a strongly typed collection of Address objects. + + + + Initializes a new instance of the collection. + + + + Initializes a new instance of the collection from an existing collection. + + Collection to copy. + + + + Initializes a new instance of the collection from an array of items. + + Array to copy. + + + Overrides ToString. + A string representation of the object. + + + + Adds an item to the end of the collection. + + + Item to add to the collection. + + + The array index of the added item. + + + + + Adds an item to IList. + + + The object to add to IList. + + + The position into which the new element was inserted, or -1 to indicate that the item was not inserted into the collection. + + + + Adds an array of elements to the end of the collection. + + + Array of elements to add to the collection. + + + + + Adds a collection of elements to the end of the collection. + + + Collection of elements to add to the collection. + + + + Removes all items from the collection. + + + Returns if the specified element is in the collection. + Item to locate in the collection. + true if the collection contains item (parameter). + + + + Determines whether IList contains a specific item. + + + The object to locate in IList. + + true if the object is found in IList; otherwise, false. + + + + Copies the collection to an array or a portion of an array. + Destination array for the collection. + Index in the target array at which you want to begin copying the collection to. + array (parameter) is multidimensional. + + -or- + index (parameter) is greater than or equal to the array length. + + -or- + + The number of elements in the collection is greater than the available space between + index (parameter) and the end of array (parameter). + + array (parameter) is null. + + index (parameter) is less than zero. + + + + + Copies the elements of the ICollection to an array, starting at a particular array index. + + + The one-dimensional array that is the destination of the elements copied from ICollection. The array must have zero-based indexing. + + + The zero-based index in array at which copying begins. + + + + + Returns the zero-based index of the first occurrence of an item in the collection. + + Item to search for. + Index of the item. If the item is not found, returns -1. + + + + Determines the index of a specific item in IList. + + + The object to locate in IList. + + + The index of the item if found in the list; otherwise, -1. + + + + Inserts an item into the collection at the specified index. + Index to insert the item at. + Item to insert into the collection. + index (parameter) is not a valid index in the IList. + + + + + Inserts an item in IList at the specified index. + + + The zero-based index at which the item should be inserted. + + + The object to insert into IList. + + + + Returns an enumerator that you can use to iterate through the collection. + Enumerator for the collection. + + + Removes the first occurrence of the specified item. + Item to remove from the collection. + + + + Removes the first occurrence of a specific object from IList. + + + The object to remove from IList. + + + + Removes the item at the specified index. + The zero-based index of the item to remove. + index (parameter) is not a valid index in the IList. + + + + + Called if the state of AddressCollection changes. + + + Information about how the list changed and the indexes that were affected. + + + + Gets or sets the Address at the specified index. In Visual C#, this property is the indexer. + + The zero-based index of the entry to locate in the collection. + + index (parameter) is outside the valid range of indexes for the collection. + + + + + Gets or sets the element at the specified index. + + + + + Gets the number of elements in the collection. + + + + + Gets a value indicating whether access to ICollection is synchronized (thread safe). + + + + + Gets a value indicating whether IList has a fixed size. + + + + + Gets a value indicating whether IList is read-only. + + + + + Gets an object that can be used to synchronize access to ICollection. + + + + Contains all the board functionality of the NI-488.2 driver. + + + + Opens and initializes a board using a board index of 0. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Opens and initializes a board using the specified index. + + + Board index to initialize. "GPIB0" corresponds to a boardIndex (parameter) of 0, "GPIB1" corresponds to a boardIndex (parameter) of 1, and so on. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Overrides Finalize. + + + + Releases all resources used by the Board object. + + + + + Releases the resources used by the Board object. + + true if this method releases managed and unmanaged resources; false if this method releases + only unmanaged resources. + + + + Overrides ToString. + Returns a string representation of the object. + + + Changes a configuration item to the specified value for the selected option. + + + A parameter that selects the software configuration item. + + + The value to which the selected configuration item changes. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + configurationOption (parameter) is less than 0x0000 or greater than 0x7FFFF. + + + + -or- + configurationOptionValue (parameter) is not defined for the input configurationOption (parameter). + + +configurationOption (parameter) is less than 0x0000 or greater than 0x7FFFF. + configurationOptionValue (parameter) is not defined for the input configurationOption (parameter). + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + Returns the current value of various configuration parameters for the specified board or device. + + + Option to query. + + + Value of configurationOption (parameter). + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + configurationOption (parameter) is less than 0x0000 or greater than 0x7FFFF. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + + Attempts to make the specified board the Active Controller by asserting the ATN line. + + true if control is taken immediately without regard for any data transfer currently in progress; + false to attempt to take control without corrupting transferred data. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + + + Sends bytes from the buffer over the GPIB as command bytes (interface messages). + + + Command bytes to send. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + commands (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + I/O operation aborted. + + The interface board is not Controller-In-Charge. + + + + Sends GPIB commands asynchronously. + + + An asynchronous result that represents this operation. + + + Buffer of command bytes to send. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + commands (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + I/O operation aborted. + + The interface board is not Controller-In-Charge. + + + + Sends GPIB commands asynchronously and invokes a callback method when the operation completes. + + + An asynchronous result that represents this operation. + + + Buffer of command bytes to send. + + + The AsyncCallback raised when + the all the command bytes have been sent. + + + Object that contains additional user information. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + commands (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + I/O operation aborted. + + The interface board is not Controller-In-Charge. + + + + Waits indefinitely + for a previous BeginSendCommands call to complete. + + + An asynchronous result that represents the asynchronous NI-488.2 send commands operation that you want to end. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The asyncResult (parameter) is invalid. + + + + -or- + + The asyncResult (parameter) is null. + + + + The asyncResult (parameter) is invalid. + + The asyncResult (parameter) is null. + + EndSendCommands was called before BeginSendCommands. + + + + -or- + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + +EndSendCommands was called before BeginSendCommands. + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Causes the GPIB interface to go to standby Controller and the GPIB ATN line to be unasserted. + + true if acceptor handshaking or shadow handshaking is performed until END occurs or until ATN is reasserted by a subsequent BecomeActiveController call; false if this handshaking is not performed. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + + + + Attempts to acquire an exclusive lock on the interface for the current process. + + + Time period in milliseconds to wait for an exclusive lock. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + Locks are not supported in the current NI-488.2 driver you are using. + + + + -or- + + + + Maximum reference count for the Board object has been reached. + + + + -or- + + Unable to acquire the requested lock within the timeout period because a different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + Locks are not supported in the current NI-488.2 driver you are using. + + -or- + + Maximum reference count for the Board object has been reached. + + Unable to acquire the requested lock within the timeout period because a different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Releases an exclusive interface lock for the current process. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + Locks are not supported in the current NI-488.2 driver you are using. + + + + -or- + + + + Maximum reference count for the Board object has been reached. + + + + -or- + + Unable to acquire the requested lock within the timeout period because a different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + Locks are not supported in the current NI-488.2 driver you are using. + + -or- + + Maximum reference count for the Board object has been reached. + + Unable to acquire the requested lock within the timeout period because a different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Returns the status of the eight GPIB control lines. + + ControlLineFlags that contains the status of the eight control lines and the validity of each line. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Checks for the presence of a device on the bus. + + + Address of the device to find. + + true if a listener is found. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Places the board in local mode if it is not in a lockout state. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Notifies the user of one or more GPIB events by invoking the user callback. + + + Bit mask of GPIB events to notice. + + + Pointer to the delegate method NotifyCallback. + + + User-defined reference data for the callback. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + mask (parameter) is invalid or nonzero. + + + + -or- + callback (parameter) is null. + + +mask (parameter) is invalid or nonzero. + callback (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The current NI-488.2 driver cannot perform notification on one or more of the specified mask (parameter) bits. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The current NI-488.2 driver cannot perform notification on one or more of the specified mask (parameter) bits. + + + + Resets the board and places all its software configuration parameters in their preconfigured state. The interface is left operational or online. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Initiates a read to a device asynchronously. This method assumes that the GPIB is already properly addressed. + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Initiates a read of a specified number of bytes to a device asynchronously. This method assumes that the GPIB is already properly addressed. + + An asynchronous result that represents this operation. + + + Number of bytes to read from the GPIB. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Initiates a read to a device asynchronously and invokes a callback method when the read completes. This method assumes that the GPIB is already properly addressed. + + An asynchronous result that represents this operation. + + + The AsyncCallback raised when + the read completes. + + + Object that contains additional user information. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Initiates a read of a specified number of bytes to a device asynchronously and invokes the a callback method when the read completes. This method assumes that the GPIB is already properly addressed. + + An asynchronous result that represents this operation. + + + Number of bytes to read from the GPIB. + + + The AsyncCallback raised when + the read completes. + + + Object that contains additional user information. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Waits indefinitely for a previous BeginRead call to complete. + + + An asynchronous result that represents the asynchronous NI-488.2 read operation that you want to end. + + + A byte array that contains the read data. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + asyncResult (parameter) is invalid. + + + + -or- + asyncResult (parameter) is null. + + +asyncResult (parameter) is invalid. + asyncResult (parameter) is null. + + EndReadByteArray or EndReadString was called before BeginRead. + + + + -or- + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + +EndReadByteArray or EndReadString was called before BeginRead. + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Waits indefinitely for a previous BeginRead call to complete. + + + An asynchronous result that represents the asynchronous NI-488.2 read operation that you want to end. + + + A string that contains the data read. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The asyncResult (parameter) is invalid. + + + + -or- + + The asyncResult (parameter) is null. + + + + The asyncResult (parameter) is invalid. + + The asyncResult (parameter) is null. + + EndReadByteArray or EndReadString was called before BeginRead. + + + + -or- + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + +EndReadByteArray or EndReadString was called before BeginRead. + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Reads data from a device into a file. + + + Name of file into which data is read. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + fileName (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + File System error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + File System error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + + + Resets the GPIB by sending the interface clear message. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + GPIB interface not System Controller as required. + + + + Conducts a parallel poll. + + + Represents the status information for each device configured for a parallel poll. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + + + Sets the Remote Enable (REN) line. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + GPIB interface not System Controller as required. + + + + Unasserts the GPIB Remote Enable (REN) line. + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + GPIB interface not System Controller as required. + + + + + Aborts any asynchronous read, write, or command operation in progress and resynchronizes the application with the driver. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + Monitors the events specified by mask and delays processing until one or more of the events occurs. + + + Bit mask of GPIB events to wait for. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + A bit set if mask (parameter) is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + Wait or GetCurrentStatus is already in progress on the interface. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + Wait or GetCurrentStatus is already in progress on the interface. + + + + Returns the current GPIB status. + + + The updated status of GPIB. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + Wait or GetCurrentStatus is already in progress on the interface. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + Wait or GetCurrentStatus is already in progress on the interface. + + + + Writes byte data to a GPIB device. This method assumes that the GPIB is already properly addressed. + + + An asynchronous result that represents this operation. + + + Buffer that contains the bytes to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + GPIB interface not addressed correctly. + + + + Writes string data to a GPIB device. This method assumes that the GPIB is already properly addressed. + + + An asynchronous result that represents this operation. + + + Buffer that contains the bytes to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + I/O operation aborted. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + GPIB interface not addressed correctly. + + + + Writes byte data to a GPIB device and invokes a callback method when the write completes. This method assumes that the GPIB is already properly addressed. + + + An asynchronous result that represents this operation. + + + Buffer that contains the bytes to write. + + + The AsyncCallback raised when + all the data bytes have been sent. + + + Object that contains additional user information. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + I/O operation aborted. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + GPIB interface not addressed correctly. + + + + Writes string data to a GPIB device and invokes a callback method when the write completes. This method assumes that the GPIB is already properly addressed. + + + An asynchronous result that represents this operation. + + + Buffer that contains the bytes to write + + + The AsyncCallback that is raised when + the all the data bytes have been sent. + + + Object that contains additional user information. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the InvalidOperationException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the InvalidOperationException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + I/O operation aborted. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + GPIB interface not addressed correctly. + + + + Waits indefinitely + for a previous BeginWrite call to complete. + + + An asynchronous result that represents the asynchronous NI-488.2 write operation that you want to end. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The asyncResult (parameter) is invalid. + + + + -or- + + The asyncResult (parameter) is null. + + + + The asyncResult (parameter) is invalid. + + The asyncResult (parameter) is null. + + EndWrite was called before BeginWrite. + + + + -or- + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + +EndWrite was called before BeginWrite. + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Writes all bytes of data from the given filename to a GPIB device. + + + Name of the file that contains the data to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + fileName (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + + + -or- + + File System Error. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + I/O operation aborted. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + File System Error. + + GPIB interface not addressed correctly. + + + + Serial polls a single device. + + + The device address. + + + The serial poll response byte. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + I/O operation aborted. + + + + Serial polls multiple devices. + + + A list of device addresses. + + + The poll responses. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + One of the devices timed out instead of responding to the serial poll. LastCount contains the index of the timed-out device. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + One of the devices timed out instead of responding to the serial poll. LastCount contains the index of the timed-out device. + + + + Sends the universal Device Clear (DCL) message to all devices on the bus. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Sends the Selected Device Clear (SDC) GPIB message to the specified device. + + + Address of the device you want to clear. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + address (parameter) parameter does not contain a valid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Sends the Selected Device Clear (SDC) GPIB message to multiple GPIB devices. + + + A list of device addresses you want to clear. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Unasserts the GPIB Remote Enable (REN) line. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Places the device into local mode by sending the Go To Local (GTL) GPIB message to the specified device. + + + Address to enable. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Places multiple GPIB devices into local mode by sending the Go To Local (GTL) GPIB message to all the specified devices. + + + A list of device addresses. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Enables remote GPIB programming for devices. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + GPIB interface not System Controller as required. + + + + Enables remote GPIB programming and places the given device into a listen-active state. + + + Device address. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + GPIB interface not System Controller as required. + + + + Enables remote GPIB programming and places multiple GPIB devices into a listen-active state. + + + A list of device addresses. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + GPIB interface not System Controller as required. + + + + Finds all listening devices on GPIB. + + + A list of the devices found. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Finds multiple listening devices on the GPIB. + + + List of the GPIB devices to find. + + + A list of the devices found. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Finds up to the specified number of listening devices on the GPIB described in the address list. + + + List of GPIB devices to find. + + + The maximum number of devices to find. + + + A list of the devices found. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Serial polls the devices in order as described by the specified address list until it finds a device that requests service. + + + List of device addresses. + + + Upon return, contains the serial poll response byte of the device that requested service. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the method. If thrown due to an invalid NI-488.2 driver argument, the inner exception is set to GpibException. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Passes control to another device with Controller capability by sending the Take Control (TCT) GPIB message to the device with the specified address. + + + Device address. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Configures the specified device to respond to parallel polls by asserting or not asserting the GPIB data line. + + + Address of the device to be configured. + + + Data line (a value in the range of 1 to 8) on which the device responds to parallel polls. + + + Sense (either 0 or 1) of the parallel poll response. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + dataLine (parameter) is not in the range 1 to 8. + + + + -or- + lineSense (parameter) is not 0 or 1. + + + + The address (parameter) parameter is invalid. + dataLine (parameter) is not in the range 1 to 8. + lineSense (parameter) is not 0 or 1. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Sends the Parallel Poll Unconfigure (PPU) GPIB message to all GPIB devices. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Unconfigures a device for parallel polls. + + + Device address. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Unconfigures a list of devices for parallel polls. + + + A list of device addresses. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Reads string data from a device into a user buffer. + + + The string data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Addresses the given GPIB device to talk and the interface to listen and then reads up to DefaultBufferSize bytes of string data. + + + Address of a device from which data is read. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + Data read in string format. + + + + Reads up to a specified number of string data bytes from a device into a user buffer. + + + Number of bytes to read. + + + The string data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Reads up to a specified number of string data bytes from a device that is already addressed to talk, using the specified termination method. + + + Number of bytes to read. + + + Description of the data termination mode (STOPend or an EOS character). + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + terminationByte (parameter) is invalid. It must be either STOPend or and 8-bit EOS character. + + + + -or- + count (parameter) is negative. + + +terminationByte (parameter) is invalid. It must be either STOPend or and 8-bit EOS character. + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + The string data read from the device. + + + + Addresses the given GPIB device to talk and the interface to listen and then reads up to DefaultBufferSize bytes of string data, using the specified termination method. + + + Address of a device from which data is read. + + + Description of the data termination mode (STOPend or an EOS character). + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 river library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + terminationByte (parameter) is invalid. It must be either STOPend or and 8-bit EOS character. + + + + The address (parameter) parameter is invalid. + terminationByte (parameter) is invalid. It must be either STOPend or and 8-bit EOS character. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + Data read in string format. + + + + Addresses the given GPIB device to talk and the interface to listen and then reads up to the specified number of bytes, using the specified termination method. + + + Address of a device from which data is received. + + + Number of bytes to read. + + + Description of the data termination mode (STOPend or an EOS character). + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + terminationByte (parameter) is invalid. It must be either STOPend or and 8-bit EOS character. + + + + -or- + count (parameter) is negative. + + + + The address (parameter) parameter is invalid. + terminationByte (parameter) is invalid. It must be either STOPend or and 8-bit EOS character. + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + The string data read from the device. + + + + Reads byte array data from a device into a user buffer. + + + The byte array data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Addresses the specified GPIB device to talk and the interface to listen and then reads up to DefaultBufferSize bytes of array data. + + + Address of the device from which data is read. + + + The byte array data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA Error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA Error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Reads a specified number of bytes of array data from a device into a user buffer. + + + The byte array data read from the device. + + + Number of bytes to read. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Reads a specified number of bytes of array data from a device that is already addressed to talk, using the specified termination method. + + + Number of bytes to read. + + + Description of the data termination mode (STOPend or an EOS character). + + + The byte array data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + terminationByte (parameter) is invalid. It must be either STOPend or an 8-bit EOS character. + + + + -or- + count (parameter) is negative. + + +terminationByte (parameter) is invalid. It must be either STOPend or an 8-bit EOS character. + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received. + + + + Addresses the specified GPIB device to talk and the interface to listen and then reads up to DefaultBufferSize bytes of array data using the specified termination method. + + + The byte array data read from the device. + + + Address of a device from which data is read. + + + Description of the data termination mode (STOPend or an EOS character). + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + terminationByte (parameter) is invalid. It must be either STOPend or an 8-bit EOS character. + + + + The address (parameter) parameter is invalid. + terminationByte (parameter) is invalid. It must be either STOPend or an 8-bit EOS character. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Addresses the specified GPIB device to talk and the interface to listen and then reads up to the specified number of bytes of array data using the specified termination method. + + + The byte array data read from the device. + + + Address of a device from which data is read. + + + Number of bytes to read. + + + Description of the data termination mode (STOPend or an EOS character). + + + The NI-488.2 river returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + terminationByte (parameter) is invalid. It must be either STOPend or an 8-bit EOS character. + + + + -or- + count (parameter) is negative. + + + + The address (parameter) parameter is invalid. + terminationByte (parameter) is invalid. It must be either STOPend or an 8-bit EOS character. + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge and a Device Clear message (DCL or SDC) was received. + + + + Addresses a device to be a Talker and the interface to be a Listener in preparation for ReadByteArray or ReadString. + + + Address of the device to be talk addressed. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Resets and initializes multiple IEEE 488.2-compliant devices. + + + List of devices. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Writes string data to a GPIB device. + + + Data to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + The I/O timeout period elapsed before all of the data bytes were sent. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + The I/O timeout period elapsed before all of the data bytes were sent. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + + + Writes byte array data to a GPIB device. + + + Bytes to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + The I/O timeout period elapsed before all of the data bytes were sent. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + The I/O timeout period elapsed before all of the data bytes were sent. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + + + Writes string data to devices that are already addressed to listen, using the given data termination mode. + + + The data bytes to send. + + + The data termination mode. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + The I/O timeout period elapsed before all of the data bytes were sent. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + The I/O timeout period elapsed before all of the data bytes were sent. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + GPIB interface not addressed correctly. + + + + Writes array data bytes to devices that are already addressed to listen, using the given data termination mode. + + + The data bytes to send. + + + The data termination mode. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + DMA error. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + The I/O timeout period elapsed before all of the data bytes were sent. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + DMA error. + + No Listeners on the GPIB. + + The I/O timeout period elapsed before all of the data bytes were sent. + + GPIB interface not addressed correctly. + + The board is not Controller-In-Charge, and a Device Clear message (DCL or SDC) was received before the write could terminate normally. + + + + Addresses GPIB and sends string data to the specified device. + + + Address of the device to which data is sent. + + + The data bytes to send. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + data (parameter) is null. + + + + The address (parameter) parameter is invalid. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Addresses GPIB and sends byte array data to the specified device. + + + Address of the device to which data is sent. + + + The data bytes to send. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + data (parameter) is null. + + + + The address (parameter) parameter is invalid. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Sends string data bytes to multiple GPIB devices. + + + A list of device addresses to which data is sent. + + + The data bytes to send. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + + -or- + data (parameter) is null. + + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Sends array data bytes to multiple GPIB devices. + + + A list of device addresses to which data is sent. + + + The data bytes to send. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + + -or- + data (parameter) is null. + + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Addresses GPIB and sends string data to the specified device, using the given termination mode. + + + Address of the device to which data is sent. + + + The data bytes to send. + + + The data termination mode. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + data (parameter) is null. + + + + The address (parameter) parameter is invalid. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Addresses GPIB and sends byte array data to the specified device, using the specified termination mode. + + + Address of the device to which data is sent. + + + The data bytes to send. + + + The data termination mode. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + + -or- + data (parameter) is null. + + + + The address (parameter) parameter is invalid. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Sends string data bytes to multiple GPIB devices, using the specified data termination mode. + + + A list of device addresses to which data is sent. + + + The data bytes to send. + + + The data termination mode. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + + -or- + data (parameter) is null. + + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Sends array data bytes to multiple GPIB devices, using the specified data termination mode. + + + A list of device addresses to which data is sent. + + + The data bytes to send. + + + The data termination mode. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + + -or- + data (parameter) is null. + + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Sends the Local Lockout (LLO) message to all devices. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + No Listeners on the GPIB. + + + + Makes the specified device listen active and makes the interface talk active in preparation for + Write or BeginWrite. + + + Address of the device to be talk addressed. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + + + Makes multiple GPIB devices listen active and makes the interface talk active in preparation for + Write or BeginWrite. + + + Collection of addresses of devices that need to be talk addressed. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter), or is empty. LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + + + Places a device into Remote With Lockout State by asserting the Remote Enable (REN) GPIB line and sending the Local Lockout (LLO) GPIB message. + + + Device address. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + + + Places multiple devices into Remote With Lockout State by asserting the Remote Enable (REN) GPIB line and sending the Local Lockout (LLO) GPIB message. + + + List of device addresses. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not System Controller as required. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not System Controller as required. + + + + Determines the current state of the GPIB Service Request (SRQ) line. + + true if the SRQ line is asserted; false if the line is not asserted. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + + + Causes an IEEE 488.2-compliant device to conduct self-tests. + + + Device address. + + true if the self-test passed; false otherwise. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Causes multiple IEEE 488.2-compliant devices to conduct self-tests. + + + A list of device addresses. + + + A bool array that corresponds to the index in addressList (parameter). Returns true if the self-test passed; false otherwise. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Causes multiple IEEE 488.2-compliant devices to conduct self-tests and returns device-specific information. + + + A list of device addresses. + + + A list of test results; each entry corresponds to an address in addressList (parameter). + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid address appears in addressList (parameter). LastCount is the index of the first invalid address. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + No Listeners on the GPIB. + + + + Sends the Group Execute Trigger (GET) GPIB message to all devices that are currently listen-active on the GPIB. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Sends the Group Execute Trigger (GET) GPIB message to the specified device. + + + Device address. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Sends the Group Execute Trigger (GET) GPIB message to multiple devices. + + + A list of device addresses. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the method. If thrown due to an invalid NI-488.2 driver argument, the inner exception is set to GpibException. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Waits until either the GPIB SRQ line is asserted, or the timeout period specified by IOTimeout has expired. + + true if the GPIB SRQ line is asserted; false otherwise. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + + + Gets or sets the default buffer size used for I/O operations. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + + Gets the last status of the last call made on this board. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + Gets the count of the last call made on this board. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + Gets or sets the primary address of the board. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the secondary address of the board. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the timeout period to select the maximum duration allowed for a synchronous I/O operation. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether to assert the end or identify (EOI) line during write operations. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the local parallel poll configuration of the board. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether to use automatic serial polling. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether to use interrupts. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if the board is the GPIB System Controller. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets the status of the GPIB Remote Enable (REN) line. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if the end-of-string (EOS) character is used during read operations. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if the EOI line is asserted when the EOS character is sent during write operations. Refer to SetEndOnWrite. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if an 8-bit or 7-bit compare should be used. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the current end-of-string (EOS) character of the board. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the current parallel poll configuration mode of the board. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the bus timing of the interface. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether to use direct memory access (DMA) for GPIB transfers. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if the GPIB Local Lockout (LLO) command is sent during a device-level "online and CIC" test. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the timeout value used when conducting a parallel poll. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets how the End bit is set during a call to the interface. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the cable length of the GPIB system and if high-speed date transfer (HS488) is enabled. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the individual status (IST) bit of the board. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the serial poll response byte of the board. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if the board is in the listen-only state. + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets the Serial Number of the Interface Board + + + The NI-488.2 driver returns an error as a result of using this property. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver or Interface Board. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver or Interface Board. + + + + + Gets access to the NI-488.2 driver board handle that NI-488.2 driver operations use internally. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + + Gets or sets the object used to marshal event-handler and callback calls. + + + + + Specifies how events and callback delegates are invoked. + + + + + Specifies the current bus timing of the GPIB board. + + + + + GPIB Source handshake delay of 2 s. + + + + + GPIB Source handshake timing of 500 ns. + + + + + GPIB Source handshake of 350 ns. + + + + + Specifies common GPIB commands. + + + + + Device Clear (DCL). + + + + + Selected Device Clear (SDC). + + + + + Go To Local (GTL). + + + + + Group Execute Trigger (GET). + + + + + Local Lock Out (LLO). + + + + + Parallel Poll Configure (PPC). + + + + + Parallel Poll Unconfigure (PPU). + + + + + Parallel Poll Enable (PPE). + + + + + Parallel Poll Disable (PPD). + + + + + Serial Poll Enable (SPE). + + + + + Serial Poll Disable (SPD). + + + + + Take Control (TCT). + + + + + Unlisten Command (UNL). + + + + + Untalk Command (UNT). + + + + + Contains the status of the eight GPIB control lines and if the current status is valid. + + + + + End Or Identity (EOI) line status. + + + + + End Or Identity (EOI) line contains a valid value. + + + + + Attention (ATN) line status. + + + + + Attention (ATN) line contains a valid value. + + + + + Service Request (SRQ) line status. + + + + + Service Request (SRQ) line contains a valid value. + + + + + Remote Enable Line (REN) line status. + + + + + Remote Enable Line (REN) line contains a valid value. + + + + + Interface Clear (IFC) line state. + + + + + Interface Clear (IFC) line contains a valid value. + + + + + Not Ready for Data (NRFD) line status. + + + + + Not Ready for Data (NRFD) line contains a valid value. + + + + + Not Data Accepted (NDAC) line status. + + + + + Not Data Accepted (NDAC) line contains a valid value. + + + + + Data Available (DAV) line status. + + + + + Data Available (DAV) line contains a valid value. + + + + + Specifies how I/O operations are to be terminated. + + + + The last byte is sent without the EOI line asserted. + + + + A new line character ('\n') is sent with the EOI line asserted. + + + + The last byte is sent with the EOI line asserted. + + + + The last byte is received with the EOI line asserted + + + + Contains all the device functionality of the NI-488.2 driver. + + + + Opens and initializes a device and configures it according to specified board number and address. + + + Index of the access board for the device. + + + The Address of the GPIB device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The address (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Opens and initializes a device and configures it according to the specified board number and primary address. + + + Index of the access board for the device. + + + The primary GPIB address of the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The primaryAddress (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Opens and initializes a device and configures it according to the specified board number, primary address, and secondary address. + + + Index of the access board for the device. + + + The primary GPIB address of the device. + + + The secondary GPIB address of the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The primaryAddress (parameter) parameter is invalid. + + + + -or- + + The secondaryAddress (parameter) parameter is invalid. + + + + The primaryAddress (parameter) parameter is invalid. + + The secondaryAddress (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Opens and initializes a device and configures it according to the specified board number, primary address, secondary address, and timeout. + + + Index of the access board for the device. + + + The primary GPIB address of the device. + + + The secondary GPIB address of the device. + + + The I/O timeout value. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The primaryAddress (parameter) parameter is invalid. + + + + -or- + + The secondaryAddress (parameter) parameter is invalid. + + + + The primaryAddress (parameter) parameter is invalid. + + The secondaryAddress (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + boardNumber (parameter) is within the range 0-99, but the interface board described by boardNumber (parameter) is not installed nor properly configured. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Overrides Finalize. + + + + Releases all resources used by the Device object. + + + + + Releases the resources used by the Device object. + + true if this method releases managed and unmanaged resources; false if this method releases + only unmanaged resources. + + + + Overrides ToString. + Returns a string representation of the object. + + + Changes a configuration item to the specified value for the selected device. + + + A parameter that selects the software configuration item. + + + The value to which the selected configuration item is to change. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + configurationOption (parameter) is valid, but configurationOptionValue (parameter) is not defined for it. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + Returns the current value of various configuration parameters for the specified board or device. + + + Option to query. + + + Value of configurationOption (parameter). + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + configurationOption (parameter) is less than 0x0000 or greater than 0x7FFFF. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + configurationOption (parameter) is not available in the current NI-488.2 driver installed on the system. + + + + Sends the GPIB Selected Device Clear (SDC) message to the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Automatically places the specified device in local mode. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Notifies the user of one or more GPIB events by invoking the user callback. + + + Bit mask of GPIB events to notice. + + + Pointer to the delegate method NotifyCallback. + + + User-defined reference data for the callback. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + mask (parameter) is invalid or nonzero. + + + + -or- + callback (parameter) is null. + + +mask (parameter) is invalid or nonzero. + callback (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The current NI-488.2 driver cannot perform notification on one or more of the specified mask (parameter) bits. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The current NI-488.2 driver cannot perform notification on one or more of the specified mask (parameter) bits. + + + + Places the device online by putting its software configuration parameters in their preconfigured state. The device is left operational or online. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + GPIB bus error. + + + + Passes control to another GPIB device with Controller capability. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Configures a device for a parallel poll. + + + Parallel poll enable/disable value. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The parallelPollMessage (parameter) parameter is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Reads byte array data from a device into a user buffer. + + + The byte array data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + I/O operation aborted. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + I/O operation aborted. + + GPIB interface not addressed correctly. + + + + Addresses the GPIB and reads up to the specified number of bytes of data. + + + Number of bytes to read. + + + The byte array data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + I/O operation aborted. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + I/O operation aborted. + + GPIB interface not addressed correctly. + + + + Reads string data from a device into a user buffer. + + + The string data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + I/O operation aborted. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + I/O operation aborted. + + GPIB interface not addressed correctly. + + + + Addresses the GPIB and reads up to the specified number of bytes of data. + + + Number of bytes to read. + + + The string data read from the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + I/O operation aborted. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + I/O operation aborted. + + GPIB interface not addressed correctly. + + + + Initiates a read to a device asynchronously and reads up to DefaultBufferSize bytes of data. + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + + + + Initiates a read to a device asynchronously and reads up to a specified number of bytes of data. + + + Number of bytes to read from the GPIB. + + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + + + Initiates a read of DefaultBufferSize to a device asynchronously and invokes a callback method when complete. + + The AsyncCallback that is raised when + the read completes. + + + Object that contains additional user information. + + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the method. If thrown due to an invalid NI-488.2 driver argument, the inner exception is set to GpibException. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + + + Initiates a read of up to a specified number of bytes to a device asynchronously and invokes a callback method when complete. + + Number of bytes to read from the GPIB. + + + The AsyncCallback that is raised when + the read completes. + + + Object that contains additional user information. + + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + count (parameter) is negative. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + + + Waits indefinitely for a previous BeginRead call to complete. + + + An asynchronous result that represents the asynchronous NI-488.2 read operation that you want to end. + + + A byte array containing the read data. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + asyncResult (parameter) is invalid. + + + + -or- + asyncResult (parameter) is null. + + +asyncResult (parameter) is invalid. + asyncResult (parameter) is null. + + EndReadByteArray or EndReadString was called before BeginRead. + + + + -or- + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + +EndReadByteArray or EndReadString was called before BeginRead. + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Waits indefinitely for a previous BeginRead call to complete. + + + An asynchronous result that represents the asynchronous NI-488.2 read operation that you want to end. + + + A string containing the read data. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + asyncResult (parameter) is invalid. + + + + -or- + asyncResult (parameter) is null. + + +asyncResult (parameter) is invalid. + asyncResult (parameter) is null. + + EndReadByteArray or EndReadString was called before BeginRead. + + + + -or- + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + +EndReadByteArray or EndReadString was called before BeginRead. + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Reads data from a device into a file. + + + Name of file into which data is read. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + fileName (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + I/0 operation aborted. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + File System Error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + I/0 operation aborted. + + GPIB interface not addressed correctly. + + File System Error. + + + + Parallel polls devices on the GPIB. + + + Parallel poll response byte. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + GPIB bus error. + + + + Conducts a serial poll. + + + Serial poll response byte. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + The serial poll response could not be read within the serial poll timeout period. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + The serial poll response could not be read within the serial poll timeout period. + + + + + Aborts any asynchronous read or write operation that is in progress on the device and resynchronizes the application with the driver. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Sends the Group Execute Trigger (GET) GPIB message to the device. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + + + Monitors the events specified by mask and delays processing until one or more of the events occurs. + + + Bit mask of GPIB events to wait for. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + A bit set in the mask (parameter) is invalid. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Method requires GPIB interface to be Controller-in-Charge (CIC). + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + GPIB bus error. + + + + -or- + + SRQ stuck in ON position. + + + + -or- + Wait or GetCurrentStatus is already in progress on the interface. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Method requires GPIB interface to be Controller-in-Charge (CIC). + + Nonexistent GPIB interface. + + GPIB bus error. + + SRQ stuck in ON position. + Wait or GetCurrentStatus is already in progress on the interface. + + + + Returns the current status of the GPIB. + + + The updated status of GPIB. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Method requires GPIB interface to be Controller-In-Charge (CIC). + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + GPIB bus error. + + + + -or- + + SRQ stuck in ON position. + + + + -or- + Wait or GetCurrentStatus is already in progress on the interface. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Method requires GPIB interface to be Controller-In-Charge (CIC). + + Nonexistent GPIB interface. + + GPIB bus error. + + SRQ stuck in ON position. + Wait or GetCurrentStatus is already in progress on the interface. + + + + Writes byte array data to a device. + + + Data to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Writes string data to a device. + + + Data to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + Writes string data asynchronously to a device from a user buffer. + + + Address of the buffer that contains the string to write. + + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + No Listeners on the GPIB. + + + + Writes byte array data asynchronously to a device from a user buffer. + + + Address of the buffer that contains the string to write. + + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + No Listeners on the GPIB. + + + + Writes string data asynchronously to a device from a user buffer and invokes a callback method when complete. + + + Address of the buffer that contains the string to write. + + + The AsyncCallback raised when + the write completes. + + + Object that contains additional user information. + + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + No Listeners on the GPIB. + + + + Writes byte array data asynchronously to a device from a user buffer and invokes a callback method when complete. + + + Address of the buffer that contains the string to write. + + + The AsyncCallback that is raised when + the write completes. + + + Object that contains additional user information. + + + An asynchronous result that represents this operation. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + data (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + No Listeners on the GPIB. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + No Listeners on the GPIB. + + + + Waits indefinitely + for a previous BeginWrite call to complete. + + + An asynchronous result that represents the asynchronous NI-488.2 write operation that you want to end. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + asyncResult (parameter) is invalid. + + + + -or- + asyncResult (parameter) is null. + + +asyncResult (parameter) is invalid. + asyncResult (parameter) is null. + + EndWrite was called before BeginWrite. + + + + -or- + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + +EndWrite was called before BeginWrite. + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + + + Writes data to a device from a file. + + + Name of file that contains the data to write. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + fileName (parameter) is null. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + The interface board is not Controller-In-Charge. + + + + -or- + + DMA error. + + + + -or- + + GPIB bus error. + + + + -or- + + GPIB interface not addressed correctly. + + + + -or- + + No Listeners on the GPIB. + + + + -or- + + I/O operation aborted. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + The interface board is not Controller-In-Charge. + + DMA error. + + GPIB bus error. + + GPIB interface not addressed correctly. + + No Listeners on the GPIB. + + I/O operation aborted. + + + + + Gets or sets the default size of read buffers when they are not explicitly defined as a parameter on read operations. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + Gets the last status of the last call made on the Device object. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + Gets the count of the last call made on the device. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + Gets or sets the primary address of the Device object. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the secondary address of the Device object. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the timeout period to select the maximum duration allowed for a synchronous I/O operation. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether to assert the end or identify (EOI) line during write operations. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if readdressing is performed between read and write operations. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether the end-of-string (EOS) character is used during read operations. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating if the EOI line is asserted when the EOS character is sent during write operations. Refer to SetEndOnWrite. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether to use an 8-bit or 7-bit compare. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + + Gets or sets the end-of-string character to use during data transfer. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets the length of time the driver waits for a serial poll response byte when polling. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + Gets or sets a value indicating whether to send UNT (Untalk) and UNL (Unlisten) at the end of read and write operations. + + + The property is set to an invalid state. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + An invalid value was passed to the property. + + + The inner exception is set to the GpibException due to one of the following conditions: + + + + A different process owns a lock for the interface. + + + + -or- + + Nonexistent GPIB interface. + + + + -or- + + Asynchronous I/O operation in progress. + + + + -or- + + Value is not currently supported by the NI-488.2 driver. + + + + The inner exception is set to the GpibException due to one of the following conditions: + + A different process owns a lock for the interface. + + Nonexistent GPIB interface. + + Asynchronous I/O operation in progress. + + Value is not currently supported by the NI-488.2 driver. + + + + + Gets access to the NI-488.2 driver device handle that is internally used with NI-488.2 driver operations. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + + + Gets or sets the object used to marshal event-handler and callback calls. + + + + + Specifies how events and callback delegates are invoked. + + + + + Specifies the comparison method to use with all end-of-string (EOS) comparisons. + + + + + 7-bit compare for all end-of-string (EOS) comparisons. + + + + + 8-bit compare for all end-of-string (EOS) comparisons. + + + + + Specifies the error codes that can be returned from the NI-488.2 driver API. + + + + + System error. This generally is returned if the interface board is not installed properly. + + + + + Method requires GPIB interface to be Controller-In-Charge (CIC). + + + + + No Listeners on the GPIB. + + + + + The GPIB interface is not addressed correctly when using the Board object methods. + + + + + Invalid argument to method call. + + + + + GPIB interface not System Controller as required. + + + + + I/O operation aborted (timeout). + + + + + Nonexistent GPIB interface. + + + + + DMA error. + + + + + Asynchronous I/O in progress on the interface. + + + + + The capability is not available in the underlying NI-488.2 driver. + + + + + File system error. + + + + + A GPIB bus error that occurs when the user sends out command bytes. + + + + The Serial Poll Queue cannot hold any more serial poll responses. + + + + + SRQ stuck in ON position. + + + + + Table problem. + + + + + Address or Board is locked. + + + + Notify or NotifyCallback + failed to re-arm. + + + + + Input handle is invalid. + + + + + Wait in progress on specified interface. + + + + + The event notification was canceled due to a reset of the interface. + + + + + The interface lost power. + + + + + This exception is thrown when the NI-488.2 driver returns an error due to invalid configuration states, invalid parameters, + and other factors. + + + + + Initializes a new instance of the GpibException object. + + + + + Initializes a new instance of the GpibException object using the + given error message. + + + Error message associated with this exception. + + + + + Initializes a new instance of the GpibException object using the + given error message and inner exception. + + + Error message associated with this exception. + + + Inner exception that caused this exception to be thrown. + + + + + Initializes a new instance of the GpibException object with the + given error message, NI-488.2 driver error code, and count. + + + Error message associated with this exception. + + + NI-488.2 driver error code that caused this exception to be thrown. + + + Count value specific to the method that threw the exception. + + + + + Initializes a new instance of the GpibException object with the + given error message, inner exception, NI-488.2 driver error code, and count. + + + Error message associated with this exception. + + + Inner exception that caused this exception to be thrown. + + + NI-488.2 driver error code that caused this exception to be thrown. + + + Count value specific to the method that throws the exception. + + + + + Initializes a new instance of the GpibException object using serialized data. + + + Object that holds the serialized object data. + + + Contextual information about the source or destination. + + + + + Sets the SerializationInfo object with information about the exception. + + + Object that holds the serialized object data. + + + Contextual information about the source or destination. + + + + + Gets the NI-488.2 driver error code that caused the exception to be thrown. + + + + + Gets a count value that can help you diagnose a specific error. + + + + + Gets a complete description of the error that caused the exception to be thrown. + + + + + Retrieves the status information for GPIB on a per-process and per-thread basis. + + + + Initializes the object to receive GPIB status information on a per-process and per-thread basis. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + + Finalizes the instance of the GpibStatus object. + + + + + Releases all resources used by the GpibStatus object. + + + + Overrides ToString. + Returns a string representation of the object. + + + Gets the current count of GPIB on the current thread. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + Gets the current status of GPIB on the current thread. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + Gets the current error of GPIB on the current thread. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + Gets the current count of the GPIB on the current process. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + Gets the current status of the GPIB on the current process. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + Gets the current error of the GPIB on the current process. + + + The NI-488.2 driver returns an error as a result of calling this method. + + + This member is called after the Dispose + method has been called directly from your code or indirectly through a finalizer. + + + The NI-488.2 driver library cannot be found. + + + A required operation in the NI-488.2 driver library cannot be found. + + + + + Contains NI-488.2 driver status information. + + + + + An error occurred. + + + + + Time limit exceeded. + + + + + END or end-of-string (EOS) detected. + + + + + SRQ line is asserted. + + + + + Device Requesting Service. + + + + + I/O complete. + + + + + Interface is in a lockout state. + + + + + Interface is in the Remote state. + + + + + Board is Controller-In-Charge. + + + + + Attention is asserted. + + + + + Interface is Talk addressed (that is, either TADS, SPAS, or TACS is active). + + + + + Listen addressed (either LADS or LACS is active). + + + + + Device Trigger State. + + + + + Device Clear State. + + + + + Asynchronous I/O is in progress. + + + + + Converts a GpibException to a standard .NET exception (i.e. + ArgumentOutOfRangeException), if the type of error that the GpibException + represents makes sense as a standard .NET exception. + + + GpibException to translate + + + Either the GpibException that was passed in or a new standard .NET exception + with exp passed in as a parameter. + + + + + Contains the NI-488.2 driver status code after the asynchronous operation has raised the event. + + + + + Specifies the number of bytes of data or command bytes to write. + + + + + Specifies the current Error if an error happened during the asynchronous operation. + + + + + Contains the data read. + + + + + Contains the data read. + + + + + This delegate of this type is called once after the mask condition is satisfied in the Notify method. + + + Object that generated the event. + + NotifyData object that specifies information about the event. + + + + + Specifies the format of the data that passes to the NotifyCallback delegate. + + + + + Initializes a new instance of NotifyData with serialized data. + + SerializationInfo to populate with data. + + + Serialization destination. + + + + + Sets the current re-arm mask for the NotifyCallback delegate. + + + Re-arm mask. + + + + + Returns the current Rearm mask for the NotifyCallback delegate. + + + The current Rearm mask for the NotifyCallback delegate. You can specify the rearm mask by calling SetReenableMask. This method is equivalent to calling Board Notify or Device Notify with the mask specified in SetReenableMask after the delegate returns. + + + + Overrides ToString. + Returns a string representation of the object. + + + + Populates a SerializationInfo with the data needed to serialize the target object. + + The SerializationInfo to populate with data. + + The destination for this serialization. + + + + + Gets the user data value that the user specified in the NotifyCallback delegate. + + + + + Gets the status value at the time the delegate is called. + + + + + Gets the count value at the time the delegate is called. + + + + + Gets the error value at the time the delegate is called. + + + + Specifies whether to use local or remote parallel poll configuration. + + + + + Remote parallel poll configuration. + + + + + Local parallel poll configuration. + + + + + Specifies the timeout value to use when doing parallel polls. + + + + + Use standard duration (2 microseconds) when conducting a parallel poll. + + + + + 10 microseconds. + + + + + 30 microseconds. + + + + + 100 microseconds. + + + + + 300 microseconds. + + + + + 1 millisecond. + + + + + 3 milliseconds. + + + + + 10 milliseconds. + + + + + 30 milliseconds. + + + + + 100 milliseconds. + + + + + 300 milliseconds. + + + + + 1 second. + + + + + 3 seconds. + + + + + 10 seconds. + + + + + 30 seconds. + + + + + 100 seconds. + + + + + 300 seconds. + + + + + 1000 seconds. + + + + + Partially defines the bits on a serial poll status byte bitfield. + + + + + Device that asserted the service request is requesting service. + + + + + At least one bit in the Event Status Register (ESR) is set. + + + + + Device that is requesting service has a message available. + + + + + Specifies the timeout value to use when doing method calls. + + + + + Disabled - no timeout. + + + + + 10 microseconds. + + + + + 30 microseconds. + + + + + 100 microseconds. + + + + + 300 microseconds. + + + + + 1 millisecond. + + + + + 3 milliseconds. + + + + + 10 milliseconds. + + + + + 30 milliseconds. + + + + + 100 milliseconds. + + + + + 300 milliseconds. + + + + + 1 second. + + + + + 3 seconds. + + + + + 10 seconds. + + + + + 30 seconds. + + + + + 100 seconds. + + + + + 300 seconds. + + + + + 1000 seconds. + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/nidmm_32.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/nidmm_32.dll new file mode 100644 index 0000000..e37c5ed Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/nidmm_32.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/niswitch_32.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/niswitch_32.dll new file mode 100644 index 0000000..01cb57a Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/NI/niswitch_32.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Lxi.Communication.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Lxi.Communication.dll new file mode 100644 index 0000000..c16719d Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Lxi.Communication.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Lxi.Piplx.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Lxi.Piplx.dll new file mode 100644 index 0000000..1f38bc8 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Lxi.Piplx.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Pipx40.Interop.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Pipx40.Interop.dll new file mode 100644 index 0000000..f5b11b0 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Pickering/Pickering.Pipx40.Interop.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/EDigitalInfo.txt b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/EDigitalInfo.txt new file mode 100644 index 0000000..58bccc1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/EDigitalInfo.txt @@ -0,0 +1 @@ +these dlls were taken from C:\Program Files (x86)\IVI Foundation\IVI\Microsoft.NET\Framework32\v4.0.30319 \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigital.Fx40.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigital.Fx40.dll new file mode 100644 index 0000000..7421118 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigital.Fx40.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigital.Fx40.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigital.Fx40.xml new file mode 100644 index 0000000..a70fed0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigital.Fx40.xml @@ -0,0 +1,1929 @@ + + + Teradyne.eDigital.Fx40 + + + + Main driver class. + + + Creates a new instance of the driver and opens and I/O session with the instrument. + An IVI logical name or an instrument specific string that identifies the address of the instrument, such as a VISA resource descriptor string. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + + + Creates a new instance of the driver and opens and I/O session with the instrument. + An IVI logical name or an instrument specific string that identifies the address of the instrument, such as a VISA resource descriptor string. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + A string that allows the user to specify the initial values of certain inherent attributes. + + + Creates a new instance of the driver and opens and I/O session with the instrument. + An IVI logical name or an instrument specific string that identifies the address of the instrument, such as a VISA resource descriptor string. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + Specifies whether to use process-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances that are created with the same accessKey will be protected from simultaneous access by multiple threads within a process or across processes, depending upon the value of the lockType parameter. + A string that allows the user to specify the initial values of certain inherent attributes. + + + Closes the I/O session to the instrument, as well as other unmanaged resources. The behavior is the same as IDisposable.Dispose. + + + Gets the service object of the specified type. Typically, this is an interface supported by the driver. + The type object of the service to get. Typically, this is the type of an interface supported by the driver. + A service object of the specified type. Null is returned if there is no service object of the specified type. + + + Performs driver-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Calling this method is equivalent to calling the driver's Close method. + + + Resets the interchangeability checking algorithms of the driver so that methods and properties that executed prior to calling this method have no affect on whether future calls to the driver generate interchangeability warnings. + + + Invalidates all of the driver's cached values. + + + Returns the list of instrument models that the IVI specific driver can control. The string does not include an abbreviation for the manufacturer if it is the same for all models. + Array of instrument models. + + + Returns the list of the class capability groups implemented by the driver. Capability group names are documented in the IVI class specifications. If the driver is not class compliant, the driver returns an empty array. + Array of class capability groups. + + + Queries the instrument and returns instrument specific error information. + A struct that includes the instrument error code and error message. + + + Performs an instrument self test, waits for the instrument to complete the test, and queries the instrument for the results. If the instrument passes the test, TestResult is zero and TestMessage is 'Self test passed'. + A struct that includes the numeric result from the self test operation (0 = no error, e.g. the test passed) and self test status message. + + + Quickly places the instrument in a state where it has no, or minimal, effect on the external system to which it is connected. This state is not necessarily a known state. + + + Does the equivalent of Reset and then, (1) disables class extension capability groups, (2) sets properties to initial values defined by class specs, and (3) configures the driver to option string settings used in the driver constructor. + + + Places the instrument in a known state and configures instrument options on which the IVI specific driver depends (for example, enabling/disabling headers). For an IEEE 488.2 instrument, Reset sends the command string *RST to the instrument. + + + Attempts to acquire a synchronization lock on this instance of the driver. The calling thread is blocked indefinitely until the lock is acquired. This method is useful for gaining exclusive access to the driver instance across a series of methods calls. The user must call the Unlock method on the returned lock to relinquish the lock and allow other threads to access this instance of the driver. + A reference to the acquired lock. Unlock is called on the returned reference. + + + Attempts to acquire a synchronization lock on this instance of the driver. The calling thread is blocked until either the lock is acquired or maxTime expires. If the lock is not acquired within the interval specified by maxTime, an exception is thrown. This method is useful for gaining exclusive access to the driver instance across a series of methods calls. The user must call the Unlock method on the returned lock to relinquish the lock and allow other threads to access this instance of the driver. + Specifies the maximum amount of time to wait to acquire the lock. + A reference to the acquired lock. Unlock is called on the returned reference. + + + Clears the user-defined pinmap entry for the specified pinmap index. + Index of a user-defined pinmap entry. + + + Returns a list of predefined pinmap indices for the specified list of pinmap indices. The pinmap indices can reference single pins or groups of pins. + Pinmmap index or list of pinmap indices to expand. + A list of predefined pinmap indices. + + + Finds a user-defined pinmap index that references the specified pinmap index. + First index to examine during the search. A value of 0 starts the search at the very first index in the pinmap. + Pinmap index for which the entries in the pinmap are searched. + Indicates whether or not pin groups should be searched. + The index of a pinmap entry that references the specified pinmap index. + + + Finds the pinmap entry with the specified name. The search is case sensitive. + Name of the entry to find. + Index of the pinmap entry whose name matches the specified name. + + + Returns a zero-based instrument-wide channel index for the channel referenced by the specified pinmap index. + Pinmap index whose instrument-wide channel index is to be returned. + Zero-based instrument-wide channel index for the channel referenced by the pinmap index. + + + Returns the list of pinmap indices associated with the specified pinmap index. If the pinmap index references a single pin entry, a list with one pinmap index is returned. + Pinmap index whose referenced pinmap indices are to be returned. + List of pinmap indices associated with the specified pinmap index. + + + Returns the name of the pinmap entry referenced by the specified pinmap index. + Pinmap index whose name is to be returned. + Name of the pinmap entry. + + + Returns the index of the pimap entry referenced by the specified pinmap index. + Pinmap index whose value is to be returned. + Index of the entry referenced by the specified pinmap index. + + + Returns the type of pinmap entry associated with the specified index. + Pinmap index whose type is to be returned. + The pinmap entry type of the specified pinmap index. + + + Loads the pinmap definitions from the specified file. + Path to file with pinmap definition to load + + + Resets the user-defined region of the pinmap. Makes all user-defined pinmap entries undefined. + + + Sets the user-defined pinmap entry referenced by the specified pinmap index to the single value or list of values specified. + User-defined pinmap index to set. + Name for the pinmap entry + Single pinmap index or list of pinmap index (group) to associate with the specified pinmap index. + + + Writes the user-defined pinmap entries to the specified file. + Path to file to which the pinmap gets saved + + + Returns the pin opcode for a channel identified by the pinmap index for the most recently executed static pattern. + Pinmap index identifying the channel of interest. + Pin opcode for the channel on the last executed static pattern. + + + Returns the pin result for a channel identified by the pinmap index for the most recently executed static pattern. + Pinmap index identifying the channel of interest. + Pin Result for the channel on the last executed static pattern. + + + Returns the overall result of the last static pattern executed. + Overall result of the last static pattern executed. + + + Executes the currently configured static pattern and returns the result of that execution. + Overall result for the static pattern. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) corresponds to the first pin in the group and so on. + A reference to the IStaticPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) corresponds to the first pin in the group and so on. + A reference to the IStaticPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector array that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) of the first byte corresponds to the first pin in the group and so on. + A reference to the IStaticPattern interface. + + + Sets the pin opcode for the specified pins. + Pin opcode to apply to specified pins. + One or more pinmap indices identifying the channels to set. Each pinmap index can reference a single channel or a group of channels. The static pin opcode specified is set for all channels referenced. + A reference to the IStaticPattern interface. + + + Returns a list pinmap indices identifying the channels that failed during the last executed static pattern. + List of failing pins for the last executed static pattern. If there are no failing pins, an empty list is returned. + + + Applies configured instrument settings to the hardware. + + + Reads instrument settings from a file. + File with stored instrument settings. + + + Reads the instrument settings to apply to the instrument when the Disable function is called. + File with instrument settings for the disable state. + + + Reads the instrument settings to apply to the instrument when the Reset function is called. + File with instrument settings for the reset state. + + + Saves instrument settings to the specified file. + File to which instrument settings are saved. + + + Synchronizes the software state maintained by the driver to the actual HW state. + + + Returns the ChannelInfo object for a given channel. + A zero-based index of a channel in the digital instrument + An object containing read-only information about a channel. + + + Returns the ModuleInfo object for a given module + A zero-based index of a module in the digital instrument + An object containing read-only information about a module. + + + Sets the state (open or closed) of the relay that connects a pin's channel to its front panel connection. + Specifies the state of the relay. + One or more pinmap indices identifying the pins to set. + + + Returns the state (open or closed) of the digital relay that connects a pin's channel to its front panel connection. + Pinmap index identifying a single pin. + The state of the digital connect relay for the specified pin. + + + Sets the state (open or closed) of the relay that connects a pin's front panel connection to a secondary (hybrid) front panel connection. + Specifies the state of the relay. + One or more pinmap indices identifying the pins to set. + + + Returns the state (open or closed) of the hybrid relay that connects a pin's front panel connection to a secondary (hybrid) front panel connection. + Pinmap index identifying a single pin. + The state of the hybrid relay for the specified pin. + + + This method simulates the specified alarm. This method is intented to be used when testing alarm event handling. + Type of alarm to simulate. + Source of simulated alarm. + Index of the source of the simulated alarm. + + + Initializes dynamic pattern set loading. + Indicates whether or not "sticky" (values that carry from one pattern to another if not specified)dynamic pattern values are initialized. If true, all dynamic channels set to load a an IOX pin opcode on the first pattern, Result Capture is set to True and the Timing Set index is set to 0. If false, all dynamic channels use the last opcode, and the Result Capture and Timing Set index are set to the last value specified. + + + Sets the pin opcode for the specified pins. + Pin opcode to apply to specified pins. + One or more pinmap indices identifying the channels to set. Each pinmap index can reference a single channel or a group of channels. The static pin opcode specified is set for all channels referenced. + A reference to the IDynamicPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector array that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) of the first byte corresponds to the first pin in the group and so on. + A reference to the IDynamicPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) corresponds to the first pin in the group and so on. + A reference to the IDynamicPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) corresponds to the first pin in the group and so on. + A reference to the IDynamicPattern interface. + + + Returns a list pinmap indices identifying the channels failing at the result index specifed for the most recently executed dynamic pattern set + Result index of interest. + List of failing pins for the result index specifed. If there are no failing pins, an empty list is returned. + + + Returns the result for a channel identified by the pinmap index collected at the specified result index for the most recently executed dynamic pattern set. + Result index of interest. + Pinmap index identifying the channel of interest. + The result for the channel at the specified index. + + + Returns the pin opcode for a channel identified by the pinmap index at the specified pattern index for the most recently executed dynamic pattern set. + Pattern index of interest. + Pinmap index identifying the channel of interest. + The pin opcode for the channel at the specified index. + + + Returns the result collected at the specified index for the most recently executed dynamic pattern set. + Result index of interest. + A struct containing the overall result collected at the specified index and the index of the pattern that generated the result. + + + Returns the result for the most recently executed dynamic pattern set. + A struct containing result information for the most recently executed dynamic pattern set. + + + Completes the current pattern and sets the pattern test instruction. + Type of test to perform when dynamic pattern is executed. + + + Sets the channel mode. + Channel mode + One or more pinmap indices identifying the pins to set. + + + Returns the channel mode of the pin. + Pinmap index identifying a single pin. + The channel mode of the specified pin. + + + Completes the current pattern and sets the test instruction to None. + + + Ends dynamic pattern set loading. + + + Identifies this pattern as the beginning of a counted loop. + Specifies the maximum number of iterations through the counted loop. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as the beginning of an uncounted loop. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as the end of an uncounted or counted loop. + The condition which, if true, terminates the loop. If the loop is counted, then the loop will terminate when either the exit condition is true or the specified number of loop iterations occur (whichever happens first). If the loop is uncounted, then only the exit condition determines when the loop exits. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as the end of an uncounted or counted loop. There is no exit condition. If the loop is counted, then the loop iterates the number of times specified by the loop count in the matching pattern that began this loop. If the loop is uncounted, then the loop executes indefinitely. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as a counted conditional single-pattern loop. The pattern repeats until either the specified condition becomes true or it has executed the specified number of times. + Specifies the maximum number of iterations of the pattern. + The condition which, if true, causes the repeat to terminate and execution to continue at the next pattern. The repeat will terminate when either the exit condition becomes true or the specified number of iterations of the repeated pattern occurs (whichever happens first). + A reference to the IDynamicPattern interface. + + + Identifies this pattern as an uncounted single-pattern loop. As there is no exit condition specified, the pattern repeats indefinitely. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as a counted single-pattern loop. The pattern executes the specified number of times before the pattern controller advances to the next pattern. + Specifies the number of iterations of the pattern. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as a conditional single-pattern loop. The pattern repeats until the specified condition becomes true. + The condition which, if true, causes the repeat to terminate and execution to continue at the next pattern. + A reference to the IDynamicPattern interface. + + + Terminates execution of the dynamic pattern set if the specified condition is true. + The condition, which, if true, terminates dynamic pattern set execution. If the condition is false, then execution continues with the next pattern in the pattern set. + A reference to the IDynamicPattern interface. + + + Unconditionally terminates execution of the dynamic pattern set. + A reference to the IDynamicPattern interface. + + + Specifies the timing set to be used on this pattern. This setting is incremental. It remains in effect on all subsequent consecutively-defined patterns until another call changes it. + The index of the timing set to use on this pattern. This value is 0-based. + A reference to the IDynamicPattern interface. + + + Specifies whether or not results are captured on this pattern. This setting is incremental. It remains in effect on all subsequent consecutively-defined patterns until another call changes it. + Capture mode, if true a result is captured and stored in the result RAM. If false, a result is not captured. + A reference to the IDynamicPattern interface. + + + Causes the pattern controller to issue a trigger on the specified trigger line. This modifier is not incremental. A trigger is generated only on those patterns for which this setting is explicitly specified. + Identifies the particular trigger line on which to generate the trigger signal. + A reference to the IDynamicPattern interface. + + + Causes the pattern controller to issue an interrupt to the host PC during the execution of this pattern. This modifier is not incremental. A trigger is generated only on those patterns for which this setting is explicitly specified. + A reference to the IDynamicPattern interface. + + + Runs the currently loaded dynamic pattern set and returns the result of that execution. + A struct containing result information for the dynamic pattern set. + + + Returns pattern control instruction for the specified pattern. + Pattern index of interest. + The pattern's pattern control instruction. + + + Returns the pattern modifieres for the specified pattern. + Pattern index of interest. + The pattern's pattern modifiers. + + + Sets the drive format of a pin in dynamic mode. + Drive format used in dynamic mode + One or more pinmap indices identifying the pins to set. + + + Returns the format of the pin. + Pinmap index identifying a single pin. + The format of the specified pin. + + + Sets the freerun mode. If true, pin continues to assert and return at the end of a pattern set (instead of ceasing to trigger), and the dynamic pin continues to generate a drive signal. + Enables/disables freerun mode when executing dynamic pattern sets. + One or more pinmap indices identifying the pins to set. + + + Returns the freerun mode of the pin. + Pinmap index identifying a single pin. + The enable/disable state of freerun of the specified pin. + + + Creates an edge set and returns a handle to the new edge set. + Handle to the created edge set. + + + Returns the handle of the default edge set. + Handle to the default edge set. + + + Returns the edge set used by the pin. + Pinmap index identifying a single pin. + The edge set used by the pin. + + + Sets the edge set used by a pin in dynamic mode. + Edge set to use. + One or more pinmap indices identifying the pins to set. + + + Returns the timing set with the specified index. + The index of the desired timing set. + + + + Starts executing the dynamic pattern set and returns without waiting for completion. + + + Waits for the dynamic pattern set to finish executing. + + + Stops the executing dynamic pattern set. + + + Returns the captured data for a channel identified by the pinmap index collected at the specified result index for the most recently executed dynamic pattern set. + Result index of interest. + Pinmap index identifying the channel of interest. + The data captured for the channel at the specified index. A 1 indicates a high state was captured. A 0 indicates a low state was captured. + + + Returns the data captured for a channel identified by the pinmap index for the most recently executed static pattern. + Pinmap index identifying the channel of interest. + Data captured for the channel on the last executed static pattern. A 1 indicates a high state was captured. A 0 indicates a low state was captured. + + + Returns true if a dynamic pattern set is running and false otherwise. + True if a dynamic pattern set is running and false otherwise. + + + Sets the pattern controller software flag. + + + Sets the user-defined pinmap entry referenced by the specified pinmap index to the channel identified by slot, slocket and channel on socket. + User-defined pinmap index to set. + Name for the pinmap entry + The physical slot in which the module with the target channel resides. + The socket in which the module with the target channel resides. Use -1 for modules that are not socket based. + Zero-based index of channel on the module. + + + Align the timing edges. + + + Configures the clock used for dynamic pattern timing clock period generation. + Source of the reference clock used for dynamic pattern timing clock period generation. + Trigger edge used by the external reference clock for dynamic timing clock period generation. This parameter is ignored if the clock reference is external. + + + Writes alignment values to the specified file. + Path to file to which the alignment data is written. + + + Reads alignment values from the specified file. + Path to file from which the alignment data is read. + + + Specifies the clocks per pattern (CPP) factor to be used on this pattern. This setting is incremental. It remains in effect on all subsequent consecutively-defined patterns until another call changes it. The CPP is set to one when the Begin Load function is called. + The clocks per pattern factor to use on this pattern. + A reference to the IDynamicPattern interface. + + + Sets up a connection between an instrument's internal trigger line and a trigger source (input). + Internal line to which the source is connected. + The source (input) for the internal trigger. Refer to instrument family documentation for valid values which may include one or more of the standard values defined in Ivi.Driver.TriggerSource. + + + Sends a software trigger to the instrument. + + + Gets the trigger source connected to an instrument's internal trigger line. + Internal line + The source (input) connected to the internal trigger line. + + + Sets up a connection between an instrument's internal trigger line and a trigger sink (output) + Internal line to which the sink is connected. + The sink (output) for the internal trigger. Refer to instrument family documentation for valid values which may include one or more of the standard values defined in Ivi.Driver.TriggerSource. + + + Gets the trigger sink connected to an instrument's internal trigger line. + Internal line + The sink (output) connected to the internal trigger line. + + + Gets/Sets the delay between when the drive opcodes are applied and when the expect opcodes are applied. + + + The number of channels in the digital instrument. + + + The number of modules in the digital instrument. + + + Reference to the IIviDriverOperation interface. + + + Reference to the IIviDriverIdentity interface. + + + Reference to the IIviDriverUtility interface. + + + Logical Name identifies a driver session in the Configuration Store. If Logical Name is not empty, the driver was initialized from information in the driver session. If it is empty, the driver was initialized without using the Configuration Store. + + + The resource descriptor specifies the connection to a physical device. It is either specified in the Configuration Store or passed in the resource name at initialization. + + + Drivers may choose to always cache some instrument settings, never cache others, and optionally cache others, to avoid unecessary I/O to the instrument. If True, the driver caches optionally cached instrument settings. + + + If True, the driver queries the instrument status at the end of each method or property that performs I/O to the instrument. If an error is reported, use ErrorQuery to retrieve error messages one at a time from the instrument. + + + Drivers may choose to always validate some property/parameter values, never validate others, and optionally validate others, to avoid sending invalid commands to the instrument. If True, the driver performs optional validations. + + + If True, the driver does not perform I/O to the instrument, and returns simulated values for output parameters. + + + The driver setup string. It is either specified in the Configuration Store or passed via the optionString parameter to a driver constructor. + + + The name of the manufacturer reported by the physical instrument. If Simulation is enabled or the instrument is not capable of reporting the name of the manufacturer, a string is returned that explains the condition. + + + The model number or name reported by the physical instrument. If Simulation is enabled or the instrument is not capable of reporting the model number or name, a string is returned that explains the condition. + + + The firmware revision reported by the physical instrument. If Simulation is enabled or the instrument is not capable of reporting the firmware revision, a string is returned that explains the condition. + + + The case-sensitive unique identifier of the implementing IVI.NET instrument driver. + + + For IVI class-compliant drivers, the major version number of the instrument class specification. If the driver is not class compliant, the driver returns zero. + + + For IVI class-compliant drivers, the minor version number of the instrument class specification. If the driver is not class compliant, the driver returns zero. + + + A brief description of the implementing component. + + + The revision of the implementing component. Refer to IVI 3.2, Section 3.1.2.2, for a description of revision syntax and semantics. + + + The name of the vendor that supplies the implementing component. + + + Reference to the IPinmap interface. + + + Reference to the IStatic interface. + + + Reference to the ISetup interface. + + + Reference to the IInfo interface. + + + Reference to the IChannelCollection interface. + + + Reference to the IPin interface. + + + Reference to the IAlarm interface. + + + Specifies whether or not protective actions are taken in response to an over-current condition. + + + True, if the instrument session is for a simulated instrument. + + + Reference to the IInstrument interface. + + + Master driver enable. When Set to true, all drivers in the instrument are enabled immediately. When set to false, all drivers in the instrument are tristated immediately. + + + Returns the family to which the instrument model belongs. + + + Returns the version of the eDigital plug-in for the instrument model. + + + Returns the version of the plug-in interface implemented by the eDigital plug-in for the instrument model. + + + Reference to the IDynamic interface. + + + Gets/Sets the duration that dynamic pattern set can run without timing out. + + + Gets/sets expanded-result-capture mode for handling of loops and repeats in dynamic pattern sets. If true, results are captured for all patterns with results capture enabled for all iterations loops and repeats. If false, one result is captured for every pattern executed that is, only the last iteration through the loop or repeat is captured and the setting of results capture is ignored. + + + Gets/Sets the behavior of a dynamic channel when a pattern set timeout occurs. + + + Reference to the IDynamicControl interface. + + + Reference to the IDynamicModifiers interface. + + + Reference to the IDynamicPattern interface. + + + Reference to the IStaticPattern interface. + + + Reference to the IDynamicReadback interface. + + + Reference to the IStaticReadback interface. + + + Reference to the ITiming interface. + + + Gets/Sets the resolution of the system clock. + + + Reference to the IDynamicExecution interface. + + + Reference to the IeDigitalDebugSignalCollection interface. + + + Gets the state of the pattern controller software flag. Returns true if the software flag is set and false otherwise. + + + Specifies the depth of the pass/fail pipeline in terms of patterns. A value of zero specifies that the pipeline will be as short as possible given the instrument's configuration. The default value is 16 which emulates the M9-Series pipeline behavior. + + + Reference to the ITimingAlignment interface. + + + The alignment status of the instrument. + + + The maximum number of patterns that can be stored in pattern memory. + + + The maximum number of results that can be captured in results memory. + + + The maximum number of timing sets available. + + + Source of the reference clock used for dynamic pattern timing clock period generation. + + + Trigger edge used by the external reference clock for dynamic timing clock period generation. + + + Reference to the ITrigger interface. + + + Warning event. + + + Coercion record event. + + + Interchange check warning event. + + + Raised as a result of an alarm condition on the instrument hardware. + + + Occurs when the instrument executes a dynamic pattern that has a NotifyHost pattern modifier. + + + + + + + + + + + + + + + + + + Root class for the Channel repeated capability. + + + The repeated capability physical identifier. + + + Returns the predefined pinmap index assigned to the channel. + + + Collection class for the Channel repeated capability. + + + Returns an enumerator that iterates through a collection. + An IEnumerator object that can be used to iterate through the collection. + + + Returns an enumerator that iterates through a collection. + An IEnumerator object that can be used to iterate through the collection. + + + Returns an interface pointer which can be used to control the attributes and other functionality of the repeated capability instance identified by the specified physical name. + The repeated capability physical identifier. + + + The number of channels. + + + Data for the Alarm Event. + + + The type of alarm being generated. + + + The type of hardware resource that is generating the alarm. + + + An index that identifies the particular instance of the hardware resource that is generating the alarm. + + + Root class for the DebugSignal repeated capability. + + + The repeated capability physical identifier. + + + The source of the signal. + + + Collection class for the DebugSignal repeated capability. + + + Returns an enumerator that iterates through a collection. + An IEnumerator object that can be used to iterate through the collection. + + + Returns an enumerator that iterates through a collection. + An IEnumerator object that can be used to iterate through the collection. + + + Returns an interface pointer which can be used to control the attributes and other functionality of the repeated capability instance identified by the specified physical name. + The repeated capability physical identifier. + + + The number of repeated capability instances. + + + The width of the pulse of the debug signal when the source is Test Clock + + + Data for the NotifyHost event. + + + The eDigital driver reference assoicated with the dynamic pattern set that raised the event. + + + Root interface of driver hierarchy. + + + Reference to the IPinmap interface. + + + Reference to the IStatic interface. + + + Reference to the ISetup interface. + + + Reference to the IInfo interface. + + + Reference to the IChannelCollection interface. + + + Reference to the IPin interface. + + + Reference to the IeDigitalAlarms interface. + + + Reference to the IInstrument interface. + + + Reference to the IDynamic interface. + + + Reference to the ITiming interface. + + + Reference to the IeDigitalDebugSignalCollection interface. + + + Reference to the ITrigger interface. + + + + + + + + + eDigital Pinmap interface + + + Clears the pinmap entry for the specified pinmap index. + Index of a pinmap entry in the user-defined region. + + + Returns a list of predefined pinmap indices for the specified list of pinmap indices. The pinmap indices can reference single pins or groups of pins. + Pinmmap index or list of pinmap indices to expand. + A list of predefined pinmap indices. + + + Finds a user-defined pinmap index that references the specified pinmap index. + First index to examine during the search. A value of 0 starts the search at the very first index in the pinmap. + Pinmap index for which the entries in the pinmap are searched. + Indicates whether or not pin groups should be searched. + The index of a pinmap entry that references the specified pinmap index. + + + Finds the pinmap entry with the specified name. The search is case sensitive. + Name of the entry to find. + Index of the pinmap entry whose name matches the specified name. + + + Returns an instrument-wide channel index for the channel referenced by the specified pinmap index. + Pinmap index whose instrument-wide channel index is to be returned. + 0-based instrument-wide channel index for the channel referenced by the pinmap index. + + + Returns the list of pinmap indices associated with the specified pinmap index. If the pinmap index references a single pin entry, a list with one pinmap index is returned. + Pinmap index whose referenced pinmap indices are to be returned. + List of pinmap indices associated with the specified pinmap index. + + + Returns the name of the pinmap entry referenced by the specified pinmap index. + Pinmap index whose name is to be returned. + Name of the pinmap entry. + + + Returns the index of the pimap entry referenced by the specified pinmap index. + Pinmap index whose value is to be returned. + Index of the entry referenced by the specified pinmap index. + + + Returns the type of pinmap entry associated with the specified index. + Pinmap index whose type is to be returned. + The pinmap entry type of the specified pinmap index. + + + Loads the pinmap definitions from the specified file. + Path to file with pinmap definition to load + + + Resets the user-defined region of the pinmap. Makes all user-defined pinmap entries undefined. + + + Sets the user-defined pinmap entry references by the specified pinmap index to the single value or list of values specified. + User-defined pinmap index to set. + Name for the pinmap entry + Single pinmap index or list of pinmap index (group) to associated with the specified pinmap index. + + + Writes the user-defined pinmap entries to the specified file. + Path to file to which the pinmap gets saved + + + Sets the user-defined pinmap entry referenced by the specified pinmap index to the channel identified by slot, slocket and channel on socket. + User-defined pinmap index to set. + Name for the pinmap entry + The physical slot in which the module with the target channel resides. + The socket in which the module with the target channel resides. Use -1 for modules that are not socket based. + Zero-based index of channel on the module. + + + eDigital Static interface + + + Returns the pin result for a channel for the most recently executed static pattern. + Pinmap index + + + + + + + + Returns a list pinmap indices identifying the channels that failed during the last executed static pattern. + + + + Returns the data captured for a channel identified by the pinmap index for the most recently executed static pattern. + Pinmap index identifying the channel of interest. + Data captured for the channel on the last executed static pattern. A 1 indicates a high state was captured. A 0 indicates a low state was captured. + + + Reference to the IStaticPattern interface. + + + Gets/Sets the delay between when the drive opcodes are applied and when the expect opcodes are applied. + + + Reference to the IStaticReadback interface. + + + eDigital Setup interface + + + + + + + + + + + + + + + + + + + + + + + + + eDigital Info interface + + + Returns the ChannelInfo object for a given channel. + A zero-based index of a channel in the digital instrument + An object containing various read-only information about a channel. + + + Returns the ModuleInfo object for a given module + A zero-based index of a module in the digital instrument + An object containing various read-only information about a module. + + + The number of channels in the digital instrument. + + + The number of modules in the digital instrument. + + + True, if the instrument session is for a simulated instrument. + + + Returns the family to which the instrument model belongs. + + + Returns the version of the eDigital plug-in for the instrument model. + + + Returns the version of the plug-in interface implemented by the eDigital plug-in for the instrument model. + + + Root interface for the Channel repeated capability. + + + Returns the predefined pinmap index assigned to the channel. + + + Collection interface for the Channel repeated capability. + + + eDigital Pin interface + + + Sets the state (open or closed) of the relay that connects a pin's channel to its front panel connection. + Specifies the state of the relay. + One or more pinmap indices identifying the pins to set. + + + Returns the state (open or closed) of the digital relay that connects a pin's channel to its front panel connection. + Pinmap index identifying a single pin. + The state of the digital connect relay for the specified pin. + + + Sets the state (open or closed) of the relay that connects a pin's front panel connection to a secondary (hybrid) front panel connection. + Specifies the state of the relay. + One or more pinmap indices identifying the pins to set. + + + Returns the state (open or closed) of the hybrid relay that connects a pin's front panel connection to a secondary (hybrid) front panel connection. + Pinmap index identifying a single pin. + The state of the hybrid relay for the specified pin. + + + Sets the channel mode. + Channel mode + One or more pinmap indices identifying the pins to set. + + + Channel mode. + Pinmap index identifying a single pin. + The channel mode of the specified pin. + + + Sets the drive format of a pin in dynamic mode. + Drive format used in dynamic mode + One or more pinmap indices identifying the pins to set. + + + Returns the format of the pin. + Pinmap index identifying a single pin. + The format of the specified pin. + + + Sets the freerun mode. If true, pin continues to assert and return at the end of a pattern set (instead of ceasing to trigger), and the dynamic pin continues to generate a drive signal. + Enables/disables freerun mode when executing dynamic pattern sets. + One or more pinmap indices identifying the pins to set. + + + Returns the freerun mode of the pin. + Pinmap index identifying a single pin. + The enable/disable state of freerun of the specified pin. + + + The edge set used by the pin. + Pinmap index identifying a single pin. + The edge set used by the pin. + + + Sets the edge set used by a pin in dynamic mode. + Edge set to use. + One or more pinmap indices identifying the pins to set. + + + eDigital Alarm interface + + + This method simulates the specified alarm. This method is intented to be used when testing alarm event handling. + Type of alarm to simulate. + Source of simulated alarm. + Index of the source of the simulated alarm. + + + Specifies whether or not protective actions are taken in response to an over-current condition. + + + Raised as a result of an alarm condition on the instrument hardware. + + + eDigital Instrument interface + + + Master driver enable. When Set to true, all drivers in the instrument are enabled immediately. When set to false, all drivers in the instrument are tristated immediately. + + + eDigital Dynamic interface + + + Returns a list pinmap indices identifying the channels failing at the result index specifed for the most recently executed dynamic pattern set + Result index of interest. + List of failing pins for the result index specifed. If there are no failing pins, an empty list is returned. + + + Returns the result collected at the specified index for the most recently executed dynamic pattern set. + Result index of interest. + A struct containing the overall result collected at the specified index and the index of the pattern that generated the result. + + + Returns the result for the channel at the specified index for the last executed dynamic pattern set. + Result index of interest. + Pinmap index identifying the channel of interest. + The result for the channel at the specified index. + + + Returns the result for the most recently executed dynamic pattern set. + A struct containing result information for the most recently executed dynamic pattern set. + + + Initializes dynamic pattern set loading. + Indicates whether or not "sticky" (values that carry from one pattern to another if not specified)dynamic pattern values are initialized. If true, all dynamic channels set to load a an IOX pin opcode on the first pattern, Result Capture is set to True and the Timing Set index is set to 0. If false, all dynamic channels use the last opcode, and the Result Capture and Timing Set index are set to the last value specified. + + + Ends dynamic pattern set loading. + + + Runs the currently loaded dynamic pattern set and returns the result of that execution. + A struct containing result information for the dynamic pattern set. + + + The data captured for the channel at the specified index. A 1 indicates a high state was captured. A 0 indicates a low state was captured. + Result index of interest. + Pinmap index identifying the channel of interest. + The data captured for the channel at the specified index. A 1 indicates a high state was captured. A 0 indicates a low state was captured. + + + Sets the pattern controller software flag. + + + Gets/Sets the duration that dynamic pattern set can run without timing out. + + + Gets/sets expanded-result-capture mode for handling of loops and repeats in dynamic pattern sets. If true, results are captured for all patterns with results capture enabled for all iterations loops and repeats. If false, one result is captured for every pattern executed that is, only the last iteration through the loop or repeat is captured and the setting of results capture is ignored. + + + Gets/Sets the behavior of a dynamic channel when a pattern set timeout occurs. + + + Reference to the IDynamicPattern interface. + + + Reference to the IDynamicReadback interface. + + + Reference to the IDynamicAdvanced interface. + + + Gets the state of the pattern controller software flag. Returns true if the software flag is set and false otherwise. + + + Specifies the depth of the pass/fail pipeline in terms of patterns. A value of zero specifies that the pipeline will be as short as possible given the instrument's configuration. The default value is 16 which emulates the M9-Series pipeline behavior. + + + The maximum number of patterns that can be stored in pattern memory. + + + The maximum number of results that can be captured in results memory. + + + Occurs when the instrument executes a dynamic pattern that has a NotifyHost pattern modifier. + + + eDigital Dynamic Pattern Control interface + + + Identifies this pattern as a counted conditional single-pattern loop. The pattern repeats until either the specified condition becomes true or it has executed the specified number of times. + Specifies the maximum number of iterations of the pattern. + The condition which, if true, causes the repeat to terminate and execution to continue at the next pattern. The repeat will terminate when either the exit condition becomes true or the specified number of iterations of the repeated pattern occurs (whichever happens first). + A reference to the IDynamicPattern interface. + + + Identifies this pattern as a counted single-pattern loop. The pattern executes the specified number of times before the pattern controller advances to the next pattern. + Specifies the number of iterations of the pattern. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as a conditional single-pattern loop. The pattern repeats until the specified condition becomes true. + The condition which, if true, causes the repeat to terminate and execution to continue at the next pattern. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as an uncounted single-pattern loop. As there is no exit condition specified, the pattern repeats indefinitely. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as the beginning of a counted loop. + Specifies the maximum number of iterations through the counted loop. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as the beginning of an uncounted loop. + A reference to the IDynamicPattern interface. + + + Unconditionally terminates execution of the dynamic pattern set. + A reference to the IDynamicPattern interface. + + + Terminates execution of the dynamic pattern set if the specified condition is true. + The condition, which, if true, terminates dynamic pattern set execution. If the condition is false, then execution continues with the next pattern in the pattern set. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as the end of an uncounted or counted loop. There is no exit condition. If the loop is counted, then the loop iterates the number of times specified by the loop count in the matching pattern that began this loop. If the loop is uncounted, then the loop executes indefinitely. + A reference to the IDynamicPattern interface. + + + Identifies this pattern as the end of an uncounted or counted loop. + The condition which, if true, terminates the loop. If the loop is counted, then the loop will terminate when either the exit condition is true or the specified number of loop iterations occur (whichever happens first). If the loop is uncounted, then only the exit condition determines when the loop exits. + A reference to the IDynamicPattern interface. + + + eDigital Dynamic Pattern Modifiers interface + + + Specifies the timing set to be used on this pattern. This setting is incremental. It remains in effect on all subsequent consecutively-defined patterns until another call changes it. + The index of the timing set to use on this pattern. This value is 0-based. + A reference to the IDynamicPattern interface. + + + Specifies whether or not results are captured on this pattern. This setting is incremental. It remains in effect on all subsequent consecutively-defined patterns until another call changes it. + Capture mode, if true a result is captured and stored in the result RAM. If false, a result is not captured. + A reference to the IDynamicPattern interface. + + + Causes the pattern controller to issue a trigger on the specified trigger line. This modifier is not incremental. A trigger is generated only on those patterns for which this setting is explicitly specified. + Identifies the particular trigger line on which to generate the trigger signal. + A reference to the IDynamicPattern interface. + + + Causes the pattern controller to issue an interrupt to the host PC during the execution of this pattern. This modifier is not incremental. A trigger is generated only on those patterns for which this setting is explicitly specified. + A reference to the IDynamicPattern interface. + + + Specifies the clocks per pattern (CPP) factor to be used on this pattern. This setting is incremental. It remains in effect on all subsequent consecutively-defined patterns until another call changes it. The CPP is set to one when the Begin Load function is called. + The clocks per pattern factor to use on this pattern. + A reference to the IDynamicPattern interface. + + + eDigital Dynamic Pattern interface + + + Completes the current pattern and sets the test instruction to None. + + + Sets the pin opcode for the specified pins. + Pin opcode to apply to specified pins. + One or more pinmap indices identifying the channels to set. Each pinmap index can reference a single channel or a group of channels. The static pin opcode specified is set for all channels referenced. + A reference to the IDynamicPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) corresponds to the first pin in the group and so on. + A reference to the IDynamicPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) corresponds to the first pin in the group and so on. + A reference to the IDynamicPattern interface. + + + Sets the pin opcodes for a pin group. + Group opcode to apply to the pin group. + Pinmap index identify channel or channels to set. Pinmap index can reference a single pin (group of 1) or a group of pins. + Bitvector array that contains the HIGH/LOW value for each pin in the group; the LSB (least significant bit) of the first byte corresponds to the first pin in the group and so on. + A reference to the IDynamicPattern interface. + + + Completes the current pattern and sets the pattern test instruction. + Type of test to perform when dynamic pattern is executed. + + + Reference to the IDynamicControl interface. + + + Reference to the IDynamicModifiers interface. + + + eDigital Static Pattern interface + + + Sets the pin opcodes for a pin group. + + + + A reference to the IStaticPattern interface. + + + Sets the pin opcodes for a pin group. + + + + A reference to the IStaticPattern interface. + + + Sets the pin opcodes for a pin group. + + + + A reference to the IStaticPattern interface. + + + Sets the pin opcode for the specified pins. + Pin opcode to apply to specified pins. + One or more pinmap indices identifying the channels to set. Each pinmap index can reference a single channel or a group of channels. The static pin opcode specified is set for all channels referenced. + A reference to the IStaticPattern interface. + + + Executes the currently configured static pattern and returns the result of that execution. + + + + eDigital Dynamic Readback interface + + + Returns the pin opcode for a channel identified by the pinmap index at the specified pattern index for the most recently executed dynamic pattern set. + Pattern index of interest. + Pinmap index identifying the channel of interest. + The pin opcode for the channel at the specified index. + + + Returns pattern control instruction for the specified pattern. + Pattern index of interest. + The pattern's pattern control instruction. + + + Returns the pattern modifieres for the specified pattern. + Pattern index of interest. + The pattern's pattern modifiers. + + + eDigital Static Readback interface + + + Returns the pin opcode for a channel for the most recently executed static pattern. + Pinmap index + Pin opcode for the channel on the last executed static pattern. + + + eDigital Timing interface + + + Creates an edge set and returns a handle to the new edge set. + Handle to the created edge set. + + + Handle to the default edge set. + Handle to the default edge set. + + + Returns the timing set with the specified index. + The index of the desired timing set. + + + + Configures the clock used for dynamic pattern timing clock period generation. + Source of the reference clock used for dynamic pattern timing clock period generation. + Trigger edge used by the external reference clock for dynamic timing clock period generation. This parameter is ignored if the clock reference is external. + + + Gets/Sets the resolution of the system clock. + + + Reference to the ITimingAlignment interface. + + + The maximum number of timing sets available. + + + Source of the reference clock used for dynamic pattern timing clock period generation. + + + Trigger edge used by the external reference clock for dynamic timing clock period generation. + + + eDigital Timing Set interface + + + Sets the drive timing assert and return delays for the edge set on the specified timing set. + Handle for the desired edge set. + Assert delay from the beginning of the dynamic pattern for the drive phase. + Return delay from the beginning of the pattern for the drive phase. + + + Sets the test strobe delay from the beginning of the dynamic pattern for the edge set on the specified timing set. + Handle for the desired edge set. + The test strobe delay from the beginning of the pattern. + + + Gets the drive and detect timing for the edge set on the specified timing set. + Handle for the desired edge set. + Edge set associated with the specified handle. + + + Sets the drive and detect timing for the edge set on the specified timing set. + Handle for the desired edge set. + Timing values for the specified edge set. + + + Clock period of the timing set. + + + IDynamicExecution interface. + + + Starts executing the dynamic pattern set and returns without waiting for completion. + + + Waits for the dynamic pattern set to finish executing. + + + Stops the executing dynamic pattern set. + + + Returns true if a dynamic pattern set is running and false otherwise. + True if a dynamic pattern set is running and false otherwise. + + + Root interface for the DebugSignal repeated capability. + + + The source of the signal. + + + Collection interface for the DebugSignal repeated capability. + + + The width of the pulse of the debug signal when the source is Test Clock + + + ITimingAlignment interface. + + + Align the timing edges. + + + Writes alignment values to the specified file. + Path to file to which the alignment data is written. + + + Reads alignment values from the specified file. + Path to file from which the alignment data is read. + + + The alignment status of the instrument. + + + ITrigger interface. + + + Sets up a connection between an instrument's internal trigger line and a trigger source (input). + Internal line to which the source is connected. + The source (input) for the internal trigger. Refer to instrument family documentation for valid values which may include one or more of the standard values defined in Ivi.Driver.TriggerSource. + + + Sends a software trigger to the instrument. + + + Gets the trigger source connected to an instrument's internal trigger line. + Internal line + The source (input) connected to the internal trigger line. + + + Sets up a connection between an instrument's internal trigger line and a trigger sink (output) + Internal line to which the sink is connected. + The sink (output) for the internal trigger. Refer to instrument family documentation for valid values which may include one or more of the standard values defined in Ivi.Driver.TriggerSource. + + + Gets the trigger sink connected to an instrument's internal trigger line. + Internal line + The sink (output) connected to the internal trigger line. + + + A struct containing channel information. + + + Zero-based index of channel on the module. + + + ModuleInfo object for the module on which the channel resides. + + + Zero-based index of channel on the instrument. + + + Indicates whether or not the channel is a static-only channel. Static-only channels do not support dynamic pattern execution. + + + A struct containing module information. + + + The chassis in which the module resides. + + + The slot number in which the module resides. + + + The socket the module occupies within the slot. Returns -1 if the module's position is not socket-based. + + + String identifying the type of this module. + + + String identifying the firmware revision of the module. + + + Zero-based index of the module on the instrument. + + + Returns the option loaded on the module. The option specifies the runtime defined behavior of the module. An empty string is returned for modules that don't support runtime defined behavior. + + + The number of channels on the module. + + + String identifying the serial number of the module. + + + A struct containing information about a captured dynamic pattern result. + + + Result captured when dynamic pattern was executed. + + + Index of pattern that produced the captured result. + + + A struct containing the overall results information for a dynamic pattern set. + + + Overall result of the dynamic pattern set. + + + Number of results collected during the execution of the dynamic pattern set. + + + If the dynamic pattern set fails, the index result for the first failure. Otherwise, the value is -1. + + + Reasons why the dynamic pattern set stopped. + + + Total number of patterns executed during the execution of the dynamic pattern set. + + + Index of the last pattern executed during the execution of the dynamic pattern set. + + + A struct containing a dynamic pattern's pattern control instruction. + + + The opcode of the pattern control instruction. + + + The count of the pattern control instruction. + + + The condition of the pattern control instruction. + + + A struct containing a dynamic pattern's pattern modifiers. + + + Specifies whether or not the pattern controller issues a trigger. + + + Type of test to perform when dynamic pattern is executed. + + + The timing set index. + + + Specifies whether or not results are captured on this pattern. + + + Specifies whether or not an interrupt is generated to the host PC. + + + The clocks-per-pattern (cpp) factor. + + + A struct containing timing edge values. + + + The assert value specifies the delay from the time of the Drive Trigger associated with the a pin until the driver on that pin begins driving the signal speciifed by the pin's opcode. + + + The return value specifies the delay from the time of the Drive Trigger associated with the a pin until the driver on that pin stops driving the signal speciifed by the pin's opcode. + + + The detect strobe specifies the delay from the time of the Detect Trigger associated with a pin until that pin tests the detected signal as specified by the pin's opcode. + + + Specifies the type of pinmap entry. + + + Pinmap entry references a single pin. + + + Pinmap entry references a group (2 or more) pins. + + + Pinmap entry is undefined. + + + Pinmap entry references an instrument module. + + + Specifies the pin opcode. + + + IOX pin opcode specifies to drive tristate and expect X (don't care). + + + Input Low pin opcode specifies to drive low and expect X (don't care). + + + Input High pin opcode specifies to drive high and expect X (don't care). + + + Output Low pin opcode specifies to drive tristate and expect low. + + + Output High pin opcode specifies to drive tristate and expect high. + + + Monitor Low pin opcode specifies to drive and expect low. + + + Monitor High pin opcode specifies to drive and expect high. + + + Input Low Output High pin opcode specifies to simultaneously drive low and expect high. + + + Input High Output Low pin opcode specifies to simultaneously drive high and expect low. + + + Keep pin opcode specifies to drive and expect whatever states were driven and expected on the previously-executed pattern. + + + Keep pin opcode specifies to toggle drive and expect whatever states were driven and expected on the previously-executed pattern. + + + Specifies the result for a pin. + + + All tests passed. + + + One or more tests failed. + + + No tests were performed. + + + Specifies the overall result. + + + All tests passed. + + + One or more tests failed. + + + No tests were performed. + + + Specifies the group opcode. + + + Input Group opcode specifies the high/low drive states of a group of pins. The expect states are set to X (don't care). + + + Output Group opcode specifies the high/low expect states of a group of pins. The drive states are set to Z (tristate). + + + Monitor Group opcode simultaneously specifies the high/low drive and expect states of a group of pins. The drive and expect states for each pin are the same. + + + Specifies the state of a relay. + + + Relay is open. + + + Relay is closed. + + + Type of alarm. + + + An external ground reference is too far from chassis ground. + + + An overcurrent condition was detected on a channel. + + + An overvoltage condition was detected on a channel. + + + Intake temperature too high. + + + Source of alarm. + + + An alarm is being generated by a channel. + + + An alarm is being generated by a module. + + + Type of test to perform on a dynamic pattern. + + + No test is to be performed on the pattern. + + + A pass/fail test is to be performed on the pattern. + + + A conditional pass/fail test is to be performed on the pattern. The actual pass/fail result does not affect the overall pass/fail result of the pattern set. + + + Operating mode of a channel. + + + Channel operation is static. + + + Channel operation is dynamic. + + + Behavior of a dynamic channel when a pattern set timeout occurs. + + + Dynamic channels are tristated when a timeout occurs. + + + Dynamic channels are left in their last drive state when a timeout occurs. + + + Logic level of a dynamic channel after the return edge of the current phase and before the assert of the next phase. + + + Return to the logic level defined by the drive opcode. Used for any channel that requires one state change per pattern. + + + Return to zero (low). Used for clocks or emulating buses that are pulled low. + + + Return to 1 (high). Used for clocks or emulating buses that are pulled high. + + + Return to off (tristate). Used for tristated data and buses. + + + Pattern control conditions. + + + Always true. + + + Never true. + + + True if the most recently captured pattern test result is a pass. + + + True if the most recently captured pattern test result is a fail. + + + True if a trigger is received on trigger input 0. + + + True if a trigger is received on trigger input 0 or 1. + + + True if a trigger is received on trigger input 1. + + + True if a trigger has not been received on trigger input 0 or 1. + + + True if a trigger has not been received on trigger input 0. + + + True if a trigger has not been received on trigger input 1. + + + True if the software flag has been set. + + + True if the software flag has not been set. + + + Pattern Control opcodes + + + No branching, execution continues with the next pattern. Count and condition values are ignored. + + + The start of a counted loop. The count value specifies the iteration count. Condition value is ignored. + + + The start of an uncounted loop. Count and condition values are ignored. + + + A single-pattern counted loop. The repeat exits when the specified condition is true or the count is reached. + + + A single-pattern uncounted loop. The repeat exits when the specified condition is true. If no condition is specified, then the repeat iterates indefinitely. Count value is ignored. + + + The end of loop. The loop exits when the specified condition is true or count specified by the begin loop instruction is reached. + + + Terminates execution of the dynamic pattern set if the specified condition is true. Count value is ignored. + + + Selected trigger lines + + + No trigger line selected. + + + Line 0 selected. + + + Line 1 selected. + + + Both trigger lines selected. + + + Reasons why a dynamic pattern set stopped. + + + The pattern controller stopped on a Halt instruction. + + + Execution stopped when the timeout period of the dynamic pattern set elapsed in hardware. + + + Execution stopped when the timeout period of the dynamic pattern set plus a system delay elapsed in software. + + + No reason for stop is set. + + + + + + No Source is associated with the Debug Signal + + + The Source of the Debug Signal is the Test Clock. A test clock pulse is generated on every pattern. + + + The Source of the Debug Signal is the instrument's Master Clock. + + + The Source of the Debug Signal is the Test Envelope. The Test Envelope indicates whether a dynamic pattern set is executing. When the Source is Test Envelop, the Debug Signal goes high when the first dynamic pattern starts executing and remains high until the last pattern is finished. The Debug Signal is low before the first dynamic pattern starts executing and after the last pattern is finished. + + + + + + The instrument is not aligned. + + + The instrument is being aligned. + + + The instrument is aligned. + + + Source of the reference clock used for dynamic pattern timing clock period generation. + + + Period generation uses the instrument's internal clock. + + + Period generation uses an external clock provided through the instrument's front panel. + + + Trigger edge used by the external reference clock for dynamic timing clock period generation. + + + The rising edge of the external reference clock is used for dynamic timing clock period generation. + + + The falling edge of the external reference clock is used for dynamic timing clock period generation. + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigitalVersion.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigitalVersion.dll new file mode 100644 index 0000000..b838562 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_EDigital_1_3_11/Teradyne.eDigitalVersion.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/ConfigStore.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/ConfigStore.xml new file mode 100644 index 0000000..2199744 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/ConfigStore.xml @@ -0,0 +1,68 @@ + + IVI Configuration Server + The IVI Configuration Server allows access to and modification of an IVI configuration store + IVI Foundation, Inc + 1.3.1.0 + 1 + 0 + + + + + + IviDriver + 1 + 0 + IVI.NET + + + + + Raytheon.GuidedElectronicsUnit v1.2.5 Fx46 + IVI.NET Driver for GuidedElectronicsUnit + + + Configurable Initial Settings + + 1 + Required + Structure + 0 + + + + + Model + Default model used during simulation + 1 + Required + String + 0 + + + HSSub6020a, HSSub9010 + + + + + + + + HSSub6020a, HSSub9010 + + + + + + Raytheon.GuidedElectronicsUnit.GuidedElectronicsUnit, Raytheon.GuidedElectronicsUnit.Fx46, Version=1.2.5.0, Culture=neutral, PublicKeyToken=65cff6f5578f3c89 + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Introduction to GuidedElectronicsUnit.rtf b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Introduction to GuidedElectronicsUnit.rtf new file mode 100644 index 0000000..a91ab24 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Introduction to GuidedElectronicsUnit.rtf @@ -0,0 +1,304 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} +{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;} +{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;} +{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} +{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f294\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f295\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\f297\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f298\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f299\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f300\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\f301\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f302\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f304\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f305\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;} +{\f307\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}{\f308\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f309\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f310\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);} +{\f311\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}{\f312\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f314\fbidi \fmodern\fcharset238\fprq1 Courier New CE;}{\f315\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr;} +{\f317\fbidi \fmodern\fcharset161\fprq1 Courier New Greek;}{\f318\fbidi \fmodern\fcharset162\fprq1 Courier New Tur;}{\f319\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f320\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic);} +{\f321\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic;}{\f322\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f634\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f635\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;} +{\f637\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f638\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f641\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f642\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);} +{\f664\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f665\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\f667\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f668\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} +{\f669\fbidi \fswiss\fcharset177\fprq2 Calibri (Hebrew);}{\f670\fbidi \fswiss\fcharset178\fprq2 Calibri (Arabic);}{\f671\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f672\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);} +{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhimajor\f31528\fbidi \fswiss\fcharset238\fprq2 Calibri Light CE;}{\fhimajor\f31529\fbidi \fswiss\fcharset204\fprq2 Calibri Light Cyr;} +{\fhimajor\f31531\fbidi \fswiss\fcharset161\fprq2 Calibri Light Greek;}{\fhimajor\f31532\fbidi \fswiss\fcharset162\fprq2 Calibri Light Tur;}{\fhimajor\f31533\fbidi \fswiss\fcharset177\fprq2 Calibri Light (Hebrew);} +{\fhimajor\f31534\fbidi \fswiss\fcharset178\fprq2 Calibri Light (Arabic);}{\fhimajor\f31535\fbidi \fswiss\fcharset186\fprq2 Calibri Light Baltic;}{\fhimajor\f31536\fbidi \fswiss\fcharset163\fprq2 Calibri Light (Vietnamese);} +{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} +{\fhiminor\f31573\fbidi \fswiss\fcharset177\fprq2 Calibri (Hebrew);}{\fhiminor\f31574\fbidi \fswiss\fcharset178\fprq2 Calibri (Arabic);}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;} +{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; +\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green0\blue0;\red0\green0\blue0;\red230\green230\blue230;}{\*\defchp \f31506\fs22 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 +\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31506\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}{ +\s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 +\sbasedon0 \snext15 \ssemihidden \sunhideused \styrsid11281381 Normal (Web);}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \sunhideused \styrsid11281381 Hyperlink;}{\*\cs17 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 +\cf15\chshdng0\chcfpat0\chcbpat19 \sbasedon10 \ssemihidden \sunhideused \styrsid1341921 Unresolved Mention;}}{\*\listtable{\list\listtemplateid-1{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0 +{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;} +\f2\fs20\fbias0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li2160 +\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel +\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0 +\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative +\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext +\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 +\fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid975601316}{\list\listtemplateid-1{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 +\fi-360\li1080\jclisttab\tx1080\lin1080 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fs20\fbias0 \fi-360\li1800\jclisttab\tx1800\lin1800 } +{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li2520\jclisttab\tx2520\lin2520 }{\listlevel\levelnfc23\levelnfcn23\leveljc0 +\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li3240\jclisttab\tx3240\lin3240 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1 +\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li3960\jclisttab\tx3960\lin3960 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 +{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li4680\jclisttab\tx4680\lin4680 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;} +\f2\fs20\fbias0 \fi-360\li5400\jclisttab\tx5400\lin5400 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li6120 +\jclisttab\tx6120\lin6120 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \fi-360\li6840\jclisttab\tx6840\lin6840 }{\listname +;}\listid1966303994}}{\*\listoverridetable{\listoverride\listid975601316\listoverridecount0\ls1}{\listoverride\listid1966303994\listoverridecount0\ls2}}{\*\pgptbl {\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid527649\rsid610856\rsid1068840 +\rsid1193474\rsid1341921\rsid1592073\rsid2053566\rsid2247458\rsid2299657\rsid2827723\rsid2886078\rsid3500732\rsid3955874\rsid4215438\rsid4264747\rsid4333579\rsid4391466\rsid4654620\rsid4739023\rsid4788022\rsid5509084\rsid5570663\rsid7020182\rsid7483015 +\rsid8015605\rsid8080083\rsid8153627\rsid9140596\rsid9455773\rsid10160764\rsid10487149\rsid10762515\rsid11141304\rsid11171846\rsid11281381\rsid11482326\rsid11550169\rsid11556053\rsid11759083\rsid12597103\rsid12660782\rsid12725604\rsid12849194\rsid13064890 +\rsid13400244\rsid13570917\rsid13637496\rsid14252017\rsid14431944\rsid14635889\rsid14690799\rsid14704508\rsid14973440\rsid15536999}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0 +\mnaryLim1}{\info{\author Kirk Fertitta}{\operator Mark Beene}{\creatim\yr2015\mo2\dy19\hr11\min47}{\revtim\yr2023\mo2\dy27\hr22\min42}{\version48}{\edmins123}{\nofpages1}{\nofwords328}{\nofchars1874}{\nofcharsws2198}{\vern61}}{\*\userprops {\propname MSI +P_Label_fe0a1f92-ac18-422f-8e1c-3f51ca75c21a_Enabled}\proptype30{\staticval true}{\propname MSIP_Label_fe0a1f92-ac18-422f-8e1c-3f51ca75c21a_SetDate}\proptype30{\staticval 2023-02-28T03:42:13Z}{\propname MSIP_Label_fe0a1f92-ac18-422f-8e1c-3f51ca75c21a_Meth +od}\proptype30{\staticval Standard}{\propname MSIP_Label_fe0a1f92-ac18-422f-8e1c-3f51ca75c21a_Name}\proptype30{\staticval General}{\propname MSIP_Label_fe0a1f92-ac18-422f-8e1c-3f51ca75c21a_SiteId}\proptype30{\staticval d17c7130-59db-4f4c-9fa4-8b76b84d575 +5}{\propname MSIP_Label_fe0a1f92-ac18-422f-8e1c-3f51ca75c21a_ActionId}\proptype30{\staticval 3b2a0bab-af0a-481d-8319-efb160836b45}{\propname MSIP_Label_fe0a1f92-ac18-422f-8e1c-3f51ca75c21a_ContentBits}\proptype30{\staticval 0}}{\*\xmlnstbl {\xmlns1 http:/ +/schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect +\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen +\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1 +\jexpand\viewkind1\viewscale130\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct +\asianbrkrule\rsidroot11281381\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0 +{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid8153627 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 +\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11482326 \chftnsep +\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid8153627 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11482326 \chftnsepc +\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid8153627 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11482326 \chftnsep +\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid8153627 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11482326 \chftnsepc +\par }}\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang +{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7 +\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar +\ql \li540\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin540\itap0\pararsid10487149 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 +\b\f1\fs20\cf1\insrsid10487149\charrsid11281381 Driver Documentation}{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149 +\par +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 The }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 driver files are installed }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid10487149\charrsid11281381 in the }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 following directory: +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 <}{\rtlch\fcs1 \ai\af0\afs20 \ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149\charrsid11281381 Program Files}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 >\\ +IVI }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 Foundation\\IVI}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 \\Microsoft.NET\\Framework32\\v4.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid2053566 6}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 \\}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid14704508 Raytheon.GuidedElectronicsUnit 1.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid5509084 2}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid14704508 .}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid8153627 4}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 .}{ +\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 +\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149 +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 This directory will be referred to as the }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149\charrsid13637496 }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid10487149 throughout the remainder of this document. +\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 Driver Documentation}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 \~}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 The readme.txt file can be found in the }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149\charrsid13637496 }{\rtlch\fcs1 \af0\afs20 +\ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 directory: +\par +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 It contains notes about installation, known issues, and the driver\rquote s revision history. +\par \~ +\par The }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid14704508 Raytheon_GuidedElectronicsUnit_Fx472}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 .chm file can be found in the }{\rtlch\fcs1 +\af0\afs20 \ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149\charrsid13637496 }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid10487149\charrsid14704508 \\Help}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149 .}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid10487149\charrsid11281381 It contains +\par \~ +\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f2\fs20\cf1\insrsid10487149\charrsid11281381 \hich\af2\dbch\af0\loch\f2 o\tab}}\pard \ltrpar\ql \fi-360\li1080\ri0\widctlpar +\jclisttab\tx720\wrapdefault\aspalpha\aspnum\facenter\ls1\adjustright\rin0\lin1080\itap0\pararsid10487149 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 General information about using the driver}{\rtlch\fcs1 \af0 +\ltrch\fcs0 \f37\cf1\insrsid10487149\charrsid11281381 +\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f2\fs20\cf1\insrsid10487149\charrsid11281381 \hich\af2\dbch\af0\loch\f2 o\tab}}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 Reference i +nformation for all methods and properties in the }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 IVI.NET}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 driver}{\rtlch\fcs1 \af0 \ltrch\fcs0 +\f37\cf1\insrsid10487149\charrsid11281381 +\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f2\fs20\cf1\insrsid10487149\charrsid11281381 \hich\af2\dbch\af0\loch\f2 o\tab}}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 IVI compliance information}{ +\rtlch\fcs1 \af0 \ltrch\fcs0 \f37\cf1\insrsid10487149\charrsid11281381 +\par }\pard \ltrpar\ql \li1620\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin1620\itap0\pararsid10487149 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 \~ +\par }\pard \ltrpar\ql \li540\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin540\itap0\pararsid10487149 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 \~ +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 Driver Source Code and Examples}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 \~}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 The }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 IVI.NET}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 + driver source code can be found in the }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149\charrsid13637496 }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid13637496 /Source}{\rtlch\fcs1 +\af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 directory. For instructions on rebuilding the driver, refer to the \'93Driver Source Code}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 \'94 + section of the Readme.txt file.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 +\par \~ +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 Connecting to the Instrument}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 \~}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 The IVI resources page (}{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 + HYPERLINK "http://ivifoundation.org/resources/default.aspxhere" }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 {\*\datafield +00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b8000000068007400740070003a002f002f0069007600690066006f0075006e0064006100740069006f006e002e006f00720067002f007200650073006f00750072006300650073002f00640065006600610075006c00 +74002e00610073007000780068006500720065000000795881f43b1d7f48af2c825dc485276300000000a5ab0000000000000000002233370022d70000003e00002e}}}{\fldrslt {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\ul\cf2\insrsid10487149\charrsid11281381 +http://ivifoundation.org/resources/default.aspxhere}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 +) has documents and videos that explain how to get started with an }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 IVI }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 +driver in different development environments}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 .}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 +\par \~}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid12660782 +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 Configuring Instrument Settings}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 \~}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 The }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid14704508 GuidedElectronicsUnit}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid10487149\charrsid11281381 instrument driver application programming interface (API) includes methods an +d properties for setting instrument state variables, as well as methods for controlling the instrument and reading results from the instrument. These are documented in the }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\cf1\insrsid10487149\charrsid14704508 GuidedElectronicsUnit}{\rtlch\fcs1 \ai\af0\afs20 \ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149\charrsid11281381 > Reference}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 + help topic. +\par \~\~ +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 Configuring Driver Settings}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f37\cf1\insrsid10487149\charrsid11281381 \~ +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 {\*\bkmkstart _Hlk27715211} +IVI instrument drivers implement inherent capabilities including properties that control driver behavior, utility methods, and identifying information. +\par {\*\bkmkend _Hlk27715211}\~ +\par Properties that c}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149 ontrol driver behavior such as }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 +simulation, range checking, and instrument status checking can be enabled/disabled when initializing the driver or by using configuration information in the IVI Configuration Store. For more information, refer to the }{\rtlch\fcs1 \ai\af0\afs20 +\ltrch\fcs0 \i\f0\fs20\cf1\insrsid10487149\charrsid11281381 Getting Started > Configuring the Driver}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 help topic. +\par }{\rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f0\fs20\cf1\insrsid10487149\charrsid11281381 \~}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid10487149\charrsid11281381 Known Issues}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid10487149\charrsid11281381 +\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 The readme.txt file contains information about known issues. +\par }{\rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f0\fs20\cf1\insrsid10487149\charrsid11281381 \~}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf1\insrsid10487149\charrsid11281381 +\par }\pard \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid10487149 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid9455773\charrsid10487149 +\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a +9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad +5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6 +b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0 +0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6 +a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f +c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512 +0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462 +a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865 +6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b +4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b +4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100aa5225dfc60600008b1a0000160000007468656d652f7468656d652f +7468656d65312e786d6cec595d8bdb46147d2ff43f08bd3bfe92fcb1c41b6cd9ceb6d94d42eca4e4716c8fadc98e344633de8d0981923c160aa569e943037deb +43691b48a02fe9afd936a54d217fa17746b63c638fbb9b2585a5640d8b343af7ce997bafce1d4997afdc8fa87384134e58dc708b970aae83e3211b9178d2706f +f7bbb99aeb7081e211a22cc60d778eb97b65f7c30f2ea31d11e2083b601ff31dd4704321a63bf93c1fc230e297d814c7706dcc920809384d26f951828ec16f44 +f3a542a1928f10895d274611b8bd311e932176fad2a5bbbb74dea1701a0b2e078634e949d7d8b050d8d1615122f89c0734718e106db830cf881df7f17de13a14 +7101171a6e41fdb9f9ddcb79b4b330a2628bad66d7557f0bbb85c1e8b0a4e64c26836c52cff3bd4a33f3af00546ce23ad54ea553c9fc29001a0e61a52917dda7 +dfaab7dafe02ab81d2438bef76b55d2e1a78cd7f798373d3973f03af40a97f6f03dfed06104503af4029dedfc07b5eb51478065e81527c65035f2d34db5ed5c0 +2b5048497cb8812ef89572b05c6d061933ba6785d77daf5b2d2d9caf50500d5975c929c62c16db6a2d42f758d2058004522448ec88f9148fd110aa3840940c12 +e2ec93490885374531e3305c2815ba8532fc973f4f1da988a01d8c346bc90b98f08d21c9c7e1c3844c45c3fd18bcba1ae4cdcb1fdfbc7cee9c3c7a71f2e89793 +c78f4f1efd9c3a32acf6503cd1ad5e7fffc5df4f3f75fe7afeddeb275fd9f15cc7fffed367bffdfaa51d082b5d85e0d5d7cffe78f1ecd5379ffff9c3130bbc99 +a0810eef930873e73a3e766eb10816a6426032c783e4ed2cfa2122ba45339e701423398bc57f478406fafa1c5164c1b5b019c13b09488c0d787576cf20dc0b93 +9920168fd7c2c8001e30465b2cb146e19a9c4b0b737f164fec9327331d770ba123dbdc018a8dfc766653d05662731984d8a07993a258a0098eb170e4357688b1 +6575770931e27a408609e36c2c9cbbc46921620d499f0c8c6a5a19ed9108f232b711847c1bb139b8e3b418b5adba8d8f4c24dc15885ac8f73135c27815cd048a +6c2efb28a27ac0f791086d247bf364a8e33a5c40a6279832a733c29cdb6c6e24b05e2de9d7405eec693fa0f3c84426821cda7cee23c674649b1d06218aa6366c +8fc4a18efd881f428922e7261336f80133ef10790e7940f1d674df21d848f7e96a701b9455a7b42a107965965872791533a37e7b733a4658490d08bfa1e71189 +4f15f73559f7ff5b5907217df5ed53cbaa2eaaa0371362bda3f6d6647c1b6e5dbc03968cc8c5d7ee369ac53731dc2e9b0decbd74bf976ef77f2fdddbeee7772f +d82b8d06f9965bc574abae36eed1d67dfb9850da13738af7b9daba73e84ca32e0c4a3bf5cc8ab3e7b8690887f24e86090cdc2441cac64998f88488b017a229ec +ef8bae7432e10bd713ee4c19876dbf1ab6fa96783a8b0ed8287d5c2d16e5a3692a1e1c89d578c1cfc6e15143a4e84a75f50896b9576c27ea51794940dabe0d09 +6d329344d942a2ba1c9441520fe610340b09b5b277c2a26e615193ee97a9da6001d4b2acc0d6c9810d57c3f53d30012378a242148f649ed2542fb3ab92f92e33 +bd2d984605c03e625901ab4cd725d7adcb93ab4b4bed0c99364868e566925091513d8c87688417d52947cf42e36d735d5fa5d4a02743a1e683d25ad1a8d6fe8d +c579730d76ebda40635d2968ec1c37dc4ad9879219a269c31dc3633f1c4653a81d2eb7bc884ee0ddd95024e90d7f1e6599265cb4110fd3802bd149d520220227 +0e2551c395cbcfd24063a5218a5bb104827061c9d541562e1a3948ba99643c1ee3a1d0d3ae8dc848a7a7a0f0a95658af2af3f383a5259b41ba7be1e8d819d059 +720b4189f9d5a20ce0887078fb534ca33922f03a3313b255fdad35a685eceaef13550da5e3884e43b4e828ba98a77025e5191d7596c5403b5bac1902aa8564d1 +080713d960f5a01add34eb1a2987ad5df7742319394d34573dd35015d935ed2a66ccb06c036bb13c5f93d7582d430c9aa677f854bad725b7bed4bab57d42d625 +20e059fc2c5df70c0d41a3b69acca026196fcab0d4ecc5a8d93b960b3c85da599a84a6fa95a5dbb5b8653dc23a1d0c9eabf383dd7ad5c2d078b9af549156df3d +f44f136c700fc4a30d2f81675470954af8f09020d810f5d49e24950db845ee8bc5ad0147ce2c210df741c16f7a41c90f72859adfc97965af90abf9cd72aee9fb +e562c72f16daadd243682c228c8a7efacda50bafa2e87cf1e5458d6f7c7d89966fdb2e0d599467eaeb4a5e11575f5f8aa5ed5f5f1c02a2f3a052ead6cbf55625 +572f37bb39afddaae5ea41a5956b57826abbdb0efc5abdfbd0758e14d86b9603afd2a9e52ac520c8799582a45fabe7aa5ea9d4f4aacd5ac76b3e5c6c6360e5a9 +7c2c6201e155bc76ff010000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f +7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be +9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980 +ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5b +babac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c0200001300000000000000000000000000000000005b436f6e74656e +745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f +2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000190200007468656d652f7468656d652f74 +68656d654d616e616765722e786d6c504b01022d0014000600080000002100aa5225dfc60600008b1a00001600000000000000000000000000d6020000746865 +6d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b0100002700000000000000000000000000d00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000cb0a00000000} +{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d +617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 +6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 +656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} +{\*\latentstyles\lsdstimax376\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 1; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 5; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 9; +\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3; +\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6; +\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Indent; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 header;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footer; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index heading;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of figures; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope return;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation reference; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 line number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 page number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote text; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of authorities;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 macro;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 toa heading;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Closing; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Signature;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 4; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Message Header;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Note Heading; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Block Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 FollowedHyperlink;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong; +\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Document Map;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Plain Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 E-mail Signature; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Top of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Bottom of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal (Web);\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Acronym; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Cite;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Code;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Definition; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Keyboard;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Preformatted;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Sample;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Typewriter; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Variable;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation subject;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 No List;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 1; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Balloon Text;\lsdpriority39 \lsdlocked0 Table Grid; +\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid; +\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2; +\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1; +\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1; +\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; +\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2; +\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdpriority62 \lsdlocked0 Light Grid Accent 3; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3; +\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; +\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5; +\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6; +\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; +\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4; +\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4; +\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1; +\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1; +\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2; +\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2; +\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3; +\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4; +\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4; +\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5; +\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5; +\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6; +\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6; +\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark; +\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1; +\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1; +\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2; +\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3; +\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3; +\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4; +\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4; +\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5; +\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5; +\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6; +\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Mention; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Smart Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hashtag;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Unresolved Mention;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Smart Link;}}{\*\datastore 01050000 +02000000180000004d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000 +d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000070a9 +46ad264bd901feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/README.txt b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/README.txt new file mode 100644 index 0000000..6338b3a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/README.txt @@ -0,0 +1,10 @@ +Running this will install the fw and sw at the location below: +C:\Program Files (x86)\IVI Foundation\IVI\Microsoft.NET\Framework32\v4.6\Raytheon.GuidedElectronicsUnit 1.2.5 + +The sw/source that gets installed has been relocated to ComposableTestSoftware\Source\Common\COTS\Teradyne_SDLC + - Modifications to this source should be made through the ComposableTestSoftware ADS repo + +Nimbus SDK: +Then in VS under Tools/Options expand NuGet Package Manager and select Package Sources. +Click the add button and enter that same path in the source box (or just browse to the file). +You should be able to open the project after that. \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnit.Fx46.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnit.Fx46.dll new file mode 100644 index 0000000..df4f67b Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnit.Fx46.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnit.Fx46.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnit.Fx46.xml new file mode 100644 index 0000000..3bb0c5a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnit.Fx46.xml @@ -0,0 +1,1806 @@ + + + Raytheon.GuidedElectronicsUnit.Fx46 + + + + Main driver class. + + + Creates a new instance of the driver and opens and I/O session with the instrument. + An IVI logical name or an instrument specific string that identifies the address of the instrument, such as a VISA resource descriptor string. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + + + Creates a new instance of the driver and opens and I/O session with the instrument. + An IVI logical name or an instrument specific string that identifies the address of the instrument, such as a VISA resource descriptor string. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + A string that allows the user to specify the initial values of certain inherent attributes. + + + Creates a new instance of the driver and opens and I/O session with the instrument. + An IVI logical name or an instrument specific string that identifies the address of the instrument, such as a VISA resource descriptor string. + Specifies whether to verify the ID of the instrument. + Specifies whether to reset the instrument. + Specifies whether to use process-wide locking or machine-wide locking. + Specifies a user-selectable access key to identify the lock. Driver instances that are created with the same accessKey will be protected from simultaneous access by multiple threads within a process or across processes, depending upon the value of the lockType parameter. + A string that allows the user to specify the initial values of certain inherent attributes. + + + Closes the I/O session to the instrument, as well as other unmanaged resources. The behavior is the same as IDisposable.Dispose. + + + Gets the service object of the specified type.Typically, this is an interface supported by the driver. + The type object of the service to get.Typically, this is the type of an interface supported by the driver. + A service object of the specified type.Null is returned if there is no service object of the specified type. + + + Performs driver-defined tasks associated with freeing, releasing, or resetting unmanaged resources.Calling this method is equivalent to calling the driver's Close method. + + + Resets the interchangeability checking algorithms of the driver so that methods and properties that executed prior to calling this method have no affect on whether future calls to the driver generate interchangeability warnings. + + + Invalidates all of the driver's cached values. + + + Returns the list of instrument models that the IVI specific driver can control. The string does not include an abbreviation for the manufacturer if it is the same for all models. + Array of instrument models. + + + Returns the list of the class capability groups implemented by the driver. Capability group names are documented in the IVI class specifications. If the driver is not class compliant, the driver returns an empty array. + Array of class capability groups. + + + Queries the instrument and returns instrument specific error information. + A struct that includes the instrument error code and error message. + + + Performs an instrument self test, waits for the instrument to complete the test, and queries the instrument for the results. If the instrument passes the test, TestResult is zero and TestMessage is 'Self test passed'. + A struct that includes the numeric result from the self test operation (0 = no error, e.g. the test passed) and self test status message. + + + Quickly places the instrument in a state where it has no, or minimal, effect on the external system to which it is connected. This state is not necessarily a known state. + + + Does the equivalent of Reset and then, (1) disables class extension capability groups, (2) sets properties to initial values defined by class specs, and (3) configures the driver to option string settings used in the driver constructor. + + + Places the instrument in a known state and configures instrument options on which the IVI specific driver depends (for example, enabling/disabling headers). For an IEEE 488.2 instrument, Reset sends the command string *RST to the instrument. + + + Attempts to acquire a synchronization lock on this instance of the driver. The calling thread is blocked indefinitely until the lock is acquired. This method is useful for gaining exclusive access to the driver instance across a series of methods calls. The user must call the Unlock method on the returned lock to relinquish the lock and allow other threads to access this instance of the driver. + A reference to the acquired lock. Unlock is called on the returned reference. + + + Attempts to acquire a synchronization lock on this instance of the driver. The calling thread is blocked until either the lock is acquired or maxTime expires. If the lock is not acquired within the interval specified by maxTime, an exception is thrown. This method is useful for gaining exclusive access to the driver instance across a series of methods calls. The user must call the Unlock method on the returned lock to relinquish the lock and allow other threads to access this instance of the driver. + Specifies the maximum amount of time to wait to acquire the lock. + A reference to the acquired lock. Unlock is called on the returned reference. + + + Retrieves the information about the currently loaded TDF firmware. + An object containing various read-only information about the currently loaded firmware. + + + Retrieves the status of the PLL clocks. + An object containing various read-only information about PLL clocks. + + + This function performs a 32-bit read operation on the TDF register via the Local Bus on the Subsystem instrument. + The TDF Register's offset. + The value of the TDF register. + + + This function performs a 32-bit write operation to the register via the Local Bus on the Subsystem instrument. + The TDF Register's offset. + The value to write to the register. + + + Retrieves the information about the currently loaded TDF firmware. + + + + Retrieves the status of the PLL clocks. + + + + This function performs a 32-bit read operation on the TDF register via the Local Bus on the Subsystem instrument. + TDF Register address offset. + + + + This function performs a 32-bit write operation to the register via the Local Bus on the Subsystem instrument. + TDF Register address offset. + Value to write to the register. + + + SDLC port status. + + + + Sets the message data for the word selected and updates the checksum for the message. + Message word index (zero-based) of the word to set data value. + Data value for the word. + + + Reads the message data (12 bytes) and checksum (1 byte) received. Only valid when emulator is configured for receive mode. + Array containing the current IMU Message data being sent out the interface. + + + Used to configure the EDA/KWDL Config Register bits. + Structure containing the values to be written to the EDA/KWDL Config Register. + + + Crypto_GO, Xmitr_Pwr, BusMode, LowPwrMode + + + + Sets the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Fetches the SDLC port status. + Object containing the SDLC Status. + + + Sends a single message containing data on the GS_MC_KW SDLC bus. + Array of values to send. + + + Places the instrument in a known state and configures instrument to it's default state. + + + Places the instrument in a known state and configures instrument to it's default state. + + + This function performs a 32-bit read/modify/write operation on the register via the Local Bus on the Subsystem instrument. + +The 32-bit read/modify/write is accomplished by reading from the specified address, ANDing this value with the inverse of the mask, ORing the results with (mask AND data), and finally writing the result back to the specified address. + +The register value would be accomplished with the following: + +<new register value> = (data & mask) | (<old register value> & !mask) + The TDF Register's offset. + The value to write to the masked bits of the register. + Each bit that is set in the mask corresponds to a bit in the passed data to modify in the register. + + + This function performs a 32-bit read/modify/write operation on the register via the Local Bus on the Subsystem instrument. + +The 32-bit read/modify/write is accomplished by reading from the specified address, ANDing this value with the inverse of the mask, ORing the results with (mask AND data), and finally writing the result back to the specified address. + +The register value would be accomplished with the following: + +<new register value> = (data & mask) | (<old register value> & !mask) + TDF Register address offset. + Value to write to the register. + Bits in the register to be set to the data value. The bits will only be affected when the coresponding bit is set to a '1'. + + + Configures the IMU emulator. + Controls to be set or cleared. These can be a OR'd valued of ImuControl enums. + state to set the control to. True to set the bit(s), False to clear the bit(s). + + + Returns the current state of the IMU emulator. + Objext containing the current configuration of the IMU Emulator. + + + Crypto_GO, Xmitr_Pwr, BusMode, LowPwrMode + + + + Retrieves the CV data received on the specified channel and bus. + Array containing the data received. + + + EDA CVCW Data. Captures values written by Host over SDLC on the specified channel and bus. + Object containing the received CVCWData. + + + Fetchs the status of the SDLC interface. + Object containing the requested SDLC port Status. + + + Configures the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Fetches the current state of the scoreboard register and +Populates the Scoreboard structure + Value returned from the scoreboard register. + + + Configures the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Fetchs the status of the SDLC interface. + Object containing the requested SDLC port Status. + + + Reads all available messages using the SDLC interface. + List of the Messages. + + + Reads a message(data) using the SDLC interface. + List containing data/status of the first available message. + + + Sends message(data) using the SDLC interface. + Array of values to send. + + + Reads all available messages using the SDLC interface. + List of the Messages. + + + Reads a message(data) using the SDLC interface. + List containing data/status of the first available message. + + + Sends message(data) using the SDLC interface. + Array of values to send. + + + Fetches the Discrete Input register value. + Structure containing the IMU Discrete Input values. + + + Sets the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Retrieves a single message that was received on the GS_MC_KW SDLC bus. + List containing data/status of the first available message. + + + Retrieves all available messages that were received on the GS_MC_KW SDLC bus. + List of the Messages. + + + Sends a single message containing data on the GS_MC_KW SDLC bus. + Array of values to send. + + + + + + + + + + + Returns the data that was captured using the auto-foreward feature of the SDLC bus. + Array of bytes representing the captured SDLC message data. + + + Do Not Use. This method will be removed in the next release. + + + + Do Not Use. This method will be removed in the next release. + + + + Gets the status of the Aurora interface. + + + + Resets DCM in case of no lock (EmStatus GeuClock is low). + + + Reference to the IIviDriverOperation interface. + + + Reference to the IIviDriverIdentity interface. + + + Reference to the IIviDriverUtility interface. + + + Logical Name identifies a driver session in the Configuration Store. If Logical Name is not empty, the driver was initialized from information in the driver session. If it is empty, the driver was initialized without using the Configuration Store. + + + The resource descriptor specifies the connection to a physical device. It is either specified in the Configuration Store or passed in the resource name at initialization. + + + Drivers may choose to always cache some instrument settings, never cache others, and optionally cache others, to avoid unecessary I/O to the instrument. If True, the driver caches optionally cached instrument settings. + + + If True, the driver queries the instrument status at the end of each method or property that performs I/O to the instrument. If an error is reported, use ErrorQuery to retrieve error messages one at a time from the instrument. + + + Drivers may choose to always validate some property/parameter values, never validate others, and optionally validate others, to avoid sending invalid commands to the instrument. If True, the driver performs optional validations. + + + If True, the driver does not perform I/O to the instrument, and returns simulated values for output parameters. + + + The driver setup string. It is either specified in the Configuration Store or passed via the optionString parameter to a driver constructor. + + + The name of the manufacturer reported by the physical instrument. If Simulation is enabled or the instrument is not capable of reporting the name of the manufacturer, a string is returned that explains the condition. + + + The model number or name reported by the physical instrument. If Simulation is enabled or the instrument is not capable of reporting the model number or name, a string is returned that explains the condition. + + + The firmware revision reported by the physical instrument. If Simulation is enabled or the instrument is not capable of reporting the firmware revision, a string is returned that explains the condition. + + + The case-sensitive unique identifier of the implementing IVI.NET instrument driver. + + + For IVI class-compliant drivers, the major version number of the instrument class specification. If the driver is not class compliant, the driver returns zero. + + + For IVI class-compliant drivers, the minor version number of the instrument class specification. If the driver is not class compliant, the driver returns zero. + + + A brief description of the implementing component. + + + The revision of the implementing component. Refer to IVI 3.2, Section 3.1.2.2, for a description of revision syntax and semantics. + + + The name of the vendor that supplies the implementing component. + + + Reference to the IGuidedElectronicsUnitDiscrete interface. + + + Reference to the IGuidedElectronicsUnitInertialMeasurementUnitEmulator interface. + + + Reference to the IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator interface. + + + Reference to the IGuidedElectronicsUnitLowLevel interface. + + + Reference to the IGuidedElectronicsUnitLowLevelHSSub6020a interface. + + + Reference to the IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator interface. + + + Reference to the IGuidedElectronicsUnitLowLevelHSSub9100 interface. + + + NC_DACS_KW_ORD_EN signal state + + + Reference to the IGuidedElectronicsUnitGsKwSyncronousDataLinkControl interface. + + + Reference to the IGuidedElectronicsUnitTestControl interface. + + + Emulator SdlcControlBits Register +1 = Releases emulator from reset. Overrides II Reset from GEU + + + Emulator SdlcStatusBits Register + + + + + + Chassis number where the instrument is located. + + + Descriptor of the instrument. + + + Serial number of the instrument. + + + Slot number where the instrument is located. + + + Chassis number where the instrument is located. + + + Descriptor of the instrument. + + + Serial number of the instrument. + + + Slot number where the instrument is located. + + + Readback of TDF die temperature. + + + Readback of TDF die temperature. + + + Readback of VCC Internal supply level. + + + Readback of VCC Internal supply level. + + + Readback of VCC Auxilliary supply level. + + + Readback of VCC Auxilliary supply level. + + + Indicates that the instrument is being simulated in software. + + + Indicates that the instrument is being simulated in software. + + + End of Data Sample Width in seconds. A Write to this property will set the duration of the pulse width. + Min = 10 nS. + Max = 40.95 uS. + Resolution = 10 nS. + Default = 1 uSec. + + + PIM IO Module control +1=All PIM I/O TX disabled + + + Reference to the IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA interface. + + + Reference to the IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT interface. + + + Reference to the IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS interface. + + + Gets a structure contining the current write count for the TX and RX FIFOs. +May be one less than actual value due to H/W pre-popping + + + GS_MC_KW_SYNC Discrete Output Register + value written to this bit drives the GS_MC_TO_KW_CLK_SYNC signal + + + Gets a structure contining the current write count for the TX and RX FIFOs. May be one less than actual value due to H/W pre-popping + + + Gets a structure contining the current write count for the TX and RX FIFOs. May be one less than actual value due to H/W pre-popping + + + Gets a structure contining the current write count for the TX and RX FIFOs. May be one less than actual value due to H/W pre-popping + + + IMU Frame Control Enable. +1 enables IMU Frame Counter. + + + Frame Counter Period in seconds. + Min = 10 nS. + Max = 2.68435455 S. + Resolution = 10 nS. + + + Get/Set EDA PBIT Valid state. + + + Get/Set EDA PBIT Passed state. + + + Get/Set EDA CV Ready Valid state. + + + Get/Set EDA CV Ready state. + + + Get/Set EDA CV Clear Pass/Fail Valid state. + + + Get/Set EDA CV Clear Pass/Fail state. + + + Get/Set EDA Num CV Clear has been run. + + + Get/Set KWDL RF Temperature. + 0x0 = -40C + LSB = 1C + + + Get/Set KWDL MBIT Pass state. + + + Get/Set KWDL MBIT Complete state. + + + Get/Set KWDL PBIT Pass state. + + + Get/Set KWDL State. + 0 = Standby + 1 = Tact + 2 = Maint + 3 = Reprog + 4 = KA + + + Get/Set KWDL Link Up state. + + + Contains debug information for auto-forwarded SDLC message data. Initial capacity, current data amount, and the highwater level or maximum number of bytes at any given time. + + + Front Panel IO Module Control + +1=All Front Panel I/O Tristated + + + Emulator Status + +This property is Read Only. Call ResetEmStatus() to reset. + + GeuClock 1 = 40MHz II Clock from GEU Present and locked. + EmReset 1 = II Emulator is in reset. + + + Warning event. + + + Coercion record event. + + + Interchange check warning event. + + + Signals that the GS KW SDLC message handler thread encountered an error and has exited. + + + + + + + + + + + + + + + + + + + + + + + + + + + Root interface of driver hierarchy. + + + Reference to the IGuidedElectronicsUnitDiscreteIO interface. + + + Reference to the IGuidedElectronicsUnitImuEmulator interface. + + + Reference to the IGuidedElectronicsUnitEdaEmulator interface. + + + Reference to the IGuidedElectronicsUnitLowLevel interface. + + + Reference to the IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator interface. + + + Reference to the IGuidedElectronicsUnitGsMcEmulator interface. + + + Reference to the IGuidedElectronicsUnitTestControl interface. + + + + + + + + + IGuidedElectronicsUnitDiscrete interface. + + + NC_DACS_KW_ORD_EN signal state + + + IGuidedElectronicsUnitInertialMeasurementUnitEmulator interface. + + + SDLC port status. + + + + Sets the message data for the word selected and updates the checksum for the message. + Message word index (zero-based) of the word to set data value. + Data value for the word. + + + Reads the message data (12 bytes) and checksum (1 byte) received. Only valid when emulator is configured for receive mode. + Array containing the current IMU Message data being sent out the interface. + + + Configures the IMU emulator. + Controls to be set or cleared. These can be a OR'd valued of ImuControl enums. + state to set the control to. True to set the bit(s), False to clear the bit(s). + + + Returns the current state of the IMU emulator. + Objext containing the current configuration of the IMU Emulator. + + + Fetches the Discrete Input register value. + Structure containing the IMU Discrete Input values. + + + Sets the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Retrieves a single message that was received on the GS_MC_KW SDLC bus. + List containing data/status of the first available message. + + + Retrieves all available messages that were received on the GS_MC_KW SDLC bus. + List of the Messages. + + + Sends a single message containing data on the GS_MC_KW SDLC bus. + Array of values to send. + + + End of Data Sample Width in seconds. A Write to this property will set the duration of the pulse width. + Min = 10 nS. + Max = 40.95 uS. + Resolution = 10 nS. + Default = 1 uSec. + + + Gets a structure contining the current write count for the TX and RX FIFOs. May be one less than actual value due to H/W pre-popping + + + IMU Frame Control Enable. +1 enables IMU Frame Counter. + + + Frame Counter Period in seconds. + Min = 10 nS. + Max = 2.68435455 S. + Resolution = 10 nS. + + + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator interface. + + + + Channel to use. + Bus to use. + + + + Reference to the IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA interface. + + + IGuidedElectronicsUnitLowLevel interface. + + + Reference to the IGuidedElectronicsUnitLowLevelHSSub6020a interface. + + + Reference to the IGuidedElectronicsUnitLowLevelHSSub9100 interface. + + + IGuidedElectronicsUnitLowLevelHSSub6020a interface. + + + Retrieves the information about the currently loaded TDF firmware. + An object containing various read-only information about the currently loaded firmware. + + + Retrieves the status of the PLL clocks. + An object containing various read-only information about PLL clocks. + + + This function performs a 32-bit read operation on the TDF register via the Local Bus on the Subsystem instrument. + The TDF Register's offset. + The value of the TDF register. + + + This function performs a 32-bit write operation to the register via the Local Bus on the Subsystem instrument. + The TDF Register's offset. + The value to write to the register. + + + Places the instrument in a known state and configures instrument to it's default state. + + + This function performs a 32-bit read/modify/write operation on the register via the Local Bus on the Subsystem instrument. + +The 32-bit read/modify/write is accomplished by reading from the specified address, ANDing this value with the inverse of the mask, ORing the results with (mask AND data), and finally writing the result back to the specified address. + +The register value would be accomplished with the following: + +<new register value> = (data & mask) | (<old register value> & !mask) + The TDF Register's offset. + The value to write to the masked bits of the register. + Each bit that is set in the mask corresponds to a bit in the passed data to modify in the register. + + + Resets DCM in case of no lock (EmStatus GeuClock is low). + + + Chassis number where the instrument is located. + + + Descriptor of the instrument. + + + Serial number of the instrument. + + + Slot number where the instrument is located. + + + Readback of TDF die temperature. + + + Readback of VCC Internal supply level. + + + Readback of VCC Auxilliary supply level. + + + Indicates that the instrument is being simulated in software. + + + Front Panel IO Module Control + +1=All Front Panel I/O Tristated + + + Emulator Status + +This property is Read Only. Call ResetEmStatus() to reset. + + GeuClock 1 = 40MHz II Clock from GEU Present and locked. + EmReset 1 = II Emulator is in reset. + + + IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator interface. + + + Emulator SdlcControlBits Register +1 = Releases emulator from reset. Overrides II Reset from GEU + + + Emulator SdlcStatusBits Register + + + + + + IGuidedElectronicsUnitLowLevelHSSub9100 interface. + + + Retrieves the information about the currently loaded TDF firmware. + + + + Retrieves the status of the PLL clocks. + + + + This function performs a 32-bit read operation on the TDF register via the Local Bus on the Subsystem instrument. + TDF Register address offset. + + + + This function performs a 32-bit write operation to the register via the Local Bus on the Subsystem instrument. + TDF Register address offset. + Value to write to the register. + + + Places the instrument in a known state and configures instrument to it's default state. + + + This function performs a 32-bit read/modify/write operation on the register via the Local Bus on the Subsystem instrument. + +The 32-bit read/modify/write is accomplished by reading from the specified address, ANDing this value with the inverse of the mask, ORing the results with (mask AND data), and finally writing the result back to the specified address. + +The register value would be accomplished with the following: + +<new register value> = (data & mask) | (<old register value> & !mask) + TDF Register address offset. + Value to write to the register. + Bits in the register to be set to the data value. The bits will only be affected when the coresponding bit is set to a '1'. + + + Gets the status of the Aurora interface. + + + + Chassis number where the instrument is located. + + + Descriptor of the instrument. + + + Serial number of the instrument. + + + Slot number where the instrument is located. + + + Readback of TDF die temperature. + + + Readback of VCC Internal supply level. + + + Readback of VCC Auxilliary supply level. + + + Indicates that the instrument is being simulated in software. + + + PIM IO Module control +1=All PIM I/O TX disabled + + + IGuidedElectronicsUnitGsKwSyncronousDataLinkControl interface. + + + Sets the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Fetches the SDLC port status. + Object containing the SDLC Status. + + + Sends a single message containing data on the GS_MC_KW SDLC bus. + Array of values to send. + + + Returns the data that was captured using the auto-foreward feature of the SDLC bus. + Array of bytes representing the captured SDLC message data. + + + Do Not Use. This method will be removed in the next release. + + + + Do Not Use. This method will be removed in the next release. + + + + Gets a structure contining the current write count for the TX and RX FIFOs. +May be one less than actual value due to H/W pre-popping + + + GS_MC_KW_SYNC Discrete Output Register + value written to this bit drives the GS_MC_TO_KW_CLK_SYNC signal + + + Contains debug information for auto-forwarded SDLC message data. Initial capacity, current data amount, and the highwater level or maximum number of bytes at any given time. + + + Signals that the GS KW SDLC message handler thread encountered an error and has exited. + + + + + + IGuidedElectronicsUnitTestControl interface. + + + + + + + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA interface. + + + Fetches the current state of the scoreboard register and +Populates the Scoreboard structure + Value returned from the scoreboard register. + + + Crypto_GO, Xmitr_Pwr, BusMode, LowPwrMode + + + + EDA CVCW Data. Captures values written by Host over SDLC on the specified channel and bus. + Object containing the received CVCWData. + + + Retrieves the CV data received on the specified channel and bus. + Array containing the data received. + + + Used to configure the EDA/KWDL Config Register bits. + Structure containing the values to be written to the EDA/KWDL Config Register. + + + Crypto_GO, Xmitr_Pwr, BusMode, LowPwrMode + + + + + + + + Reference to the IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT interface. + + + Reference to the IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS interface. + + + Get/Set EDA PBIT Valid state. + + + Get/Set EDA PBIT Passed state. + + + Get/Set EDA CV Ready Valid state. + + + Get/Set EDA CV Ready state. + + + Get/Set EDA CV Clear Pass/Fail Valid state. + + + Get/Set EDA CV Clear Pass/Fail state. + + + Get/Set EDA Num CV Clear has been run. + + + Get/Set KWDL RF Temperature. + 0x0 = -40C + LSB = 1C + + + Get/Set KWDL MBIT Pass state. + + + Get/Set KWDL MBIT Complete state. + + + Get/Set KWDL PBIT Pass state. + + + Get/Set KWDL State. + 0 = Standby + 1 = Tact + 2 = Maint + 3 = Reprog + 4 = KA + + + Get/Set KWDL Link Up state. + + + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT interface. + + + Configures the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Fetchs the status of the SDLC interface. + Object containing the requested SDLC port Status. + + + Reads all available messages using the SDLC interface. + List of the Messages. + + + Reads a message(data) using the SDLC interface. + List containing data/status of the first available message. + + + Sends message(data) using the SDLC interface. + Array of values to send. + + + Gets a structure contining the current write count for the TX and RX FIFOs. May be one less than actual value due to H/W pre-popping + + + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS interface. + + + Fetchs the status of the SDLC interface. + Object containing the requested SDLC port Status. + + + Configures the SDLC port control bits. + Bits in the SDLC control register to set/clear. + State to set the specified control bit to. + + + Reads all available messages using the SDLC interface. + List of the Messages. + + + Reads a message(data) using the SDLC interface. + List containing data/status of the first available message. + + + Sends message(data) using the SDLC interface. + Array of values to send. + + + Gets a structure contining the current write count for the TX and RX FIFOs. May be one less than actual value due to H/W pre-popping + + + Structure containing TDF firmware information. + + + Application ID. Constant TBD. + + + Customer ID. Constant 0x0002. + + + Revision of the firmware. + + + TDF Constanst value. Always returns 0x4C01 (LVTTL), 0x4701 (FIOXI). + + + + + + TeradyneAuroraBusClk PLL locked status. + + + LocalBusClk PLL locked status. + + + PXIeClk PLL enabled (controlled by TER_LB_PXIE_EN). + + + PXIeClk PLL locked status. + + + SdlcStatusBits of the emulator SDLC port. + + + When data recovery is enabled, indicates that data was lost from the overrun buffer. + + + Indicates the RX Engine is in an inhibit state. + + + Indicates whether the echo loopback feature is currently enabled. + + + Indicates whether the internal loopback feature is currently enabled. + + + Indicates that a SDLC ABORT was received or that a RX ABORT occurred. + + + Flag that the Frame Check Sequence calculated did not match the value received. + + + Indicates that the RX engine has received a complete/incomplete SDLC frame. + + + f ADDR_FIELD_EN=TRUE, indicates that a SDLC frame was misrouted to this station. + + + Asserts when an overflow condition occurs on the RX FIFO. Cleared only via control bit. + + + Indicates that the RX FIFO is currently empty. + + + Indicates the TX Engine is in an inhibit state. + + + Indicates that the RX FIFO is currently full. + + + Indicates that the RX engine is currently processing a SDLC frame. + + + Indicates that the TX engine is currently processing a SDLC frame. + + + Asserts when an overflow condition occurs on the TX FIFO. Cleared only via control bit. + + + Indicates that the TX FIFO is currently empty. + + + Indicates that the TX FIFO is currently full. + + + Data being sent by the IMU emulator. + + + Delta Velocity X value. + + + Delta Velocity Y value. + + + Delta Velocity Z value. + + + Delta Angle X value. + + + Delta Angle Y value. + + + Delta Angle Z value. + + + IMU status summary word. + + + IMU bit mode/mux ID. + + + IMU mux data word. + + + IMU raw gyro X count. + + + IMU raw gyro Y count. + + + IMU raw gyro Z count. + + + 1's Complement of Sum of other 12 ImuMessage words. + + + EDA Status Register. Reflects Values written by Host over SDLC. + + + EDA Crypto Go Value. + + + EDA XCVR Power Mode. 1=Enable, 2=Disable. + + + EDA Data Bus Mode. 1=MTD, 2=KWDL. + + + EDA Low Power Mode. 1=Enable, 2=Disable. + + + EDA Terminal ID. + + + Structure containing data and status for a single word in a GsKwSDLC message. + + + Raw data. + + + SdlcStatusBits associated with Data. + + + Structure containing a single SDLC message. + + + Array of RxSdlcData. + + + + + + SdlcStatusBits of the II Emulator + + + 1 = 40MHz II Clock from GEU Present and locked + + + 1 = II Emulator is in reset + + + + + + + + + + + + + + + KWDL Status Register. Reflects Values written by Host over SDLC. + + + + + + + + + + + + + + + + + + + + + EDA Message Scoreboard. Indicates which messages received since power on. + + + Host to EDA crypto variable clear control message. + + + Host to EDA crypto variable control message. + + + Host to EDA general status request control message. + + + Host to EDA terminal ID control message. + + + Host to EDA crypto go control message. + + + Host to KW data link initialize message. + + + Host to KW data link control status request message. + + + Host to KW data link antenna select message. + + + Host to KW echo message. + + + Host to MTD carrier enable message. + + + Host to EDA crypto variable command word control message. + + + Host to EDA transceiver power control message. + + + Host to EDA data bus mode control message. + + + Host to EDA low power mode control message. + + + + + + CV Size value written over SDLC. + + + CVCW Byte 1. + + + CVCW Byte 2. + + + CVCW Byte 3. + + + IMU Discrete Input Register + + + IMU_SIM_NOT_INHIBIT_BIT signal state + + + IMU_SIM_NOT_COMMAND_BIT signal state + + + IMU_SIM_FAST_RESTART signal state + + + IMU_SIM_EXT_SYNC signal state + + + IMU_SIM_PWR_ON_RESET signal state + + + IMU_EXT_SYNC signal state + + + IMU_FAST_RESTART signal state + + + IMU_NOT_EXE_COMMAND_BIT signal state + + + IMU_NOT_INHIBIT_BIT_FAIL signal state + + + IMU_PWR_ON_RESET signal state + + + IMU_INHIBIT_INTERNAL_POR signal state + + + Current write count for the TX and RX FIFOs. +May be one less than actual value due to H/W pre-popping. + + + Shows current write count of the RX FIFO. + + + Shows current write count of the TX FIFO. + + + EDA/KWDL Config register values. + + + KWDL RF Temperature. + 0x0 = -40C + LSB = 1C + + + EDA PBIT Valid state. + + + EDA CV Ready Valid state. + + + EDA PBIT Passed state. + + + EDA CV Ready state. + + + EDA CV Clear Pass/Fail Valid state. + + + EDA CV Clear Pass/Fail state. + + + EDA Num CV Clear has been run. + + + KWDL MBIT Pass state. + + + KWDL MBIT Complete state. + + + KWDL PBIT Pass state. + + + KWDL State. + 0 = Standby + 1 = Tact + 2 = Maint + 3 = Reprog + 4 = KA + + + KWDL Link Up state. + + + Teradyne Aurora status register, resets status on write to this register. + + + Aurora Core Soft Error. + + + Aurora Core Hard Error. + + + Aurora Linked Up. + + + Aurora Channel UP. + + + Aurora lane up status for all 4 lanes. + + + SDLC Auto-forward buffer information. + + + Initial buffer size (in bytes). + + + Anmount of data (in bytes) currently available in the buffer. + + + Highest level of bytes in buffer at any time during this session. + + + + + + 1 = 40MHz II Clock from GEU Present and locked. + + + 1 = II Emulator is in reset + + + The state of the interface or control. + + + The interface or control is Disabled. + + + The interface or control is Enabled. + + + SDLC control word to TX and RX engines. +Can be OR'd together to set/clear multiple bits. + + + Inhibits the TX Engine from transmitting new data. + + + Aborts the current SDLC frame being transmitted. If FLUSH_ON_ABORT=TRUE, resets TX FIFO as well. + + + Forces TX engine to close the current SDLC frame on the next tx write (tx data is ignored). + + + Inhibits the RX Engine from accepting new data. + + + Aborts the current SDLC frame being received. If FLUSH_ON_ABORT=TRUE, resets RX FIFO as well. + + + Places the SDLC engine in internal loopback mode: TX data is wrapped back to the RX line. + + + Places the SDLC engine in echo loopback mode: RX data is wrapped back to the TX line. + + + If ADDR_FIELD_EN=TRUE, the RX Engine accepts data only from this address. + + + SDLC status word from TX and RX engines + + + Indicates that the TX engine is currently processing a SDLC frame. + + + Indicates that the TX FIFO is currently full. + + + Indicates that the TX FIFO is currently empty. + + + Asserts when an overflow condition occurs on the TX FIFO. Cleared only via control bit. + + + Indicates that the RX engine is currently processing a SDLC frame. + + + Indicates that the RX FIFO is currently empty. + + + Indicates that the RX FIFO is currently full. + + + Asserts when an overflow condition occurs on the RX FIFO. Cleared only via control bit. + + + Indicates that the RX engine has received a complete/incomplete SDLC frame. + + + Flag that the Frame Check Sequence calculated did not match the value received. + + + Indicates that a SDLC ABORT was received or that a RX ABORT occurred. + + + Indicates whether the internal loopback feature is currently enabled. + + + Indicates whether the echo loopback feature is currently enabled. + + + Indicates the TX Engine is in an inhibit state. + + + Indicates the RX Engine is in an inhibit state. + + + When data recovery is enabled, indicates that data was lost from the overrun buffer. + + + If ADDR_FIELD_EN=TRUE, indicates that a SDLC frame was misrouted to this station. + + + TMOD=KW_TEST_MODE Disc.,RX Enable, Tx Enable + + + Enables TX data/clock to UUT. + + + Enables TX data looped into RX for debug. + + + Asserts KW_TEST_MODE discrete to UUT, 0=Tx on IMU IO, 1=Tx on SIM IMU IO. + + + EDA/KWDL Config Register. Allows Station SW to program off-nominal values. + + + EDA CV Ready bit mask. + + + EDA CV Ready Valid bit mask. + + + EDA PBIT Passed bit mask. + + + EDA PBIT Valid bit mask. + + + EDA CV Clear Pass/Fail Valid bit mask. + + + EDA CV Clear Pass/Fail bit mask. + + + EDA Num CV Clear bit mask. + + + KWDL RF Temp bit mask. + + + KWDL MBIT Pass bit mask. + + + KWDL MBIT Complete bit mask. + + + KWDL PBIT Pass bit mask. + + + KWDL ControlState bit mask. + + + KWDL Link Up bit mask. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ControlState of the clock. + + + Clock is not present and/or it is unlocked. + + + Clock is present and locked. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EDA SDLC Interfaces. + + + Command Status SDLC Interface. + + + Plain Text SDLC interface. + + + Channel to use for EDA communications. + + + Channel A. + + + Channel B. + + + + + + + + + + + + + + + + + + + + + Used to indicate an invalid state was read from the hardware. + + + State of a given register bit that corresponds to a logic signal. + + + + + + + + + Indication of the capacity level of the SDLC auto forward memory buffer. + + + Buffer is between 50% and 100% capacity. + + + Buffer is at 100% capacity and is no longer retrieving data. + + + + + + Indicates the maximum time specified to begin receiving a message was exceeded. + + + + + + + + + + + + + + + Indicates the maximum time expired while waiting for a receive message to complete. + + + + + + + + + + + + + + + Receive message data is invalid. +If bit(11) was set the receive was aborted. +If bit(10) is set there was a frame check error. +If bit(7) is set the receive fifo overflowed. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnitVersion.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnitVersion.dll new file mode 100644 index 0000000..bc9d498 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Raytheon.GuidedElectronicsUnitVersion.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/AuroraStatus.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/AuroraStatus.cs new file mode 100644 index 0000000..4c090cd --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/AuroraStatus.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct AuroraStatus + { + + public bool SoftError { get; internal set; } + + public bool HardError { get; internal set; } + + public bool LinkUp { get; internal set; } + + public bool ChannelUp { get; internal set; } + + public int LaneUp { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CallLoggingEnumMap.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CallLoggingEnumMap.xml new file mode 100644 index 0000000..0e5197f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CallLoggingEnumMap.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CallLoggingHelper.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CallLoggingHelper.cs new file mode 100644 index 0000000..6dc1bf2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CallLoggingHelper.cs @@ -0,0 +1,256 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using FunctionCalls = Teradyne.Instruments.Logging.Adapters.FunctionCalls; +using Messaging = Teradyne.Instruments.Logging.Adapters.Messaging; +using Teradyne.Instruments.Logging.Client; + +namespace Raytheon.GuidedElectronicsUnit +{ + public class CallLoggingHelper : IDisposable + { + private static string s_source = " Raytheon.GuidedElectronicsUnit"; + private static CallLoggingHelper s_helper = null; + private FunctionCalls.ProducerAdapter _callAdapter; + private Messaging.ProducerAdapter _messageAdapter; + + static CallLoggingHelper() + { + if (s_helper != null) + return; + + s_helper = new CallLoggingHelper(); + } + + private CallLoggingHelper() + { + _callAdapter = new FunctionCalls.ProducerAdapter(); + _messageAdapter = new Messaging.ProducerAdapter(); + } + + public static bool IsLoggingEnabled() + { + return + s_helper._callAdapter.IsFunctionCallLoggingEnabled(s_source) || + s_helper._callAdapter.IsFunctionReturnLoggingEnabled(s_source) || + s_helper._messageAdapter.IsMessageLoggingEnabled(s_source); + } + + private bool _enumHandlerRegistered = false; + private static void RegisterEnumHandler() + { + if (s_helper._enumHandlerRegistered) + return; + + var assembly = typeof(CallLoggingHelper).Assembly; + //var resourceNames = assembly.GetManifestResourceNames(); + var stream = assembly.GetManifestResourceStream("Raytheon.GuidedElectronicsUnit.CallLoggingEnumMap.xml"); + var doc = new System.Xml.XmlDocument(); + try + { + if (stream != null) + doc.Load(stream); + } + catch + { + } + var xml = doc.OuterXml; + + LoggingTimestamp ts = new LoggingTimestamp(); + FunctionCalls.LoggingDataEnumTranslationConfiguration enumConfig = + new FunctionCalls.LoggingDataEnumTranslationConfiguration(ts, xml); + s_helper._callAdapter.ConfigureEnumTranslationForConsumers(enumConfig, s_source); + + s_helper._enumHandlerRegistered = true; + } + + private static Tuple ConvertToLoggingData(object value) + { + FunctionCalls.LoggingDataParameterType loggingType = FunctionCalls.LoggingDataParameterType.None; + byte[] loggingData; + string enumName = string.Empty; + int arrayLength = 0; + + if (value == null) + { + loggingData = null; + } + else + { + Type t = value.GetType(); + + if (t.IsArray) + { + var arrayValue = value as Array; + + //if (t.GetElementType() == typeof(Channel)) + //{ + // Channel[] channels = arrayValue as Channel[]; + // int[] channelIndexes = new int[channels.Length]; + // for (int c = 0; c < channels.Length; c++) + // channelIndexes[c] = channels[c].IndexOnInstrument; + + // loggingType = FunctionCalls.LoggingDataParameterType.ViInt32; + // loggingData = new byte[arrayValue.Length * sizeof(int)]; + // Buffer.BlockCopy(channelIndexes, 0, loggingData, 0, loggingData.Length); + //} + //else + { + int sizeOfElement = sizeof(int); + var elementType = t.GetElementType().UnderlyingSystemType; + loggingType = FunctionCalls.LoggingDataParameterType.ViInt32; + + if (elementType == typeof(bool)) + { + sizeOfElement = sizeof(short); + loggingType = FunctionCalls.LoggingDataParameterType.ViBoolean; + } + else if (elementType == typeof(double)) + { + sizeOfElement = sizeof(double); + loggingType = FunctionCalls.LoggingDataParameterType.ViReal64; + } + + loggingData = new byte[arrayValue.Length * sizeOfElement]; + Buffer.BlockCopy(arrayValue, 0, loggingData, 0, loggingData.Length); + arrayLength = arrayValue.Length; + } + } + else + { + //if (t == typeof(Channel)) + //{ + // loggingType = FunctionCalls.LoggingDataParameterType.ViInt32; + // loggingData = BitConverter.GetBytes(((Channel)value).IndexOnInstrument); + //} + /*else*/ if (t.IsEnum) + { + loggingType = FunctionCalls.LoggingDataParameterType.ViInt32; + loggingData = BitConverter.GetBytes((int)value); + enumName = t.Name; + } + else if (t.UnderlyingSystemType == typeof(int)) + { + loggingType = FunctionCalls.LoggingDataParameterType.ViInt32; + loggingData = BitConverter.GetBytes((int)value); + } + else if (t.UnderlyingSystemType == typeof(bool)) + { + loggingType = FunctionCalls.LoggingDataParameterType.ViBoolean; + short booleanValue = (short)(((bool)value) ? 1 : 0); + loggingData = BitConverter.GetBytes(booleanValue); + } + else if (t.UnderlyingSystemType == typeof(double)) + { + loggingType = FunctionCalls.LoggingDataParameterType.ViReal64; + loggingData = BitConverter.GetBytes((double)value); + } + else if (t.UnderlyingSystemType == typeof(string)) + { + loggingType = FunctionCalls.LoggingDataParameterType.ViString; + loggingData = Encoding.ASCII.GetBytes(value.ToString()); + } + else + { + loggingType = FunctionCalls.LoggingDataParameterType.ViString; + loggingData = Encoding.ASCII.GetBytes(value.ToString()); + } + } + } + + return new Tuple(loggingType, loggingData, enumName, arrayLength); + } + private static List CreateParameteList(object[] args) + { + RegisterEnumHandler(); + + List parameters = new List(); + + for (int i = 0; i < args.Length; i += 2) + { + string name = args[i].ToString(); + object value = args[i + 1]; + + var loggingData = ConvertToLoggingData(value); + if (value.GetType().IsArray) + { + var parameter = new FunctionCalls.LoggingDataArrayParameter(name, + loggingData.Item1, loggingData.Item4, loggingData.Item2, loggingData.Item3); + parameters.Add(parameter); + } + else + { + var parameter = new FunctionCalls.LoggingDataParameter(name, + loggingData.Item1, loggingData.Item2, loggingData.Item3); + parameters.Add(parameter); + } + } + + return parameters; + } + + public static void FunctionStart(Type t, string functionName, params object[] args) + { + if (!s_helper._callAdapter.IsFunctionCallLoggingEnabled(s_source)) + return; + + LoggingTimestamp ts = new LoggingTimestamp(); + List parameters = CreateParameteList(args); + FunctionCalls.LoggingDataFunctionCall functionCall = new FunctionCalls.LoggingDataFunctionCall($"{t.FullName}.{functionName}", ts, parameters); + s_helper._callAdapter.NotifyConsumers(functionCall, s_source); + } + + public static void FunctionEnd(Type t, string functionName, object returnValue, params object[] outOrRefArgs) + { + if (!s_helper._callAdapter.IsFunctionReturnLoggingEnabled(s_source)) + return; + + LoggingTimestamp ts = new LoggingTimestamp(); + List parameters = CreateParameteList(outOrRefArgs); + var loggingReturnData = ConvertToLoggingData(returnValue); + FunctionCalls.LoggingDataFunctionReturn functionReturn = new FunctionCalls.LoggingDataFunctionReturn($"{t.FullName}.{functionName}", ts, + loggingReturnData.Item1, loggingReturnData.Item2, parameters, loggingReturnData.Item3); + s_helper._callAdapter.NotifyConsumers(functionReturn, s_source); + } + + public static void Message(string message) + { + if (!s_helper._messageAdapter.IsMessageLoggingEnabled(s_source)) + return; + + s_helper._messageAdapter.NotifyConsumers(message, s_source); + } + + private bool _disposedValue; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + _callAdapter?.Shutdown(); + } + + s_helper = null; + _disposedValue = true; + } + } + + ~CallLoggingHelper() + { + // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method + Dispose(disposing: false); + } + + public void Dispose() + { + // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method + Dispose(disposing: true); + GC.SuppressFinalize(this); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ConfigStore.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ConfigStore.cs new file mode 100644 index 0000000..6229cdc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ConfigStore.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + + +// This file is used to customize how the driver installer registers the IVI.NET driver in the IVI Configuration Store. +// Several attributes can be used to specify additional entires that should be placed in the end user's IVI Configuration Store +// at driver installation time. + +// Use the LogicalName attribute to have your driver installer create a LogicalName entry in the IVI Configuration Store. +// This attribute can be applied multiple times to install multiple logical names. +// +// [assembly: LogicalName("TODO:LogicalName", "TODO:DriverSessionName")] +// + +// Use the DriverSession attribute to have your driver installer create a DriverSession entry in the IVI Configuration Store. +// This attribute can be applied multiple times to install multiple driver sessions. +// +// [assembly: DriverSession("TODO:DriverSessionName", +// Cache = false, +// DriverSetup = "TODO", +// HardwareAsset = "TODO:HardwareAssetName", +// InterchangeCheck = false, +// QueryInstrumentStatus = true, +// RangeCheck = false, +// RecordCoercions = false, +// Simulate = false)] +// + +// Use the HardwareAsset attribute to have your driver installer create a HardwareAsset entry in the IVI Configuration Store. +// This attribute can be applied multiple times to install multiple hardware assets. +// +// [assembly: HardwareAsset("TODO:HardwareAssetName", "TODO:ResourceDescriptor")] +// + +// Use the ConfigurableInitialSetting attribute to have your driver installer create a ConfigurableInitialSetting entry in the IVI Configuration Store. +// This attribute can be applied multiple times to install multiple ConfigurableInitialSetting entries. +// +// [assembly: ConfigurableInitialSetting("TODO:KeyName", 0 /*TODO:Value*/, UsedInSession.Required, "TODO:Description")] +// diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ConfigStore.xml b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ConfigStore.xml new file mode 100644 index 0000000..2199744 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ConfigStore.xml @@ -0,0 +1,68 @@ + + IVI Configuration Server + The IVI Configuration Server allows access to and modification of an IVI configuration store + IVI Foundation, Inc + 1.3.1.0 + 1 + 0 + + + + + + IviDriver + 1 + 0 + IVI.NET + + + + + Raytheon.GuidedElectronicsUnit v1.2.5 Fx46 + IVI.NET Driver for GuidedElectronicsUnit + + + Configurable Initial Settings + + 1 + Required + Structure + 0 + + + + + Model + Default model used during simulation + 1 + Required + String + 0 + + + HSSub6020a, HSSub9010 + + + + + + + + HSSub6020a, HSSub9010 + + + + + + Raytheon.GuidedElectronicsUnit.GuidedElectronicsUnit, Raytheon.GuidedElectronicsUnit.Fx46, Version=1.2.5.0, Culture=neutral, PublicKeyToken=65cff6f5578f3c89 + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CvCwData.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CvCwData.cs new file mode 100644 index 0000000..bc91cef --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/CvCwData.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct CvcwData + { + + public CvcwData(uint regValue) + { + Size = (int)(regValue & (uint)BitMask.Size) >> (int)Bit.Size; + Data3 = Convert.ToByte((regValue & (uint)BitMask.Data3) >> (int)Bit.Data3); + Data2 = Convert.ToByte((regValue & (uint)BitMask.Data2) >> (int)Bit.Data2); + Data1 = Convert.ToByte((regValue & (uint)BitMask.Data1) >> (int)Bit.Data1); + } + + #region Private Members + + private enum Bit + { + Size = 24, + Data3 = 16, + Data2 = 8, + Data1 = 0 + } + + private enum BitMask + { + Size = 0x0F00_0000, + Data3 = 0x00FF_0000, + Data2 = 0x0000_FF00, + Data1 = 0x0000_00FF + } + + #endregion + + public int Size { get; internal set; } + + public byte Data1 { get; internal set; } + + public byte Data2 { get; internal set; } + + public byte Data3 { get; internal set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EdaConfig.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EdaConfig.cs new file mode 100644 index 0000000..a4fc642 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EdaConfig.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct EdaConfig + { + public EdaConfig(uint status) + { + KwdlLinkUp = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlLinkUp); + KwdlState = (KwdlState)((status & (uint)EdaConfigure.KwdlState) >> (int)Bit.KwdlState); + KwdlPbitPass = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlPbitPass); + KwdlMbitComplete = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlMbitComplete); + KwdlMbitPass = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlMbitPass); + KwdlRFTemp = Convert.ToInt32((status & (uint)EdaConfigure.KwdlRFTemp) >> (int)Bit.KwdlRFTemp); + EdaNumCVClear = Convert.ToInt32((status & (uint)EdaConfigure.EdaNumCVClear) >> (int)Bit.EdaNumCVClear); + EdaCVClearPassFail = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVClearPassFail); + EdaCVClearPassFailValid = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVClearPassFailValid); + EdaCVReady = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVReady); + EdaCVReadyValid = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVReadyValid); + EdaPbitPass = Convert.ToBoolean(status & (uint)EdaConfigure.EdaPbitPass); + EdaPbitValid = Convert.ToBoolean(status & (uint)EdaConfigure.EdaPbitValid); + } + + #region Internal Members + + internal enum Bit + { + EdaPbitValid = 0, + EdaPbitPass = 1, + EdaCVReadyValid = 2, + EdaCVReady = 3, + EdaCVClearPassFailValid = 4, + EdaCVClearPassFail = 5, + EdaNumCVClear = 6, + KwdlRFTemp = 16, + KwdlMbitPass = 24, + KwdlMbitComplete = 25, + KwdlPbitPass = 26, + KwdlState = 27, + KwdlLinkUp = 30 + } + + #endregion + + public int KwdlRFTemp { get; set; } + + public bool EdaPbitValid { get; set; } + + public bool EdaCVReadyValid { get; set; } + + public bool EdaPbitPass { get; set; } + + public bool EdaCVReady { get; set; } + + public bool EdaCVClearPassFailValid { get; set; } + + public bool EdaCVClearPassFail { get; set; } + + public int EdaNumCVClear { get; set; } + + public bool KwdlMbitPass { get; set; } + + public bool KwdlMbitComplete { get; set; } + + public bool KwdlPbitPass { get; set; } + + public Raytheon.GuidedElectronicsUnit.KwdlState KwdlState { get; set; } + + public bool KwdlLinkUp { get; set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EdaStatus.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EdaStatus.cs new file mode 100644 index 0000000..1d5f3cd --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EdaStatus.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct EdaStatus + { + public EdaStatus(uint status) + { + CryptoGoValue = Convert.ToBoolean(status & (uint)BitMask.CryptoGoValue); + XcvrPowerMode = (EdaPowerMode)((status & (uint)BitMask.XcvrPowerMode) >> (int)Bit.XcvrPowerMode); + DataBusMode = (EdaDataBusMode)((status & (uint)BitMask.DataBusMode) >> (int)Bit.DataBusMode); + LowPowerMode = (EdaPowerMode)((status & (uint)BitMask.LowPowerMode) >> (int)Bit.LowPowerMode); + TerminalId = (int)((status & (uint)BitMask.TerminalId) >> (int)Bit.TerminalId); + } + + #region Private Members + + private enum BitMask + { + CryptoGoValue = 0x0000_0800, + XcvrPowerMode = 0x0000_0300, + DataBusMode = 0x0000_0030, + LowPowerMode = 0x0000_0003, + TerminalId = 0x0000_F000 + } + + private enum Bit + { + LowPowerMode = 0, + DataBusMode = 4, + XcvrPowerMode = 8, + TerminalId = 12 + } + + #endregion + + public bool CryptoGoValue { get; internal set; } + + public EdaPowerMode XcvrPowerMode { get; internal set; } + + public EdaDataBusMode DataBusMode { get; internal set; } + + public EdaPowerMode LowPowerMode { get; internal set; } + + public int TerminalId { get; internal set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EmStatus.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EmStatus.cs new file mode 100644 index 0000000..fdd9dbe --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/EmStatus.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct EmStatus + { + + public EmStatus(uint regValue) + { + GeuClock = (SignalState)((regValue & (uint)BitMask.GeuClock) >> (int)BitIdx.GeuClock); + EmReset = (SignalState)((regValue & (uint)BitMask.EmReset) >> (int)BitIdx.EmReset); + } + + #region Private Members + + private enum BitIdx + { + GeuClock = 0x1, + EmReset = 0x0 + } + + private enum BitMask + { + GeuClock = 0x2, + EmReset = 0x1 + } + + #endregion + + public Raytheon.GuidedElectronicsUnit.SignalState GeuClock { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState EmReset { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Enums.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Enums.cs new file mode 100644 index 0000000..20a46d1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Enums.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Raytheon.GuidedElectronicsUnit; + +namespace Raytheon.GuidedElectronicsUnit +{ + public enum ControlState + { + Disabled = 0, + Enabled = 1 + } + + public enum SdlcControlBits + { + TxInhibit = 0x1, + TxAbort = 2, + TxEndFrame = 4, + RxInhibit = 8, + RxAbort = 16, + InternalLoopback = 32, + EchoLoopback = 64, + StationAddress = -16777216 + } + + public enum SdlcStatusBits + { + TxActive = 0x1, + TxFifoFull = 0x2, + TxFifoEmpty = 0x4, + TxFifoOverflowed = 0x8, + RxActive = 0x10, + RxFifoEmpty = 0x40, + RxFifoFull = 0x20, + RxFifoOverflowed = 0x80, + RxMessageDone = 0x200, + RxMessageFcsError = 0x400, + RxMessageAborted = 0x800, + InternalLoopback = 0x1000, + EchoLoopback = 0x2000, + TxInhibited = 0x4000, + RxInhibited = 0x8000, + DrOverrunError = 0x10000, + RxBadAddressError = 256 + } + + public enum ImuConfigure + { + TxEnable = 1, + RxEnable = 2, + KwTestMode = 4 + } + + public enum EdaConfigure + { + EdaCVReady = 8, + EdaCVReadyValid = 4, + EdaPbitPass = 2, + EdaPbitValid = 1, + EdaCVClearPassFailValid = 16, + EdaCVClearPassFail = 32, + EdaNumCVClear = 960, + KwdlRFTemp = 16711680, + KwdlMbitPass = 16777216, + KwdlMbitComplete = 33554432, + KwdlPbitPass = 67108864, + KwdlState = 939524096, + KwdlLinkUp = 1073741824 + } + + public enum ImuMessageWord + { + VelocityDeltaX = 0, + VelocityDeltaY = 1, + VelocityDeltaZ = 2, + AngleDeltaX = 3, + AngleDeltaY = 4, + AngleDeltaZ = 5, + StatusSummaryWord = 6, + ModeMuxId = 7, + MuxDataWord = 8, + RawGyroCountX = 9, + RawGyroCountY = 10, + RawGyroCountZ = 11 + } + + public enum PllState + { + Unlocked = 0, + Locked = 1 + } + + public enum ResetState + { + Inactive = 0, + Active = 1 + } + + public enum EdaDataBusMode + { + MTD = 1, + KWDL = 2, + Invalid0 = 0, + Invalid3 = 3 + } + + public enum EdaPowerMode + { + Enabled = 1, + Disabled = 2, + Invalid3 = 3, + Invalid0 = 0 + } + + public enum KwdlLocation + { + KW = 0, + GS = 1 + } + + public enum EdaBus + { + CS = 1, + PT = 0 + } + + public enum EdaChannel + { + A = 0, + B = 1 + } + + public enum KwdlState + { + Standby = 0, + Tactical = 1, + Maintenance = 2, + Reprogram = 3, + KA = 4, + Invalid = 7 + } + + public enum SignalState + { + Low = 0, + High = 1 + } + + public enum AutoForwardBufferCapacity + { + HalfFull = 1, + Full = 2, + Empty = 0 + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/FirmwareInformation.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/FirmwareInformation.cs new file mode 100644 index 0000000..b6b79fa --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/FirmwareInformation.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct FirmwareInformation + { + public ushort ApplicationId { get; internal set; } + + public ushort CustomerId { get; internal set; } + + public uint RevisionId { get; internal set; } + + public ushort Constant { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnit.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnit.cs new file mode 100644 index 0000000..37ebbae --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnit.cs @@ -0,0 +1,1267 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Resources; +using System.Text; +using System.Threading; +using MindWorks.Nimbus; +using Ivi.Driver; + +[assembly: DriverCapabilities(Capabilities.AllExceptInterchangeCheck)] + +[assembly: SCPICompliant(true)] +[assembly: BooleanCommand("1", "0")] + +namespace Raytheon.GuidedElectronicsUnit +{ + public sealed class GuidedElectronicsUnit : Driver, + IGuidedElectronicsUnit, + IGuidedElectronicsUnitDiscrete, + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator, + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA, + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS, + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT, + IGuidedElectronicsUnitGsKwSyncronousDataLinkControl, + IGuidedElectronicsUnitInertialMeasurementUnitEmulator, + IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator, + IGuidedElectronicsUnitLowLevel, + IGuidedElectronicsUnitLowLevelHSSub6020a, + IGuidedElectronicsUnitLowLevelHSSub9100, + IGuidedElectronicsUnitTestControl, + IIviDriver, + IIviDriverOperation, + IIviDriverIdentity, + IIviDriverUtility + { + #region Member fields + + //private bool enableLog = false; + //private StreamWriter logFile = null; + + private int PollingInterval = 100; // In milliseconds + private int MessageBufferSize = (int)10485760; + + private string _hsSub6020aResourceName = string.Empty; + private HardwareSession6020a _hardwareSession6020a = null; + + private string _hsSub9100ResourceName = string.Empty; + private HardwareSession9100 _hardwareSession9100 = null; + + private readonly bool _hardwareSessionReset = false; + + #endregion + + public GuidedElectronicsUnit(string resourceName, bool idQuery, bool reset) + : this(resourceName, idQuery, reset, String.Empty) + { + _hardwareSessionReset = reset; + } + + public GuidedElectronicsUnit(string resourceName, bool idQuery, bool reset, string options) + { + CallLoggingHelper.FunctionStart(GetType(), "ctor", + nameof(resourceName), resourceName, + nameof(idQuery), idQuery, + nameof(reset), reset, + nameof(options), options); + try + { + _hardwareSessionReset = reset; + + // Do not remove this call to base.Initialize + // + base.Initialize(resourceName, idQuery, reset, options, LockType.AppDomain, String.Empty, 2000, 2000, 5000); + + //CallLoggingHelper.Message("Driver Information"); + //CallLoggingHelper.Message(string.Format(" {0,-30}: {1}", "Identifier", this.Identity.Identifier)); + //CallLoggingHelper.Message(string.Format(" {0,-30}: {1}", "Revision", this.Identity.Revision)); + //CallLoggingHelper.Message(string.Format(" {0,-30}: {1}", "Vendor", this.Identity.Vendor)); + //CallLoggingHelper.Message(string.Format(" {0,-30}: {1}", "InstrumentModel", this.Identity.InstrumentModel)); + //CallLoggingHelper.Message(string.Format(" {0,-30}: {1}", "InstrumentFirmwareRevision", this.Identity.InstrumentFirmwareRevision)); + //CallLoggingHelper.Message(string.Format(" {0,-30}: {1}", "InstrumentManufacturer", this.Identity.InstrumentManufacturer)); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "ctor", null); + } + } + + public GuidedElectronicsUnit(string resourceName, bool idQuery, bool reset, LockType lockType, string accessKey, string options) + { + _hardwareSessionReset = reset; + + // Do not remove this call to base.Initialize + // + base.Initialize(resourceName, idQuery, reset, options, lockType, accessKey, 2000, 2000, 5000); + } + + protected override void CleanupUnmanagedResources() + { + // Use this method to cleanup any driver-specific unmanaged resources + } + protected override void InitializeIO() + { + // Nothing to do, but the default implementation assumes SCPI instrument + // This method doesn't get called if simulate is true + } + + internal override void CloseIO() + { + // This method closes the I/O connection with the instrument. For VISA-based drivers, this function + // performs the viClose call on the I/O connection. For custom I/O, this function performs whatever + // cleanup tasks are necessary to free up whatever resources are held by the custom I/O implementation. + // + + HardwareSessionFactory.EndHardwareSession(this, _hsSub6020aResourceName); + _hardwareSession6020a = null; + _hsSub6020aResourceName = string.Empty; + + // Wait for background thread to stop then dispose it + if (_hardwareSession9100 != null) + { + _hardwareSession9100.messageChecker.CancelAsync(); + while (_hardwareSession9100.messageChecker.IsBusy) + { + Thread.Sleep(1); + } + _hardwareSession9100.messageChecker.Dispose(); + } + + HardwareSessionFactory.EndHardwareSession(this, _hsSub9100ResourceName); + _hardwareSession9100 = null; + _hsSub9100ResourceName = string.Empty; + + //if (logFile != null) + //{ + // logFile.Flush(); + // logFile.Close(); + // logFile = null; + //} + } + + protected override void ClearIO() + { + // Nothing to do, but the default implementation assumes SCPI instrument + } + + private HardwareSession6020a Get6020aSession() + { + if (_hardwareSession6020a == null) + throw new InvalidOperationException("Hardware session to HSSub 6020A not initialized"); + + return _hardwareSession6020a; + } + + private HardwareSession9100 Get9100Session() + { + if (_hardwareSession9100 == null) + throw new InvalidOperationException("Hardware session to HSSub 9100 not initialized"); + + return _hardwareSession9100; + } + + protected override void InitializeIdentification() + { + //SetupDebugLog(); + // If the resource string for the 6020a instrument was not specified as a Driver Setup option, + // use the resource string specified in the constructor + if (string.IsNullOrWhiteSpace(_hsSub6020aResourceName)) + _hsSub6020aResourceName = Session.ResourceDescriptor; + + + if (!string.IsNullOrWhiteSpace(_hsSub6020aResourceName)) + { + // Get the hardware session + _hardwareSession6020a = + HardwareSessionFactory.NewHardwareSession(this, _hsSub6020aResourceName, + Session.InitOptions.SimulationEnabled, _hardwareSessionReset); + } + + if (!string.IsNullOrWhiteSpace(_hsSub9100ResourceName)) + { + _hardwareSession9100 = + HardwareSessionFactory.NewHardwareSession(this, _hsSub9100ResourceName, + Session.InitOptions.SimulationEnabled, _hardwareSessionReset); + } + } + + internal override void InitNode() + { + base.InitNode(); + if (_hardwareSession9100 != null) + { + _hardwareSession9100.SetupBackgroundWorker(MessageBufferSize, PollingInterval); + } + } + + protected override void PollInstrumentErrors() + { + // Nothing to do, but the default implementation assumes SCPI instrument + } + + //public void SendWarning(string message) + //{ + // Guid _guid = Guid.NewGuid(); + // WarningEventArgs _args = new(_guid, message); + // SendWarningEvent(_args); + //} + + //private void SetupDebugLog() + //{ + // if (enableLog) + // { + // var LogFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Raytheon", "DebugLogs", this.Identity.Identifier); + // if (!Directory.Exists(LogFilePath)) + // { + // Directory.CreateDirectory(LogFilePath); + // } + // var timeStamp = string.Format("{0:yyyyMMdd_HHmmss}.txt", DateTime.Now); + // logFile = new StreamWriter(Path.Combine(LogFilePath, timeStamp)); + // } + //} + + #region IIviDriver + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IIviDriverOperation DriverOperation + { + get + { + return base.DefaultImplementation.Inherent.DriverOperation; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IIviDriverIdentity Identity + { + get + { + return base.DefaultImplementation.Inherent.Identity; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IIviDriverUtility Utility + { + get + { + return base.DefaultImplementation.Inherent.Utility; + } + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + public void Close() + { + base.DefaultImplementation.Inherent.Close(); + } + + #endregion + + #region IIviDriverIdentity + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + string IIviDriverIdentity.InstrumentManufacturer + { + get + { + return base.DefaultImplementation.Inherent.InstrumentManufacturer; + } + } + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + string IIviDriverIdentity.InstrumentModel + { + get + { + return base.DefaultImplementation.Inherent.InstrumentModel; + } + } + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + string IIviDriverIdentity.InstrumentFirmwareRevision + { + get + { + return base.DefaultImplementation.Inherent.InstrumentFirmwareRevision; + } + } + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + string IIviDriverIdentity.Identifier + { + get + { + return base.DefaultImplementation.Inherent.Identifier; + } + } + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + int IIviDriverIdentity.SpecificationMajorVersion + { + get + { + return base.DefaultImplementation.Inherent.SpecificationMajorVersion; + } + } + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + int IIviDriverIdentity.SpecificationMinorVersion + { + get + { + return base.DefaultImplementation.Inherent.SpecificationMinorVersion; + } + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + string[] IIviDriverIdentity.GetSupportedInstrumentModels() + { + return base.DefaultImplementation.Inherent.GetSupportedInstrumentModels(); + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + string[] IIviDriverIdentity.GetGroupCapabilities() + { + return base.DefaultImplementation.Inherent.GetGroupCapabilities(); + } + + #endregion + + #region IIviDriverOperation + + [DriverEvent(SuppressPollInstrumentErrors = true)] + event EventHandler IIviDriverOperation.Warning + { + add + { + base.Warning += value; + } + remove + { + base.Warning -= value; + } + } + + [DriverEvent(SuppressPollInstrumentErrors = true)] + event EventHandler IIviDriverOperation.Coercion + { + add + { + base.Coercion += value; + } + remove + { + base.Coercion -= value; + } + } + + [DriverEvent(SuppressPollInstrumentErrors = true)] + event EventHandler IIviDriverOperation.InterchangeCheckWarning + { + add + { + base.InterchangeCheckWarning += value; + } + remove + { + base.InterchangeCheckWarning -= value; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + string IIviDriverOperation.LogicalName + { + get + { + return base.DefaultImplementation.Inherent.LogicalName; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + string IIviDriverOperation.IOResourceDescriptor + { + get + { + return base.DefaultImplementation.Inherent.IOResourceDescriptor; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + bool IIviDriverOperation.Cache + { + get + { + return base.DefaultImplementation.Inherent.Cache; + } + set + { + base.DefaultImplementation.Inherent.Cache = value; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + bool IIviDriverOperation.QueryInstrumentStatus + { + get + { + return base.DefaultImplementation.Inherent.QueryInstrumentStatus; + } + set + { + base.DefaultImplementation.Inherent.QueryInstrumentStatus = value; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + bool IIviDriverOperation.RangeCheck + { + get + { + return base.DefaultImplementation.Inherent.RangeCheck; + } + set + { + base.DefaultImplementation.Inherent.RangeCheck = value; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + bool IIviDriverOperation.Simulate + { + get + { + return base.DefaultImplementation.Inherent.Simulate; + } + set + { + base.DefaultImplementation.Inherent.Simulate = value; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + string IIviDriverOperation.DriverSetup + { + get + { + return base.DefaultImplementation.Inherent.DriverSetup; + } + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + void IIviDriverOperation.ResetInterchangeCheck() + { + base.DefaultImplementation.Inherent.ResetInterchangeCheck(); + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + void IIviDriverOperation.InvalidateAllAttributes() + { + base.DefaultImplementation.Inherent.InvalidateAllAttributes(); + } + + #endregion + + #region IIviDriverUtility + + [DriverMethod(SuppressPollInstrumentErrors = true)] + ErrorQueryResult IIviDriverUtility.ErrorQuery() + { + return new ErrorQueryResult(0, "No Error"); + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + SelfTestResult IIviDriverUtility.SelfTest() + { + return base.DefaultImplementation.Inherent.SelfTest(); + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + void IIviDriverUtility.Disable() + { + base.DefaultImplementation.Inherent.Disable(); + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + void IIviDriverUtility.ResetWithDefaults() + { + // Reset each instrument in use + if (_hardwareSession6020a != null) + _hardwareSession6020a.LowLevel.Reset(); + + if (_hardwareSession9100 != null) + _hardwareSession9100.LowLevel.Reset(); + } + + [DriverMethod(SuppressPollInstrumentErrors = true)] + void IIviDriverUtility.Reset() + { + // Reset each instrument in use + if (_hardwareSession6020a != null) + _hardwareSession6020a.LowLevel.Reset(); + + if (_hardwareSession9100 != null) + _hardwareSession9100.LowLevel.Reset(); + } + + [DriverMethod(Lock = false, SuppressPollInstrumentErrors = true)] + IIviDriverLock IIviDriverUtility.Lock() + { + return base.DefaultImplementation.Inherent.Lock(); + } + + [DriverMethod(Lock = false, SuppressPollInstrumentErrors = true)] + IIviDriverLock IIviDriverUtility.Lock(PrecisionTimeSpan maxTime) + { + return base.DefaultImplementation.Inherent.Lock(maxTime); + } + + #endregion + + #region IIviComponentIdentity + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + string IIviComponentIdentity.Description + { + get + { + return base.DefaultImplementation.Inherent.Description; + } + } + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + string IIviComponentIdentity.Revision + { + get + { + return base.DefaultImplementation.Inherent.Revision; + } + } + + [DriverProperty(Lock = false, SuppressPollInstrumentErrors = true)] + string IIviComponentIdentity.Vendor + { + get + { + return base.DefaultImplementation.Inherent.Vendor; + } + } + + #endregion + + /// + /// Override this method to process a custom DriverSetup option. Custom DriverSetup options are driver-defined + /// name-value pairs that must be processed by this method. Custom DriverSetup options do *not* include those + /// options common to all Nimbus drivers, such as the "Model" and "Trace" options. This method is only called + /// when Nimbus cannot interpret a DriverSetup option. + /// + /// Be default, this method throws an UnknownOptionException. As such, it *must* be overridden in the main + /// driver class if the user specifies + /// any custom DriverSetup options. + /// + /// + /// Name of the custom DriverSetup option. + /// Value of the custom DriverSetup option. + internal override void ProcessCustomDriverSetupOption(string name, string value) + { + switch (name.ToLower()) + { + case "hssub6020a": + _hsSub6020aResourceName = value; + break; + case "hssub9100": + _hsSub9100ResourceName = value; + break; + case "pollinginterval": + PollingInterval = Convert.ToInt32(value); + break; + case "messagebuffersize": + MessageBufferSize = Convert.ToInt32(value); + if (MessageBufferSize < 1024) + { + MessageBufferSize = 1024; + } + break; + //case "debug": + // enableLog = (value.ToLower() == "on") ? true : false; + // break; + } + } + + #region IGuidedElectronicsUnit + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IGuidedElectronicsUnitDiscrete Discrete + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IGuidedElectronicsUnitInertialMeasurementUnitEmulator InertialMeasurementUnitEmulator + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator EncryptorDecryptorAssemblyEmulator + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IGuidedElectronicsUnitLowLevel LowLevel + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator IntegratedDewarAssemblyInterfaceEmulator + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IGuidedElectronicsUnitGsKwSyncronousDataLinkControl GsKwSyncronousDataLinkControl + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + public IGuidedElectronicsUnitTestControl TestControl + { + get + { + return this; + } + } + + #endregion + + #region IGuidedElectronicsUnitLowLevel + + [DriverProperty(SuppressPollInstrumentErrors = true)] + IGuidedElectronicsUnitLowLevelHSSub6020a IGuidedElectronicsUnitLowLevel.HSSub6020a + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + IGuidedElectronicsUnitLowLevelHSSub9100 IGuidedElectronicsUnitLowLevel.HSSub9100 + { + get + { + return this; + } + } + + #endregion + + #region IGuidedElectronicsUnitLowLevelHSSub6020a + + [DriverMethod] + FirmwareInformation IGuidedElectronicsUnitLowLevelHSSub6020a.GetFirmwareInfo() => + Get6020aSession().LowLevel.GetFirmwareInfo(); + + [DriverMethod] + TdfPllStatus IGuidedElectronicsUnitLowLevelHSSub6020a.GetPllStatus() => + Get6020aSession().LowLevel.GetPllStatus(); + + [DriverMethod] + uint IGuidedElectronicsUnitLowLevelHSSub6020a.ReadRegister(uint address) => + Get6020aSession().LowLevel.ReadRegister(address); + + [DriverMethod] + void IGuidedElectronicsUnitLowLevelHSSub6020a.WriteRegister(uint address, uint data) => + Get6020aSession().LowLevel.WriteRegister(address, data); + + [DriverMethod] + void IGuidedElectronicsUnitLowLevelHSSub6020a.Reset() => + Get6020aSession().LowLevel.Reset(); + + [DriverMethod] + void IGuidedElectronicsUnitLowLevelHSSub6020a.ReadModifyWrite(uint address, uint data, uint mask) => + Get6020aSession().LowLevel.ReadModifyWrite(address, data, mask); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + int IGuidedElectronicsUnitLowLevelHSSub6020a.Chassis => + Get6020aSession().LowLevel.Chassis; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + string IGuidedElectronicsUnitLowLevelHSSub6020a.Descriptor => + Get6020aSession().LowLevel.Descriptor; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + string IGuidedElectronicsUnitLowLevelHSSub6020a.SerialNumber => + Get6020aSession().LowLevel.SerialNumber; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + int IGuidedElectronicsUnitLowLevelHSSub6020a.Slot => + Get6020aSession().LowLevel.Slot; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + double IGuidedElectronicsUnitLowLevelHSSub6020a.DieTemp => + Get6020aSession().LowLevel.DieTemp; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + double IGuidedElectronicsUnitLowLevelHSSub6020a.VccInt => + Get6020aSession().LowLevel.VccInt; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + double IGuidedElectronicsUnitLowLevelHSSub6020a.VccAux => + Get6020aSession().LowLevel.VccAux; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitLowLevelHSSub6020a.IsSimulated => + Get6020aSession().LowLevel.IsSimulated; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + Raytheon.GuidedElectronicsUnit.ControlState IGuidedElectronicsUnitLowLevelHSSub6020a.EnableIO + { + get => Get6020aSession().LowLevel.EnableIO; + set => Get6020aSession().LowLevel.EnableIO = value; + } + + [DriverMethod] + void IGuidedElectronicsUnitLowLevelHSSub6020a.ResetEmStatus() + { + Get6020aSession().LowLevel.ResetEmStatus(); + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + EmStatus IGuidedElectronicsUnitLowLevelHSSub6020a.EmStatus + { + get => Get6020aSession().LowLevel.EmStatus; + } + + #endregion + + #region IGuidedElectronicsUnitLowLevelHSSub9100 + + [DriverMethod] + FirmwareInformation IGuidedElectronicsUnitLowLevelHSSub9100.GetFirmwareInfo() => + Get9100Session().LowLevel.GetFirmwareInfo(); + + [DriverMethod] + TdfPllStatus IGuidedElectronicsUnitLowLevelHSSub9100.GetPllStatus() => + Get9100Session().LowLevel.GetPllStatus(); + + [DriverMethod] + uint IGuidedElectronicsUnitLowLevelHSSub9100.ReadRegister(uint address) => + Get9100Session().LowLevel.ReadRegister(address); + + [DriverMethod] + void IGuidedElectronicsUnitLowLevelHSSub9100.WriteRegister(uint address, uint data) => + Get9100Session().LowLevel.WriteRegister(address, data); + + [DriverMethod] + void IGuidedElectronicsUnitLowLevelHSSub9100.Reset() => + Get9100Session().LowLevel.Reset(); + + [DriverMethod] + void IGuidedElectronicsUnitLowLevelHSSub9100.ReadModifyWrite(uint address, uint data, uint mask) => + Get9100Session().LowLevel.ReadModifyWrite(address, data, mask); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + int IGuidedElectronicsUnitLowLevelHSSub9100.Chassis => + Get9100Session().LowLevel.Chassis; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + string IGuidedElectronicsUnitLowLevelHSSub9100.Descriptor => + Get9100Session().LowLevel.Descriptor; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + string IGuidedElectronicsUnitLowLevelHSSub9100.SerialNumber => + Get9100Session().LowLevel.SerialNumber; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + int IGuidedElectronicsUnitLowLevelHSSub9100.Slot => + Get9100Session().LowLevel.Slot; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + double IGuidedElectronicsUnitLowLevelHSSub9100.DieTemp => + Get9100Session().LowLevel.DieTemp; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + double IGuidedElectronicsUnitLowLevelHSSub9100.VccInt => + Get9100Session().LowLevel.VccInt; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + double IGuidedElectronicsUnitLowLevelHSSub9100.VccAux => + Get9100Session().LowLevel.VccAux; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitLowLevelHSSub9100.IsSimulated => + Get9100Session().LowLevel.IsSimulated; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + Raytheon.GuidedElectronicsUnit.ControlState IGuidedElectronicsUnitLowLevelHSSub9100.EnableIO + { + get => Get9100Session().LowLevel.EnableIO; + set => Get9100Session().LowLevel.EnableIO = value; + } + + [DriverMethod] + AuroraStatus IGuidedElectronicsUnitLowLevelHSSub9100.GetAuroraStatus() => + Get9100Session().LowLevel.GetAuroraStatus(); + + #endregion + + #region IGuidedElectronicsUnitInertialMeasurementUnitEmulator + + [DriverMethod] + SdlcStatus IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchStatus() => + Get9100Session().ImuEmulator.FetchStatus(); + + [DriverMethod] + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.SetDataWord(ImuMessageWord word, uint data) => + Get9100Session().ImuEmulator.SetDataWord(word, data); + + [DriverMethod] + ImuMessage IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchMessageData() => + Get9100Session().ImuEmulator.FetchMessageData(); + + [DriverMethod] + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.Configure(ImuConfigure control, Raytheon.GuidedElectronicsUnit.ControlState state) => + Get9100Session().ImuEmulator.Configure(control, state); + + [DriverMethod] + ImuConfig IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchConfiguration() => + Get9100Session().ImuEmulator.FetchConfiguration(); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + double IGuidedElectronicsUnitInertialMeasurementUnitEmulator.EODSampleWidth + { + get => Get9100Session().ImuEmulator.EODSampleWidth; + set => Get9100Session().ImuEmulator.EODSampleWidth = value; + } + + [DriverMethod] + ImuDiscreteInput IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchDiscreteInput() => + Get9100Session().ImuEmulator.FetchDiscreteInput(); + + [DriverMethod] + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.SdlcControl(SdlcControlBits control, ControlState state) => + Get9100Session().ImuEmulator.SdlcControl(control, state); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + SdlcFifoWrCount IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FifoWrCount + { + get => Get9100Session().ImuEmulator.FifoWrCount; + } + + [DriverMethod] + RxSdlcMessage IGuidedElectronicsUnitInertialMeasurementUnitEmulator.ReadMessage() => + Get9100Session().ImuEmulator.ReadMessage(); + + [DriverMethod] + RxSdlcMessage[] IGuidedElectronicsUnitInertialMeasurementUnitEmulator.ReadAllMessages() => + Get9100Session().ImuEmulator.ReadAllMessages(); + + [DriverMethod] + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.SendMessage(uint[] data) => + Get9100Session().ImuEmulator.SendMessage(data); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + Raytheon.GuidedElectronicsUnit.ControlState IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FrameEnable + { + get => Get9100Session().ImuEmulator.FrameEnable; + set => Get9100Session().ImuEmulator.FrameEnable = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + [RangeCheckMinMax(1E-08, 2.68435455, MinInclusive = true, MaxInclusive = true)] + double IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FramePeriod + { + get => Get9100Session().ImuEmulator.FramePeriod; + set => Get9100Session().ImuEmulator.FramePeriod = value; + } + + #endregion + + #region IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + Raytheon.GuidedElectronicsUnit.ControlState IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator.Control + { + get => Get6020aSession().IdaEmulator.Control; + set => Get6020aSession().IdaEmulator.Control = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + IdaStatus IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator.Status => + Get6020aSession().IdaEmulator.Status; + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + uint IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator.Version => + Get6020aSession().IdaEmulator.Version; + + #endregion + + #region IGuidedElectronicsUnitDiscrete + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + Raytheon.GuidedElectronicsUnit.SignalState IGuidedElectronicsUnitDiscrete.NcDacsKwOrdEn + { + get + { + return Get9100Session().Discrete.NcDacsKwOrdEn; + } + } + + #endregion + + #region IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator + + [DriverProperty(SuppressPollInstrumentErrors = true)] + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator.ChannelA + { + get + { + return this; + } + } + + #endregion + + #region IGuidedElectronicsUnitGsKwSyncronousDataLinkControl + + [DriverMethod] + void IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.SdlcControl(SdlcControlBits control, ControlState state) + { + Get9100Session().GsKwSDLC.SdlcControl(control, state); + } + + [DriverMethod] + SdlcStatus IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.FetchStatus() + { + return Get9100Session().GsKwSDLC.FetchStatus(); + } + + [DriverMethod] + void IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.SendMessage(uint[] data) => + Get9100Session().GsKwSDLC.SendMessage(data); + + [DriverEvent] + event EventHandler IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.AutoForwardBufferCapacityWarning + { + add => Get9100Session().GsKwSDLC.AutoForwardBufferCapacityWarning += value; + remove => Get9100Session().GsKwSDLC.AutoForwardBufferCapacityWarning -= value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + SdlcFifoWrCount IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.FifoWrCount + { + get => Get9100Session().GsKwSDLC.FifoWrCount; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.Sync + { + get => Get9100Session().GsKwSDLC.Sync; + set => Get9100Session().GsKwSDLC.Sync = value; + } + + [DriverMethod] + byte[] IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.FetchMessageData() => + Get9100Session().GsKwSDLC.FetchMessageData(); + + [DriverMethod] + RxSdlcMessage IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.ReadMessage() => + Get9100Session().GsKwSDLC.ReadMessage(); + + [DriverMethod] + RxSdlcMessage[] IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.ReadAllMessages() => + Get9100Session().GsKwSDLC.ReadAllMessages(); + + [DriverEvent] + event EventHandler IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.AutoForwardProcessExited + { + add => Get9100Session().GsKwSDLC.AutoForwardProcessExited += value; + remove => Get9100Session().GsKwSDLC.AutoForwardProcessExited -= value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + RxSdlcAutoForwardBuffer IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.SdlcAutoForwardBuffer => + Get9100Session().GsKwSDLC.SdlcAutoForwardBuffer; + + #endregion + + #region IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA + + [DriverProperty(SuppressPollInstrumentErrors = true)] + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.PT + { + get + { + return this; + } + } + + [DriverProperty(SuppressPollInstrumentErrors = true)] + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.CS + { + get + { + return this; + } + } + + [DriverMethod] + Scoreboard IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchScoreboard() => + Get9100Session().EdaEmulator.ChannelA.FetchScoreboard(); + + [DriverMethod] + KwdlStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchKwdlStatus() => + Get9100Session().EdaEmulator.ChannelA.FetchKwdlStatus(); + + [DriverMethod] + CvcwData IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchCVCWData() => + Get9100Session().EdaEmulator.ChannelA.FetchCVCWData(); + + [DriverMethod] + byte[] IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchCVData() => + Get9100Session().EdaEmulator.ChannelA.FetchCVData(); + + [DriverMethod] + EdaStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchEdaStatus() => + Get9100Session().EdaEmulator.ChannelA.FetchEdaStatus(); + + [DriverMethod] + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.Configure(EdaConfig configuration) => + Get9100Session().EdaEmulator.ChannelA.Configure(configuration); + + [DriverMethod] + EdaConfig IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchConfiguration() => + Get9100Session().EdaEmulator.ChannelA.FetchConfiguration(); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaPbitValid + { + get => Get9100Session().EdaEmulator.ChannelA.EdaPbitValid; + set => Get9100Session().EdaEmulator.ChannelA.EdaPbitValid = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaPbitPass + { + get => Get9100Session().EdaEmulator.ChannelA.EdaPbitPass; + set => Get9100Session().EdaEmulator.ChannelA.EdaPbitPass = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVReadyValid + { + get => Get9100Session().EdaEmulator.ChannelA.EdaCVReadyValid; + set => Get9100Session().EdaEmulator.ChannelA.EdaCVReadyValid = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVReady + { + get => Get9100Session().EdaEmulator.ChannelA.EdaCVReady; + set => Get9100Session().EdaEmulator.ChannelA.EdaCVReady = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVClearPassFailValid + { + get => Get9100Session().EdaEmulator.ChannelA.EdaCVClearPassFailValid; + set => Get9100Session().EdaEmulator.ChannelA.EdaCVClearPassFailValid = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVClearPassFail + { + get => Get9100Session().EdaEmulator.ChannelA.EdaCVClearPassFail; + set => Get9100Session().EdaEmulator.ChannelA.EdaCVClearPassFail = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + short IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaNumCVClear + { + get => Get9100Session().EdaEmulator.ChannelA.EdaNumCVClear; + set => Get9100Session().EdaEmulator.ChannelA.EdaNumCVClear = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + short IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlRFTemp + { + get => Get9100Session().EdaEmulator.ChannelA.KwdlRFTemp; + set => Get9100Session().EdaEmulator.ChannelA.KwdlRFTemp = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlMbitPass + { + get => Get9100Session().EdaEmulator.ChannelA.KwdlMbitPass; + set => Get9100Session().EdaEmulator.ChannelA.KwdlMbitPass = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlMbitComplete + { + get => Get9100Session().EdaEmulator.ChannelA.KwdlMbitComplete; + set => Get9100Session().EdaEmulator.ChannelA.KwdlMbitComplete = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlPbitPass + { + get => Get9100Session().EdaEmulator.ChannelA.KwdlPbitPass; + set => Get9100Session().EdaEmulator.ChannelA.KwdlPbitPass = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + Raytheon.GuidedElectronicsUnit.KwdlState IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlState + { + get => Get9100Session().EdaEmulator.ChannelA.KwdlState; + set => Get9100Session().EdaEmulator.ChannelA.KwdlState = value; + } + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlLinkUp + { + get => Get9100Session().EdaEmulator.ChannelA.KwdlLinkUp; + set => Get9100Session().EdaEmulator.ChannelA.KwdlLinkUp = value; + } + + #endregion + + #region IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS + + [DriverMethod] + SdlcStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.FetchSdlcStatus() => + Get9100Session().EdaEmulator.ChannelA.CS.FetchSdlcStatus(); + + [DriverMethod] + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.SdlcControl(SdlcControlBits control, ControlState state) => + Get9100Session().EdaEmulator.ChannelA.CS.SdlcControl(control, state); + + [DriverMethod] + RxSdlcMessage[] IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.ReadAllMessages() => + Get9100Session().EdaEmulator.ChannelA.CS.ReadAllMessages(); + + [DriverMethod] + RxSdlcMessage IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.ReadMessage() => + Get9100Session().EdaEmulator.ChannelA.CS.ReadMessage(); + + [DriverMethod] + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.SendMessage(uint[] data) => + Get9100Session().EdaEmulator.ChannelA.CS.SendMessage(data); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + SdlcFifoWrCount IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.FifoWrCount + { + get => Get9100Session().EdaEmulator.ChannelA.CS.FifoWrCount; + } + + #endregion + + #region IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT + + [DriverMethod] + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.SdlcControl(SdlcControlBits control, ControlState state) => + Get9100Session().EdaEmulator.ChannelA.PT.SdlcControl(control, state); + + [DriverMethod] + SdlcStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.FetchSdlcStatus() => + Get9100Session().EdaEmulator.ChannelA.PT.FetchSdlcStatus(); + + [DriverMethod] + RxSdlcMessage[] IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.ReadAllMessages() => + Get9100Session().EdaEmulator.ChannelA.PT.ReadAllMessages(); + + [DriverMethod] + RxSdlcMessage IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.ReadMessage() => + Get9100Session().EdaEmulator.ChannelA.PT.ReadMessage(); + + [DriverMethod] + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.SendMessage(uint[] data) => + Get9100Session().EdaEmulator.ChannelA.PT.SendMessage(data); + + [DriverProperty] + [Simulation(SimulationMode.Manual)] + SdlcFifoWrCount IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.FifoWrCount + { + get => Get9100Session().EdaEmulator.ChannelA.CS.FifoWrCount; + } + + #endregion + + #region IGuidedElectronicsUnitTestControl + + [DriverMethod] + void IGuidedElectronicsUnitTestControl.WaitForMsg(ushort count) => + Get9100Session().Test.WaitForMsg(count); + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnit.design b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnit.design new file mode 100644 index 0000000..83d0ebe --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnit.design @@ -0,0 +1,2933 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnitDriver.csproj b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnitDriver.csproj new file mode 100644 index 0000000..5c4becd --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/GuidedElectronicsUnitDriver.csproj @@ -0,0 +1,70 @@ + + + SAK + SAK + SAK + SAK + x86 + + + 5.1.5 + 5.1.0 + IviNetDriverProject + GuidedElectronicsUnit + 1.2.5.0 + Raytheon + IVI.NET Driver for GuidedElectronicsUnit + Copyright 2021, Raytheon + None + Raytheon.GuidedElectronicsUnit + net46 + true + 1.2.5.0 + 1.2.5.0 + + + 1.2.5.0 + Copyright 2021, Raytheon + + + 1.2.5.0 + + + + + + + + + + + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Teradyne\Shared\Assemblies\Logging\FunctionCallsLoggingAdapter.Common.dll + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Teradyne\Shared\Assemblies\Logging\FunctionCallsLoggingAdapter.Producer.dll + + + ..\..\..\..\..\..\..\..\..\..\Program Files (x86)\IVI Foundation\IVI\Microsoft.NET\Framework32\v2.0.50727\IviFoundationSharedComponents 1.4.1\Ivi.Driver.dll + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Teradyne\Shared\Assemblies\Logging\MessagingLoggingAdapter.Common.dll + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Teradyne\Shared\Assemblies\Logging\MessagingLoggingAdapter.Producer.dll + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\IVI Foundation\IVI\Drivers\terHsi\References\Teradyne.Instruments.HighSpeed.SubsystemDriver.dll + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Teradyne\Shared\Assemblies\Logging\Teradyne.Instruments.Logging.Client.Common.dll + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Teradyne\Shared\Assemblies\Logging\Teradyne.Instruments.Logging.Client.Producer.dll + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession.cs new file mode 100644 index 0000000..2b49215 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession.cs @@ -0,0 +1,685 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using Teradyne.Instruments.HighSpeed.SubsystemDriver; +using Teradyne.Instruments.Logging.Client; + +namespace Raytheon.GuidedElectronicsUnit +{ + public abstract class HardwareSession + { + protected readonly object componentLock = new(); + + protected const int auroraBusClkLockedBitIndex = 18; + protected const int localBusPllLockedBitIndex = 17; + protected const int pxiePllLockedBitIndex = 16; + protected const int pxiePllEnableBitIndex = 0; + + internal terHsi TerHsiSession { get; set; } + + internal bool IsSimulated { get; set; } + + internal void InitSession() + { + CallLoggingHelper.FunctionStart(GetType(), "InitSession"); + + try + { + uint registerValue = 0; + bool needToReset = false; + + // Check that the FPGA is the right type. + try + { + registerValue = ReadRegister16(RegisterConstant, RegisterHalf.Upper); + } + catch + { + // Assume that if there's any error, we'll need to reset the instrument. + needToReset = true; + } + if ((registerValue == 0) || (registerValue == 0xFACE)) + { + // If the value of the register is one of these values (depending + // on whether it's a core instrument or IOXI), then that means + // we've got an unloaded TDF. We'll need a reset to get the FW + // loaded. + needToReset = true; + } + else if (registerValue != ApplicationConstant) + { + throw new InvalidOperationException("Invalid Target device."); + } + else + { + var customerAppId = ReadRegister(RegisterApplicationCustomerId); + + var revisionId = ReadRegister(RegisterRevisionId); + + needToReset = ( + ((customerAppId & 0xFFFF) != ExpectedCustomerId) || + (((customerAppId >> 16) & 0xFFFF) != ExpectedApplicationId) || + (revisionId != ExpectedRevisionId)); + } + + if (needToReset) + { + LoadFirmware(); + GetInitialDefaults(); + SetDefaults(); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "InitSession", null); + } + } + + #region Protected Properties + + protected string SerialNumber => TerHsiSession.AssemblySerial; + protected int Slot => TerHsiSession.InstrumentInfo.SlotNumber; + protected int Chassis => TerHsiSession.InstrumentInfo.ChassisNumber; + protected string Descriptor => TerHsiSession.ResourceDescriptor; + protected ushort ApplicationConstant { get; set; } + protected string ApplicationPrefix { get; set; } + protected uint ExpectedApplicationId { get; set; } + protected uint ExpectedCustomerId { get; set; } + protected uint ExpectedRevisionId { get; set; } + protected uint RegisterConstant { get; set; } + protected uint RegisterApplicationCustomerId { get; set; } + protected uint RegisterRevisionId { get; set; } + protected uint RegisterPllStatus { get; set; } + protected uint RegisterVccIntDieTemp { get; set; } + protected uint RegisterVccAux { get; set; } + protected bool WordSwap { get; set; } + protected string ChipId { get; set; } + protected int AdcBitCount { get; set; } + protected double DieTemp + { + get + { + CallLoggingHelper.FunctionStart(GetType(), "DieTemp"); + + double temp = 0; + uint regData = 0; + var mask = 0x03FF0000; + + try + { + + if (TerHsiSession.IsFioxi) + { + mask = 0x0FFF0000; + } + + lock (componentLock) + { + regData = ReadRegister(RegisterVccIntDieTemp); + } + + var data = (regData & mask) >> 16; + temp = (data * 503.975 / Math.Pow(2, AdcBitCount)) - 269.15; + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "DieTemp", temp); + } + return temp; // accounting for +-4 degrees accuracy. + } + } + protected double VccInt + { + get + { + CallLoggingHelper.FunctionStart(GetType(), "VccInt"); + + var mask = 0x03FF; + double vccInt = 0; + + try + { + if (TerHsiSession.IsFioxi) + { + mask = 0x0FFF; + } + + var regData = ReadRegister(RegisterVccIntDieTemp); + var data = regData & mask; + vccInt = data / Math.Pow(2, AdcBitCount) * 3; + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "VccInt", vccInt); + } + return vccInt; + } + } + protected double VccAux + { + get + { + CallLoggingHelper.FunctionStart(GetType(), "VccAux"); + + var mask = 0x03FF0000; + double vccAux = 0; + + try + { + if (TerHsiSession.IsFioxi) + { + mask = 0x0FFF0000; + } + + var regData = ReadRegister(RegisterVccAux); + var data = (regData & mask) >> 16; + vccAux = data * 3 / Math.Pow(2, AdcBitCount); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "VccAus", vccAux); + } + return vccAux; + } + } + + protected const int gsTxFifoSize = 4096; + + protected const int imuTxFifoSize = 4096; + + protected const int edaAcsTxFifoSize = 4096; + + protected const int edaAptTxFifoSize = 4096; + + protected enum SdlcInterface + { + GSKW = 0, + IMU = 1, + EDACS = 2, + EDAPT = 3 + } + + protected uint TerScratch0 { get; set; } + protected uint TerScratch1 { get; set; } + protected uint TerScratch2 { get; set; } + protected uint TerSoftRstVal { get; set; } + protected uint CLversion { get; set; } + protected uint Scratch { get; set; } + protected uint SoftRstVal { get; set; } + protected uint IIemVersion { get; set; } + + #endregion + + #region Protected Methods + + protected virtual void Reset() + { + SetDefaults(); + } + + protected virtual void GetInitialDefaults() + { + } + + protected virtual void SetDefaults() + { + } + + protected void LoadFirmware() + { + CallLoggingHelper.FunctionStart(GetType(), "LoadFirmware"); + + try + { + string firmwareDirectory = string.Empty; + string firmwareFile = + $"{ChipId}_C{ExpectedCustomerId:X4}_A{ExpectedApplicationId:X4}_R{ExpectedRevisionId:X8}.tdf"; + + string firmwarePath = Path.Combine(@"SOFTWARE\Raytheon\SM3", ApplicationPrefix, "IVI.NET"); + object pathValue = string.Empty; + RegistryKey hklm = null; + try + { + hklm = Registry.LocalMachine; + RegistryKey subKey = hklm.OpenSubKey(firmwarePath); + pathValue = subKey.GetValue("DriverPath"); + } + catch (NullReferenceException e) + { + throw new NullReferenceException( + string.Format("{0} Registry Key {1}\\{2} missing.", e.Message, hklm.ToString(), firmwarePath)); + } + + if (pathValue != null) + { + firmwareDirectory = Path.Combine(pathValue.ToString(), "Firmware"); + } + + firmwarePath = Path.Combine(firmwareDirectory, firmwareFile); + try + { + TerHsiSession.Firmware_Load(firmwarePath); + } + catch (terHsiException e) + { + throw new Exception( + string.Format("Error: 0x{0:X8} - {1} Error trying to load TDF file {2}.", e.Status, e.Message, firmwarePath)); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "LoadFirmware", null); + } + } + + protected FirmwareInformation GetFirmwareInfo() + { + CallLoggingHelper.FunctionStart(GetType(), "GetPllStatus"); + + var fwInfo = new FirmwareInformation(); + + try + { + var registerValue = ReadRegister(RegisterApplicationCustomerId); + fwInfo.CustomerId = (ushort)registerValue; + fwInfo.ApplicationId = (ushort)(registerValue >> 16); + fwInfo.RevisionId = ReadRegister(RegisterRevisionId); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "GetPllStatus", fwInfo); + } + return fwInfo; + } + + protected TdfPllStatus GetPllStatus() + { + CallLoggingHelper.FunctionStart(GetType(), "GetPllStatus"); + + var pllStatus = new TdfPllStatus(); + + try + { + var registerValue = ReadRegister(RegisterPllStatus); + + pllStatus.AuroraBusClkLocked = (PllState)GetBitValue(registerValue, auroraBusClkLockedBitIndex); + pllStatus.LocalBusPllLocked = (PllState)GetBitValue(registerValue, localBusPllLockedBitIndex); + pllStatus.PxiePllEnable = (ControlState)GetBitValue(registerValue, pxiePllEnableBitIndex); + pllStatus.PxiePllLocked = (PllState)GetBitValue(registerValue, pxiePllLockedBitIndex); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "GetPllStatus", pllStatus); + } + + return pllStatus; + } + + internal bool IsBitSet(uint val, int bitIdx) + { + int mask = 0x1 << bitIdx; + + if ((val & mask) == 0) + return false; + + return true; + } + + internal int GetBitValue(uint val, int bitIdx) + { + int mask = 0x1 << bitIdx; + + if ((val & mask) == 0) + return 0; + + return 1; + } + + internal SignalState GetSignalState(uint val, int bitIdx) + { + SignalState state = Raytheon.GuidedElectronicsUnit.SignalState.Low; + int mask = 0x1 << bitIdx; + + if ((val & mask) != 0) + state = Raytheon.GuidedElectronicsUnit.SignalState.High; + + return state; + } + + #region SDLC Methods + + protected void SendMessage(SdlcInterface sdlc, uint[] data) + { + CallLoggingHelper.FunctionStart(GetType(), "SendMessage", + nameof(sdlc), sdlc, + nameof(data), data); + + uint countRegister = 0; + uint controlRegister = 0; + uint txInfoRegister = 0; + int txFifoSize = 0; + + try + { + switch (sdlc) + { + case SdlcInterface.GSKW: + countRegister = RegisterMapHSSub9100.GS_KW__FIFO_WR_CNT; + controlRegister = RegisterMapHSSub9100.GS_KW__CONTROL; + txInfoRegister = RegisterMapHSSub9100.GS_KW__TX_INFO; + txFifoSize = gsTxFifoSize; + break; + case SdlcInterface.IMU: + countRegister = RegisterMapHSSub9100.IMU__FIFO_WR_CNT; + controlRegister = RegisterMapHSSub9100.IMU__CONTROL; + txInfoRegister = RegisterMapHSSub9100.IMU__TX_INFO; + txFifoSize = imuTxFifoSize; + break; + case SdlcInterface.EDACS: + countRegister = RegisterMapHSSub9100.EDA_ACS__FIFO_WR_CNT; + controlRegister = RegisterMapHSSub9100.EDA_ACS__CONTROL; + txInfoRegister = RegisterMapHSSub9100.EDA_ACS__TX_INFO; + txFifoSize = edaAcsTxFifoSize; + break; + case SdlcInterface.EDAPT: + countRegister = RegisterMapHSSub9100.EDA_APT__FIFO_WR_CNT; + controlRegister = RegisterMapHSSub9100.EDA_APT__CONTROL; + txInfoRegister = RegisterMapHSSub9100.EDA_APT__TX_INFO; + txFifoSize = edaAptTxFifoSize; + break; + } + + var frequency = Stopwatch.Frequency; + var stopwatch = Stopwatch.StartNew(); + //1) Read *__FIFO_WR_CNT register and verify TX FIFO can hold entire message + var wrCnt = ReadRegister(countRegister) & 0x0000FFFF; + if (data.Length > (txFifoSize - wrCnt)) + throw new InvalidOperationException("TX Message size too large for TxFIFO"); + + // Disable TX engine until all data has been loaded + if (data.Length > 1) + ReadModifyWrite(controlRegister, 0x1, 0x1); + + //2) Write entire message to the *__TX_INFO register + foreach (uint word in data) + WriteRegister(txInfoRegister, word); + + //3) Insert message End Frame(optional but recommended) + // a.Set bit 2 of *__CONTROL_TX_END_SDLC_FRAME register + ReadModifyWrite(controlRegister, 0x4, 0x4); + // b.Write one data word to *__TX_INFO register(data does not matter) + WriteRegister(txInfoRegister, 0x0); + // c.Clear bit 2 of *__CONTROL_TX_END_SDLC_FRAME register, Clear TX Inhibit (0) + ReadModifyWrite(controlRegister, 0x0, 0x5); + double delta = (double)stopwatch.ElapsedTicks / (double)frequency; + // TODO Log(string.Format("Time to Load/Start message: {0:f}mS", delta * 1000)); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "SendMessage", null); + } + } + + protected RxSdlcMessage[] ReadAllMessages(SdlcInterface sdlc) + { + CallLoggingHelper.FunctionStart(GetType(), "ReadAllMessages", + nameof(sdlc), sdlc); + + Queue messages = new Queue(); + + try + { + bool messageFound; + do + { + var message = ReadMessage(sdlc); + messageFound = (message.MessageData != null) ? true : false; + + if (messageFound) + { + messages.Enqueue(message); + } + + } while (messageFound); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "ReadAllMessages", null); + } + return messages.ToArray(); + } + + protected RxSdlcMessage ReadMessage(SdlcInterface sdlc) + { + CallLoggingHelper.FunctionStart(GetType(), "ReadMessage", + nameof(sdlc), sdlc); + + uint rxMsgCntRegister = 0; + uint statusRegister = 0; + uint rxDataRegister = 0; + uint rxMessageCount = 0; + + RxSdlcMessage sdlcMessage = new RxSdlcMessage(); + + try + { + switch (sdlc) + { + case SdlcInterface.GSKW: + rxMsgCntRegister = RegisterMapHSSub9100.GS_KW__MSG_CNT; + statusRegister = RegisterMapHSSub9100.GS_KW__STATUS; + rxDataRegister = RegisterMapHSSub9100.GS_KW__RX_DATA; + break; + case SdlcInterface.IMU: + rxMsgCntRegister = RegisterMapHSSub9100.IMU__MSG_CNT; + statusRegister = RegisterMapHSSub9100.IMU__STATUS; + rxDataRegister = RegisterMapHSSub9100.IMU__RX_DATA; + break; + case SdlcInterface.EDACS: + rxMsgCntRegister = RegisterMapHSSub9100.EDA_ACS__MSG_CNT; + statusRegister = RegisterMapHSSub9100.EDA_ACS__STATUS; + rxDataRegister = RegisterMapHSSub9100.EDA_ACS__RX_DATA; + break; + case SdlcInterface.EDAPT: + rxMsgCntRegister = RegisterMapHSSub9100.EDA_APT__MSG_CNT; + statusRegister = RegisterMapHSSub9100.EDA_APT__STATUS; + rxDataRegister = RegisterMapHSSub9100.EDA_APT__RX_DATA; + break; + } + + rxMessageCount = ReadRegister(rxMsgCntRegister); + + if (rxMessageCount != 0) + { + var message = new List(); + uint status; + // Read the message + do + { + // Read *__STATUS register. + status = ReadRegister(statusRegister); + + // Read and store the *__RX_DATA register + var data = ReadRegister(rxDataRegister); + var sdlcData = new RxSdlcData + { + Data = data, + Status = status + }; + + message.Add(sdlcData); + // Repeat until status register bit 9 indicates the end of the message. + } while (!IsBitSet(status, 9)); + + sdlcMessage.MessageData = message.ToArray(); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "ReadMessage", null); + } + return sdlcMessage; + } + + protected void WaitForMsg(SdlcInterface sdlc, ushort count, double timeout) + { + CallLoggingHelper.FunctionStart(GetType(), "WaitForMsg", + nameof(sdlc), sdlc, + nameof(count), count, + nameof(timeout), timeout); + + uint rxMsgCntRegister = 0; + + try + { + + switch (sdlc) + { + case SdlcInterface.IMU: + rxMsgCntRegister = RegisterMapHSSub9100.IMU__MSG_CNT; + break; + case SdlcInterface.EDACS: + rxMsgCntRegister = RegisterMapHSSub9100.EDA_ACS__MSG_CNT; + break; + case SdlcInterface.EDAPT: + rxMsgCntRegister = RegisterMapHSSub9100.EDA_APT__MSG_CNT; + break; + } + rxMsgCntRegister += 2; + + lock (componentLock) + { + TerHsiSession.LB_BusyBitWait16(rxMsgCntRegister, count, count, timeout); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "WaitForMsg", null); + } + } + + + #endregion + + #endregion + + #region Protected Register Access + + protected uint ReadRegister(uint registerAddress) + { + uint registerValue = 0; + + lock (componentLock) + { + registerValue = TerHsiSession.LB_Read32(registerAddress); + } + + return registerValue; + } + + protected void WriteRegister(uint registerAddress, uint data) + { + lock (componentLock) + { + TerHsiSession.LB_Write32(registerAddress, data); + } + } + + protected void ReadModifyWrite(uint registerAddress, uint data, uint mask) + { + CallLoggingHelper.FunctionStart(GetType(), "ReadModifyWrite", + nameof(registerAddress), registerAddress, + nameof(data), data, + nameof(mask), mask); + + try + { + lock (componentLock) + { + var oldVal = ReadRegister(registerAddress); + + // = (data & mask) | ( & !mask) + var newVal = (data & mask) | (oldVal & ~mask); + + CallLoggingHelper.Message(string.Format("{0}.{1}", GetType(), "ReadModifyWrite")); + CallLoggingHelper.Message(string.Format("New Value to write: 0x{0:X}", newVal)); + + WriteRegister(registerAddress, newVal); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "ReadModifyWrite", null); + } + } + + internal enum RegisterHalf + { + Upper = 1, + Lower = 0 + } + + internal ushort ReadRegister16(uint registerAddress, RegisterHalf location) + { + CallLoggingHelper.FunctionStart(GetType(), "ReadModifyWrite", + nameof(registerAddress), registerAddress, + nameof(location), location); + + ushort registerValue = 0; + + try + { + if (location == RegisterHalf.Lower) + { + registerAddress += 2; + } + + CallLoggingHelper.Message(string.Format("{0}.{1}", GetType(), "ReadRegister16")); + CallLoggingHelper.Message(string.Format("Actual Register Offset: 0x{0:X}", registerAddress)); + + lock (componentLock) + { + registerValue = TerHsiSession.LB_Read16(registerAddress); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "ReadRegister16", registerValue); + } + + return registerValue; + } + + internal void BusyBitWait16(uint registerAddress, RegisterHalf location, ushort data, ushort mask, double timeout) + { + CallLoggingHelper.FunctionStart(GetType(), "ReadModifyWrite", + nameof(registerAddress), registerAddress, + nameof(location), location); + + try + { + if (location == RegisterHalf.Lower) + { + registerAddress += 2; + } + + CallLoggingHelper.Message(string.Format("{0}.{1}", GetType(), "BusyBitWait16")); + CallLoggingHelper.Message(string.Format("Actual Register Offset: 0x{0:X}", registerAddress)); + + lock (componentLock) + { + TerHsiSession.LB_BusyBitWait16(registerAddress, data, mask, timeout); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "ReadRegister16", null); + } + + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession6020a.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession6020a.cs new file mode 100644 index 0000000..cbd0365 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession6020a.cs @@ -0,0 +1,162 @@ +using System; +using System.Threading; + +namespace Raytheon.GuidedElectronicsUnit +{ + internal class HardwareSession6020a : HardwareSession + , IGuidedElectronicsUnitLowLevelHSSub6020a + , IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator + { + public HardwareSession6020a() + { + ApplicationConstant = 0x4C01; + ApplicationPrefix = "GEU"; + ChipId = "L1"; + AdcBitCount = 10; + + WordSwap = false; + + ExpectedApplicationId = RegisterMapHSSub6020a.ExpectedAppID; + ExpectedCustomerId = RegisterMapHSSub6020a.ExpectedCustID; + ExpectedRevisionId = RegisterMapHSSub6020a.ExpectedRevID; + + RegisterConstant = RegisterMapHSSub6020a.TER_LB__FPGA_CONST; + RegisterApplicationCustomerId = RegisterMapHSSub6020a.TER_LB__APP_CUST_ID; + RegisterRevisionId = RegisterMapHSSub6020a.TER_LB__REV_ID; + RegisterPllStatus = RegisterMapHSSub6020a.TER_LB__PLL; + RegisterVccIntDieTemp = RegisterMapHSSub6020a.TER_LB__VCCINT_DT; + RegisterVccAux = RegisterMapHSSub6020a.TER_LB__VCCAUX; + } + + public IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator IdaEmulator => this; + public IGuidedElectronicsUnitLowLevelHSSub6020a LowLevel => this; + + #region Protected Methods + + protected override void GetInitialDefaults() + { + base.GetInitialDefaults(); + } + + protected override void SetDefaults() + { + base.SetDefaults(); + + IdaEmulator.Control = ControlState.Disabled; + } + + #endregion + + #region IdaEmulator + + ControlState IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator.Control + { + get + { + return IsBitSet(ReadRegister(RegisterMapHSSub6020a.EM_CONTROL), 0) ? ControlState.Enabled : ControlState.Disabled; + } + set + { + ReadModifyWrite(RegisterMapHSSub6020a.EM_CONTROL, Convert.ToUInt32(value), 0x1); + } + } + + IdaStatus IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator.Status + { + get + { + return new(ReadRegister(RegisterMapHSSub6020a.EM_STATUS)); + } + } + + uint IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator.Version + { + get + { + return ReadRegister(RegisterMapHSSub6020a.II_EM_VERSION); + } + } + + #endregion + + #region LowLevel + + bool IGuidedElectronicsUnitLowLevelHSSub6020a.IsSimulated => IsSimulated; + + int IGuidedElectronicsUnitLowLevelHSSub6020a.Chassis => Chassis; + + string IGuidedElectronicsUnitLowLevelHSSub6020a.Descriptor => Descriptor; + + string IGuidedElectronicsUnitLowLevelHSSub6020a.SerialNumber => SerialNumber; + + int IGuidedElectronicsUnitLowLevelHSSub6020a.Slot => Slot; + + void IGuidedElectronicsUnitLowLevelHSSub6020a.Reset() => Reset(); + + FirmwareInformation IGuidedElectronicsUnitLowLevelHSSub6020a.GetFirmwareInfo() => GetFirmwareInfo(); + + TdfPllStatus IGuidedElectronicsUnitLowLevelHSSub6020a.GetPllStatus() => GetPllStatus(); + + uint IGuidedElectronicsUnitLowLevelHSSub6020a.ReadRegister(uint address) => + ReadRegister(address); + + void IGuidedElectronicsUnitLowLevelHSSub6020a.ReadModifyWrite(uint address, uint data, uint mask) => + ReadModifyWrite(address, data, mask); + + void IGuidedElectronicsUnitLowLevelHSSub6020a.WriteRegister(uint address, uint data) => + WriteRegister(address, data); + + double IGuidedElectronicsUnitLowLevelHSSub6020a.DieTemp => DieTemp; + + double IGuidedElectronicsUnitLowLevelHSSub6020a.VccInt => VccInt; + + double IGuidedElectronicsUnitLowLevelHSSub6020a.VccAux => VccAux; + + + ControlState IGuidedElectronicsUnitLowLevelHSSub6020a.EnableIO + { + get + { + CallLoggingHelper.FunctionStart(GetType(), "getEnableIO"); + + ControlState state = ControlState.Disabled; + try + { + state = IsBitSet(ReadRegister(RegisterMapHSSub6020a.FP_IO_CTRL), 0) ? ControlState.Enabled : ControlState.Disabled; + return state; + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "getEnableIO", state); + } + } + set + { + CallLoggingHelper.FunctionStart(GetType(), "setEnableIO", value); + + try + { + WriteRegister(RegisterMapHSSub6020a.FP_IO_CTRL, (uint)(Convert.ToBoolean(value) ? 0 : 1)); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "setEnableIO", null); + } + } + } + + EmStatus IGuidedElectronicsUnitLowLevelHSSub6020a.EmStatus + { + get => new(ReadRegister(RegisterMapHSSub6020a.EM_STATUS)); + } + + void IGuidedElectronicsUnitLowLevelHSSub6020a.ResetEmStatus() + { + WriteRegister(RegisterMapHSSub6020a.EM_STATUS, 0x0); + Thread.Sleep(1000); + } + + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession9100.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession9100.cs new file mode 100644 index 0000000..22a40cb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSession9100.cs @@ -0,0 +1,1025 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading; +using System.Diagnostics; +using Ivi.Driver; +using Teradyne.Instruments.HighSpeed.SubsystemDriver; + +namespace Raytheon.GuidedElectronicsUnit +{ + internal class HardwareSession9100 : HardwareSession + , IGuidedElectronicsUnitLowLevelHSSub9100 + , IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator + , IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA + , IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS + , IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT + , IGuidedElectronicsUnitGsKwSyncronousDataLinkControl + , IGuidedElectronicsUnitDiscrete + , IGuidedElectronicsUnitInertialMeasurementUnitEmulator + , IGuidedElectronicsUnitTestControl + { + public HardwareSession9100() + { + ApplicationConstant = 0x4701; + ApplicationPrefix = "GEU"; + ChipId = "G1"; + AdcBitCount = 12; + + WordSwap = false; + + ExpectedApplicationId = RegisterMapHSSub9100.ExpectedAppID; + ExpectedCustomerId = RegisterMapHSSub9100.ExpectedCustID; + ExpectedRevisionId = RegisterMapHSSub9100.ExpectedRevID; + + RegisterConstant = RegisterMapHSSub9100.TER_LB__FPGA_CONST; + RegisterApplicationCustomerId = RegisterMapHSSub9100.TER_LB__APP_CUST_ID; + RegisterRevisionId = RegisterMapHSSub9100.TER_LB__REV_ID; + RegisterPllStatus = RegisterMapHSSub9100.TER_LB__PLL; + RegisterVccIntDieTemp = RegisterMapHSSub9100.TER_LB__VCCINT_DT; + RegisterVccAux = RegisterMapHSSub9100.TER_LB__VCCAUX; + + sdlcMessages = new Queue(); + } + + public IGuidedElectronicsUnitLowLevelHSSub9100 LowLevel => this as IGuidedElectronicsUnitLowLevelHSSub9100; + public IGuidedElectronicsUnitGsKwSyncronousDataLinkControl GsKwSDLC => this as IGuidedElectronicsUnitGsKwSyncronousDataLinkControl; + public IGuidedElectronicsUnitDiscrete Discrete => this as IGuidedElectronicsUnitDiscrete; + public IGuidedElectronicsUnitInertialMeasurementUnitEmulator ImuEmulator => this as IGuidedElectronicsUnitInertialMeasurementUnitEmulator; + public IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator EdaEmulator => this as IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator; + public IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA ChannelA => this as IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA; + public IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS CS => this as IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS; + public IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT PT => this as IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT; + public IGuidedElectronicsUnitTestControl Test => this; + + #region I/O Map + + // PIM0_DP0 | A01, A02 | KW_TO_GS_MC_SDLC_CLK_H/_L | IN + // PIM0_DP1 | B01, B02 | KW_TO_GS_MC_SDLC_DATA_H/_L | IN + // PIM0_DP2 | A04, A05 | GS_MC_TO_KW_SDLC_CLK_H/_L | OUT + // PIM0_DP3 | B04, B05 | GS_MC_TO_KW_SDLC_DATA_H/_L | OUT + // PIM0_DP4 | A07, A08 | GS_MC_TO_KW_CLK_SYNC_H/_L | OUT + // PIM0_DP5 | B07, B08 | (NC) SDLC_ACQ_RX_NC_TX_CLK_H/_L | IN + // PIM0_DP6 | A10, A11 | (NC) SDLC_ACQ_RX_NC_TX_DATA_H/_L | IN + // PIM0_DP7 | B10, B11 | (NC) SDLC_NC_RX_ACQ_TX_CLK_H/_L | IN + // PIM0_DP8 | A13, A14 | (NC) SDLC_NC_RX_ACQ_TX_DATA_H/_L | IN + // PIM0_DP9 | B13, B14 | KW_TEST_MODE_H/_L | OUT + // PIM0_DP10 | A16, A17 | (NC) NC_ACQ_MF_SYNC_H/_L | IN + // PIM0_DP11 | B16, B17 | (NC) NC_ACQ_SF_SYNC_H/_L | IN + // PIM0_DP12 | A19, A20 | NC_DACS_KW_ORD_EN_H/_L | IN + // PIM0_DP13 | B19, B20 | (NC) | IN + // PIM0_DP14 | A22, A23 | (NC) | IN + // PIM0_DP15 | B22, B23 | (NC) | IN + // PIM0_DP16 | D01, D02 | EDA_NC_CLK_H/_L | OUT + // PIM0_DP17 | C01, C02 | EDA_NC_PT_H/_L | OUT + // PIM0_DP18 | D04, D05 | EDA_NC_STAT_H/_L | OUT + // PIM0_DP19 | C04, C05 | NC_EDA_CLK_H/_L | IN + // PIM0_DP20 | D07, D08 | NC_EDA_CNT_H/_L | IN + // PIM0_DP21 | C07, C08 | NC_EDA_PT_H/_L | IN + // PIM0_DP22 | D10, D11 | (NC) | IN + // PIM0_DP23 | C10, C11 | (NC) | IN + // PIM0_DP24 | D13, D14 | (NC) | IN + // PIM0_DP25 | C13, C14 | (NC) | IN + // PIM0_DP26 | D16, D17 | (NC) | IN + // PIM0_DP27 | C16, C17 | (NC) | IN + // PIM0_DP28 | D19, D20 | (NC) | IN + // PIM0_DP29 | C19, C20 | (NC) | IN + // PIM0_DP30 | D22, D23 | (NC) NC_IOC_SPARE_1_H/_L | IN + // PIM0_DP31 | C22, C23 | (NC) NC_IOC_SPARE_3_H/_L | IN + //---PIM1------ -------------------------------------------------------------- + // PIM1_DP0 | A01, A02 | IMU_SER_DATA_H/_L | OUT + // PIM1_DP1 | B01, B02 | IMU_SER_DATA_CLK_H/_L | OUT + // PIM1_DP2 | A04, A05 | IMU_END_DATA_SAMP_H/_L | OUT + // PIM1_DP3 | B04, B05 | IMU_EXT_SYNC_H/_L | IN + // PIM1_DP4 | A07, A08 | IMU_INHIBIT_INTERNAL_POR_H/_L | IN + // PIM1_DP5 | B07, B08 | IMU_NOT_INHIBIT_BIT_FAIL_H/_L | IN + // PIM1_DP6 | A10, A11 | IMU_FAST_RESTART_H/_L | IN + // PIM1_DP7 | B10, B11 | IMU_NOT_EXE_COMMAND_BIT_H/_L | IN + // PIM1_DP8 | A13, A14 | IMU_SIM_PWR_ON_RESET_H/_L | IN + // PIM1_DP9 | B13, B14 | IMU_SIM_SER_DATA_H/_L | OUT + // PIM1_DP10 | A16, A17 | IMU_SIM_SER_DATA_CLK_H/_L | OUT + // PIM1_DP11 | B16, B17 | IMU_SIM_END_DATA_SAMP_H/_L | OUT + // PIM1_DP12 | A19, A20 | IMU_SIM_EXT_SYNC_H/_L | IN + // PIM1_DP13 | B19, B20 | IMU_SIM_NOT_INHIBIT_BIT_H/_L | IN + // PIM1_DP14 | A22, A23 | IMU_SIM_FAST_RESTART_H/_L | IN + // PIM1_DP15 | B22, B23 | IMU_SIM_NOT_COMMAND_BIT_H/_L | IN + // PIM1_DP16 | D01, D02 | IMU_PWR_ON_RESET_H/_L | IN + // PIM1_DP17 | C01, C02 | (NC) | IN + // PIM1_DP18 | D04, D05 | (NC) | IN + // PIM1_DP19 | C04, C05 | (NC) | IN + // PIM1_DP20 | D07, D08 | (NC) | IN + // PIM1_DP21 | C07, C08 | (NC) | IN + // PIM1_DP22 | D10, D11 | (NC) | IN + // PIM1_DP23 | C10, C11 | (NC) | IN + // PIM1_DP24 | D13, D14 | (NC) | IN + // PIM1_DP25 | C13, C14 | (NC) | IN + // PIM1_DP26 | D16, D17 | (NC) | IN + // PIM1_DP27 | C16, C17 | (NC) | IN + // PIM1_DP28 | D19, D20 | (NC) | IN + // PIM1_DP29 | C19, C20 | (NC) | IN + // PIM1_DP30 | D22, D23 | (NC) | IN + // PIM1_DP31 | C22, C23 | (NC) | IN + + #endregion + + #region Protected Properties + + protected readonly object messageLock = new(); + protected readonly object responseDataLock = new(); + private int pam0; + private int pam1; + private ulong pamAddr0; + private ulong pamAddr1; + private int pamBufferSize = 1048576; + private Queue sdlcMessages; + private Queue gsMcKwSdlcData = new(); + private RxSdlcAutoForwardBuffer autoForwardMessageBuffer = new(); + private uint AutoForwardDestination { get; set; } + + + #region Bit Posistions + + private const int NcDacsKwOrdEnBit = 0; + + #endregion + + #endregion + + #region Protected Methods + + protected override void GetInitialDefaults() + { + base.GetInitialDefaults(); + } + + protected override void SetDefaults() + { + base.SetDefaults(); + } + + #endregion + + #region Background Thread + + internal int pollingInterval; + + internal BackgroundWorker messageChecker; + + internal void SetupBackgroundWorker(int bufferSize, int interval) + { + messageChecker = new() + { + WorkerSupportsCancellation = true, + }; + pollingInterval = interval; + autoForwardMessageBuffer.InitialCapacity = bufferSize; + pamBufferSize = bufferSize / 2; + messageChecker.DoWork += new DoWorkEventHandler(CheckForMessages); + + // Allocate PCIe memory and inform FW of the address + pam0 = TerHsiSession.PAM_Alloc("SDLC Buffer 0", pamBufferSize); + pam1 = TerHsiSession.PAM_Alloc("SDLC Buffer 1", pamBufferSize); + pamAddr0 = (ulong)TerHsiSession.PAM_FetchBufferInfo(pam0)[0]; + pamAddr1 = (ulong)TerHsiSession.PAM_FetchBufferInfo(pam1)[0]; + //Console.WriteLine("Pam0 Address (GS_KW__SYS_ADDR_H0): {0:X8}", pamAddr0); + //Console.WriteLine("Pam1 Address (GS_KW__SYS_ADDR_H1): {0:X8}", pamAddr1); + + byte[] fillData = new byte[pamBufferSize]; + for (int i = 0; i < pamBufferSize; i++) + { + fillData[i] = 0xB0; + } + TerHsiSession.PAM_Write(pam0, 0, fillData); + for (int i = 0; i < pamBufferSize; i++) + { + fillData[i] = 0xB1; + } + TerHsiSession.PAM_Write(pam1, 0, fillData); + + // Update FW with PAM addresses + TerHsiSession.LB_Write64(RegisterMapHSSub9100.GS_KW__SYS_ADDR_H0, pamAddr0); + TerHsiSession.LB_Write64(RegisterMapHSSub9100.GS_KW__SYS_ADDR_H1, pamAddr1); + + // Tell FW to start with PAM buffer0. + TerHsiSession.LB_Write32(RegisterMapHSSub9100.GS_KW__SYS_ADDR_SEL, 0); + CurrentPam = pam0; + + // Set the auto-forward destination to TAurora + SetAutoForwardDestination(RegisterMapHSSub9100.DefaultGsKwFwdDestAddr); + //WriteRegister(RegisterMapHSSub9100.GS_KW__FWD_DEST_ADDR, RegisterMapHSSub9100.DefaultGsKwFwdDestAddr); + + // Enable auto forwarding + AutoForwardEnabled = (int)(AutoForwardControl.EnableOn | AutoForwardControl.TlpHeaderEnable | AutoForwardControl.SizeEnable); + + // Start the background worker thread + messageChecker.RunWorkerAsync(); + } + + private void SetAutoForwardDestination(uint destination) + { + AutoForwardDestination = destination; + + // Switch Pam Buffer twice to clear counters. + SwitchPamBuffer(); + SwitchPamBuffer(); + + WriteRegister(RegisterMapHSSub9100.GS_KW__FWD_DEST_ADDR, AutoForwardDestination); + } + + private enum AutoForwardControl + { + EnableOn = 0x1, + TlpHeaderEnable = 0x2, + SizeEnable = 0x4 + } + + private int AutoForwardEnabled + { + get => (int)ReadRegister(RegisterMapHSSub9100.GS_KW__FWD_EN); + set => ReadModifyWrite(RegisterMapHSSub9100.GS_KW__FWD_EN, (uint)value, 0x7); + } + + private int CurrentPam { get; set; } + + private void SwitchPamBuffer() + { + //uint wordCountRegister = 0; + //int previousPamIdx = 0; + //uint previousWordCountRegister = 0; + var pamIndex = CurrentPam == pam0 ? 1 : 0; + //switch (pamIndex) + //{ + // case 0: + // previousPamIdx = 1; + // wordCountRegister = RegisterMapHSSub9100.GS_KW__SYS_DW_CNT0; + // previousWordCountRegister = RegisterMapHSSub9100.GS_KW__SYS_DW_CNT1; + // break; + // case 1: + // previousPamIdx = 0; + // wordCountRegister = RegisterMapHSSub9100.GS_KW__SYS_DW_CNT1; + // previousWordCountRegister = RegisterMapHSSub9100.GS_KW__SYS_DW_CNT0; + // break; + //} + // Inform FW to switch buffers + WriteRegister(RegisterMapHSSub9100.GS_KW__SYS_ADDR_SEL, (uint)pamIndex); + // Wait for FW to switch + BusyBitWait16(RegisterMapHSSub9100.GS_KW__FWD_STATUS, RegisterHalf.Upper, (ushort)pamIndex, 0x1, 500e-3); + CurrentPam = pamIndex == 0 ? pam0 : pam1; + //Console.WriteLine("Switched to use PAM {0}", pamIndex); + //Console.WriteLine("PAM {0} byte count = {1}", pamIndex, ReadRegister(wordCountRegister) * 4); + //Console.WriteLine("PAM {0} byte count = {1}", previousPamIdx, ReadRegister(previousWordCountRegister) * 4); + } + + internal void CheckForMessages(object sender, DoWorkEventArgs e) + { + try + { + var frequency = Stopwatch.Frequency; + var stopwatch = Stopwatch.StartNew(); + while (!messageChecker.CancellationPending) + { + if (AutoForwardDestination == RegisterMapHSSub9100.DefaultGsKwFwdDestAddr) + { + lock (componentLock) + { + // Get current buffer + var pamHandle = CurrentPam; + var currentPamIdx = CurrentPam == pam0 ? 0 : 1; + var newPamIdx = CurrentPam == pam0 ? 1 : 0; + var wordCountRegister = currentPamIdx == 0 ? RegisterMapHSSub9100.GS_KW__SYS_DW_CNT0 : RegisterMapHSSub9100.GS_KW__SYS_DW_CNT1; + //Console.WriteLine("{0}: Checking for data in PAM {1}...", (double)stopwatch.ElapsedTicks / (double)frequency, currentPamIdx); + + // Get number of DWords to be read + var numDWords = ReadRegister(wordCountRegister); + + if (numDWords > 0) + { + // Inform FW to switch buffers + SwitchPamBuffer(); + + // Get number of DWords to be read + var numBytes = ReadRegister(wordCountRegister) * 4; + + if (BufferCapacity(numBytes) != AutoForwardBufferCapacity.Full) + { + //Console.WriteLine("Retieving {0} bytes from PAM {1}", numBytes, currentPamIdx); + // Read the data + var data = TerHsiSession.PAM_Read(pamHandle, 0, numBytes); + + // Process Data + lock (responseDataLock) + { + foreach (byte val in data) + { + gsMcKwSdlcData.Enqueue(val); + } + } + UpdateAutoForwardBuffer(gsMcKwSdlcData.Count); + } + } + } + } + Thread.Sleep(pollingInterval); + } + } + catch (Exception ex) + { + AutoForwardProcessExited?.Invoke(this, new SdlcEventArgs() { Message = ex.Message }); + } + finally + { + TerHsiSession.PAM_Free(pam0); + TerHsiSession.PAM_Free(pam1); + } + } + + private void UpdateAutoForwardBuffer(int bufferCount) + { + autoForwardMessageBuffer.HighwaterLevel = bufferCount > autoForwardMessageBuffer.HighwaterLevel ? bufferCount : autoForwardMessageBuffer.HighwaterLevel; + } + + private AutoForwardBufferCapacity autoForwardBufferCapacity { get; set; } = AutoForwardBufferCapacity.Empty; + + private AutoForwardBufferCapacity BufferCapacity(uint messageSize) + { + switch (autoForwardBufferCapacity) + { + case AutoForwardBufferCapacity.Empty: + if ((autoForwardMessageBuffer.InitialCapacity / 2) < gsMcKwSdlcData.Count) + { + autoForwardBufferCapacity = AutoForwardBufferCapacity.HalfFull; + AutoForwardBufferCapacityWarning?.Invoke(this, new SdlcEventArgs(autoForwardBufferCapacity)); + } + break; + case AutoForwardBufferCapacity.HalfFull: + if (autoForwardMessageBuffer.InitialCapacity < (gsMcKwSdlcData.Count + messageSize)) + { + autoForwardBufferCapacity = AutoForwardBufferCapacity.Full; + // Disable autoforwarding + WriteRegister(RegisterMapHSSub9100.GS_KW__FWD_EN, (uint)ControlState.Disabled); + AutoForwardBufferCapacityWarning?.Invoke(this, new SdlcEventArgs(autoForwardBufferCapacity)); + } + break; + case AutoForwardBufferCapacity.Full: + break; + } + + return autoForwardBufferCapacity; + } + + public event EventHandler AutoForwardProcessExited; + + public event EventHandler AutoForwardBufferCapacityWarning; + + RxSdlcAutoForwardBuffer IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.SdlcAutoForwardBuffer => autoForwardMessageBuffer; + + #endregion + + #region Discrete + + SignalState IGuidedElectronicsUnitDiscrete.NcDacsKwOrdEn + { + get + { + lock (componentLock) + { + return GetSignalState(ReadRegister(RegisterMapHSSub9100.DACS_DISC_IN), NcDacsKwOrdEnBit); + } + } + } + + #endregion + + #region EdaEmulator + + #region Channel A + + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.Configure(EdaConfig config) + { + CallLoggingHelper.FunctionStart(GetType(), "Configure", nameof(config), config); + + try + { + uint data = ( + Convert.ToUInt32(config.KwdlLinkUp) << (int)EdaConfig.Bit.KwdlLinkUp | + Convert.ToUInt32(config.KwdlState) << (int)EdaConfig.Bit.KwdlState | + Convert.ToUInt32(config.KwdlPbitPass) << (int)EdaConfig.Bit.KwdlPbitPass | + Convert.ToUInt32(config.KwdlMbitComplete) << (int)EdaConfig.Bit.KwdlMbitComplete | + Convert.ToUInt32(config.KwdlMbitPass) << (int)EdaConfig.Bit.KwdlMbitPass | + Convert.ToUInt32(config.KwdlRFTemp) << (int)EdaConfig.Bit.KwdlRFTemp | + Convert.ToUInt32(config.EdaNumCVClear) << (int)EdaConfig.Bit.EdaNumCVClear | + Convert.ToUInt32(config.EdaCVClearPassFail) << (int)EdaConfig.Bit.EdaCVClearPassFail | + Convert.ToUInt32(config.EdaCVClearPassFailValid) << (int)EdaConfig.Bit.EdaCVClearPassFailValid | + Convert.ToUInt32(config.EdaCVReady) << (int)EdaConfig.Bit.EdaCVReady | + Convert.ToUInt32(config.EdaCVReadyValid) << (int)EdaConfig.Bit.EdaCVReadyValid | + Convert.ToUInt32(config.EdaPbitPass) << (int)EdaConfig.Bit.EdaPbitPass | + Convert.ToUInt32(config.EdaPbitValid) << (int)EdaConfig.Bit.EdaPbitValid + ); + + WriteRegister(RegisterMapHSSub9100.EDA_A__CFG, data); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "Configure", null); + } + } + + EdaConfig IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchConfiguration() + { + CallLoggingHelper.FunctionStart(GetType(), "FetchConfiguration"); + + EdaConfig config = new(); + + try + { + config = new(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG)); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "FetchConfiguration", config); + } + + return config; + } + + CvcwData IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchCVCWData() => + new(ReadRegister(RegisterMapHSSub9100.EDA_A__CVCW_RX_DATA)); + + byte[] IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchCVData() + { + var cvData = new List(); + + var rxCnt = ReadRegister(RegisterMapHSSub9100.EDA_A__CV_RX_CNT); + for (int i = 0; i < rxCnt; i++) + { + var data = ReadRegister(RegisterMapHSSub9100.EDA_A__CV_RX_DATA); + cvData.Add(Convert.ToByte(data & 0x0000_00FF)); + } + + return cvData.ToArray(); + } + + EdaStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchEdaStatus() => + new(ReadRegister(RegisterMapHSSub9100.EDA_A__EDA_STS)); + + KwdlStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchKwdlStatus() => + new(ReadRegister(RegisterMapHSSub9100.EDA_A__KWDL_STS)); + + Scoreboard IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.FetchScoreboard() => + new(ReadRegister(RegisterMapHSSub9100.EDA_A__SCOREBOARD)); + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaPbitValid + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.EdaPbitValid); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.EdaPbitValid, (uint)EdaConfigure.EdaPbitValid); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaPbitPass + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.EdaPbitPass); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.EdaPbitPass, (uint)EdaConfigure.EdaPbitPass); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVReadyValid + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.EdaCVReadyValid); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.EdaCVReadyValid, (uint)EdaConfigure.EdaCVReadyValid); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVReady + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.EdaCVReady); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.EdaCVReady, (uint)EdaConfigure.EdaCVReady); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVClearPassFailValid + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.EdaCVClearPassFailValid); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.EdaCVClearPassFailValid, (uint)EdaConfigure.EdaCVClearPassFailValid); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaCVClearPassFail + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.EdaCVClearPassFail); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.EdaCVClearPassFail, (uint)EdaConfigure.EdaCVClearPassFail); + } + + short IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.EdaNumCVClear + { + get => (short)((ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.EdaNumCVClear) >> (int)EdaConfig.Bit.EdaNumCVClear); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.EdaNumCVClear, (uint)EdaConfigure.EdaNumCVClear); + } + + short IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlRFTemp + { + get => (short)((ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.KwdlRFTemp) >> (int)EdaConfig.Bit.KwdlRFTemp); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.KwdlRFTemp, (uint)EdaConfigure.KwdlRFTemp); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlMbitPass + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.KwdlMbitPass); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.KwdlMbitPass, (uint)EdaConfigure.KwdlMbitPass); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlMbitComplete + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.KwdlMbitComplete); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.KwdlMbitComplete, (uint)EdaConfigure.KwdlMbitComplete); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlPbitPass + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.KwdlPbitPass); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.KwdlPbitPass, (uint)EdaConfigure.KwdlPbitPass); + } + + Raytheon.GuidedElectronicsUnit.KwdlState IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlState + { + get + { + var val = (ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.KwdlState) >> (int)EdaConfig.Bit.KwdlState; + + if (val > 4) + { + return KwdlState.Invalid; + } + + return (KwdlState)val; + } + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, (uint)value << (int)EdaConfig.Bit.KwdlState, (uint)EdaConfigure.KwdlState); + } + + bool IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA.KwdlLinkUp + { + get => Convert.ToBoolean(ReadRegister(RegisterMapHSSub9100.EDA_A__CFG) & (uint)EdaConfigure.KwdlLinkUp); + set => ReadModifyWrite(RegisterMapHSSub9100.EDA_A__CFG, Convert.ToUInt32(value) << (int)EdaConfig.Bit.KwdlLinkUp, (uint)EdaConfigure.KwdlLinkUp); + } + + #region CS + + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.SdlcControl(SdlcControlBits control, ControlState state) => + ReadModifyWrite(RegisterMapHSSub9100.EDA_ACS__CONTROL, state == ControlState.Disabled ? 0x0 : 0xffffffff, (uint)control); + + SdlcStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.FetchSdlcStatus() => + new(ReadRegister(RegisterMapHSSub9100.EDA_ACS__STATUS)); + + SdlcFifoWrCount IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.FifoWrCount => + new(ReadRegister(RegisterMapHSSub9100.EDA_ACS__FIFO_WR_CNT)); + + RxSdlcMessage[] IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.ReadAllMessages() => + ReadAllMessages(SdlcInterface.EDACS); + + RxSdlcMessage IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.ReadMessage() => + ReadMessage(SdlcInterface.EDACS); + + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS.SendMessage(uint[] data) => + SendMessage(SdlcInterface.EDACS, data); + + #endregion + + #region PT + + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.SdlcControl(SdlcControlBits control, ControlState state) => + ReadModifyWrite(RegisterMapHSSub9100.EDA_APT__CONTROL, state == ControlState.Disabled ? 0x0 : 0xffffffff, (uint)control); + + SdlcStatus IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.FetchSdlcStatus() => + new(ReadRegister(RegisterMapHSSub9100.EDA_APT__STATUS)); + + SdlcFifoWrCount IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.FifoWrCount => + new(ReadRegister(RegisterMapHSSub9100.EDA_APT__FIFO_WR_CNT)); + + RxSdlcMessage[] IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.ReadAllMessages() => + ReadAllMessages(SdlcInterface.EDAPT); + + RxSdlcMessage IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.ReadMessage() => + ReadMessage(SdlcInterface.EDAPT); + + void IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT.SendMessage(uint[] data) => + SendMessage(SdlcInterface.EDAPT, data); + + #endregion + + #endregion + + #endregion + + #region GsKwSDLC + + private const int rxMaxWaitTime = 5; // Maximum time to wait for an incomming message in Seconds + + private int RxMessageCount { get => (int)ReadRegister(RegisterMapHSSub9100.GS_KW__MSG_CNT); } + + void IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.SdlcControl(SdlcControlBits control, ControlState state) + { + CallLoggingHelper.FunctionStart(GetType(), "SdlcControl", nameof(control), control, nameof(state), state); + + try + { + lock (componentLock) + { + uint data = 0x0; + if (state == ControlState.Enabled) data = 0xFFFF_FFFF; + + var mask = (uint)control; + ReadModifyWrite(RegisterMapHSSub9100.GS_KW__CONTROL, data, mask); + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "SdlcControl", null); + } + } + + SdlcStatus IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.FetchStatus() => + new SdlcStatus(ReadRegister(RegisterMapHSSub9100.GS_KW__STATUS)); + + SdlcFifoWrCount IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.FifoWrCount => + new(ReadRegister(RegisterMapHSSub9100.GS_KW__FIFO_WR_CNT)); + + RxSdlcMessage[] IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.ReadAllMessages() => + ReadAllMessages(SdlcInterface.GSKW); + + RxSdlcMessage IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.ReadMessage() => + ReadMessage(SdlcInterface.GSKW); + + void IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.SendMessage(uint[] data) => + SendMessage(SdlcInterface.GSKW, data); + + bool IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.Sync + { + get => IsBitSet(ReadRegister(RegisterMapHSSub9100.GS_KW__SYNC), 1); + set => ReadModifyWrite(RegisterMapHSSub9100.GS_KW__SYNC, Convert.ToUInt32(value), 0x1); + } + + byte[] IGuidedElectronicsUnitGsKwSyncronousDataLinkControl.FetchMessageData() + { + CallLoggingHelper.FunctionStart(GetType(), "FetchMessageData"); + + byte[] data = new byte[0]; + + try + { + lock (responseDataLock) + { + data = gsMcKwSdlcData.ToArray(); + gsMcKwSdlcData.Clear(); + autoForwardBufferCapacity = AutoForwardBufferCapacity.Empty; + } + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "FetchMessageData", null); + } + + return data; + } + + #endregion + + #region ImuEmulator + + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.Configure(ImuConfigure control, ControlState state) + { + CallLoggingHelper.FunctionStart(GetType(), "Configure", + nameof(control), control, + nameof(state), state); + + try + { + uint newState = 0x0; + if (state == ControlState.Enabled) + { + newState = 0xFFFFFFFF; + } + + ReadModifyWrite(RegisterMapHSSub9100.IMU__CONFIG, newState, (uint)control); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "Configure", null); + } + } + + double IGuidedElectronicsUnitInertialMeasurementUnitEmulator.EODSampleWidth + { + get => (ReadRegister(RegisterMapHSSub9100.IMU__EODS_WIDTH) & 0x0FFF) * 10e-9; + set + { + uint width = (uint)Math.Round(value / 10e-9, MidpointRounding.AwayFromZero); + WriteRegister(RegisterMapHSSub9100.IMU__EODS_WIDTH, (uint)width); + } + } + + ImuConfig IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchConfiguration() + { + CallLoggingHelper.FunctionStart(GetType(), "FetchConfiguration"); + + ImuConfig config = new ImuConfig(); + + try + { + config = new ImuConfig(ReadRegister(RegisterMapHSSub9100.IMU__CONFIG)); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "FetchConfiguratin", null); + } + return config; + } + + ImuMessage IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchMessageData() + { + CallLoggingHelper.FunctionStart(GetType(), "FetchMessageData"); + + ImuMessage msg = new ImuMessage(); + + try + { + msg = FetchTxData(); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "FetchMessageData", null); + } + return msg; + } + + ImuDiscreteInput IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchDiscreteInput() + { + CallLoggingHelper.FunctionStart(GetType(), "FetchDiscreteInput"); + + ImuDiscreteInput data = new ImuDiscreteInput(); + + try + { + data = new(ReadRegister(RegisterMapHSSub9100.IMU__DISC_IN)); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "FetchDiscreteInput", null); + } + return data; + } + + SdlcStatus IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FetchStatus() + { + CallLoggingHelper.FunctionStart(GetType(), "FetchStatus"); + + SdlcStatus sdlcStatus = new(); + + try + { + sdlcStatus = new(ReadRegister(RegisterMapHSSub9100.IMU__STATUS)); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "FetchStatus", null); + } + + return sdlcStatus; + } + + SdlcFifoWrCount IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FifoWrCount => + new(ReadRegister(RegisterMapHSSub9100.IMU__FIFO_WR_CNT)); + + ControlState IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FrameEnable + { + get => IsBitSet(ReadRegister(RegisterMapHSSub9100.IMU__FRM_CTRL), 31) ? ControlState.Enabled : ControlState.Disabled; + set + { + uint mask = 0x8000_0000; + uint state = 0; + + if (value == ControlState.Enabled) + { + state = mask; + } + + ReadModifyWrite(RegisterMapHSSub9100.IMU__FRM_CTRL, state, mask); + } + } + + double IGuidedElectronicsUnitInertialMeasurementUnitEmulator.FramePeriod + { + get => (ReadRegister(RegisterMapHSSub9100.IMU__FRM_CTRL) & 0x0FFF_FFFF) * 10e-9; + set + { + var period = Math.Round(value / 10e-9, MidpointRounding.AwayFromZero); + ReadModifyWrite(RegisterMapHSSub9100.IMU__FRM_CTRL, (uint)period, 0x0FFF_FFFF); + } + } + + RxSdlcMessage[] IGuidedElectronicsUnitInertialMeasurementUnitEmulator.ReadAllMessages() => + ReadAllMessages(SdlcInterface.IMU); + + RxSdlcMessage IGuidedElectronicsUnitInertialMeasurementUnitEmulator.ReadMessage() => + ReadMessage(SdlcInterface.IMU); + + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.SdlcControl(SdlcControlBits control, ControlState state) + { + lock (componentLock) + { + uint data = 0x0; + if (state == ControlState.Enabled) data = 0xFFFF_FFFF; + + var mask = (uint)control; + ReadModifyWrite(RegisterMapHSSub9100.IMU__CONTROL, data, mask); + } + } + + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.SendMessage(uint[] data) => + SendMessage(SdlcInterface.IMU, data); + + void IGuidedElectronicsUnitInertialMeasurementUnitEmulator.SetDataWord(ImuMessageWord word, uint data) + { + lock (componentLock) + { + var registerOffset = word switch + { + ImuMessageWord.AngleDeltaX => RegisterMapHSSub9100.IMU__AGL_DLTA_X, + ImuMessageWord.AngleDeltaY => RegisterMapHSSub9100.IMU__AGL_DLTA_Y, + ImuMessageWord.AngleDeltaZ => RegisterMapHSSub9100.IMU__AGL_DLTA_Z, + ImuMessageWord.VelocityDeltaX => RegisterMapHSSub9100.IMU__VEL_DLTA_X, + ImuMessageWord.VelocityDeltaY => RegisterMapHSSub9100.IMU__VEL_DLTA_Y, + ImuMessageWord.VelocityDeltaZ => RegisterMapHSSub9100.IMU__VEL_DLTA_Z, + ImuMessageWord.ModeMuxId => RegisterMapHSSub9100.IMU__MODE_MUX, + ImuMessageWord.MuxDataWord => RegisterMapHSSub9100.IMU__MUX_DATA, + ImuMessageWord.RawGyroCountX => RegisterMapHSSub9100.IMU__RAW_GCNT_X, + ImuMessageWord.RawGyroCountY => RegisterMapHSSub9100.IMU__RAW_GCNT_Y, + ImuMessageWord.RawGyroCountZ => RegisterMapHSSub9100.IMU__RAW_GCNT_Z, + ImuMessageWord.StatusSummaryWord => RegisterMapHSSub9100.IMU__STS_SUM, + _ => throw new ArgumentOutOfRangeException(word.ToString()), + }; + + WriteRegister(registerOffset, data); + + UpdateImuMessageChecksum(); + } + } + + #region Private Methods + + private ImuMessage FetchTxData() + { + CallLoggingHelper.FunctionStart(GetType(), "FetchTxData"); + + ImuMessage msg = new ImuMessage(); + + try + { + msg = new ImuMessage + { + AngleDeltaX = ReadRegister(RegisterMapHSSub9100.IMU__AGL_DLTA_X), + AngleDeltaY = ReadRegister(RegisterMapHSSub9100.IMU__AGL_DLTA_Y), + AngleDeltaZ = ReadRegister(RegisterMapHSSub9100.IMU__AGL_DLTA_Z), + VelocityDeltaX = ReadRegister(RegisterMapHSSub9100.IMU__VEL_DLTA_X), + VelocityDeltaY = ReadRegister(RegisterMapHSSub9100.IMU__VEL_DLTA_Y), + VelocityDeltaZ = ReadRegister(RegisterMapHSSub9100.IMU__VEL_DLTA_Z), + ModeMuxId = ReadRegister(RegisterMapHSSub9100.IMU__MODE_MUX), + MuxDataWord = ReadRegister(RegisterMapHSSub9100.IMU__MUX_DATA), + RawGyroCountX = ReadRegister(RegisterMapHSSub9100.IMU__RAW_GCNT_X), + RawGyroCountY = ReadRegister(RegisterMapHSSub9100.IMU__RAW_GCNT_Y), + RawGyroCountZ = ReadRegister(RegisterMapHSSub9100.IMU__RAW_GCNT_Z), + StatusSummaryWord = ReadRegister(RegisterMapHSSub9100.IMU__STS_SUM), + Checksum = ReadRegister(RegisterMapHSSub9100.IMU__CHECKSUM) + }; + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "FetchTxData", msg); + } + return msg; + } + + private void UpdateImuMessageChecksum() + { + var messageData = FetchTxData(); + + // Calculate checksum on data and update checksum value before writing to instrument + uint checksum = ~(messageData.AngleDeltaX + + messageData.AngleDeltaY + + messageData.AngleDeltaZ + + messageData.VelocityDeltaX + + messageData.VelocityDeltaY + + messageData.VelocityDeltaZ + + messageData.ModeMuxId + + messageData.MuxDataWord + + messageData.RawGyroCountX + + messageData.RawGyroCountY + + messageData.RawGyroCountZ + + messageData.StatusSummaryWord) & 0xFFFF; + + WriteRegister(RegisterMapHSSub9100.IMU__CHECKSUM, checksum); + } + + #endregion + + #endregion + + #region LowLevel + + int IGuidedElectronicsUnitLowLevelHSSub9100.Chassis => base.Chassis; + + string IGuidedElectronicsUnitLowLevelHSSub9100.Descriptor => base.Descriptor; + + double IGuidedElectronicsUnitLowLevelHSSub9100.DieTemp => base.DieTemp; + + ControlState IGuidedElectronicsUnitLowLevelHSSub9100.EnableIO + { + get => IsBitSet(ReadRegister(RegisterMapHSSub9100.PIM_CTRL), 1) ? ControlState.Disabled : ControlState.Enabled; + set + { + var state = Convert.ToBoolean(value); + WriteRegister(RegisterMapHSSub9100.PIM_CTRL, (uint)(state ? 0 : 1)); + TerHsiSession.Rs485.SetTermEnable(0, terHsi.Rs485PortAll, state); + TerHsiSession.Rs485.SetTermEnable(1, terHsi.Rs485PortAll, state); + TerHsiSession.Rs485.SetRxEnable(0, terHsi.Rs485PortAll, state); + TerHsiSession.Rs485.SetRxEnable(1, terHsi.Rs485PortAll, state); + } + } + + FirmwareInformation IGuidedElectronicsUnitLowLevelHSSub9100.GetFirmwareInfo() + { + return GetFirmwareInfo(); + } + + TdfPllStatus IGuidedElectronicsUnitLowLevelHSSub9100.GetPllStatus() + { + return GetPllStatus(); + } + + bool IGuidedElectronicsUnitLowLevelHSSub9100.IsSimulated => IsSimulated; + + void IGuidedElectronicsUnitLowLevelHSSub9100.ReadModifyWrite(uint address, uint data, uint mask) + { + ReadModifyWrite(address, data, mask); + } + + uint IGuidedElectronicsUnitLowLevelHSSub9100.ReadRegister(uint address) + { + return ReadRegister(address); + } + + void IGuidedElectronicsUnitLowLevelHSSub9100.Reset() + { + Reset(); + + if (sdlcMessages.Count > 0) + sdlcMessages.Clear(); + } + + string IGuidedElectronicsUnitLowLevelHSSub9100.SerialNumber => SerialNumber; + + int IGuidedElectronicsUnitLowLevelHSSub9100.Slot => Slot; + + void IGuidedElectronicsUnitLowLevelHSSub9100.WriteRegister(uint address, uint data) + { + if (address == RegisterMapHSSub9100.GS_KW__FWD_DEST_ADDR) + { + SetAutoForwardDestination(data); + return; + } + WriteRegister(address, data); + } + + double IGuidedElectronicsUnitLowLevelHSSub9100.VccAux => VccAux; + + double IGuidedElectronicsUnitLowLevelHSSub9100.VccInt => VccInt; + + AuroraStatus IGuidedElectronicsUnitLowLevelHSSub9100.GetAuroraStatus() + { + CallLoggingHelper.FunctionStart(GetType(), "GetAuroraStatus"); + + var auroraStatus = new AuroraStatus(); + + try + { + var registerValue = ReadRegister(RegisterMapHSSub9100.TAURORA__STATUS); + auroraStatus.SoftError = IsBitSet(registerValue, 7); + auroraStatus.HardError = IsBitSet(registerValue, 6); + auroraStatus.LinkUp = IsBitSet(registerValue, 5); + auroraStatus.ChannelUp = IsBitSet(registerValue, 4); + auroraStatus.LaneUp = (int)(registerValue & 0xF); + } + finally + { + CallLoggingHelper.FunctionEnd(GetType(), "GetAuroraStatus", auroraStatus); + } + + return auroraStatus; + } + + #endregion + + #region TestControl + + void IGuidedElectronicsUnitTestControl.WaitForMsg(ushort count) + { + WaitForMsg(SdlcInterface.IMU, count, 1.0); + } + + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSessionFactory.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSessionFactory.cs new file mode 100644 index 0000000..5dc4b71 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/HardwareSessionFactory.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Teradyne.Instruments.HighSpeed.SubsystemDriver; + +namespace Raytheon.GuidedElectronicsUnit +{ + internal static class HardwareSessionFactory + { + //private static readonly Dictionary _driverSessionToHardwareSession = + // new(); + private static readonly Dictionary _resourceNameToHardwareSession = new(); + private static readonly Dictionary> _hardwareSessionToDriverSession = new(); + + private static readonly object _componentLock = new(); + + public static T NewHardwareSession( + MindWorks.Nimbus.Driver driverSession, + string resourceName, + bool simulated, + bool reset) where T : HardwareSession, new() + { + lock (_componentLock) + { + HardwareSession foundHardwareSession = null; + terHsi terHsiSession = null; + + //if (_driverSessionToHardwareSession.ContainsKey(driverSession)) + // return _driverSessionToHardwareSession[driverSession] as T; + if (_resourceNameToHardwareSession.ContainsKey(resourceName)) + return _resourceNameToHardwareSession[resourceName] as T; + + if (simulated) + { + terHsiSession = terHsi.CreateSession(resourceName, reset, "simulate=true"); + } + else + { + // Call the driver's init function to get a session handle. + terHsiSession = terHsi.CreateSession(resourceName, reset); + driverSession.Session.InstrumentFirmwareRevision = terHsiSession.FirmwareRevision; + driverSession.Session.InstrumentManufacturer = terHsiSession.Manufacturer; + } + + + // If the returned session handle is new, then create a wrapper for it. + foreach (var entry in _hardwareSessionToDriverSession) + { + HardwareSession hardwareSession = entry.Key; + if (hardwareSession.TerHsiSession == terHsiSession) + { + entry.Value.Add(driverSession); + foundHardwareSession = hardwareSession; + break; + } + } + + if (foundHardwareSession == null) + { + var driverSessionList = new List(); + + // Create a hardware session and associate the driver session with it. + foundHardwareSession = new T + { + TerHsiSession = terHsiSession, + IsSimulated = simulated + }; + driverSessionList.Add(driverSession); + _hardwareSessionToDriverSession.Add(foundHardwareSession, driverSessionList); + + foundHardwareSession.InitSession(); + } + + // Record the hardware session associated with the driver session and + // return the hardware session. + //_driverSessionToHardwareSession.Add(driverSession, foundHardwareSession); + _resourceNameToHardwareSession.Add(resourceName, foundHardwareSession); + + return foundHardwareSession as T; + } + } + + public static void EndHardwareSession(MindWorks.Nimbus.Driver driverSession, string resourceName) + { + lock (_componentLock) + { + // Locate the hardware session associated with the driver session. + //if (!_driverSessionToHardwareSession.TryGetValue(driverSession, out HardwareSession hardwareSession)) + if (!_resourceNameToHardwareSession.TryGetValue(resourceName, out HardwareSession hardwareSession)) + { + // Not found, nothing to do + return; + } + + if (!_hardwareSessionToDriverSession.TryGetValue(hardwareSession, out List driverSessionList)) + { + // Not found, nothing to do + return; + } + + // Remove the driver session from the list of driver sessions supported by the hardware session. + if (!driverSessionList.Remove(driverSession)) + { + // Nothing found, nothing to do + return; + } + + // If there are no more sessions for this wrapper, then shutdown the wrapper + // and delete it from our list. + if (driverSessionList.Count == 0) + { + _hardwareSessionToDriverSession.Remove(hardwareSession); + + // Close the hardware session too + terHsi terHsiSession = hardwareSession.TerHsiSession; + terHsiSession?.Reset(); + terHsiSession?.Dispose(); + + hardwareSession = null; + } + + // Remove the driver session entry in our list of driver sessions. + //_driverSessionToHardwareSession.Remove(driverSession); + _resourceNameToHardwareSession.Remove(resourceName); + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/IdaStatus.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/IdaStatus.cs new file mode 100644 index 0000000..009d0a4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/IdaStatus.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct IdaStatus + { + public IdaStatus(uint status) + { + GeuToII40MhzClockLocked = (PllState)(status & (uint)BitMask.GeuToII40MhzClockLocked); + IIEmulatorReset = (ResetState)(status & (uint)BitMask.IIEmulatorReset); + } + + #region Private Members + + private enum BitMask + { + GeuToII40MhzClockLocked = 0x0000_0002, + IIEmulatorReset = 0x0000_0001 + } + + #endregion + + public Raytheon.GuidedElectronicsUnit.PllState GeuToII40MhzClockLocked { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.ResetState IIEmulatorReset { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuConfig.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuConfig.cs new file mode 100644 index 0000000..bafcb5e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuConfig.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct ImuConfig + { + public ImuConfig(uint status) + { + KwTestMode = Convert.ToBoolean(status & (uint)ImuConfigure.KwTestMode); + RxEnable = Convert.ToBoolean(status & (uint)ImuConfigure.RxEnable); + TxEnable = Convert.ToBoolean(status & (uint)ImuConfigure.TxEnable); + } + + public bool KwTestMode { get; } + + public bool RxEnable { get; } + + public bool TxEnable { get; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuDiscreteInput.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuDiscreteInput.cs new file mode 100644 index 0000000..3f5104b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuDiscreteInput.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct ImuDiscreteInput + { + public ImuDiscreteInput(uint status) + { + ExternalSync = Convert.ToBoolean(status & (uint)BitMask.ExternalSync) ? SignalState.High : SignalState.Low; + PowerOnreset = Convert.ToBoolean(status & (uint)BitMask.PowerOnreset) ? SignalState.High : SignalState.Low; + FastRestart = Convert.ToBoolean(status & (uint)BitMask.FastRestart) ? SignalState.High : SignalState.Low; + NotCommandBit = Convert.ToBoolean(status & (uint)BitMask.NotCommandBit) ? SignalState.High : SignalState.Low; + NotInhibitBit = Convert.ToBoolean(status & (uint)BitMask.NotInhibitBit) ? SignalState.High : SignalState.Low; + InhibitPowerOnReset = Convert.ToBoolean(status & (uint)BitMask.InhibitPowerOnReset) ? SignalState.High : SignalState.Low; + SimExternalSync = Convert.ToBoolean(status & (uint)BitMask.SimExternalSync) ? SignalState.High : SignalState.Low; + SimPowerOnreset = Convert.ToBoolean(status & (uint)BitMask.SimPowerOnreset) ? SignalState.High : SignalState.Low; + SimFastRestart = Convert.ToBoolean(status & (uint)BitMask.SimFastRestart) ? SignalState.High : SignalState.Low; + SimNotCommandBit = Convert.ToBoolean(status & (uint)BitMask.SimNotCommandBit) ? SignalState.High : SignalState.Low; + SimNotInhibitBit = Convert.ToBoolean(status & (uint)BitMask.SimNotInhibitBit) ? SignalState.High : SignalState.Low; + } + + #region Internal Members + + internal enum BitMask + { + ExternalSync = 0x1, + PowerOnreset = 0x2, + FastRestart = 0x4, + NotCommandBit = 0x8, + NotInhibitBit = 0x10, + InhibitPowerOnReset = 0x20, + SimExternalSync = 0x100, + SimPowerOnreset = 0x200, + SimFastRestart = 0x400, + SimNotCommandBit = 0x800, + SimNotInhibitBit = 0x1000 + } + + #endregion + + public Raytheon.GuidedElectronicsUnit.SignalState SimNotInhibitBit { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState SimNotCommandBit { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState SimFastRestart { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState SimExternalSync { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState SimPowerOnreset { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState ExternalSync { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState FastRestart { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState NotCommandBit { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState NotInhibitBit { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState PowerOnreset { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.SignalState InhibitPowerOnReset { get; internal set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuMessage.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuMessage.cs new file mode 100644 index 0000000..c13b527 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ImuMessage.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct ImuMessage + { + public uint VelocityDeltaX { get; internal set; } + + public uint VelocityDeltaY { get; internal set; } + + public uint VelocityDeltaZ { get; internal set; } + + public uint AngleDeltaX { get; internal set; } + + public uint AngleDeltaY { get; internal set; } + + public uint AngleDeltaZ { get; internal set; } + + public uint StatusSummaryWord { get; internal set; } + + public uint ModeMuxId { get; internal set; } + + public uint MuxDataWord { get; internal set; } + + public uint RawGyroCountX { get; internal set; } + + public uint RawGyroCountY { get; internal set; } + + public uint RawGyroCountZ { get; internal set; } + + public uint Checksum { get; internal set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Interfaces.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Interfaces.cs new file mode 100644 index 0000000..6aaa69f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Interfaces.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public interface IGuidedElectronicsUnit + { + IGuidedElectronicsUnitDiscrete Discrete { get; } + IGuidedElectronicsUnitInertialMeasurementUnitEmulator InertialMeasurementUnitEmulator { get; } + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator EncryptorDecryptorAssemblyEmulator { get; } + IGuidedElectronicsUnitLowLevel LowLevel { get; } + IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator IntegratedDewarAssemblyInterfaceEmulator { get; } + IGuidedElectronicsUnitGsKwSyncronousDataLinkControl GsKwSyncronousDataLinkControl { get; } + IGuidedElectronicsUnitTestControl TestControl { get; } + } + + public interface IGuidedElectronicsUnitDiscrete + { + Raytheon.GuidedElectronicsUnit.SignalState NcDacsKwOrdEn { get; } + } + + public interface IGuidedElectronicsUnitInertialMeasurementUnitEmulator + { + SdlcStatus FetchStatus(); + void SetDataWord(Raytheon.GuidedElectronicsUnit.ImuMessageWord word, uint data); + ImuMessage FetchMessageData(); + void Configure(Raytheon.GuidedElectronicsUnit.ImuConfigure control, Raytheon.GuidedElectronicsUnit.ControlState state); + ImuConfig FetchConfiguration(); + double EODSampleWidth { get; set; } + ImuDiscreteInput FetchDiscreteInput(); + void SdlcControl(Raytheon.GuidedElectronicsUnit.SdlcControlBits control, Raytheon.GuidedElectronicsUnit.ControlState state); + SdlcFifoWrCount FifoWrCount { get; } + RxSdlcMessage ReadMessage(); + RxSdlcMessage[] ReadAllMessages(); + void SendMessage(uint[] data); + + Raytheon.GuidedElectronicsUnit.ControlState FrameEnable { get; set; } + double FramePeriod { get; set; } + } + + public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator + { + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA ChannelA { get; } + } + + public interface IGuidedElectronicsUnitLowLevel + { + IGuidedElectronicsUnitLowLevelHSSub6020a HSSub6020a { get; } + IGuidedElectronicsUnitLowLevelHSSub9100 HSSub9100 { get; } + } + + public interface IGuidedElectronicsUnitLowLevelHSSub6020a + { + FirmwareInformation GetFirmwareInfo(); + TdfPllStatus GetPllStatus(); + uint ReadRegister(uint address); + void WriteRegister(uint address, uint data); + void Reset(); + void ReadModifyWrite(uint address, uint data, uint mask); + int Chassis { get; } + string Descriptor { get; } + string SerialNumber { get; } + int Slot { get; } + double DieTemp { get; } + double VccInt { get; } + double VccAux { get; } + bool IsSimulated { get; } + Raytheon.GuidedElectronicsUnit.ControlState EnableIO { get; set; } + void ResetEmStatus(); + EmStatus EmStatus { get; } + } + + public interface IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator + { + Raytheon.GuidedElectronicsUnit.ControlState Control { get; set; } + IdaStatus Status { get; } + uint Version { get; } + } + + public interface IGuidedElectronicsUnitLowLevelHSSub9100 + { + FirmwareInformation GetFirmwareInfo(); + TdfPllStatus GetPllStatus(); + uint ReadRegister(uint address); + void WriteRegister(uint address, uint data); + void Reset(); + void ReadModifyWrite(uint address, uint data, uint mask); + int Chassis { get; } + string Descriptor { get; } + string SerialNumber { get; } + int Slot { get; } + double DieTemp { get; } + double VccInt { get; } + double VccAux { get; } + bool IsSimulated { get; } + Raytheon.GuidedElectronicsUnit.ControlState EnableIO { get; set; } + AuroraStatus GetAuroraStatus(); + } + + public interface IGuidedElectronicsUnitGsKwSyncronousDataLinkControl + { + void SdlcControl(SdlcControlBits control, ControlState state); + SdlcStatus FetchStatus(); + void SendMessage(uint[] data); + + event EventHandler AutoForwardBufferCapacityWarning; + SdlcFifoWrCount FifoWrCount { get; } + bool Sync { get; set; } + byte[] FetchMessageData(); + RxSdlcMessage ReadMessage(); + RxSdlcMessage[] ReadAllMessages(); + event EventHandler AutoForwardProcessExited; + + RxSdlcAutoForwardBuffer SdlcAutoForwardBuffer { get; } + } + + public interface IGuidedElectronicsUnitTestControl + { + void WaitForMsg(ushort count); + } + + public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA + { + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT PT { get; } + IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS CS { get; } + Scoreboard FetchScoreboard(); + KwdlStatus FetchKwdlStatus(); + byte[] FetchCVData(); + CvcwData FetchCVCWData(); + void Configure(EdaConfig configuration); + EdaStatus FetchEdaStatus(); + EdaConfig FetchConfiguration(); + bool EdaPbitValid { get; set; } + bool EdaPbitPass { get; set; } + bool EdaCVReadyValid { get; set; } + bool EdaCVReady { get; set; } + bool EdaCVClearPassFailValid { get; set; } + bool EdaCVClearPassFail { get; set; } + short EdaNumCVClear { get; set; } + short KwdlRFTemp { get; set; } + bool KwdlMbitPass { get; set; } + bool KwdlMbitComplete { get; set; } + bool KwdlPbitPass { get; set; } + Raytheon.GuidedElectronicsUnit.KwdlState KwdlState { get; set; } + bool KwdlLinkUp { get; set; } + } + + public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT + { + void SdlcControl(SdlcControlBits control, ControlState state); + SdlcStatus FetchSdlcStatus(); + RxSdlcMessage[] ReadAllMessages(); + RxSdlcMessage ReadMessage(); + void SendMessage(uint[] data); + SdlcFifoWrCount FifoWrCount { get; } + } + + public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS + { + SdlcStatus FetchSdlcStatus(); + void SdlcControl(SdlcControlBits control, ControlState state); + RxSdlcMessage[] ReadAllMessages(); + RxSdlcMessage ReadMessage(); + void SendMessage(uint[] data); + SdlcFifoWrCount FifoWrCount { get; } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/KwdlStatus.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/KwdlStatus.cs new file mode 100644 index 0000000..d0aab1f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/KwdlStatus.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct KwdlStatus + { + + public KwdlStatus(uint status) + { + AntennaPort = (int)((status & (uint)BitMask.AntennaPort) >> (int)Bit.AntennaPort); + Channel = (int)((status & (uint)BitMask.Channel) >> (int)Bit.Channel); + DestinationId = (int)((status & (uint)BitMask.DestinationId) >> (int)Bit.DestinationId); + Location = (KwdlLocation)((status & (uint)BitMask.Location) >> (int)Bit.Location); + RFPower = (int)((status & (uint)BitMask.RFPower) >> (int)Bit.RFPower); + SourceId = (int)((status & (uint)BitMask.SourceId) >> (int)Bit.SourceId); + } + + #region Private Members + + private enum BitMask + { + DestinationId = 0x0000_000F, + SourceId = 0x0000_00F0, + Channel = 0x0000_3F00, + Location = 0x0001_0000, + AntennaPort = 0x0030_0000, + RFPower = 0x0300_0000 + } + + private enum Bit + { + DestinationId = 0, + SourceId = 4, + Channel = 8, + Location = 16, + AntennaPort = 20, + RFPower = 24 + } + + #endregion + + public int RFPower { get; internal set; } + + public int AntennaPort { get; internal set; } + + public KwdlLocation Location { get; internal set; } + + public int Channel { get; internal set; } + + public int SourceId { get; internal set; } + + public int DestinationId { get; internal set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Models.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Models.cs new file mode 100644 index 0000000..56a84ad --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Models.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; + +namespace Raytheon.GuidedElectronicsUnit +{ + + [InstrumentFamilies] + internal static class Families + { + internal const string DefaultFamily = "DefaultFamily"; + + internal static readonly string[] DefaultFamilyMembers = new[] { Models.HSSub6020a__HSSub9010 }; + } + + + + [InstrumentModels(Models.HSSub6020a__HSSub9010)] + internal static class Models + { + internal const string Any = ""; + internal const string HSSub6020a__HSSub9010 = "HSSub6020a, HSSub9010"; + } + +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ReadMessageIncomplete.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ReadMessageIncomplete.cs new file mode 100644 index 0000000..02fd0e7 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ReadMessageIncomplete.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Runtime.Serialization; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + [Serializable] + public class ReadMessageIncomplete : Exception + { + public ReadMessageIncomplete() + { + // Add any type-specific logic, and supply the default message. + // + } + + public ReadMessageIncomplete(string message) + : base(message) + { + // Add any type-specific logic. + // + } + + public ReadMessageIncomplete(string message, Exception innerException) + : base(message, innerException) + { + // Add any type-specific logic for inner exceptions. + // + } + + protected ReadMessageIncomplete(SerializationInfo info, StreamingContext context) + : base(info, context) + { + // Implement type-specific serialization constructor logic. + // + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ReadMessageTimeout.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ReadMessageTimeout.cs new file mode 100644 index 0000000..0dff532 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/ReadMessageTimeout.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Runtime.Serialization; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + [Serializable] + public class ReadMessageTimeout : Exception + { + public ReadMessageTimeout() + { + // Add any type-specific logic, and supply the default message. + // + } + + public ReadMessageTimeout(string message) + : base(message) + { + // Add any type-specific logic. + // + } + + public ReadMessageTimeout(string message, Exception innerException) + : base(message, innerException) + { + // Add any type-specific logic for inner exceptions. + // + } + + protected ReadMessageTimeout(SerializationInfo info, StreamingContext context) + : base(info, context) + { + // Implement type-specific serialization constructor logic. + // + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterDefaults.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterDefaults.cs new file mode 100644 index 0000000..5c1e2ff --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterDefaults.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.GuidedElectronicsUnit +{ + class RegisterDefaults + { + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterMapHSSub6020a.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterMapHSSub6020a.cs new file mode 100644 index 0000000..03ee043 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterMapHSSub6020a.cs @@ -0,0 +1,1151 @@ +namespace Raytheon.GuidedElectronicsUnit +{ + static public class RegisterMapHSSub6020a + { + /// + /// The CustID value that is returned by the FPGA version + /// associated with this list of registers. + /// + internal const ushort ExpectedCustID = 0x0002; + + /// + /// The AppID value that is returned by the FPGA version + /// associated with this list of registers. + /// + internal const ushort ExpectedAppID = 0x0002; + + /// + /// The RevID value that is returned by the FPGA version + /// associated with this list of registers. + /// + internal const uint ExpectedRevID = 0x00000010; + + internal const uint BufferPtr = 0x00040000; + + internal const uint DDR2Ptr0 = 0x20000000; + + internal const uint DDR2Ptr1 = 0x30000000; + + + + /// + /// Access Type: RO + /// Default Value: DEAD_4C01 + /// + public const uint TER_LB__FPGA_CONST = 0x00200000; + + public const uint DefaultTerLbFpgaConst = 0xDEAD4C01; + + /// + /// Access Type: RO + /// Default Value: 0002_0002 + /// + public const uint TER_LB__APP_CUST_ID = 0x00200004; + + public const uint DefaultTerLbAppCustId = 0x00020002; + + /// + /// Access Type: RO + /// Default Value: 0000_0010 + /// + public const uint TER_LB__REV_ID = 0x00200008; + + public const uint DefaultTerLbRevId = 0x00000010; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__PLL = 0x0020000C; + + public const uint DefaultTerLbPll = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__VCCINT_DT = 0x00200010; + + public const uint DefaultTerLbVccintDt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__VCCAUX = 0x00200014; + + public const uint DefaultTerLbVccaux = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TER_LB__FEATURE_IDX = 0x00200020; + + public const uint DefaultTerLbFeatureIdx = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__FEATURE_ENT = 0x00200024; + + public const uint DefaultTerLbFeatureEnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 1216_1773 + /// + public const uint TER_LB__SCRATCH0 = 0x00200030; + + public const uint DefaultTerLbScratch0 = 0x12161773; + + /// + /// Access Type: RW + /// Default Value: 0419_1775 + /// + public const uint TER_LB__SCRATCH1 = 0x00200034; + + public const uint DefaultTerLbScratch1 = 0x04191775; + + /// + /// Access Type: RW + /// Default Value: 0704_1776 + /// + public const uint TER_LB__SCRATCH2 = 0x00200038; + + public const uint DefaultTerLbScratch2 = 0x07041776; + + /// + /// Access Type: RW + /// Default Value: ABCD_1234 + /// + public const uint TER_LB__SOFT_RST_VAL = 0x0020005C; + + public const uint DefaultTerLbSoftRstVal = 0xABCD1234; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TER_LB__SOFT_RST_REG = 0x00200060; + + public const uint DefaultTerLbSoftRstReg = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint TER_LB__PXIE_EN = 0x00200064; + + public const uint DefaultTerLbPxieEn = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint TER_LB_TRASH = 0x002000F8; + + public const uint DefaultTerLbTrash = 0xDEADDEAD; + + /// + /// Access Type: RO + /// Default Value: DEAD_DEAD + /// + public const uint TER_LB_TADDR = 0x002000FC; + + public const uint DefaultTerLbTaddr = 0xDEADDEAD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC = 0x00200100; + + public const uint DefaultDuc = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC_ROM = 0x00200200; + + public const uint DefaultDucRom = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TAURORA__STATUS0 = 0x00204000; + + public const uint DefaultTauroraStatus0 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TAURORA__STATUS1 = 0x00204004; + + public const uint DefaultTauroraStatus1 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: FFFF_FFFF + /// + public const uint TAURORA__CONTROL0 = 0x00204008; + + public const uint DefaultTauroraControl0 = 0xFFFFFFFF; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA__TX_PKT_CNTS = 0x00204020; + + public const uint DefaultTauroraTxPktCnts = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA__RX_PKT_CNTS = 0x00204024; + + public const uint DefaultTauroraRxPktCnts = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA__PAGE_ADDR = 0x00204030; + + public const uint DefaultTauroraPageAddr = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 6000_000A + /// + public const uint TAURORA__PCIE_HDR0 = 0x00204034; + + public const uint DefaultTauroraPcieHdr0 = 0x6000000A; + + /// + /// Access Type: RW + /// Default Value: 01A0_00FF + /// + public const uint TAURORA__PCIE_HDR1 = 0x00204038; + + public const uint DefaultTauroraPcieHdr1 = 0x01A000FF; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA__PCIE_ADDR1 = 0x0020403C; + + public const uint DefaultTauroraPcieAddr1 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0040 + /// + public const uint TAURORA__TX_STALL = 0x00204048; + + public const uint DefaultTauroraTxStall = 0x00000040; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint TRASH_REG_TAUR = 0x002040F8; + + public const uint DefaultTrashRegTaur = 0xDEADDEAD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC_RAM = 0x00210000; + + public const uint DefaultDucRam = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint CL_DATE = 0x00220000; + + public const uint DefaultClDate = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint CL_TIME = 0x00220004; + + public const uint DefaultClTime = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0010 + /// + public const uint CL_VERSION = 0x00220008; + + public const uint DefaultClVersion = 0x00000010; + + /// + /// Access Type: RO + /// Default Value: 0201_5090 + /// + public const uint CL_CAGE = 0x0022000C; + + public const uint DefaultClCage = 0x02015090; + + /// + /// Access Type: RO + /// Default Value: D504_0107 + /// + public const uint CL_CLC = 0x00220010; + + public const uint DefaultClClc = 0xD5040107; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_DIRTY = 0x00220014; + + public const uint DefaultGitDirty = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH0 = 0x00220018; + + public const uint DefaultGitHash0 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH1 = 0x0022001C; + + public const uint DefaultGitHash1 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH2 = 0x00220020; + + public const uint DefaultGitHash2 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH3 = 0x00220024; + + public const uint DefaultGitHash3 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH4 = 0x00220028; + + public const uint DefaultGitHash4 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 8765_4321 + /// + public const uint SCRATCH = 0x0022002C; + + public const uint DefaultScratch = 0x87654321; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint SYS_HEALTH_STATUS = 0x00220030; + + public const uint DefaultSysHealthStatus = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 1234_ABCD + /// + public const uint SYS_SOFT_RST_VALUE = 0x00220038; + + public const uint DefaultSysSoftRstValue = 0x1234ABCD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint SYS_SOFT_RST_REG = 0x0022003C; + + public const uint DefaultSysSoftRstReg = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PGEN = 0x00220044; + + public const uint DefaultT132a0Pgen = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PGEN_SEED = 0x00220048; + + public const uint DefaultT132a0PgenSeed = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint T1_32A0__PGEN_CON = 0x0022004C; + + public const uint DefaultT132a0PgenCon = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK = 0x00220050; + + public const uint DefaultT132a0Pchk = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK_SEED = 0x00220054; + + public const uint DefaultT132a0PchkSeed = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint T1_32A0__PCHK_CON = 0x00220058; + + public const uint DefaultT132a0PchkCon = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: FFFF_FFFF + /// + public const uint T1_32A0__PCHK_MASK = 0x0022005C; + + public const uint DefaultT132a0PchkMask = 0xFFFFFFFF; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK_ERR = 0x00220060; + + public const uint DefaultT132a0PchkErr = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK_CNT = 0x00220064; + + public const uint DefaultT132a0PchkCnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__CRC_CALC = 0x00220074; + + public const uint DefaultT132a0CrcCalc = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__CRC_RESULT = 0x00220078; + + public const uint DefaultT132a0CrcResult = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC__HP_HEAD = 0x0022007C; + + public const uint DefaultDucHpHead = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC__LP_HEAD = 0x00220080; + + public const uint DefaultDucLpHead = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__LINK_ID = 0x00220084; + + public const uint DefaultDucLinkId = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__CNTRL = 0x00220088; + + public const uint DefaultDucCntrl = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__SRC = 0x0022008C; + + public const uint DefaultDucSrc = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__DST = 0x00220090; + + public const uint DefaultDucDst = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__TX_CNT = 0x00220094; + + public const uint DefaultDucTxCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__N_LINK = 0x00220098; + + public const uint DefaultDucNLink = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__B_LINK = 0x0022009C; + + public const uint DefaultDucBLink = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__SKIP_CNT = 0x002200A0; + + public const uint DefaultDucSkipCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__STATUS = 0x002200A4; + + public const uint DefaultDucStatus = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__POST_CNT = 0x002200A8; + + public const uint DefaultDucPostCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__TX_TIME = 0x002200AC; + + public const uint DefaultDucTxTime = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__STALLED = 0x002200B0; + + public const uint DefaultDucStalled = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DDR2_STATUS = 0x002200B4; + + public const uint DefaultDdr2Status = 0x00000000; + + /// + /// Access Type: WO + /// Default Value: 0000_0000 + /// + public const uint PTIQ__CLEAR = 0x002200B8; + + public const uint DefaultPtiqClear = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__IPR = 0x002200BC; + + public const uint DefaultPtiqIpr = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_00FF + /// + public const uint PTIQ__MASK = 0x002200C0; + + public const uint DefaultPtiqMask = 0x000000FF; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint PTIQ__FILTER0 = 0x002200C4; + + public const uint DefaultPtiqFilter0 = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: 0000_0002 + /// + public const uint PTIQ__FILTER1 = 0x002200C8; + + public const uint DefaultPtiqFilter1 = 0x00000002; + + /// + /// Access Type: RW + /// Default Value: 0000_0004 + /// + public const uint PTIQ__FILTER2 = 0x002200CC; + + public const uint DefaultPtiqFilter2 = 0x00000004; + + /// + /// Access Type: RW + /// Default Value: 0000_0008 + /// + public const uint PTIQ__FILTER3 = 0x002200D0; + + public const uint DefaultPtiqFilter3 = 0x00000008; + + /// + /// Access Type: RW + /// Default Value: 0000_0010 + /// + public const uint PTIQ__FILTER4 = 0x002200D4; + + public const uint DefaultPtiqFilter4 = 0x00000010; + + /// + /// Access Type: RW + /// Default Value: 0000_0020 + /// + public const uint PTIQ__FILTER5 = 0x002200D8; + + public const uint DefaultPtiqFilter5 = 0x00000020; + + /// + /// Access Type: RW + /// Default Value: 0000_0040 + /// + public const uint PTIQ__FILTER6 = 0x002200DC; + + public const uint DefaultPtiqFilter6 = 0x00000040; + + /// + /// Access Type: RW + /// Default Value: 0000_0080 + /// + public const uint PTIQ__FILTER7 = 0x002200E0; + + public const uint DefaultPtiqFilter7 = 0x00000080; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__TEST_EN = 0x002200E4; + + public const uint DefaultPtiqTestEn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__TEST_INT = 0x002200E8; + + public const uint DefaultPtiqTestInt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: FFFF_FFFF + /// + public const uint PTIQ__EDGE_EN = 0x002200EC; + + public const uint DefaultPtiqEdgeEn = 0xFFFFFFFF; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint PTIQ__ERROR = 0x002200F0; + + public const uint DefaultPtiqError = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__INVERT_EN = 0x002200F4; + + public const uint DefaultPtiqInvertEn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_0_INT = 0x002200F8; + + public const uint DefaultPtiq0Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_1_INT = 0x002200FC; + + public const uint DefaultPtiq1Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_2_INT = 0x00220100; + + public const uint DefaultPtiq2Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_3_INT = 0x00220104; + + public const uint DefaultPtiq3Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_4_INT = 0x00220108; + + public const uint DefaultPtiq4Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_5_INT = 0x0022010C; + + public const uint DefaultPtiq5Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_6_INT = 0x00220110; + + public const uint DefaultPtiq6Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_7_INT = 0x00220114; + + public const uint DefaultPtiq7Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_0_CNT = 0x00220118; + + public const uint DefaultPtiq0Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_1_CNT = 0x0022011C; + + public const uint DefaultPtiq1Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_2_CNT = 0x00220120; + + public const uint DefaultPtiq2Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_3_CNT = 0x00220124; + + public const uint DefaultPtiq3Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_4_CNT = 0x00220128; + + public const uint DefaultPtiq4Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_5_CNT = 0x0022012C; + + public const uint DefaultPtiq5Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_6_CNT = 0x00220130; + + public const uint DefaultPtiq6Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_7_CNT = 0x00220134; + + public const uint DefaultPtiq7Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint EM_CONTROL = 0x00220138; + + public const uint DefaultEmControl = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint FP_IO_CTRL = 0x00220140; + + public const uint DefaultFpIoCtrl = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint EM_STATUS = 0x00220204; + + public const uint DefaultEmStatus = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint TRASH32A0 = 0x00220FF8; + + public const uint DefaultTrash32a0 = 0xDEADDEAD; + + /// + /// Access Type: RO + /// Default Value: DEAD_DEAD + /// + public const uint TADDR32A0 = 0x00220FFC; + + public const uint DefaultTaddr32a0 = 0xDEADDEAD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint SCRATCH_RAM = 0x00240000; + + public const uint DefaultScratchRam = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: D100_0100 + /// + public const uint II_EM_VERSION = 0x00280000; + + public const uint DefaultIiEmVersion = 0xD1000100; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint ADC0_SPI__DATA = 0x00280004; + + public const uint DefaultAdc0SpiData = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint ADC1_SPI__DATA = 0x00280008; + + public const uint DefaultAdc1SpiData = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DAC_SPI__BIAS0 = 0x0028000C; + + public const uint DefaultDacSpiBias0 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DAC_SPI__BIAS1 = 0x00280010; + + public const uint DefaultDacSpiBias1 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint VID_ADC_LOCK = 0x00280014; + + public const uint DefaultVidAdcLock = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0001 + /// + public const uint VID_ADC_LO_STATUS = 0x00280018; + + public const uint DefaultVidAdcLoStatus = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint IDA__CTRL = 0x00280020; + + public const uint DefaultIdaCtrl = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 007E_01EC + /// + public const uint IDA__PDATA0 = 0x00280024; + + public const uint DefaultIdaPdata0 = 0x007E01EC; + + /// + /// Access Type: RW + /// Default Value: 0240_F800 + /// + public const uint IDA__PDATA1 = 0x00280028; + + public const uint DefaultIdaPdata1 = 0x0240F800; + + /// + /// Access Type: RW + /// Default Value: 1BD3_8000 + /// + public const uint IDA__PDATA2 = 0x0028002C; + + public const uint DefaultIdaPdata2 = 0x1BD38000; + + /// + /// Access Type: RW + /// Default Value: 96D9_0103 + /// + public const uint IDA__PDATA3 = 0x00280030; + + public const uint DefaultIdaPdata3 = 0x96D90103; + + /// + /// Access Type: RW + /// Default Value: 010D_C6DC + /// + public const uint IDA__PDATA4 = 0x00280034; + + public const uint DefaultIdaPdata4 = 0x010DC6DC; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint IDA__PDATA5 = 0x00280038; + + public const uint DefaultIdaPdata5 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint SDLC_TX__TX_INFO = 0x00280044; + + public const uint DefaultSdlcTxTxInfo = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0003 + /// + public const uint STS__CTRL = 0x0028004C; + + public const uint DefaultStsCtrl = 0x00000003; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint INIT__CTRL = 0x00280050; + + public const uint DefaultInitCtrl = 0x00000001; + + /// + /// Access Type: RO + /// Default Value: 0000_0002 + /// + public const uint INIT__STATUS = 0x00280054; + + public const uint DefaultInitStatus = 0x00000002; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__IDA_BIAS0 = 0x00280058; + + public const uint DefaultVoltMonIdaBias0 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__IDA_BIAS1 = 0x0028005C; + + public const uint DefaultVoltMonIdaBias1 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__IDA_BIAS2 = 0x00280060; + + public const uint DefaultVoltMonIdaBias2 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__IDA_BIAS3 = 0x00280064; + + public const uint DefaultVoltMonIdaBias3 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__IDA_BIAS4 = 0x00280068; + + public const uint DefaultVoltMonIdaBias4 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__IDA_BIAS5 = 0x0028006C; + + public const uint DefaultVoltMonIdaBias5 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__II_PWR0 = 0x00280070; + + public const uint DefaultVoltMonIiPwr0 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__II_PWR1 = 0x00280074; + + public const uint DefaultVoltMonIiPwr1 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint VOLT_MON__IDA_TEMP = 0x00280078; + + public const uint DefaultVoltMonIdaTemp = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0ABC + /// + public const uint TEMP_MON__II_TEMP = 0x0028007C; + + public const uint DefaultTempMonIiTemp = 0x00000ABC; + + /// + /// Access Type: RW + /// Default Value: 0023_0000 + /// + public const uint PLL__CTRL = 0x0028008C; + + public const uint DefaultPllCtrl = 0x00230000; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint II_EM_TRASH = 0x002800F8; + + public const uint DefaultIiEmTrash = 0xDEADDEAD; + + /// + /// Access Type: RO + /// Default Value: DEAD_DEAD + /// + public const uint II_EM_TADDR = 0x002800FC; + + public const uint DefaultIiEmTaddr = 0xDEADDEAD; + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterMapHSSub9100.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterMapHSSub9100.cs new file mode 100644 index 0000000..eaa2505 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RegisterMapHSSub9100.cs @@ -0,0 +1,1557 @@ +namespace Raytheon.GuidedElectronicsUnit +{ + static public class RegisterMapHSSub9100 + { + /// + /// The CustID value that is returned by the FPGA version + /// associated with this list of registers. + /// + internal const ushort ExpectedCustID = 0x0002; + + /// + /// The AppID value that is returned by the FPGA version + /// associated with this list of registers. + /// + internal const ushort ExpectedAppID = 0x0004; + + /// + /// The RevID value that is returned by the FPGA version + /// associated with this list of registers. + /// + internal const uint ExpectedRevID = 0x00000009; + + internal const uint BufferPtr = 0x00040000; + + internal const uint DDRAxiPtr = 0xC0000000; + + + + /// + /// Access Type: RO + /// Default Value: DEAD_4701 + /// + public const uint TER_LB__FPGA_CONST = 0x00200000; + + public const uint DefaultTerLbFpgaConst = 0xDEAD4701; + + /// + /// Access Type: RO + /// Default Value: 0004_0002 + /// + public const uint TER_LB__APP_CUST_ID = 0x00200004; + + public const uint DefaultTerLbAppCustId = 0x00040002; + + /// + /// Access Type: RO + /// Default Value: 0000_0009 + /// + public const uint TER_LB__REV_ID = 0x00200008; + + public const uint DefaultTerLbRevId = 0x00000009; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__PLL = 0x0020000C; + + public const uint DefaultTerLbPll = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__VCCINT_DT = 0x00200010; + + public const uint DefaultTerLbVccintDt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__VCCAUX = 0x00200014; + + public const uint DefaultTerLbVccaux = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TER_LB__FEATURE_IDX = 0x00200020; + + public const uint DefaultTerLbFeatureIdx = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint TER_LB__FEATURE_ENT = 0x00200024; + + public const uint DefaultTerLbFeatureEnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 1216_1773 + /// + public const uint TER_LB__SCRATCH0 = 0x00200030; + + public const uint DefaultTerLbScratch0 = 0x12161773; + + /// + /// Access Type: RW + /// Default Value: 0419_1775 + /// + public const uint TER_LB__SCRATCH1 = 0x00200034; + + public const uint DefaultTerLbScratch1 = 0x04191775; + + /// + /// Access Type: RW + /// Default Value: 0704_1776 + /// + public const uint TER_LB__SCRATCH2 = 0x00200038; + + public const uint DefaultTerLbScratch2 = 0x07041776; + + /// + /// Access Type: RW + /// Default Value: ABCD_1234 + /// + public const uint TER_LB__SOFT_RST_VAL = 0x0020005C; + + public const uint DefaultTerLbSoftRstVal = 0xABCD1234; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TER_LB__SOFT_RST_REG = 0x00200060; + + public const uint DefaultTerLbSoftRstReg = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint TER_LB__PXIE_EN = 0x00200064; + + public const uint DefaultTerLbPxieEn = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint TER_LB_TRASH = 0x002000F8; + + public const uint DefaultTerLbTrash = 0xDEADDEAD; + + /// + /// Access Type: RO + /// Default Value: DEAD_DEAD + /// + public const uint TER_LB_TADDR = 0x002000FC; + + public const uint DefaultTerLbTaddr = 0xDEADDEAD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC = 0x00200100; + + public const uint DefaultDuc = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC_ROM = 0x00201000; + + public const uint DefaultDucRom = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC_RAM = 0x00202000; + + public const uint DefaultDucRam = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 2022_0904 + /// + public const uint CL_DATE = 0x00220000; + + public const uint DefaultClDate = 0x20220904; + + /// + /// Access Type: RO + /// Default Value: 1749_4800 + /// + public const uint CL_TIME = 0x00220004; + + public const uint DefaultClTime = 0x17494800; + + /// + /// Access Type: RO + /// Default Value: 0000_0009 + /// + public const uint CL_VERSION = 0x00220008; + + public const uint DefaultClVersion = 0x00000009; + + /// + /// Access Type: RO + /// Default Value: 0201_5090 + /// + public const uint CL_CAGE = 0x0022000C; + + public const uint DefaultClCage = 0x02015090; + + /// + /// Access Type: RO + /// Default Value: D504_0111 + /// + public const uint CL_CLC = 0x00220010; + + public const uint DefaultClClc = 0xD5040111; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_DIRTY = 0x00220014; + + public const uint DefaultGitDirty = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH0 = 0x00220018; + + public const uint DefaultGitHash0 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH1 = 0x0022001C; + + public const uint DefaultGitHash1 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH2 = 0x00220020; + + public const uint DefaultGitHash2 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH3 = 0x00220024; + + public const uint DefaultGitHash3 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GIT_HASH4 = 0x00220028; + + public const uint DefaultGitHash4 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 8765_4321 + /// + public const uint SCRATCH = 0x0022002C; + + public const uint DefaultScratch = 0x87654321; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint SYS_HEALTH_STATUS = 0x00220030; + + public const uint DefaultSysHealthStatus = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 1234_ABCD + /// + public const uint SYS_SOFT_RST_VALUE = 0x00220038; + + public const uint DefaultSysSoftRstValue = 0x1234ABCD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint SYS_SOFT_RST_REG = 0x0022003C; + + public const uint DefaultSysSoftRstReg = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PGEN = 0x00220044; + + public const uint DefaultT132a0Pgen = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PGEN_SEED = 0x00220048; + + public const uint DefaultT132a0PgenSeed = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint T1_32A0__PGEN_CON = 0x0022004C; + + public const uint DefaultT132a0PgenCon = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK = 0x00220050; + + public const uint DefaultT132a0Pchk = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK_SEED = 0x00220054; + + public const uint DefaultT132a0PchkSeed = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint T1_32A0__PCHK_CON = 0x00220058; + + public const uint DefaultT132a0PchkCon = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: FFFF_FFFF + /// + public const uint T1_32A0__PCHK_MASK = 0x0022005C; + + public const uint DefaultT132a0PchkMask = 0xFFFFFFFF; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK_ERR = 0x00220060; + + public const uint DefaultT132a0PchkErr = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__PCHK_CNT = 0x00220064; + + public const uint DefaultT132a0PchkCnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__CRC_CALC = 0x00220074; + + public const uint DefaultT132a0CrcCalc = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint T1_32A0__CRC_RESULT = 0x00220078; + + public const uint DefaultT132a0CrcResult = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC__HP_HEAD = 0x0022007C; + + public const uint DefaultDucHpHead = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint DUC__LP_HEAD = 0x00220080; + + public const uint DefaultDucLpHead = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__LINK_ID = 0x00220084; + + public const uint DefaultDucLinkId = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__CNTRL = 0x00220088; + + public const uint DefaultDucCntrl = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__SRC = 0x0022008C; + + public const uint DefaultDucSrc = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__DST = 0x00220090; + + public const uint DefaultDucDst = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__TX_CNT = 0x00220094; + + public const uint DefaultDucTxCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__N_LINK = 0x00220098; + + public const uint DefaultDucNLink = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__B_LINK = 0x0022009C; + + public const uint DefaultDucBLink = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__SKIP_CNT = 0x002200A0; + + public const uint DefaultDucSkipCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__STATUS = 0x002200A4; + + public const uint DefaultDucStatus = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__POST_CNT = 0x002200A8; + + public const uint DefaultDucPostCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__TX_TIME = 0x002200AC; + + public const uint DefaultDucTxTime = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DUC__STALLED = 0x002200B0; + + public const uint DefaultDucStalled = 0x00000000; + + /// + /// Access Type: WO + /// Default Value: 0000_0000 + /// + public const uint PTIQ__CLEAR = 0x002200B8; + + public const uint DefaultPtiqClear = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__IPR = 0x002200BC; + + public const uint DefaultPtiqIpr = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_00FF + /// + public const uint PTIQ__MASK = 0x002200C0; + + public const uint DefaultPtiqMask = 0x000000FF; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint PTIQ__FILTER0 = 0x002200C4; + + public const uint DefaultPtiqFilter0 = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: 0000_0002 + /// + public const uint PTIQ__FILTER1 = 0x002200C8; + + public const uint DefaultPtiqFilter1 = 0x00000002; + + /// + /// Access Type: RW + /// Default Value: 0000_0004 + /// + public const uint PTIQ__FILTER2 = 0x002200CC; + + public const uint DefaultPtiqFilter2 = 0x00000004; + + /// + /// Access Type: RW + /// Default Value: 0000_0008 + /// + public const uint PTIQ__FILTER3 = 0x002200D0; + + public const uint DefaultPtiqFilter3 = 0x00000008; + + /// + /// Access Type: RW + /// Default Value: 0000_0010 + /// + public const uint PTIQ__FILTER4 = 0x002200D4; + + public const uint DefaultPtiqFilter4 = 0x00000010; + + /// + /// Access Type: RW + /// Default Value: 0000_0020 + /// + public const uint PTIQ__FILTER5 = 0x002200D8; + + public const uint DefaultPtiqFilter5 = 0x00000020; + + /// + /// Access Type: RW + /// Default Value: 0000_0040 + /// + public const uint PTIQ__FILTER6 = 0x002200DC; + + public const uint DefaultPtiqFilter6 = 0x00000040; + + /// + /// Access Type: RW + /// Default Value: 0000_0080 + /// + public const uint PTIQ__FILTER7 = 0x002200E0; + + public const uint DefaultPtiqFilter7 = 0x00000080; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__TEST_EN = 0x002200E4; + + public const uint DefaultPtiqTestEn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__TEST_INT = 0x002200E8; + + public const uint DefaultPtiqTestInt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: FFFF_FFFF + /// + public const uint PTIQ__EDGE_EN = 0x002200EC; + + public const uint DefaultPtiqEdgeEn = 0xFFFFFFFF; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint PTIQ__ERROR = 0x002200F0; + + public const uint DefaultPtiqError = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ__INVERT_EN = 0x002200F4; + + public const uint DefaultPtiqInvertEn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_0_INT = 0x002200F8; + + public const uint DefaultPtiq0Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_1_INT = 0x002200FC; + + public const uint DefaultPtiq1Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_2_INT = 0x00220100; + + public const uint DefaultPtiq2Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_3_INT = 0x00220104; + + public const uint DefaultPtiq3Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_4_INT = 0x00220108; + + public const uint DefaultPtiq4Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_5_INT = 0x0022010C; + + public const uint DefaultPtiq5Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_6_INT = 0x00220110; + + public const uint DefaultPtiq6Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_7_INT = 0x00220114; + + public const uint DefaultPtiq7Int = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_0_CNT = 0x00220118; + + public const uint DefaultPtiq0Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_1_CNT = 0x0022011C; + + public const uint DefaultPtiq1Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_2_CNT = 0x00220120; + + public const uint DefaultPtiq2Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_3_CNT = 0x00220124; + + public const uint DefaultPtiq3Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_4_CNT = 0x00220128; + + public const uint DefaultPtiq4Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_5_CNT = 0x0022012C; + + public const uint DefaultPtiq5Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_6_CNT = 0x00220130; + + public const uint DefaultPtiq6Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint PTIQ_7_CNT = 0x00220134; + + public const uint DefaultPtiq7Cnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0001 + /// + public const uint PIM_CTRL = 0x00220140; + + public const uint DefaultPimCtrl = 0x00000001; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint TRASH32A0 = 0x00220FF8; + + public const uint DefaultTrash32a0 = 0xDEADDEAD; + + /// + /// Access Type: RO + /// Default Value: DEAD_DEAD + /// + public const uint TADDR32A0 = 0x00220FFC; + + public const uint DefaultTaddr32a0 = 0xDEADDEAD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint SCRATCH_RAM = 0x00240000; + + public const uint DefaultScratchRam = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__CONTROL = 0x00280000; + + public const uint DefaultGsKwControl = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0044 + /// + public const uint GS_KW__STATUS = 0x00280004; + + public const uint DefaultGsKwStatus = 0x00000044; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GS_KW__FIFO_WR_CNT = 0x00280008; + + public const uint DefaultGsKwFifoWrCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GS_KW__MSG_CNT = 0x0028000C; + + public const uint DefaultGsKwMsgCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GS_KW__RX_DATA = 0x00280010; + + public const uint DefaultGsKwRxData = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__TX_INFO = 0x00280014; + + public const uint DefaultGsKwTxInfo = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYNC = 0x00280018; + + public const uint DefaultGsKwSync = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint DACS_DISC_IN = 0x0028001C; + + public const uint DefaultDacsDiscIn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0004_3D12 + /// + public const uint IMU__FRM_CTRL = 0x00280020; + + public const uint DefaultImuFrmCtrl = 0x00043D12; + + /// + /// Access Type: RW + /// Default Value: 0000_0063 + /// + public const uint IMU__EODS_WIDTH = 0x00280024; + + public const uint DefaultImuEodsWidth = 0x00000063; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint IMU__CONTROL = 0x00280030; + + public const uint DefaultImuControl = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0044 + /// + public const uint IMU__STATUS = 0x00280034; + + public const uint DefaultImuStatus = 0x00000044; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint IMU__FIFO_WR_CNT = 0x00280038; + + public const uint DefaultImuFifoWrCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint IMU__MSG_CNT = 0x0028003C; + + public const uint DefaultImuMsgCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint IMU__RX_DATA = 0x00280040; + + public const uint DefaultImuRxData = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint IMU__TX_INFO = 0x00280044; + + public const uint DefaultImuTxInfo = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint IMU__CONFIG = 0x00280048; + + public const uint DefaultImuConfig = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint IMU__DISC_IN = 0x0028004C; + + public const uint DefaultImuDiscIn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_1111 + /// + public const uint IMU__VEL_DLTA_X = 0x00280050; + + public const uint DefaultImuVelDltaX = 0x00001111; + + /// + /// Access Type: RW + /// Default Value: 0000_2222 + /// + public const uint IMU__VEL_DLTA_Y = 0x00280054; + + public const uint DefaultImuVelDltaY = 0x00002222; + + /// + /// Access Type: RW + /// Default Value: 0000_3333 + /// + public const uint IMU__VEL_DLTA_Z = 0x00280058; + + public const uint DefaultImuVelDltaZ = 0x00003333; + + /// + /// Access Type: RW + /// Default Value: 0000_4444 + /// + public const uint IMU__AGL_DLTA_X = 0x0028005C; + + public const uint DefaultImuAglDltaX = 0x00004444; + + /// + /// Access Type: RW + /// Default Value: 0000_5555 + /// + public const uint IMU__AGL_DLTA_Y = 0x00280060; + + public const uint DefaultImuAglDltaY = 0x00005555; + + /// + /// Access Type: RW + /// Default Value: 0000_6666 + /// + public const uint IMU__AGL_DLTA_Z = 0x00280064; + + public const uint DefaultImuAglDltaZ = 0x00006666; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint IMU__STS_SUM = 0x00280068; + + public const uint DefaultImuStsSum = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_8888 + /// + public const uint IMU__MODE_MUX = 0x0028006C; + + public const uint DefaultImuModeMux = 0x00008888; + + /// + /// Access Type: RW + /// Default Value: 0000_9999 + /// + public const uint IMU__MUX_DATA = 0x00280070; + + public const uint DefaultImuMuxData = 0x00009999; + + /// + /// Access Type: RW + /// Default Value: 0000_AAAA + /// + public const uint IMU__RAW_GCNT_X = 0x00280074; + + public const uint DefaultImuRawGcntX = 0x0000AAAA; + + /// + /// Access Type: RW + /// Default Value: 0000_BBBB + /// + public const uint IMU__RAW_GCNT_Y = 0x00280078; + + public const uint DefaultImuRawGcntY = 0x0000BBBB; + + /// + /// Access Type: RW + /// Default Value: 0000_CCCC + /// + public const uint IMU__RAW_GCNT_Z = 0x0028007C; + + public const uint DefaultImuRawGcntZ = 0x0000CCCC; + + /// + /// Access Type: RW + /// Default Value: 0000_4448 + /// + public const uint IMU__CHECKSUM = 0x00280080; + + public const uint DefaultImuChecksum = 0x00004448; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint EDA_ACS__CONTROL = 0x00280090; + + public const uint DefaultEdaAcsControl = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_ACS__STATUS = 0x00280094; + + public const uint DefaultEdaAcsStatus = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_ACS__FIFO_WR_CNT = 0x00280098; + + public const uint DefaultEdaAcsFifoWrCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_ACS__MSG_CNT = 0x0028009C; + + public const uint DefaultEdaAcsMsgCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_ACS__RX_DATA = 0x002800A0; + + public const uint DefaultEdaAcsRxData = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint EDA_ACS__TX_INFO = 0x002800A4; + + public const uint DefaultEdaAcsTxInfo = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint EDA_APT__CONTROL = 0x002800A8; + + public const uint DefaultEdaAptControl = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_APT__STATUS = 0x002800AC; + + public const uint DefaultEdaAptStatus = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_APT__FIFO_WR_CNT = 0x002800B0; + + public const uint DefaultEdaAptFifoWrCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_APT__MSG_CNT = 0x002800B4; + + public const uint DefaultEdaAptMsgCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_APT__RX_DATA = 0x002800B8; + + public const uint DefaultEdaAptRxData = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint EDA_APT__TX_INFO = 0x002800BC; + + public const uint DefaultEdaAptTxInfo = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0750_000F + /// + public const uint EDA_A__CFG = 0x002800C0; + + public const uint DefaultEdaACfg = 0x0750000F; + + /// + /// Access Type: RO + /// Default Value: 0000_0201 + /// + public const uint EDA_A__EDA_STS = 0x002800C4; + + public const uint DefaultEdaAEdaSts = 0x00000201; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_A__CVCW_RX_DATA = 0x002800C8; + + public const uint DefaultEdaACvcwRxData = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_A__CV_RX_CNT = 0x002800CC; + + public const uint DefaultEdaACvRxCnt = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_A__CV_RX_DATA = 0x002800D0; + + public const uint DefaultEdaACvRxData = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_A__SCOREBOARD = 0x002800D4; + + public const uint DefaultEdaAScoreboard = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint EDA_A__KWDL_STS = 0x002800D8; + + public const uint DefaultEdaAKwdlSts = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__FWD_EN = 0x00280100; + + public const uint DefaultGsKwFwdEn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 000A_0000 + /// + public const uint GS_KW__FWD_DEST_ADDR = 0x00280104; + + public const uint DefaultGsKwFwdDestAddr = 0x000A0000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYS_ADDR_H0 = 0x00280108; + + public const uint DefaultGsKwSysAddrH0 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYS_ADDR_L0 = 0x0028010C; + + public const uint DefaultGsKwSysAddrL0 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYS_DW_CNT0 = 0x00280110; + + public const uint DefaultGsKwSysDwCnt0 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYS_ADDR_H1 = 0x00280114; + + public const uint DefaultGsKwSysAddrH1 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYS_ADDR_L1 = 0x00280118; + + public const uint DefaultGsKwSysAddrL1 = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYS_DW_CNT1 = 0x0028011C; + + public const uint DefaultGsKwSysDwCnt1 = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__SYS_ADDR_SEL = 0x00280120; + + public const uint DefaultGsKwSysAddrSel = 0x00000000; + + /// + /// Access Type: RO + /// Default Value: 0000_0000 + /// + public const uint GS_KW__FWD_STATUS = 0x00280124; + + public const uint DefaultGsKwFwdStatus = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__FLTR_EN = 0x00280130; + + public const uint DefaultGsKwFltrEn = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__FLTR_ID = 0x00280134; + + public const uint DefaultGsKwFltrId = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint GS_KW__FLTR_CNT = 0x00280138; + + public const uint DefaultGsKwFltrCnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint STRESS__CFG = 0x00280200; + + public const uint DefaultStressCfg = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint EM_TRASH = 0x00280FF8; + + public const uint DefaultEmTrash = 0xDEADDEAD; + + /// + /// Access Type: RO + /// Default Value: DEAD_DEAD + /// + public const uint EM_TADDR = 0x00280FFC; + + public const uint DefaultEmTaddr = 0xDEADDEAD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA = 0x002A0000; + + public const uint DefaultTaurora = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA__STATUS = 0x002A1000; + + public const uint DefaultTauroraStatus = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA__GO = 0x002A100C; + + public const uint DefaultTauroraGo = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TX_HEADER__LEN = 0x002A1010; + + public const uint DefaultTxHeaderLen = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TX_HEADER__BE = 0x002A1014; + + public const uint DefaultTxHeaderBe = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TX_HEADER__ADDR_H = 0x002A1018; + + public const uint DefaultTxHeaderAddrH = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TX_HEADER__ADDR_L = 0x002A101C; + + public const uint DefaultTxHeaderAddrL = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0F00 + /// + public const uint SMSN0__CONTROL = 0x002A1020; + + public const uint DefaultSmsn0Control = 0x00000F00; + + /// + /// Access Type: RW + /// Default Value: 0002_007C + /// + public const uint SMSN0__ADDR = 0x002A1024; + + public const uint DefaultSmsn0Addr = 0x0002007C; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint SMSN0__DATA_DADDRH = 0x002A1028; + + public const uint DefaultSmsn0DataDaddrh = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 000A_0130 + /// + public const uint SMSN0__DATA_DADDRL = 0x002A102C; + + public const uint DefaultSmsn0DataDaddrl = 0x000A0130; + + /// + /// Access Type: RW + /// Default Value: AAAA_AAAA + /// + public const uint HEADER__ID = 0x002A1030; + + public const uint DefaultHeaderId = 0xAAAAAAAA; + + /// + /// Access Type: RW + /// Default Value: 0000_3014 + /// + public const uint HEADER__DMA_CTRL = 0x002A1034; + + public const uint DefaultHeaderDmaCtrl = 0x00003014; + + /// + /// Access Type: RW + /// Default Value: 000A_0110 + /// + public const uint HEADER__SRC = 0x002A1038; + + public const uint DefaultHeaderSrc = 0x000A0110; + + /// + /// Access Type: RW + /// Default Value: 000A_0000 + /// + public const uint HEADER__DST = 0x002A103C; + + public const uint DefaultHeaderDst = 0x000A0000; + + /// + /// Access Type: RW + /// Default Value: 0000_0010 + /// + public const uint HEADER__BYTE_CNT = 0x002A1040; + + public const uint DefaultHeaderByteCnt = 0x00000010; + + /// + /// Access Type: RW + /// Default Value: 000A_0150 + /// + public const uint HEADER__NXP = 0x002A1044; + + public const uint DefaultHeaderNxp = 0x000A0150; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint HEADER__CBLP = 0x002A1048; + + public const uint DefaultHeaderCblp = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint HEADER__SKP_COUNT = 0x002A104C; + + public const uint DefaultHeaderSkpCount = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: BBBB_BBBB + /// + public const uint RAM__ID = 0x002A1050; + + public const uint DefaultRamId = 0xBBBBBBBB; + + /// + /// Access Type: RW + /// Default Value: 0000_3010 + /// + public const uint RAM__DMA_CTRL = 0x002A1054; + + public const uint DefaultRamDmaCtrl = 0x00003010; + + /// + /// Access Type: RW + /// Default Value: 000A_4000 + /// + public const uint RAM__SRC = 0x002A1058; + + public const uint DefaultRamSrc = 0x000A4000; + + /// + /// Access Type: RW + /// Default Value: 000A_0000 + /// + public const uint RAM__DST = 0x002A105C; + + public const uint DefaultRamDst = 0x000A0000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint RAM__BYTE_CNT = 0x002A1060; + + public const uint DefaultRamByteCnt = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint RAM__NXP = 0x002A1064; + + public const uint DefaultRamNxp = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint RAM__CBLP = 0x002A1068; + + public const uint DefaultRamCblp = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint RAM__SKP_COUNT = 0x002A106C; + + public const uint DefaultRamSkpCount = 0x00000000; + + /// + /// Access Type: RW + /// Default Value: 0000_0300 + /// + public const uint TAURORA__NFC_FIFO = 0x002A1070; + + public const uint DefaultTauroraNfcFifo = 0x00000300; + + /// + /// Access Type: RW + /// Default Value: DEAD_DEAD + /// + public const uint TAURORA__TRASH = 0x002A10F8; + + public const uint DefaultTauroraTrash = 0xDEADDEAD; + + /// + /// Access Type: RW + /// Default Value: 0000_0000 + /// + public const uint TAURORA_RAM = 0x002A4000; + + public const uint DefaultTauroraRam = 0x00000000; + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxDataError.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxDataError.cs new file mode 100644 index 0000000..9ba6da1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxDataError.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Runtime.Serialization; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + [Serializable] + public class RxDataError : Exception + { + public RxDataError() + { + // Add any type-specific logic, and supply the default message. + // + } + + public RxDataError(string message) + : base(message) + { + // Add any type-specific logic. + // + } + + public RxDataError(string message, Exception innerException) + : base(message, innerException) + { + // Add any type-specific logic for inner exceptions. + // + } + + protected RxDataError(SerializationInfo info, StreamingContext context) + : base(info, context) + { + // Implement type-specific serialization constructor logic. + // + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcAutoForwardBuffer.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcAutoForwardBuffer.cs new file mode 100644 index 0000000..552066e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcAutoForwardBuffer.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct RxSdlcAutoForwardBuffer + { + + public int InitialCapacity { get; internal set; } + + public int CurrentCapacity { get; internal set; } + + public int HighwaterLevel { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcData.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcData.cs new file mode 100644 index 0000000..9f3b052 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcData.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct RxSdlcData + { + public RxSdlcData(uint data, uint status) + { + Data = data; + Status = status; + } + + public uint Data { get; internal set; } + + public uint Status { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcMessage.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcMessage.cs new file mode 100644 index 0000000..7fca94b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/RxSdlcMessage.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct RxSdlcMessage + { + public RxSdlcMessage(List data) { MessageData = data.ToArray(); } + + public RxSdlcData[] MessageData { get; internal set; } + + public uint[] ToDataArray + { + get + { + List data = new List(); + + foreach (RxSdlcData val in MessageData) + { + data.Add(val.Data); + } + + return data.ToArray(); + } + } + + public MessageEnumerator GetEnumerator() + { + return new MessageEnumerator(this); + } + + // Declare the enumerator class: + public class MessageEnumerator + { + int nIndex; + RxSdlcMessage message; + public MessageEnumerator(RxSdlcMessage coll) + { + message = coll; + nIndex = -1; + } + + public bool MoveNext() + { + nIndex++; + return (nIndex < message.MessageData.Length); + } + + public RxSdlcData Current => message.MessageData[nIndex]; + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Scoreboard.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Scoreboard.cs new file mode 100644 index 0000000..94ac7e8 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/Scoreboard.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct Scoreboard + { + public Scoreboard(uint status) + { + EdaCVClearControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaCVClearControlMessage); + MtdCarrierEnableMessage = Convert.ToBoolean(status & (uint)BitMask.MtdCarrierEnableMessage); + KwEchoMessage = Convert.ToBoolean(status & (uint)BitMask.KwEchoMessage); + KwdlAntennaSelectMessage = Convert.ToBoolean(status & (uint)BitMask.KwdlAntennaSelectMessage); + KwdlStateControlStatusRequestMessage = Convert.ToBoolean(status & (uint)BitMask.KwdlStateControlStatusRequestMessage); + KwdlInitializeMessage = Convert.ToBoolean(status & (uint)BitMask.KwdlInitializeMessage); + EdaCryptoGoControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaCryptoGoControlMessage); + EdaTerminalIDControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaTerminalIDControlMessage); + EdaGeneralStatusRequestMessage = Convert.ToBoolean(status & (uint)BitMask.EdaGeneralStatusRequestMessage); + EdaCVControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaCVControlMessage); + EdaCVCWControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaCVCWControlMessage); + EdaTransceiverPowerControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaTransceiverPowerControlMessage); + EdaDataBusModeControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaDataBusModeControlMessage); + EdaLowPowerModeControlMessage = Convert.ToBoolean(status & (uint)BitMask.EdaLowPowerModeControlMessage); + } + + public bool EdaCVClearControlMessage { get; internal set; } + + public bool EdaCVControlMessage { get; internal set; } + + public bool EdaGeneralStatusRequestMessage { get; internal set; } + + public bool EdaTerminalIDControlMessage { get; internal set; } + + public bool EdaCryptoGoControlMessage { get; internal set; } + + public bool KwdlInitializeMessage { get; internal set; } + + public bool KwdlStateControlStatusRequestMessage { get; internal set; } + + public bool KwdlAntennaSelectMessage { get; internal set; } + + public bool KwEchoMessage { get; internal set; } + + public bool MtdCarrierEnableMessage { get; internal set; } + + public bool EdaCVCWControlMessage { get; internal set; } + + public bool EdaTransceiverPowerControlMessage { get; internal set; } + + public bool EdaDataBusModeControlMessage { get; internal set; } + + public bool EdaLowPowerModeControlMessage { get; internal set; } + + internal enum BitMask + { + EdaCVClearControlMessage = 0x0000_2000, + MtdCarrierEnableMessage = 0x0000_1000, + KwEchoMessage = 0x0000_0800, + KwdlAntennaSelectMessage = 0x0000_0400, + KwdlStateControlStatusRequestMessage = 0x0000_0200, + KwdlInitializeMessage = 0x0000_0100, + EdaCryptoGoControlMessage = 0x0000_0080, + EdaTerminalIDControlMessage = 0x0000_0040, + EdaGeneralStatusRequestMessage = 0x0000_0020, + EdaCVControlMessage = 0x0000_0010, + EdaCVCWControlMessage = 0x0000_0008, + EdaTransceiverPowerControlMessage = 0x0000_0004, + EdaDataBusModeControlMessage = 0x0000_0002, + EdaLowPowerModeControlMessage = 0x0000_0001 + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcEventArgs.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcEventArgs.cs new file mode 100644 index 0000000..9672867 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcEventArgs.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public sealed class SdlcEventArgs : EventArgs + { + /// + /// Creates a new instance of the MessageEventArgs class. For the parameter, pass in the "this" reference of the driver class + /// that instantiated the MessageEventArgs class. + /// + /// The driver class that instantiated the MessageEventArgs class. + internal SdlcEventArgs() + { + Message = string.Empty; + PrecentageFull = AutoForwardBufferCapacity.Empty; + } + + internal SdlcEventArgs(AutoForwardBufferCapacity level) + { + Message = level switch + { + AutoForwardBufferCapacity.HalfFull => "Buffer is at 50% capacity.", + AutoForwardBufferCapacity.Full => "Buffer is full and no longer capturing data.", + _ => "Buffer is less than half full or empty" + }; + + PrecentageFull = level; + } + + public string Message { get; set; } + + public AutoForwardBufferCapacity PrecentageFull { get; set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcFifoWrCount.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcFifoWrCount.cs new file mode 100644 index 0000000..711bfd6 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcFifoWrCount.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct SdlcFifoWrCount + { + public SdlcFifoWrCount(uint count) + { + RxWrCount = (int)((count & 0xffff0000) >> 16); + TxWrCount = (int)(count & 0xffff); + } + + public int RxWrCount { get; internal set; } + + public int TxWrCount { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcStatus.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcStatus.cs new file mode 100644 index 0000000..2b04d90 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/SdlcStatus.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + //public struct SdlcStatus + public struct SdlcStatus + { + public SdlcStatus(uint status) + { + DrOverrunError = Convert.ToBoolean(status & (uint)BitMask.DrError); + RxInhibited = Convert.ToBoolean(status & (uint)BitMask.RxInhibit); + TxInhibited = Convert.ToBoolean(status & (uint)BitMask.TxInhibit); + EchoLoopback = Convert.ToBoolean(status & (uint)BitMask.Echo); + InternalLoopback = Convert.ToBoolean(status & (uint)BitMask.InterruptLB); + RxMessageAborted = Convert.ToBoolean(status & (uint)BitMask.RxAbort); + RxMessageFcsError = Convert.ToBoolean(status & (uint)BitMask.RxFcs); + RxMessageDone = Convert.ToBoolean(status & (uint)BitMask.RxDone); + RxBadAddrError = Convert.ToBoolean(status & (uint)BitMask.Rba); + RxFifoOverflowed = Convert.ToBoolean(status & (uint)BitMask.RxFifoOverflow); + RxFifoEmpty = Convert.ToBoolean(status & (uint)BitMask.RxFifoEmpty); + RxFifoFull = Convert.ToBoolean(status & (uint)BitMask.RxFifoFull); + RxActive = Convert.ToBoolean(status & (uint)BitMask.RxActive); + TxFifoOverflowed = Convert.ToBoolean(status & (uint)BitMask.TxFifoOverflow); + TxFifoEmpty = Convert.ToBoolean(status & (uint)BitMask.TxFifoEmpty); + TxFifoFull = Convert.ToBoolean(status & (uint)BitMask.TxFifoFull); + TxActive = Convert.ToBoolean(status & (uint)BitMask.TxActive); + } + + #region Private Members + + private enum BitMask + { + DrError = 0x00010000, + RxInhibit = 0x00008000, + TxInhibit = 0x00004000, + Echo = 0x00002000, + InterruptLB = 0x00001000, + RxAbort = 0x00000800, + RxFcs = 0x00000400, + RxDone = 0x00000200, + Rba = 0x00000100, + RxFifoOverflow = 0x00000080, + RxFifoEmpty = 0x00000040, + RxFifoFull = 0x00000020, + RxActive = 0x00000010, + TxFifoOverflow = 0x00000008, + TxFifoEmpty = 0x00000004, + TxFifoFull = 0x00000002, + TxActive = 0x0000001 + } + + #endregion + + public bool DrOverrunError { get; internal set; } + + public bool RxInhibited { get; internal set; } + + public bool EchoLoopback { get; internal set; } + + public bool InternalLoopback { get; internal set; } + + public bool RxMessageAborted { get; internal set; } + + public bool RxMessageFcsError { get; internal set; } + + public bool RxMessageDone { get; internal set; } + + public bool RxBadAddrError { get; internal set; } + + public bool RxFifoOverflowed { get; internal set; } + + public bool RxFifoEmpty { get; internal set; } + + public bool TxInhibited { get; internal set; } + + public bool RxFifoFull { get; internal set; } + + public bool RxActive { get; internal set; } + + public bool TxActive { get; internal set; } + + public bool TxFifoOverflowed { get; internal set; } + + public bool TxFifoEmpty { get; internal set; } + + public bool TxFifoFull { get; internal set; } + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/TdfPllStatus.cs b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/TdfPllStatus.cs new file mode 100644 index 0000000..fd7fd1d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/TdfPllStatus.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Resources; +using System.Text; +using MindWorks.Nimbus; +using Ivi.Driver; + +namespace Raytheon.GuidedElectronicsUnit +{ + public struct TdfPllStatus + { + public Raytheon.GuidedElectronicsUnit.PllState AuroraBusClkLocked { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.PllState LocalBusPllLocked { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.ControlState PxiePllEnable { get; internal set; } + + public Raytheon.GuidedElectronicsUnit.PllState PxiePllLocked { get; internal set; } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/global.json b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/global.json new file mode 100644 index 0000000..8c91386 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/Source/global.json @@ -0,0 +1,5 @@ +{ + "msbuild-sdks": { + "MindWorks.Nimbus.BuildTools": "5.2.0" + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/archive/Raytheon.GuidedElectronicsUnit.Fx46 V1.2.5.msi b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/archive/Raytheon.GuidedElectronicsUnit.Fx46 V1.2.5.msi new file mode 100644 index 0000000..3dc4c72 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/Teradyne_SDLC/archive/Raytheon.GuidedElectronicsUnit.Fx46 V1.2.5.msi differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/Ivi.Dmm.Interop.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/Ivi.Dmm.Interop.dll new file mode 100644 index 0000000..7977947 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/Ivi.Dmm.Interop.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/Ivi.Driver.Interop.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/Ivi.Driver.Interop.dll new file mode 100644 index 0000000..46df938 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/Ivi.Driver.Interop.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/VTI.VTEXDmm.Interop.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/VTI.VTEXDmm.Interop.dll new file mode 100644 index 0000000..a3df75a Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/VTI.VTEXDmm.Interop.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/VTI.VTEXSwitch.Interop.dll b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/VTI.VTEXSwitch.Interop.dll new file mode 100644 index 0000000..0fb0995 Binary files /dev/null and b/Source/TSRealLib/HAL/Implementations/Common/COTS/VTI/VTI.VTEXSwitch.Interop.dll differ diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdvantech.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdvantech.cs new file mode 100644 index 0000000..e388393 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdvantech.cs @@ -0,0 +1,512 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using Raytheon.Instruments.GeneralIO; +using System.Collections.Generic; +using Automation.BDaq; +using NLog; +using Raytheon.Common; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements a Context DIO card + /// + public class DIOAdvantech : IGeneralIO, IDisposable + { + #region PrivateClassMembers + private InstantDiCtrl _inputCtrl; + private InstantDoCtrl _outputCtrl; + private string _name; + private readonly int _deviceNum; + private readonly SelfTestResult _selfTestResult; + private State _state; + private object _syncObj = new Object(); + private ErrorCode errorCode = ErrorCode.Success; + + private int _numChannelPerPort = 8; + private int _channelStartIndex = 0; + private int _numInputChannels; + private int _numOutputChannels; + private bool _shallWeInitializeOutput = false; + + private Dictionary _signalNameToChannelMap = new Dictionary(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + ~DIOAdvantech() + { + Dispose(false); + } + + private static bool BioFailed(ErrorCode err) + { + return err < ErrorCode.Success && err >= ErrorCode.ErrorHandleNotValid; + } + /// + /// Dispose the object's resources + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Shutdown(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + + /// + /// Because the user has to define each channel number in the config file, some people will use 0 or 1 start their starting channel number + /// Whether the user prefers 0 or 1 as their starting channel number, this function will then calculate the port index and bit index that the + /// driver API needs to be able to drive/read the signal + /// + /// portIndex will range from 0..N + /// bitIndex will range from 0..M + /// + private void GetPortIndexAndBitIndex(string signalName, out int portIndex, out int bitIndex) + { + portIndex = (int)(Math.Ceiling((double)((int)_signalNameToChannelMap[signalName].channelNumber + Math.Abs(_channelStartIndex - 1)) / (double)_numChannelPerPort) - 1.0); + + int multiplier = ((int)_signalNameToChannelMap[signalName].channelNumber + _numChannelPerPort) / _numChannelPerPort; + bitIndex = (((int)_signalNameToChannelMap[signalName].channelNumber + _numChannelPerPort) - (_numChannelPerPort * multiplier)) - _channelStartIndex; + if (bitIndex < 0) + { + bitIndex = _numChannelPerPort - 1; + } + } + + /// + /// Invert Contec DIO bits. + /// + private byte InvertBit(byte bitValue) + { + if (bitValue == 0) + { + return 1; + } + else if (bitValue == 1) + { + return 0; + } + else + { + throw new Exception("Unexpected input value: " + bitValue.ToString()); + } + } + private void ReadBit(int port, int bitNum, out byte data) + { + _inputCtrl.ReadBit(port, bitNum, out data); + } + private void WriteBit(int port, int bitNum, byte bitState) + { + errorCode = _outputCtrl.WriteBit(port, bitNum, bitState); + + if (BioFailed(errorCode)) + { + throw new Exception("call to WriteBit returned error: " + errorCode.ToString() + " on card: " + _name); ; + } + } + #endregion + + #region PublicClassFunctions + + /// + /// DIOAdvantech factory constructor + /// + /// + /// + public DIOAdvantech(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string dioModuleDefPath = _configuration.GetConfigurationValue(deviceName, ConfigXml.DIO_MODULE_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(dioModuleDefPath)) + dioModuleDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, dioModuleDefPath)); + + IConfigurationFile dioModuleConfig = new ConfigurationFile(dioModuleDefPath); + + Boolean.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION.ToString()), out _shallWeInitializeOutput); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.DEVICE_NUMBER.ToString()), out _deviceNum); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_INPUT_CHANNELS.ToString()), out _numInputChannels); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_OUTPUT_CHANNELS.ToString()), out _numOutputChannels); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_CHANNELS_PER_PORT.ToString()), out _numChannelPerPort); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.CHANNEL_START_INDEX.ToString()), out _channelStartIndex); + + if (!(_channelStartIndex == 0 || _channelStartIndex == 1)) + { + throw new Exception($"The value for key {ConfigIni.CHANNEL_START_INDEX.ToString()} in section {Name} must be 0 or 1 in {dioModuleDefPath}"); + } + + List outputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.OUTPUT_SIGNALS}"); + List intputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.INPUT_SIGNALS}"); + + IODatatypes.DIOChannelInfo info; + foreach (string signalName in outputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.OUTPUT_SIGNALS}", signalName); + string[] infoTokens = iniLine.Split('|'); + if (infoTokens.Length != 2) + { + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} does not contain 2 tokens"); + } + + info.channelNumber = Convert.ToUInt32(infoTokens[0]); + info.initialValue = Convert.ToInt32(infoTokens[1]); + + _signalNameToChannelMap[signalName] = info; + } + + foreach (string signalName in intputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.INPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.INPUT_SIGNALS}", signalName); + + info.channelNumber = Convert.ToUInt32(iniLine); + info.initialValue = -1; + + _signalNameToChannelMap[signalName] = info; + } + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + public DIOAdvantech(string deviceName, int deviceNum) + { + _deviceNum = deviceNum; + _name = deviceName; + + _logger = LogManager.GetCurrentClassLogger(); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + //_outputCtrl.SelectedDevice; Need to see what the card returns for this + return "This is a Advantech DIO Card " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + /// + /// Dispose of this object. + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + } + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels+_channelStartIndex} on card " + _name); + } + + GetPortIndexAndBitIndex(signalName, out int portIndex, out int bitIndex); + + ReadBit(portIndex, bitIndex, out byte data); + + return (IODatatypes.BitState)(data); + } + } + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + //@@@ do we need both of these? DO can read and write. Read may be for internal read back + _inputCtrl = new InstantDiCtrl(); + _outputCtrl = new InstantDoCtrl(); + + _inputCtrl.SelectedDevice = new DeviceInformation(_deviceNum); + _outputCtrl.SelectedDevice = new DeviceInformation(_deviceNum); + + if (_shallWeInitializeOutput) + { + foreach (KeyValuePair item in _signalNameToChannelMap) + { + if (item.Value.initialValue != -1) + { + SetBit(item.Key, (IODatatypes.BitState)item.Value.initialValue); + } + } + } + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// Return list of signal names + /// + public List GetSignalNames() + { + return new List(_signalNameToChannelMap.Keys); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public uint NumberOfInputBits + { + get + { + return (uint)_numInputChannels; + } + } + + /// + /// + /// + public uint NumberOfOutputBits + { + get + { + return (uint)_numOutputChannels; + } + } + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + // card does not support self test + //throw new NotImplementedException("card does not support self test" + " on card " + _name); + throw new NotImplementedException(); + } + } + public void Reset() + { + lock (_syncObj) + { + Shutdown(); + Initialize(); + } + } + + /// + /// + /// + /// + /// high(open) or low(closed) + /// + public void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels +_channelStartIndex} on card " + _name); + } + + GetPortIndexAndBitIndex(signalName, out int portIndex, out int bitIndex); + + WriteBit(portIndex, bitIndex, (byte)state); + } + } + public void SetTristate(string signalName) + { + throw new NotImplementedException(); + } + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + _outputCtrl.Dispose(); + _inputCtrl.Dispose(); + _state = State.Uninitialized; + } + } + } + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdvantechFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdvantechFactory.cs new file mode 100644 index 0000000..adf2d8b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdvantechFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// DIOAdvantechFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DIOAdvantechFactory")] + public class DIOAdvantechFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DIOAdvantechFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DIOAdvantechFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOAdvantech(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DIOSim(name, _configurationManager, _logger); + else + return new DIOAdvantech(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdventech.csproj b/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdventech.csproj new file mode 100644 index 0000000..ebd6b09 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOAdvantech/DIOAdventech.csproj @@ -0,0 +1,42 @@ + + + + + net472 + Raytheon.Instruments.DIOAdventech + DIO Adventech implementation + Digital IO Adventech implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\Advantech\Automation.BDaq4.dll + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/CdioCs.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/CdioCs.cs new file mode 100644 index 0000000..8b28595 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/CdioCs.cs @@ -0,0 +1,718 @@ +//============================================================- +// CDIOCS.CS +// Class file for CONTEC Digital I/O device +// CONTEC.Co.,Ltd. +//============================================================- + +using System; +using System.Runtime.InteropServices; + +public enum CdioConst +{ +//------------------------------------------------- +// Type definition +//------------------------------------------------- + DEVICE_TYPE_ISA = 0, // ISA or C bus + DEVICE_TYPE_PC = 1, // PCI bus + DEVICE_TYPE_PCMCIA = 2, // PCMCIA + DEVICE_TYPE_USB = 3, // USB + DEVICE_TYPE_FIT = 4, // FIT + DEVICE_TYPE_CARDBUS = 5, // CardBus + +//------------------------------------------------- +// Parameters +//------------------------------------------------- +// I/O(for Sample) + DIO_MAX_ACCS_PORTS = 256, +// DioNotifyInt:Logic + DIO_INT_NONE = 0, + DIO_INT_RISE = 1, + DIO_INT_FALL = 2, +// DioNotifyTrg:TrgKind + DIO_TRG_RISE = 1, + DIO_TRG_FALL = 2, +// Message + DIOM_INTERRUPT = 0x1300, + DIOM_TRIGGER = 0x1340, + DIO_DMM_STOP = 0x1350, + DIO_DMM_COUNT = 0x1360, +// Device Information + IDIO_DEVICE_TYPE = 0, // device type. Param1:short + IDIO_NUMBER_OF_8255 = 1, // Number of 8255 chip. Param1:int + IDIO_IS_8255_BOARD = 2, // Is 8255 board? Param1:BOOL(True/False) + IDIO_NUMBER_OF_DI_BIT = 3, // Number of digital input bit. Param1:int + IDIO_NUMBER_OF_DO_BIT = 4, // Number of digital outout bit. Param1:int + IDIO_NUMBER_OF_DI_PORT = 5, // Number of digital input port. Param1:int + IDIO_NUMBER_OF_DO_PORT = 6, // Number of digital output port. Param1:int + IDIO_IS_POSITIVE_LOGIC = 7, // Is positive logic? Param1:BOOL(True/False) + IDIO_IS_ECHO_BACK = 8, // Can echo back output port? Param1:BOOL(True/False) + IDIO_IS_DIRECTION = 9, // Can DioSetIoDirection function be used? Param1:int(1:true, 0:false) + IDIO_IS_FILTER = 10, // Can digital filter be used? Param1:int(1:true, 0:false) + IDIO_NUMBER_OF_INT_BIT = 11, // Number of interrupt bit. Param1:short + +// DM +// Direction + PI_32 = 1, + PO_32 = 2, + PIO_1616 = 3, + DIODM_DIR_IN = 0x1, + DIODM_DIR_OUT = 0x2, + +// Start + DIODM_START_SOFT = 1, + DIODM_START_EXT_RISE = 2, + DIODM_START_EXT_FALL = 3, + DIODM_START_PATTERN = 4, + DIODM_START_EXTSIG_1 = 5, + DIODM_START_EXTSIG_2 = 6, + DIODM_START_EXTSIG_3 = 7, + +// Clock + DIODM_CLK_CLOCK = 1, + DIODM_CLK_EXT_TRG = 2, + DIODM_CLK_HANDSHAKE = 3, + DIODM_CLK_EXTSIG_1 = 4, + DIODM_CLK_EXTSIG_2 = 5, + DIODM_CLK_EXTSIG_3 = 6, + +// Internal Clock + DIODM_TIM_UNIT_S = 1, + DIODM_TIM_UNIT_MS = 2, + DIODM_TIM_UNIT_US = 3, + DIODM_TIM_UNIT_NS = 4, + +// Stop + DIODM_STOP_SOFT = 1, + DIODM_STOP_EXT_RISE = 2, + DIODM_STOP_EXT_FALL = 3, + DIODM_STOP_NUM = 4, + DIODM_STOP_EXTSIG_1 = 5, + DIODM_STOP_EXTSIG_2 = 6, + DIODM_STOP_EXTSIG_3 = 7, + +// ExtSig + DIODM_EXT_START_SOFT_IN = 1, + DIODM_EXT_STOP_SOFT_IN = 2, + DIODM_EXT_CLOCK_IN = 3, + DIODM_EXT_EXT_TRG_IN = 4, + DIODM_EXT_START_EXT_RISE_IN = 5, + DIODM_EXT_START_EXT_FALL_IN = 6, + DIODM_EXT_START_PATTERN_IN = 7, + DIODM_EXT_STOP_EXT_RISE_IN = 8, + DIODM_EXT_STOP_EXT_FALL_IN = 9, + DIODM_EXT_CLOCK_ERROR_IN = 10, + DIODM_EXT_HANDSHAKE_IN = 11, + DIODM_EXT_TRNSNUM_IN = 12, + + DIODM_EXT_START_SOFT_OUT = 101, + DIODM_EXT_STOP_SOFT_OUT = 102, + DIODM_EXT_CLOCK_OUT = 103, + DIODM_EXT_EXT_TRG_OUT = 104, + DIODM_EXT_START_EXT_RISE_OUT= 105, + DIODM_EXT_START_EXT_FALL_OUT= 106, + DIODM_EXT_STOP_EXT_RISE_OUT = 107, + DIODM_EXT_STOP_EXT_FALL_OUT = 108, + DIODM_EXT_CLOCK_ERROR_OUT = 109, + DIODM_EXT_HANDSHAKE_OUT = 110, + DIODM_EXT_TRNSNUM_OUT = 111, + +// Status + DIODM_STATUS_BMSTOP = 0x1, + DIODM_STATUS_PIOSTART = 0x2, + DIODM_STATUS_PIOSTOP = 0x4, + DIODM_STATUS_TRGIN = 0x8, + DIODM_STATUS_OVERRUN = 0x10, + +// Error + DIODM_STATUS_FIFOEMPTY = 0x1, + DIODM_STATUS_FIFOFULL = 0x2, + DIODM_STATUS_SGOVERIN = 0x4, + DIODM_STATUS_TRGERR = 0x8, + DIODM_STATUS_CLKERR = 0x10, + DIODM_STATUS_SLAVEHALT = 0x20, + DIODM_STATUS_MASTERHALT = 0x40, + +// Reset + DIODM_RESET_FIFO_IN = 0x02, + DIODM_RESET_FIFO_OUT = 0x04, + +// Buffer Ring + DIODM_WRITE_ONCE = 0, + DIODM_WRITE_RING = 1, + +//------------------------------------------------- +// Error codes +//------------------------------------------------- +// Initialize Error +// Common + DIO_ERR_SUCCESS = 0, // normal completed + DIO_ERR_INI_RESOURCE = 1, // invalid resource reference specified + DIO_ERR_INI_INTERRUPT = 2, // invalid interrupt routine registered + DIO_ERR_INI_MEMORY = 3, // invalid memory allocationed + DIO_ERR_INI_REGISTRY = 4, // invalid registry accesse + + DIO_ERR_SYS_RECOVERED_FROM_STANDBY = 7, // Execute DioResetDevice function because the device has recovered from standby mode. + DIO_ERR_INI_NOT_FOUND_SYS_FILE = 8, // Because the Cdio.sys file is not found, it is not possible to initialize it. + DIO_ERR_INI_DLL_FILE_VERSION = 9, // Because version information on the Cdio.dll file cannot be acquired, it is not possible to initialize it. + DIO_ERR_INI_SYS_FILE_VERSION = 10, // Because version information on the Cdio.sys file cannot be acquired, it is not possible to initialize it. + DIO_ERR_INI_NO_MATCH_DRV_VERSION = 11, // Because version information on Cdio.dll and Cdio.sys is different, it is not possible to initialize it. + +// DLL Error +// Common + DIO_ERR_DLL_DEVICE_NAME = 10000, // invalid device name specified. + DIO_ERR_DLL_INVALID_ID = 10001, // invalid ID specified. + DIO_ERR_DLL_CALL_DRIVER = 10002, // not call the driver.(Invalid device I/O controller) + DIO_ERR_DLL_CREATE_FILE = 10003, // not create the file.(Invalid CreateFile) + DIO_ERR_DLL_CLOSE_FILE = 10004, // not close the file.(Invalid CloseFile) + DIO_ERR_DLL_CREATE_THREAD = 10005, // not create the thread.(Invalid CreateThread) + DIO_ERR_INFO_INVALID_DEVICE = 10050, // invalid device infomation specified .Please check the spell. + DIO_ERR_INFO_NOT_FIND_DEVICE = 10051, // not find the available device + DIO_ERR_INFO_INVALID_INFOTYPE = 10052, // specified device infomation type beyond the limit + +// DIO + DIO_ERR_DLL_BUFF_ADDRESS = 10100, // invalid data buffer address + DIO_ERR_DLL_HWND = 10200, // window handle beyond the limit + DIO_ERR_DLL_TRG_KIND = 10300, // trigger kind beyond the limit + +// SYS Error +// Common + DIO_ERR_SYS_MEMORY = 20000, // not secure memory + DIO_ERR_SYS_NOT_SUPPORTED = 20001, // this board couldn't use this function + DIO_ERR_SYS_BOARD_EXECUTING = 20002, // board is behaving, not execute + DIO_ERR_SYS_USING_OTHER_PROCESS = 20003, // other process is using the device, not execute + + STATUS_SYS_USB_CRC = 20020, // the last data packet received from end point exist CRC error + STATUS_SYS_USB_BTSTUFF = 20021, // the last data packet received from end point exist bit stuffing offense error + STATUS_SYS_USB_DATA_TOGGLE_MISMATCH = 20022, // the last data packet received from end point exist toggle packet mismatch error + STATUS_SYS_USB_STALL_PID = 20023, // end point return STALL packet identifier + STATUS_SYS_USB_DEV_NOT_RESPONDING = 20024, // device don't respond to token(IN), don't support handshake + STATUS_SYS_USB_PID_CHECK_FAILURE = 20025, + STATUS_SYS_USB_UNEXPECTED_PID = 20026, // invalid packet identifier received + STATUS_SYS_USB_DATA_OVERRUN = 20027, // end point return data quantity overrun + STATUS_SYS_USB_DATA_UNDERRUN = 20028, // end point return data quantity underrun + STATUS_SYS_USB_BUFFER_OVERRUN = 20029, // IN transmit specified buffer overrun + STATUS_SYS_USB_BUFFER_UNDERRUN = 20030, // OUT transmit specified buffer underrun + STATUS_SYS_USB_ENDPOINT_HALTED = 20031, // end point status is STALL, not transmit + STATUS_SYS_USB_NOT_FOUND_DEVINFO = 20032, // not found device infomation + STATUS_SYS_USB_ACCESS_DENIED = 20033, // Access denied + STATUS_SYS_USB_INVALID_HANDLE = 20034, // Invalid handle + +// DIO + DIO_ERR_SYS_PORT_NO = 20100, // board No. beyond the limit + DIO_ERR_SYS_PORT_NUM = 20101, // board number beyond the limit + DIO_ERR_SYS_BIT_NO = 20102, // bit No. beyond the limit + DIO_ERR_SYS_BIT_NUM = 20103, // bit number beyond the limit + DIO_ERR_SYS_BIT_DATA = 20104, // bit data beyond the limit of 0 to 1 + DIO_ERR_SYS_INT_BIT = 20200, // interrupt bit beyond the limit + DIO_ERR_SYS_INT_LOGIC = 20201, // interrupt logic beyond the limit + DIO_ERR_SYS_TIM = 20300, // timer value beyond the limit + DIO_ERR_SYS_FILTER = 20400, // filter number beyond the limit + DIO_ERR_SYS_IODIRECTION = 20500, // Direction value is out of range + +// DM + DIO_ERR_SYS_SIGNAL = 21000, // Usable signal is outside the setting range. + DIO_ERR_SYS_START = 21001, // Usable start conditions are outside the setting range. + DIO_ERR_SYS_CLOCK = 21002, // Clock conditions are outside the setting range. + DIO_ERR_SYS_CLOCK_VAL = 21003, // Clock value is outside the setting range. + DIO_ERR_SYS_CLOCK_UNIT = 21004, // Clock value unit is outside the setting range. + DIO_ERR_SYS_STOP = 21005, // Stop conditions are outside the setting range. + DIO_ERR_SYS_STOP_NUM = 21006, // Stop number is outside the setting range. + DIO_ERR_SYS_RESET = 21007, // Contents of reset are outside the setting range. + DIO_ERR_SYS_LEN = 21008, // Data number is outside the setting range. + DIO_ERR_SYS_RING = 21009, // Buffer repetition use setup is outside the setting range. + DIO_ERR_SYS_COUNT = 21010, // Data transmission number is outside the setting range. + DIO_ERR_DM_BUFFER = 21100, // Buffer was too large and has not secured. + DIO_ERR_DM_LOCK_MEMORY = 21101, // Memory has not been locked. + DIO_ERR_DM_PARAM = 21102, // Parameter error + DIO_ERR_DM_SEQUENCE = 21103 // Procedure error of execution +} + +namespace CdioCs +{ + //unsafe public delegate void PINTCALLBACK(short Id, int wParam, int lParam, void *Param); + //unsafe public delegate void PTRGCALLBACK(short Id, int wParam, int lParam, void *Param); + //unsafe public delegate void PDMCOUNTCALLBACK(short Id, int wParam, int lParam, void *Param); + //unsafe public delegate void PDMSTOPCALLBACK(short Id, int wParam, int lParam, void *Param); + + public class Cdio + { + // Definition of common functions + [DllImport("cdio.dll")] static extern int DioInit(string DeviceName, ref short Id); + [DllImport("cdio.dll")] static extern int DioExit(short Id); + [DllImport("cdio.dll")] static extern int DioResetDevice(short Id); + [DllImport("cdio.dll")] static extern int DioGetErrorString(int ErrorCode, System.Text.StringBuilder ErrorString); + + // Digital filter functions + [DllImport("cdio.dll")] static extern int DioSetDigitalFilter(short Id, short FilterValue); + [DllImport("cdio.dll")] static extern int DioGetDigitalFilter(short Id, ref short FilterValue); + + // I/O Direction functions + [DllImport("cdio.dll")] static extern int DioSetIoDirection(short Id, uint dwDir); + [DllImport("cdio.dll")] static extern int DioGetIoDirection(short Id, ref uint dwDir); + [DllImport("cdio.dll")] static extern int DioSetIoDirectionEx(short Id, uint dwDir); + [DllImport("cdio.dll")] static extern int DioGetIoDirectionEx(short Id, ref uint dwDir); + [DllImport("cdio.dll")] static extern int DioSet8255Mode(short Id, short ChipNo, short CtrlWord); + [DllImport("cdio.dll")] static extern int DioGet8255Mode(short Id, short ChipNo, ref short CtrlWord); + + // Simple I/O functions + [DllImport("cdio.dll")] static extern int DioInpByte(short Id, short PortNo, ref byte Data); + [DllImport("cdio.dll")] static extern int DioInpBit(short Id, short BitNo, ref byte Data); + [DllImport("cdio.dll")] static extern int DioOutByte(short Id, short PortNo, byte Data); + [DllImport("cdio.dll")] static extern int DioOutBit(short Id, short BitNo, byte Data); + [DllImport("cdio.dll")] static extern int DioEchoBackByte(short Id, short PortNo, ref byte Data); + [DllImport("cdio.dll")] static extern int DioEchoBackBit(short Id, short BitNo, ref byte Data); + + // Multiple I/O functions + [DllImport("cdio.dll")] static extern int DioInpMultiByte(short Id, [MarshalAs(UnmanagedType.LPArray)] short[] PortNo, short PortNum, [MarshalAs(UnmanagedType.LPArray)] byte[] Data); + [DllImport("cdio.dll")] static extern int DioInpMultiBit(short Id, [MarshalAs(UnmanagedType.LPArray)] short[] BitNo, short BitNum, [MarshalAs(UnmanagedType.LPArray)] byte[] Data); + [DllImport("cdio.dll")] static extern int DioOutMultiByte(short Id, [MarshalAs(UnmanagedType.LPArray)] short[] PortNo, short PortNum, [MarshalAs(UnmanagedType.LPArray)] byte[] Data); + [DllImport("cdio.dll")] static extern int DioOutMultiBit(short Id, [MarshalAs(UnmanagedType.LPArray)] short[] BitNo, short BitNum, [MarshalAs(UnmanagedType.LPArray)] byte[] Data); + [DllImport("cdio.dll")] static extern int DioEchoBackMultiByte(short Id, [MarshalAs(UnmanagedType.LPArray)] short[] PortNo, short PortNum, [MarshalAs(UnmanagedType.LPArray)] byte[] Data); + [DllImport("cdio.dll")] static extern int DioEchoBackMultiBit(short Id, [MarshalAs(UnmanagedType.LPArray)] short[] BitNo, short BitNum, [MarshalAs(UnmanagedType.LPArray)] byte[] Data); + + // Interrupt functions + [DllImport("cdio.dll")] static extern int DioNotifyInterrupt(short Id, short IntBit, short Logic, int hWnd); + //[DllImport("cdio.dll")] unsafe static extern int DioSetInterruptCallBackProc(short Id, PINTCALLBACK pIntCallBack, void *Param); + + // Trigger functions + [DllImport("cdio.dll")] static extern int DioNotifyTrg(short Id, short TrgBit, short TrgKind, int Tim, int hWnd); + [DllImport("cdio.dll")] static extern int DioStopNotifyTrg(short Id, short TrgBit); + //[DllImport("cdio.dll")] static extern int DioSetTrgCallBackProc(short Id, PTRGCALLBACK CallBackProc, ref int Param); + + // Information functions + [DllImport("cdio.dll")] static extern int DioGetDeviceInfo(string Device, short InfoType, ref int Param1, ref int Param2, ref int Param3); + [DllImport("cdio.dll")] static extern int DioQueryDeviceName(short Index, System.Text.StringBuilder DeviceName, System.Text.StringBuilder Device); + [DllImport("cdio.dll")] static extern int DioGetDeviceType(string Device, ref short DeviceType); + [DllImport("cdio.dll")] static extern int DioGetMaxPorts(short Id, ref short InPortNum, ref short OutPortNum); + + //dm functions + [DllImport("cdio.DLL")] static extern int DioDmSetDirection(short Id, short Direction); + [DllImport("cdio.DLL")] static extern int DioDmGetDirection(short Id, ref short Direction); + [DllImport("cdio.DLL")] static extern int DioDmSetStandAlone(short Id); + [DllImport("cdio.DLL")] static extern int DioDmSetMaster(short Id, short ExtSig1, short ExtSig2, short ExtSig3, short MasterHalt, short SlaveHalt); + [DllImport("cdio.DLL")] static extern int DioDmSetSlave(short Id, short ExtSig1, short ExtSig2, short ExtSig3, short MasterHalt, short SlaveHalt); + [DllImport("cdio.DLL")] static extern int DioDmSetStartTrigger(short Id, short Direction, short Start); + [DllImport("cdio.DLL")] static extern int DioDmSetStartPattern(short Id, uint Pattern, uint Mask); + [DllImport("cdio.DLL")] static extern int DioDmSetClockTrigger(short Id, short Direction, short Clock); + [DllImport("cdio.DLL")] static extern int DioDmSetInternalClock(short Id, short Direction, uint Clock, short Unit); + [DllImport("cdio.DLL")] static extern int DioDmSetStopTrigger(short Id, short Direction, short Stop); + [DllImport("cdio.DLL")] static extern int DioDmSetStopNumber(short Id, short Direction, uint StopNumber); + [DllImport("cdio.DLL")] static extern int DioDmFifoReset(short Id, short Reset); + [DllImport("cdio.DLL")] static extern int DioDmSetBuffer(short Id, short Direction, IntPtr Buffer, uint Length, short IsRing); + [DllImport("cdio.DLL")] static extern int DioDmSetTransferStartWait(short Id, short Time); + [DllImport("cdio.DLL")] static extern int DioDmTransferStart(short Id, short Direction); + [DllImport("cdio.DLL")] static extern int DioDmTransferStop(short Id, short Direction); + [DllImport("cdio.DLL")] static extern int DioDmGetStatus(short Id, short Direction, ref uint Status, ref uint Err); + [DllImport("cdio.DLL")] static extern int DioDmGetCount(short Id, short Direction, ref uint Count, ref uint Carry); + [DllImport("cdio.DLL")] static extern int DioDmGetWritePointer(short Id, short Direction, ref uint WritePointer, ref uint Count, ref uint Carry); + [DllImport("cdio.DLL")] static extern int DioDmSetStopEvent(short Id, short Direction, int hWnd); + //[DllImport("cdio.DLL")] unsafe static extern int DioDmSetStopCallBackProc(short Id, PDMSTOPCALLBACK CallBackProc, void *Param); + [DllImport("cdio.DLL")] static extern int DioDmSetCountEvent(short Id, short Direction, uint Count, int hWnd); + //[DllImport("cdio.DLL")] unsafe static extern int DioDmSetCountCallBackProc(short Id, PDMCOUNTCALLBACK CallBackProc, void *Param); + + // Demo Device I/O functions + [DllImport("cdio.dll")] static extern int DioSetDemoByte(short Id, short PortNo, byte Data); + [DllImport("cdio.dll")] static extern int DioSetDemoBit(short Id, short BitNo, byte Data); + + // Constructor + public Cdio() + { + } + + // Description of common functions + public int Init(string DeviceName, out short Id) + { + Id = 0; + int ret = DioInit(DeviceName, ref Id); + return ret; + } + + public int Exit(short Id) + { + int ret = DioExit(Id); + return ret; + } + + public int ResetDevice(short Id) + { + int ret = DioResetDevice(Id); + return ret; + } + + public int GetErrorString(int ErrorCode, out string ErrorString) + { + ErrorString = new String('0', 1); + System.Text.StringBuilder errorstring = new System.Text.StringBuilder(256); + int ret = DioGetErrorString(ErrorCode, errorstring); + if(ret == 0) + { + ErrorString = errorstring.ToString(); + } + return ret; + } + + // Digital filter functions + public int SetDigitalFilter(short Id, short FilterValue) + { + int ret = DioSetDigitalFilter(Id, FilterValue); + return ret; + } + + public int GetDigitalFilter(short Id, out short FilterValue) + { + FilterValue = 0; + int ret = DioGetDigitalFilter(Id, ref FilterValue); + return ret; + } + + // I/O Direction functions + public int SetIoDirection(short Id, uint dwDir) + { + int ret = DioSetIoDirection(Id, dwDir); + return ret; + } + + public int GetIoDirection(short Id, out uint dwDir) + { + dwDir = 0; + int ret = DioGetIoDirection(Id, ref dwDir); + return ret; + } + + public int Set8255Mode(short Id, short ChipNo, short CtrlWord) + { + int ret = DioSet8255Mode(Id, ChipNo, CtrlWord); + return ret; + } + + public int Get8255Mode(short Id, short ChipNo, out short CtrlWord) + { + CtrlWord = 0; + int ret = DioGet8255Mode(Id, ChipNo, ref CtrlWord); + return ret; + } + + public int SetIoDirectionEx(short Id, uint dwDir) + { + int ret = DioSetIoDirectionEx(Id, dwDir); + return ret; + } + + public int GetIoDirectionEx(short Id, out uint dwDir) + { + dwDir = 0; + int ret = DioGetIoDirectionEx(Id, ref dwDir); + return ret; + } + + // Simple I/O functions + public int InpByte(short Id, short PortNo, out byte Data) + { + Data = 0; + int ret = DioInpByte(Id, PortNo, ref Data); + return ret; + } + + public int InpBit(short Id, short BitNo, out byte Data) + { + Data = 0; + int ret = DioInpBit(Id, BitNo, ref Data); + return ret; + } + + public int OutByte(short Id, short PortNo, byte Data) + { + int ret = DioOutByte(Id, PortNo, Data); + return ret; + } + + public int OutBit(short Id, short BitNo, byte Data) + { + int ret = DioOutBit(Id, BitNo, Data); + return ret; + } + + public int EchoBackByte(short Id, short PortNo, out byte Data) + { + Data = 0; + int ret = DioEchoBackByte(Id, PortNo, ref Data); + return ret; + } + + public int EchoBackBit(short Id, short BitNo, out byte Data) + { + Data = 0; + int ret = DioEchoBackBit(Id, BitNo, ref Data); + return ret; + } + + // Multiple I/O functions + public int InpMultiByte(short Id, short[] PortNo, short PortNum, byte[] Data) + { + int ret = DioInpMultiByte(Id, PortNo, PortNum, Data); + return ret; + } + + public int InpMultiBit(short Id, short[] BitNo, short BitNum, byte[] Data) + { + int ret = DioInpMultiBit(Id, BitNo, BitNum, Data); + return ret; + } + + public int OutMultiByte(short Id, short[] PortNo, short PortNum, byte[] Data) + { + int ret = DioOutMultiByte(Id, PortNo, PortNum, Data); + return ret; + } + + public int OutMultiBit(short Id, short[] BitNo, short BitNum, byte[] Data) + { + int ret = DioOutMultiBit(Id, BitNo, BitNum, Data); + return ret; + } + + public int EchoBackMultiByte(short Id, short[] PortNo, short PortNum, byte[] Data) + { + int ret = DioEchoBackMultiByte(Id, PortNo, PortNum, Data); + return ret; + } + + public int EchoBackMultiBit(short Id, short[] BitNo, short BitNum, byte[] Data) + { + int ret = DioEchoBackMultiBit(Id, BitNo, BitNum, Data); + return ret; + } + + // Interrupt functions + public int NotifyInterrupt(short Id, short IntBit, short Logic, int hWnd) + { + int ret = DioNotifyInterrupt(Id, IntBit, Logic, hWnd); + return ret; + } + + //unsafe public int SetInterruptCallBackProc(short Id, PINTCALLBACK pIntCallBack, void *Param) + //{ + // int ret = DioSetInterruptCallBackProc(Id, pIntCallBack, Param); + // return ret; + //} + + // Trigger functions + public int NotifyTrg(short Id, short TrgBit, short TrgKind, int Tim, int hWnd) + { + int ret = DioNotifyTrg(Id, TrgBit, TrgKind, Tim, hWnd); + return ret; + } + + public int StopNotifyTrg(short Id, short TrgBit) + { + int ret = DioStopNotifyTrg(Id, TrgBit); + return ret; + } + + //public int SetTrgCallBackProc(short Id, PTRGCALLBACK CallBackProc, out int Param) + //{ + // Param = 0; + // int ret = DioSetTrgCallBackProc(Id, CallBackProc, ref Param); + // return ret; + //} + + // Information functions + public int GetDeviceInfo(string Device, short InfoType, out int Param1, out int Param2, out int Param3) + { + Param1 = 0; + Param2 = 0; + Param3 = 0; + int ret = DioGetDeviceInfo(Device, InfoType, ref Param1, ref Param2, ref Param3); + return ret; + } + + public int QueryDeviceName(short Index, out string DeviceName, out string Device) + { + DeviceName = new String('0', 1); + Device = new String('0', 1); + System.Text.StringBuilder devicename = new System.Text.StringBuilder(256); + System.Text.StringBuilder device = new System.Text.StringBuilder(256); + int ret = DioQueryDeviceName(Index, devicename, device); + if(ret == 0) + { + DeviceName = devicename.ToString(); + Device = device.ToString(); + } + return ret; + } + + public int GetDeviceType(string Device, out short DeviceType) + { + DeviceType = 0; + int ret = DioGetDeviceType(Device, ref DeviceType); + return ret; + } + + public int GetMaxPorts(short Id, out short InPortNum, out short OutPortNum) + { + InPortNum = 0; + OutPortNum = 0; + int ret = DioGetMaxPorts(Id, ref InPortNum, ref OutPortNum); + return ret; + } + + public int DmSetDirection(short Id, short Direction) + { + int ret = DioDmSetDirection(Id, Direction); + return ret; + } + + public int DmGetDirection(short Id, out short Direction) + { + Direction = 0; + int ret = DioDmGetDirection(Id, ref Direction); + return ret; + } + + public int DmSetStandAlone(short Id) + { + int ret = DioDmSetStandAlone(Id); + return ret; + } + + public int DmSetMaster(short Id, short ExtSig1, short ExtSig2, short ExtSig3, short MasterHalt, short SlaveHalt) + { + int ret = DioDmSetMaster(Id, ExtSig1, ExtSig2, ExtSig3, MasterHalt, SlaveHalt); + return ret; + } + + public int DmSetSlave(short Id, short ExtSig1, short ExtSig2, short ExtSig3, short MasterHalt, short SlaveHalt) + { + int ret = DioDmSetSlave(Id, ExtSig1, ExtSig2, ExtSig3, MasterHalt, SlaveHalt); + return ret; + } + + public int DmSetStartTrigger(short Id, short Direction, short Start) + { + int ret = DioDmSetStartTrigger(Id, Direction, Start); + return ret; + } + + public int DmSetStartPattern(short Id, uint Pattern, uint Mask) + { + int ret = DioDmSetStartPattern(Id, Pattern, Mask); + return ret; + } + + public int DmSetClockTrigger(short Id, short Direction, short Clock) + { + int ret = DioDmSetClockTrigger(Id, Direction, Clock); + return ret; + } + + public int DmSetInternalClock(short Id, short Direction, uint Clock, short Unit) + { + int ret = DioDmSetInternalClock(Id, Direction, Clock, Unit); + return ret; + } + + public int DmSetStopTrigger(short Id, short Direction, short Stop) + { + int ret = DioDmSetStopTrigger(Id, Direction, Stop); + return ret; + } + + public int DmSetStopNumber(short Id, short Direction, uint StopNumber) + { + int ret = DioDmSetStopNumber(Id, Direction, StopNumber); + return ret; + } + + public int DmFifoReset(short Id, short Reset) + { + int ret = DioDmFifoReset(Id, Reset); + return ret; + } + + public int DmSetBuffer(short Id, short Direction, IntPtr Buffer, uint Length, short IsRing) + { + int ret = DioDmSetBuffer(Id, Direction, Buffer, Length, IsRing); + return ret; + } + + public int DmSetTransferStartWait(short Id, short Time) + { + int ret = DioDmSetTransferStartWait(Id, Time); + return ret; + } + + public int DmTransferStart(short Id, short Direction) + { + int ret = DioDmTransferStart(Id, Direction); + return ret; + } + + public int DmTransferStop(short Id, short Direction) + { + int ret = DioDmTransferStop(Id, Direction); + return ret; + } + + public int DmGetStatus(short Id, short Direction, out uint Status, out uint Err) + { + Status = 0; + Err = 0; + int ret = DioDmGetStatus(Id, Direction, ref Status, ref Err); + return ret; + } + + public int DmGetCount(short Id, short Direction, out uint Count, out uint Carry) + { + Count = 0; + Carry = 0; + int ret = DioDmGetCount(Id, Direction, ref Count, ref Carry); + return ret; + } + + public int DmGetWritePointer(short Id, short Direction, out uint WritePointer, out uint Count, out uint Carry) + { + WritePointer = 0; + Count = 0; + Carry = 0; + int ret = DioDmGetWritePointer(Id, Direction, ref WritePointer, ref Count, ref Carry); + return ret; + } + + public int DmSetStopEvent(short Id, short Direction, int hWnd) + { + int ret = DioDmSetStopEvent(Id, Direction, hWnd); + return ret; + } + + //unsafe public int DmSetStopCallBackProc(short Id, PDMSTOPCALLBACK CallBackProc, void *Param) + //{ + // int ret = DioDmSetStopCallBackProc(Id, CallBackProc, Param); + // return ret; + //} + + public int DmSetCountEvent(short Id, short Direction, uint Count, int hWnd) + { + int ret = DioDmSetCountEvent(Id, Direction, Count, hWnd); + return ret; + } + + //unsafe public int DmSetCountCallBackProc(short Id, PDMCOUNTCALLBACK CallBackProc, void *Param) + //{ + // int ret = DioDmSetCountCallBackProc(Id, CallBackProc, Param); + // return ret; + //} + + public int SetDemoByte(short Id, short PortNo, byte Data) + { + int ret = DioSetDemoByte(Id, PortNo, Data); + return ret; + } + + public int SetDemoBit(short Id, short BitNo, byte Data) + { + int ret = DioSetDemoBit(Id, BitNo, Data); + return ret; + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContec.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContec.cs new file mode 100644 index 0000000..49267b8 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContec.cs @@ -0,0 +1,613 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using CdioCs; +using Raytheon.Instruments.GeneralIO; +using System.Collections.Generic; +using NLog; +using Raytheon.Common; +using System.ComponentModel.Composition.Primitives; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements a Contec DIO card + /// + public class DIOContec : IGeneralIO, IDisposable + { + #region PrivateClassMembers + private Cdio _dio; + private short _id; + private string _name; + private string _address; + private SelfTestResult _selfTestResult; + private State _state; + private object _syncObj = new Object(); + + private int _numChannelPerPort = 8; + private int _channelStartIndex = 0; + private int _numInputChannels; + private int _numOutputChannels; + private bool _shallWeInitializeOutput = false; + + private Dictionary _signalNameToChannelMap = new Dictionary(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + + /// + /// Dispose of this object's resources + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _dio.Exit(_id); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + + /// + /// Invert Contec DIO bits. + /// + private byte InvertBit(byte bitValue) + { + if (bitValue == 0) + { + return 1; + } + else if (bitValue == 1) + { + return 0; + } + else + { + throw new Exception("Unexpected input value: " + bitValue.ToString()); + } + } + + #endregion + + #region PublicClassFunctions + + /// + /// DIOContec factory constructor + /// + /// + /// + public DIOContec(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("DIOContec", "Address", ""); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string dioModuleDefPath = _configuration.GetConfigurationValue(deviceName, ConfigXml.DIO_MODULE_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(dioModuleDefPath)) + dioModuleDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, dioModuleDefPath)); + + IConfigurationFile dioModuleConfig = new ConfigurationFile(dioModuleDefPath); + + Boolean.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION.ToString()), out _shallWeInitializeOutput); + + _address = dioModuleConfig.ReadValue(Name, ConfigIni.DIO_ADDRESS.ToString()); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_INPUT_CHANNELS.ToString()), out _numInputChannels); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_OUTPUT_CHANNELS.ToString()), out _numOutputChannels); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_CHANNELS_PER_PORT.ToString()), out _numChannelPerPort); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.CHANNEL_START_INDEX.ToString()), out _channelStartIndex); + + if (!(_channelStartIndex == 0 || _channelStartIndex == 1)) + { + throw new Exception($"The value for key {ConfigIni.CHANNEL_START_INDEX.ToString()} in section {Name} must be 0 or 1 in {dioModuleDefPath}"); + } + + List outputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.OUTPUT_SIGNALS}"); + List intputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.INPUT_SIGNALS}"); + + IODatatypes.DIOChannelInfo info; + foreach (string signalName in outputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.OUTPUT_SIGNALS}", signalName); + string[] infoTokens = iniLine.Split('|'); + if (infoTokens.Length != 2) + { + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} does not contain 2 tokens"); + } + + info.channelNumber = Convert.ToUInt32(infoTokens[0]); + info.initialValue = Convert.ToInt32(infoTokens[1]); + + _signalNameToChannelMap[signalName] = info; + } + + foreach (string signalName in intputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.INPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.INPUT_SIGNALS}", signalName); + + info.channelNumber = Convert.ToUInt32(iniLine); + info.initialValue = -1; + + _signalNameToChannelMap[signalName] = info; + } + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + + // set in Initialize() + _dio = null; + _id = -1; + } + + /// + /// Constructor which opens a handle to the DIO instrument and resets it. + /// Note that all signals on the Contec DIO card are inverted. + /// This class masks the inversion so that the caller does not have to deal with it. + /// + public DIOContec(string name, string address, List inputPins, List outputPins) + { + _name = name; + + _address = address; + + _logger = LogManager.GetCurrentClassLogger(); + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + + // set in Initialize() + _dio = null; + _id = -1; + } + + /// + /// The finalizer. + /// + ~DIOContec() + { + Dispose(false); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Contec DIO Card " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + byte dioData = 0; + + int ret = _dio.InpBit(_id, (short)bitIndex, out dioData); + + if (ret != 0) + { + string errorString = ""; + + _dio.GetErrorString(ret, out errorString); + + throw new Exception("call to InpBit returned error: " + ret.ToString() + ", " + errorString + " on card " + _name); + } + + return (IODatatypes.BitState)InvertBit(dioData); + } + } + + /// + /// Get state of an output signal. The contec DIO states are inverted. + /// This function masks the inversion before returning. + /// + /// The bit number of the signal. + /// The state of the signal. 0 for low, 1 for high. + /*public DioMeasurementInstruments.SignalState GetOutputSignalState(uint bitno) + { + byte dioData = 0; + + int ret = _dio.EchoBackBit(_id, (short)bitno, out dioData); + + if (ret != 0) + { + string errorString = ""; + + _dio.GetErrorString(ret, out errorString); + + throw new Exception("call to EchoBackBit returned error: " + ret.ToString() + ", " + errorString); + } + + dioData = InvertBit(dioData); + + if (dioData == 0) + { + return DioMeasurementInstruments.SignalState.LOW; + } + else + { + return DioMeasurementInstruments.SignalState.HIGH; + } + }*/ + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _dio = new Cdio(); + + int ret = _dio.Init(_address, out _id); + + if (ret != 0) + { + string errorString = ""; + + _dio.GetErrorString(ret, out errorString); + + throw new Exception("call to Init returned error: " + ret.ToString() + ", " + errorString + " on card " + _name); + } + + Reset(); + + if (_shallWeInitializeOutput) + { + foreach (KeyValuePair item in _signalNameToChannelMap) + { + if (item.Value.initialValue != -1) + { + SetBit(item.Key, (IODatatypes.BitState)item.Value.initialValue); + } + } + } + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// Return list of signal names + /// + public List GetSignalNames() + { + return new List(_signalNameToChannelMap.Keys); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public uint NumberOfInputBits + { + get + { + return (uint)_numInputChannels; + } + } + + /// + /// + /// + public uint NumberOfOutputBits + { + get + { + return (uint)_numOutputChannels; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + // card does not support self test + throw new NotImplementedException("card does not support self test" + " on card " + _name); + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + int ret = _dio.ResetDevice(_id); + + if (ret != 0) + { + string errorString = ""; + + _dio.GetErrorString(ret, out errorString); + + throw new Exception("call to ResetDevice returned error: " + ret.ToString() + ", " + errorString + " on card " + _name); + } + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + /// high(open) or low(closed) + /// + public void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + int ret = _dio.OutBit(_id, (short)bitIndex, InvertBit((byte)state)); + + if (ret != 0) + { + string errorString = ""; + + _dio.GetErrorString(ret, out errorString); + + throw new Exception("call to OutBit returned error: " + ret.ToString() + ", " + errorString + " on card " + _name); + } + } + } + + /// + /// + /// + /// + public void SetTristate(string signalName) + { + lock (_syncObj) + { + } + } + + /// + /// + /// + /// + /// + /// + public void StartClock(uint bit, double frequencyInHz, double dutyCylePercentage) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void StopClock(uint bit) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + Reset(); + + _dio.Exit(_id); + + _state = State.Uninitialized; + } + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContec.csproj b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContec.csproj new file mode 100644 index 0000000..d14db91 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContec.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.DIOContec + DIO Contec implementation + Digital IO Contec implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContecFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContecFactory.cs new file mode 100644 index 0000000..4a2365f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOContec/DIOContecFactory.cs @@ -0,0 +1,141 @@ +// ********************************************************************************************************** +// DIOContecFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +// Ignore Spelling: Contec + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DIOContecFactory")] + public class DIOContecFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DIOContecFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DIOContecFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOContec(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DIOSim(name, _configurationManager, _logger); + else + return new DIOContec(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40x.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40x.cs new file mode 100644 index 0000000..485e0f5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40x.cs @@ -0,0 +1,482 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using Raytheon.Instruments.GeneralIO; +using System.Collections.Generic; +using Raytheon.Common; +using NLog; +using Pickering.Lxi.Communication; +using Pickering.Lxi.Piplx; +using Pickering.Lxi; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements a Pickering DIO card + /// + public class DIOPickering40x : IGeneralIO, IDisposable + { + #region PrivateClassMembers + private string _name; + private readonly int _pxiCardSlotIndex; + private SelfTestResult _selfTestResult; + private State _state; + private object _syncObj = new Object(); + private PiplxCard _dioCard; + private int _numChannelPerPort = 8; + private int _channelStartIndex = 0; + private int _numInputChannels; + private int _numOutputChannels; + private bool _shallWeInitializeOutput = false; + + private Dictionary _signalNameToChannelMap = new Dictionary(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + + /// + /// The finalizer. + /// + ~DIOPickering40x() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + // nothing to do here + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicClassFunctions + + /// + /// DIOPickering40x factory constructor + /// + /// + /// + public DIOPickering40x(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string dioModuleDefPath = _configuration.GetConfigurationValue(deviceName, ConfigXml.DIO_MODULE_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(dioModuleDefPath)) + dioModuleDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, dioModuleDefPath)); + + IConfigurationFile dioModuleConfig = new ConfigurationFile(dioModuleDefPath); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.PXI_CARD_SLOT_INDEX.ToString()), out _pxiCardSlotIndex); + + Boolean.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION.ToString()), out _shallWeInitializeOutput); + + List outputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.OUTPUT_SIGNALS}"); + List intputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.INPUT_SIGNALS}"); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_CHANNELS_PER_PORT.ToString()), out _numChannelPerPort); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.CHANNEL_START_INDEX.ToString()), out _channelStartIndex); + + if (!(_channelStartIndex == 0 || _channelStartIndex == 1)) + { + throw new Exception($"The value for key {ConfigIni.CHANNEL_START_INDEX.ToString()} in section {Name} must be 0 or 1 in {dioModuleDefPath}"); + } + + IODatatypes.DIOChannelInfo info; + foreach (string signalName in outputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.OUTPUT_SIGNALS}", signalName); + string[] infoTokens = iniLine.Split('|'); + if (infoTokens.Length != 2) + { + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} does not contain 2 tokens"); + } + + info.channelNumber = Convert.ToUInt32(infoTokens[0]); + info.initialValue = Convert.ToInt32(infoTokens[1]); + + _signalNameToChannelMap[signalName] = info; + } + + foreach (string signalName in intputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.INPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.INPUT_SIGNALS}", signalName); + + info.channelNumber = Convert.ToUInt32(iniLine); + info.initialValue = -1; + + _signalNameToChannelMap[signalName] = info; + } + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + /// + /// Initialize the card + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + PiplxManager manager = new PiplxManager(""); + + _dioCard = (PiplxCard)manager.Cards[_pxiCardSlotIndex]; + + PiplxCardInfo info = (PiplxCardInfo)_dioCard.Info; + + _numInputChannels = info.InputSubunitsCount * _numChannelPerPort; + _numOutputChannels = info.OutputSubunitsCount * _numChannelPerPort; + + _dioCard.Open(); + + if (_shallWeInitializeOutput) + { + foreach (KeyValuePair item in _signalNameToChannelMap) + { + if (item.Value.initialValue != -1) + { + SetBit(item.Key, (IODatatypes.BitState)item.Value.initialValue); + } + } + } + + _state = State.Ready; + } + else + { + throw new Exception("Expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// Return list of signal names + /// + public List GetSignalNames() + { + return new List(_signalNameToChannelMap.Keys); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Pickering DIO Card " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels +_channelStartIndex} on card " + _name); + } + + GetPortIndexAndBitIndex(signalName, out int portIndex, out int bitIndex); + + DigitalInputOutputSubunit subunit = (DigitalInputOutputSubunit)_dioCard.OutputSubunits[portIndex]; + + subunit[bitIndex+1] = state != 0; + } + } + + /// + /// + /// + /// + /// + public IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels+_channelStartIndex} on card " + _name); + } + + GetPortIndexAndBitIndex(signalName, out int portIndex, out int bitIndex); + + DigitalInputOutputSubunit subunit = (DigitalInputOutputSubunit)_dioCard.InputSubunits[portIndex]; + + return (IODatatypes.BitState)(subunit[bitIndex+1] ? 1:0); + } + } + + /// + /// Because the user has to define each channel number in the config file, some people will use 0 or 1 start their starting channel number + /// Whether the user prefers 0 or 1 as their starting channel number, this function will then calculate the port index and bit index that the + /// driver API needs to be able to drive/read the signal + /// + /// portIndex will range from 0..N + /// bitIndex will range from 0..M + /// + private void GetPortIndexAndBitIndex(string signalName, out int portIndex, out int bitIndex) + { + portIndex = (int)(Math.Ceiling((double)((int)_signalNameToChannelMap[signalName].channelNumber + Math.Abs(_channelStartIndex - 1)) / (double)_numChannelPerPort) - 1.0); + + int multiplier = ((int)_signalNameToChannelMap[signalName].channelNumber + _numChannelPerPort) / _numChannelPerPort; + bitIndex = (((int)_signalNameToChannelMap[signalName].channelNumber + _numChannelPerPort) - (_numChannelPerPort * multiplier)) - _channelStartIndex; + if (bitIndex < 0) + { + bitIndex = _numChannelPerPort - 1; + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public uint NumberOfInputBits + { + get + { + return (uint)_numInputChannels; + } + } + + /// + /// + /// + public uint NumberOfOutputBits + { + get + { + return (uint)_numOutputChannels; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + Shutdown(); + Initialize(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + public void SetTristate(string signalName) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + _state = State.Uninitialized; + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40x.csproj b/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40x.csproj new file mode 100644 index 0000000..d49f915 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40x.csproj @@ -0,0 +1,45 @@ + + + + + net472 + Raytheon.Instruments.DIOPickering40x + DIO Sim implementation + DIO Sim implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\Pickering\Pickering.Lxi.Communication.dll + + + ..\..\Common\COTS\Pickering\Pickering.Lxi.Piplx.dll + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40xFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40xFactory.cs new file mode 100644 index 0000000..6f660be --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOPickering40x/DIOPickering40xFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// DIOPickering40xFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DIOPickering40xFactory")] + public class DIOPickering40xFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DIOPickering40xFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DIOPickering40xFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOPickering40x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DIOSim(name, _configurationManager, _logger); + else + return new DIOPickering40x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/CP210xRuntime.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/CP210xRuntime.cs new file mode 100644 index 0000000..8eda9b8 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/CP210xRuntime.cs @@ -0,0 +1,141 @@ +using System; +using System.Runtime.InteropServices; + +namespace CP210xRuntime_DLL +{ + internal class CP210xRuntime + { + public const int CP210x_MAX_MAXPOWER = 250; + + //GetPartNumber() + public const byte CP210x_CP2108_VERSION = ((Byte)(0xFF & 0x08)); + + // GetProductString() function flags + public const byte CP210x_RETURN_SERIAL_NUMBER = 0x00; + public const byte CP210x_RETURN_DESCRIPTION = 0x01; + public const byte CP210x_RETURN_FULL_PATH = 0x02; + + // GetDeviceVersion() return codes Deprecated + //public const byte CP210x_USBXPRESS_EFM8 = 0x80; + //public const byte CP210x_USBXPRESS_EFM32 = 0x81; + //public const byte CP210x_CP2101_VERSION = 0x01; + //public const byte CP210x_CP2102_VERSION = 0x02; + //public const byte CP210x_CP2103_VERSION = 0x03; + //public const byte CP210x_CP2104_VERSION = 0x04; + //public const byte CP210x_CP2105_VERSION = 0x05; + //public const byte CP210x_CP2108_VERSION = 0x08; + //public const byte CP210x_CP2109_VERSION = 0x09; + //public const byte CP210x_CP2102N_QFN28_VERSION = 0x20; + //public const byte CP210x_CP2102N_QFN24_VERSION = 0x21; + //public const byte CP210x_CP2102N_QFN20_VERSION = 0x22; + + // Return codes + public const byte CP210x_SUCCESS = 0x00; + public const byte CP210x_DEVICE_NOT_FOUND = 0xFF; + public const byte CP210x_INVALID_HANDLE = 0x01; + public const byte CP210x_INVALID_PARAMETER = 0x02; + public const byte CP210x_DEVICE_IO_FAILED = 0x03; + public const byte CP210x_FUNCTION_NOT_SUPPORTED = 0x04; + public const byte CP210x_GLOBAL_DATA_ERROR = 0x05; + public const byte CP210x_FILE_ERROR = 0x06; + public const byte CP210x_COMMAND_FAILED = 0x08; + public const byte CP210x_INVALID_ACCESS_TYPE = 0x09; + + // Buffer size limits + //public const int CP2108_MAX_PRODUCT_STRLEN = 126; + //public const int CP2108_MAX_SERIAL_STRLEN = 63; + + // Type Definitions + //readonly char CP210x_PRODUCT_STRING[] = new char[CP2108_MAX_PRODUCT_STRLEN](); + //char CP210x_SERIAL_STRING[CP2108_MAX_SERIAL_STRLEN]; + + // Mask and Latch value bit definitions + public const UInt32 CP210x_GPIO_0 = 0x0001; // (1<<0) + public const UInt32 CP210x_GPIO_1 = 0x0002; // (1<<1) + public const UInt32 CP210x_GPIO_2 = 0x0004; // (1<<2) + public const UInt32 CP210x_GPIO_3 = 0x0008;// etc. + public const UInt32 CP210x_GPIO_4 = 0x0010; + public const UInt32 CP210x_GPIO_5 = 0x0020; + public const UInt32 CP210x_GPIO_6 = 0x0040; + public const UInt32 CP210x_GPIO_7 = 0x0080; + public const UInt32 CP210x_GPIO_8 = 0x0100; + public const UInt32 CP210x_GPIO_9 = 0x0200; + public const UInt32 CP210x_GPIO_10 = 0x0400; + public const UInt32 CP210x_GPIO_11 = 0x0800; + public const UInt32 CP210x_GPIO_12 = 0x1000; + public const UInt32 CP210x_GPIO_13 = 0x2000; + public const UInt32 CP210x_GPIO_14 = 0x4000; + public const UInt32 CP210x_GPIO_15 = 0x8000; + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_GetNumDevices( + ref uint lpdwNumDevices + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_Open( + uint deviceIndex, + ref IntPtr pcyHandle + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_Close( + IntPtr cyHandle + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_ReadLatch( + IntPtr cyHandle, + ref ushort lpwLatch + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_WriteLatch( + IntPtr cyHandle, + ushort Mask, + ushort Latch + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_GetPartNumber( + IntPtr cyHandle, + ref byte lpbPartNum + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_GetDeviceProductString( + IntPtr cyHandle, + [Out] byte[] lpProduct, + ref byte lpbLength, + bool bConvertToASCII + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_GetDeviceSerialNumber( + IntPtr cyHandle, + [Out] byte[] lpSerialNumberString, + ref byte lpbLength, + bool bConvertToASCII + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_GetDeviceInterfaceString( + IntPtr cyHandle, + [Out] byte[] lpInterfaceString, + ref byte lpbLength, + bool bConvertToASCII + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_GetReceiverMaxTimeout( + IntPtr cyHandle, + ref UInt16 maxTimeout + ); + + [DllImport("CP210xRuntime.dll")] + public static extern int CP210xRT_SetReceiverMaxTimeout( + IntPtr cyHandle, + UInt16 maxTimeout + ); + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210x.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210x.cs new file mode 100644 index 0000000..a14b832 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210x.cs @@ -0,0 +1,664 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using Raytheon.Instruments.GeneralIO; +using System.Collections.Generic; +using CP210xRuntime_DLL; +using NLog; +using Raytheon.Common; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + /// + /// Class for controlling a Silicon Labs CP2108 UART GPIO device + /// + public class DIOSiCp210x : IGeneralIO, IDisposable + { + + #region PrivateClassMembers + protected IntPtr _handle; + protected uint _deviceNum; + protected State _state; + protected string _name; + protected IConfigurationFile _dioModuleConfig; + protected SelfTestResult _selfTestResult; + protected object _syncObj = new Object(); + + protected int _numChannelPerPort = 8; + protected int _channelStartIndex = 0; + protected int _numInputChannels; + protected int _numOutputChannels; + protected bool _shallWeInitializeOutput = false; + + protected Dictionary _signalNameToChannelMap = new Dictionary(); + + protected const ushort CP210x_GPIO_0 = 0x0001; + protected const ushort CP210x_GPIO_1 = 0x0002; + protected const ushort CP210x_GPIO_2 = 0x0004; + protected const ushort CP210x_GPIO_3 = 0x0008; + protected const ushort CP210x_GPIO_4 = 0x0010; + protected const ushort CP210x_GPIO_5 = 0x0020; + protected const ushort CP210x_GPIO_6 = 0x0040; + protected const ushort CP210x_GPIO_7 = 0x0080; + protected const ushort CP210x_GPIO_8 = 0x0100; + protected const ushort CP210x_GPIO_9 = 0x0200; + protected const ushort CP210x_GPIO_10 = 0x0400; + protected const ushort CP210x_GPIO_11 = 0x0800; + protected const ushort CP210x_GPIO_12 = 0x1000; + protected const ushort CP210x_GPIO_13 = 0x2000; + protected const ushort CP210x_GPIO_14 = 0x4000; + protected const ushort CP210x_GPIO_15 = 0x8000; + + // Return codes + public const byte SI_SUCCESS = 0x00; + public const byte SI_DEVICE_NOT_FOUND = 0xFF; + public const byte SI_INVALID_HANDLE = 0x01; + public const byte SI_READ_ERROR = 0x02; + public const byte SI_RX_QUEUE_NOT_READY = 0x03; + public const byte SI_WRITE_ERROR = 0x04; + public const byte SI_RESET_ERROR = 0x05; + public const byte SI_INVALID_PARAMETER = 0x06; + public const byte SI_INVALID_REQUEST_LENGTH = 0x07; + public const byte SI_DEVICE_IO_FAILED = 0x08; + public const byte SI_INVALID_BAUDRATE = 0x09; + public const byte SI_FUNCTION_NOT_SUPPORTED = 0x0a; + public const byte SI_GLOBAL_DATA_ERROR = 0x0b; + public const byte SI_SYSTEM_ERROR_CODE = 0x0c; + public const byte SI_READ_TIMED_OUT = 0x0d; + public const byte SI_WRITE_TIMED_OUT = 0x0e; + public const byte SI_IO_PENDING = 0x0f; + public const byte SI_NOTHING_TO_CANCEL = 0xa0; + + /// + /// NLog logger + /// + protected ILogger _logger; + /// + /// Raytheon configuration + /// + protected readonly IConfigurationManager _configurationManager; + protected readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + ~DIOSiCp210x() + { + Dispose(false); + } + + /// + /// + /// + protected void Close() + { + int ret = CP210xRuntime.CP210xRT_Close(_handle); + + if (ret != SI_SUCCESS) + { + throw new Exception("call to close returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// Dispose the object's resources + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Close(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + + /// + /// + /// + /// + /// + /// + protected void GetDeviceProductString(ref byte[] product, ref byte length, bool convertToAscii) + { + int ret = CP210xRuntime.CP210xRT_GetDeviceProductString(_handle, product, ref length, convertToAscii); + if (ret != SI_SUCCESS) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + protected void GetNumDevices(ref uint numDevices) + { + int ret = CP210xRuntime.CP210xRT_GetNumDevices(ref numDevices); + if (ret != SI_SUCCESS) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + protected void GetPartNumber(ref byte partNumber) + { + int ret = CP210xRuntime.CP210xRT_GetPartNumber(_handle, ref partNumber); + if (ret != SI_SUCCESS) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + protected void Open() + { + int ret = CP210xRuntime.CP210xRT_Open(_deviceNum, ref _handle); + + if (ret != SI_SUCCESS) + { + throw new Exception("call to open returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + protected virtual void ReadLatch(ref ushort latch) + { + int ret = CP210xRuntime.CP210xRT_ReadLatch(_handle, ref latch); + + if (ret != SI_SUCCESS) + { + throw new Exception("call to read latch returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + /// + protected virtual void WriteLatch(ushort mask, ushort latch) + { + int ret = CP210xRuntime.CP210xRT_WriteLatch(_handle, mask, latch); + + if (ret != SI_SUCCESS) + { + throw new Exception("call to write latch returned error: " + ret.ToString() + " on card: " + _name); + } + } + + #endregion + + #region PublicClassFunctions + + /// + /// DIOSiCp210x factory constructor + /// + /// + /// + public DIOSiCp210x(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string dioModuleDefPath = _configuration.GetConfigurationValue(deviceName, ConfigXml.DIO_MODULE_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(dioModuleDefPath)) + dioModuleDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, dioModuleDefPath)); + + _dioModuleConfig = new ConfigurationFile(dioModuleDefPath); + + Boolean.TryParse(_dioModuleConfig.ReadValue(Name, ConfigIni.SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION.ToString()), out _shallWeInitializeOutput); + + UInt32.TryParse(_dioModuleConfig.ReadValue(Name, ConfigIni.DEVICE_NUMBER.ToString()), out _deviceNum); + + Int32.TryParse(_dioModuleConfig.ReadValue(Name, ConfigIni.NUM_INPUT_CHANNELS.ToString()), out _numInputChannels); + Int32.TryParse(_dioModuleConfig.ReadValue(Name, ConfigIni.NUM_OUTPUT_CHANNELS.ToString()), out _numOutputChannels); + + Int32.TryParse(_dioModuleConfig.ReadValue(Name, ConfigIni.NUM_CHANNELS_PER_PORT.ToString()), out _numChannelPerPort); + Int32.TryParse(_dioModuleConfig.ReadValue(Name, ConfigIni.CHANNEL_START_INDEX.ToString()), out _channelStartIndex); + + if (!(_channelStartIndex == 0 || _channelStartIndex == 1)) + { + throw new Exception($"The value for key {ConfigIni.CHANNEL_START_INDEX.ToString()} in section {Name} must be 0 or 1 in {dioModuleDefPath}"); + } + + List outputSignalNames = _dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.OUTPUT_SIGNALS}"); + List intputSignalNames = _dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.INPUT_SIGNALS}"); + + IODatatypes.DIOChannelInfo info; + foreach (string signalName in outputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = _dioModuleConfig.ReadValue($"{Name}.{ConfigIni.OUTPUT_SIGNALS}", signalName); + string[] infoTokens = iniLine.Split('|'); + if (infoTokens.Length != 2) + { + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} does not contain 2 tokens"); + } + + info.channelNumber = Convert.ToUInt32(infoTokens[0]); + info.initialValue = Convert.ToInt32(infoTokens[1]); + + _signalNameToChannelMap[signalName] = info; + } + + foreach (string signalName in intputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.INPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = _dioModuleConfig.ReadValue($"{Name}.{ConfigIni.INPUT_SIGNALS}", signalName); + + info.channelNumber = Convert.ToUInt32(iniLine); + info.initialValue = -1; + + _signalNameToChannelMap[signalName] = info; + } + + _handle = IntPtr.Zero; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + /// + /// + public DIOSiCp210x(string deviceName, uint deviceNum) + { + _deviceNum = deviceNum; + _name = deviceName; + _handle = IntPtr.Zero; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + + _logger = LogManager.GetCurrentClassLogger(); + + //for(int i = 0; i < inputPins.Count; i++) + //{ + // inputPins[i] = Convert.ToUInt32(Math.Pow(2, Convert.ToDouble(inputPins[i]))); + //} + + + //@@@ Do we need to pass in more args to configure the DIO (Baud?) + } + + /// + /// + /// + /// + public bool ClearErrors() + { + //could use this to cancel IO and flush the buffers + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + byte arrSize = 255; + byte[] deviceStringArray = new byte[arrSize]; + GetDeviceProductString(ref deviceStringArray, ref arrSize, true); + return "This is a Silicon Labs CP2108 device: " + deviceStringArray.ToString(); + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public virtual IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + ushort latchValue = 0; + ushort mask = (ushort)(0x1 << (int)bitIndex); + + ReadLatch(ref latchValue); + + return (IODatatypes.BitState)(latchValue & mask); + + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + //@@@ call the other setup functions..Baud? Flow? Timeout? Others? + Open(); + + if (_shallWeInitializeOutput) + { + foreach (KeyValuePair item in _signalNameToChannelMap) + { + if (item.Value.initialValue != -1) + { + SetBit(item.Key, (IODatatypes.BitState)item.Value.initialValue); + } + } + } + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// Return list of signal names + /// + public List GetSignalNames() + { + return new List(_signalNameToChannelMap.Keys); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public uint NumberOfInputBits + { + get + { + return (uint)_numInputChannels; + } + } + + /// + /// + /// + public uint NumberOfOutputBits + { + get + { + return (uint)_numOutputChannels; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + // card does not support self test + //throw new NotImplementedException("card does not support self test" + " on card " + _name); + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + Close(); + Open(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + /// high(open) or low(closed) + /// + public virtual void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + ushort mask = (ushort)(0x1 << (int)bitIndex); + + if (state == IODatatypes.BitState.High) + { + WriteLatch(mask, mask); + } + else + { + WriteLatch(mask, 0); + } + } + } + + /// + /// + /// + /// + public void SetTristate(string signalName) + { + lock (_syncObj) + { + //@@@@ Is there a way to do this? + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + Close(); + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + /// + /// + /// + public void StartClock(uint bit, double frequencyInHz, double dutyCylePercentage) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void StopClock(uint bit) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210x.csproj b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210x.csproj new file mode 100644 index 0000000..40d4f19 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210x.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.DIOSiCp2010x + DIO SiCp 210x implementation + Digital IO SiCp 210x implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210xFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210xFactory.cs new file mode 100644 index 0000000..ec3353d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/DIOSiCp210xFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// DIOSiCp210xFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DIOSiCp210xFactory")] + public class DIOSiCp210xFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DIOSiCp210xFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DIOSiCp210xFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOSiCp210x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DIOSim(name, _configurationManager, _logger); + else + return new DIOSiCp210x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/ECPDIOSiCp210x.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/ECPDIOSiCp210x.cs new file mode 100644 index 0000000..7e33194 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/ECPDIOSiCp210x.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using Win_API; +using Raytheon.Instruments.GeneralIO; +using CP210xRuntime_DLL; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// + /// + public class ECPDIOSiCp210x : DIOSiCp210x + { + private string _comPort = string.Empty; + + /// + /// ECPDIOSiCp210x factory constructor + /// + /// + /// + public ECPDIOSiCp210x(string deviceName, IConfigurationManager configurationManager, ILogger logger) + : base(deviceName, configurationManager, logger) + { + _comPort = _dioModuleConfig.ReadValue(Name, ConfigIni.COM_PORT.ToString()); + } + + + /// + /// + /// + /// + /// + /// + /// + public ECPDIOSiCp210x(string deviceName, uint deviceNum) + : base(deviceName, deviceNum) + { } + + /// + /// + /// + /// + /// + /// + /// + public ECPDIOSiCp210x(string deviceName, string comPort) + : base(deviceName, 0) + { + _comPort = comPort; + } + + /// + /// + /// + /// + public void SetComPort(string comPort) + { + _comPort = comPort; + } + + /// + /// + /// + /// + private IntPtr GetHandle() + { + var comString = $"\\\\.\\{_comPort}"; + var securityAttbs = NativeMethods.InitWithDefaultAttributes(); + + //Open a handle the device specified + IntPtr hDevice = NativeMethods.CreateFileA(comString, + NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, + 0, + ref securityAttbs, + 3, + NativeMethods.FILE_ATTRIBUTE_NORMAL | NativeMethods.FILE_FLAG_OVERLAPPED, + IntPtr.Zero); + + if (hDevice != NativeMethods.INVALID_HANDLE_VALUE) + { + return hDevice; + } + else + { + throw new Exception($"Unable to get a valid handle using COM port {_comPort}"); + } + } + + /// + /// + /// + /// + public ushort ReadLatch() + { + var handle = GetHandle(); + ushort latch = 0; + + var errCode = CP210xRuntime.CP210xRT_ReadLatch(handle, ref latch); + + NativeMethods.CloseHandle(handle); + + if (errCode == SI_SUCCESS) + { + return latch; + } + else + { + throw new Exception($"Error when reading CP210X latch. Error code returned: {errCode}"); + } + } + + /// + /// + /// + /// + /// + public override IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + ushort mask = (ushort)(0x1 << (int)bitIndex); + + var latch = ReadLatch(); + + return (IODatatypes.BitState)(latch & mask); + } + } + + /// + /// + /// + /// + /// + public override void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + ushort mask = (ushort)(0x1 << (int)bitIndex); + + if (state == IODatatypes.BitState.High) + { + WriteLatch(mask, mask); + } + else + { + WriteLatch(mask, 0); + } + } + } + + /// + /// + /// + /// + /// + /// + protected override void WriteLatch(ushort mask, ushort latch) + { + var handle = GetHandle(); + + int ret = CP210xRuntime.CP210xRT_WriteLatch(handle, mask, latch); + + NativeMethods.CloseHandle(handle); + + if (ret != SI_SUCCESS) + { + throw new Exception("call to write latch returned error: " + ret.ToString() + " on card: " + _name); + } + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/ECPDIOSiCp210xFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/ECPDIOSiCp210xFactory.cs new file mode 100644 index 0000000..8a57b22 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiCp210x/ECPDIOSiCp210xFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// ECPDIOSiCp210xFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ECPDIOSiCp210xFactory")] + public class ECPDIOSiCp210xFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ECPDIOSiCp210xFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ECPDIOSiCp210xFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ECPDIOSiCp210x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DIOSim(name, _configurationManager, _logger); + else + return new ECPDIOSiCp210x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXp.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXp.cs new file mode 100644 index 0000000..5960036 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXp.cs @@ -0,0 +1,927 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using Raytheon.Instruments.GeneralIO; +using System.Collections.Generic; +using SIUSBXP_DLL; +using System.Collections.Specialized; +using NLog; +using Raytheon.Common; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + /// + /// Class for controlling a Silicon Labs CP2108 UART GPIO device + /// + public class DIOSiUSBXp : IGeneralIO, IDisposable + { + #region PublicClassMembers + #endregion + + #region PrivateClassMembers + private IntPtr _handle; + private uint _deviceNum; + private State _state; + private string _name; + private SelfTestResult _selfTestResult; + private object _syncObj = new Object(); + + private int _numChannelPerPort = 8; + private int _channelStartIndex = 0; + private int _numInputChannels; + private int _numOutputChannels; + private bool _shallWeInitializeOutput = false; + + private Dictionary _signalNameToChannelMap = new Dictionary(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + ~DIOSiUSBXp() + { + Dispose(false); + } + + /// + /// + /// + private void CancelIo() + { + int ret = SIUSBXP.SI_CancelIo(_handle); + + if (ret != 0) + { + throw new Exception("call to cancel IO returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + private void CancelIoEx() + { + int ret = SIUSBXP.SI_CancelIoEx(_handle, IntPtr.Zero); + + if (ret != 0) + { + throw new Exception("call to cancel IO EX returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + private void CheckRXQueue(ref uint numBytesInQueue, ref uint queueStatus) + { + int ret = SIUSBXP.SI_CheckRXQueue(_handle, ref numBytesInQueue, ref queueStatus); + + if (ret != 0) + { + throw new Exception("call to check Rx Queue returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + private void Close() + { + int ret = SIUSBXP.SI_Close(_handle); + + if (ret != 0) + { + throw new Exception("call to close returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void DeviceIOControl(uint ioControlCode, ref byte[] inBuffer, uint bytesToRead, ref byte[] outBuffer, uint bytesToWrite, ref uint bytesSucceeded) + { + int ret = SIUSBXP.SI_DeviceIOControl(_handle, ioControlCode, inBuffer, bytesToRead, outBuffer, bytesToWrite, ref bytesSucceeded); + + if (ret != 0) + { + throw new Exception("call to SI_DeviceIOControl returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// Dispose the object's resources + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Close(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + + /// + /// + /// + private void FlushBuffers() + { + int ret = SIUSBXP.SI_FlushBuffers(_handle, 1, 1); + + if (ret != 0) + { + throw new Exception("call to flush returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + /// + private void GetDeviceProductString(ref byte[] product, ref byte length, bool convertToAscii) + { + int ret = SIUSBXP.SI_GetDeviceProductString(_handle, product, ref length, convertToAscii); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + private void GetDLLVersion(ref uint highVersion, ref uint lowVersion) + { + int ret = SIUSBXP.SI_GetDLLVersion(ref highVersion, ref lowVersion); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + private void GetDriverVersion(ref uint highVersion, ref uint lowVersion) + { + int ret = SIUSBXP.SI_GetDriverVersion(ref highVersion, ref lowVersion); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + private void GetInterfaceNumber(ref byte LibVersion) + { + int ret = SIUSBXP.SI_GetInterfaceNumber(_handle, ref LibVersion); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + private void GetModemStatus(ref byte modemStatus) + { + int ret = SIUSBXP.SI_GetModemStatus(_handle, ref modemStatus); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + private void GetNumDevices() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + private void GetPartLibraryVersion(ref int libVersion) + { + int ret = SIUSBXP.SI_GetPartLibraryVersion(_handle, ref libVersion); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + private void GetPartNumber(ref byte partNumber) + { + int ret = SIUSBXP.SI_GetPartNumber(_handle, ref partNumber); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// Can use as self-test + /// + /// + private void GetProductString() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + private void GetTimeouts(ref uint readTimeoutMs, ref uint writeTimeoutMs) + { + int ret = SIUSBXP.SI_GetTimeouts(ref readTimeoutMs, ref writeTimeoutMs); + if (ret != 0) + { + throw new Exception("call returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + private void Open() + { + int ret = SIUSBXP.SI_Open(_deviceNum, ref _handle); + + if (ret != 0) + { + throw new Exception("call to open returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + /// + private uint Read(ref byte[] buff, uint numBytesToRead) + { + uint bytesRead = 0; + //uint bytesToReadUint = Convert.ToUInt32(bytesToRead); + int ret = SIUSBXP.SI_Read(_handle, buff, numBytesToRead, ref bytesRead, IntPtr.Zero); + if (ret != 0) + { + throw new Exception("call to read latch returned error: " + ret.ToString() + " on card: " + _name); + } + + if (numBytesToRead != bytesRead) + { + throw new Exception("Commanded " + numBytesToRead + " bytes, received " + bytesRead + " bytes on card: " + _name); + } + + return bytesRead; + } + + /// + /// + /// + /// + /// + private void ReadLatch(ref byte latch) + { + int ret = SIUSBXP.SI_ReadLatch(_handle, ref latch); + + if (ret != 0) + { + throw new Exception("call to read latch returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + private void SetBaudDivisor(ushort baudDivisor) + { + int ret = SIUSBXP.SI_SetBaudDivisor(_handle, baudDivisor); + if (ret != 0) + { + throw new Exception("call to returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + private void SetBaudRate(uint baudRate) + { + int ret = SIUSBXP.SI_SetBaudRate(_handle, baudRate); + if (ret != 0) + { + throw new Exception("call to returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// 0 or 1 + /// + /// + /// + private void SetBreak(ushort breakState) + { + int ret = SIUSBXP.SI_SetBreak(_handle, breakState); + if (ret != 0) + { + throw new Exception("call to returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// CTS + /// SI_STATUS_INPUT = 0x00; + /// SI_HANDSHAKE_LINE = 0x01; + /// RTS + /// SI_HELD_INACTIVE = 0x00; + /// SI_HELD_ACTIVE = 0x01; + /// SI_FIRMWARE_CONTROLLED = 0x02; + /// SI_TRANSMIT_ACTIVE_SIGNAL = 0x03; + /// DTR + /// SI_HELD_INACTIVE = 0x00; + /// SI_HELD_ACTIVE = 0x01; + /// SI_FIRMWARE_CONTROLLED = 0x02; + /// DSR + /// SI_STATUS_INPUT = 0x00; + /// SI_HANDSHAKE_LINE = 0x01; + /// DCD + /// SI_STATUS_INPUT = 0x00; + /// SI_HANDSHAKE_LINE = 0x01; + /// FlowXonXoff + /// 0 or 1 + /// + /// + private void SetFlowControl(byte cts, byte rts, byte dtr, byte dsr, byte dcd, bool flowXOnOff) + { + int ret = SIUSBXP.SI_SetFlowControl(_handle, cts, rts, dtr, dsr, dcd, flowXOnOff); + if (ret != 0) + { + throw new Exception("call to returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// Set the line control + /// Bits 0-3: Number of stop bits + /// 0: 1 stop bit + /// 1: 1.5 stop bits + /// 2: 2 stop bits + /// Bits 4-7: Parity + /// 0: none + /// 1: Odd + /// 2: Even + /// 3: Mark + /// 4: Space + /// Bits 8-15: Number of bits per word + /// 5, 6, 7, or 8 + /// + /// + private void SetLineControl(ushort lineControl) + { + int ret = SIUSBXP.SI_SetLineControl(_handle, lineControl); + if (ret != 0) + { + throw new Exception("call to returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + private void SetTimeout(uint readTimeoutMs, uint writeTimeoutMs) + { + int ret = SIUSBXP.SI_SetTimeouts(readTimeoutMs, writeTimeoutMs); + if (ret != 0) + { + throw new Exception("call to returned error: " + ret.ToString() + " on card: " + _name); + } + } + + /// + /// + /// + /// + /// + private void Write(ref byte[] writeBuff, uint numBytesToWrite) + { + uint bytesWritten = 0; + //uint bytesToWriteUint = Convert.ToUInt32(numBytesToWrite); + int ret = SIUSBXP.SI_Write(_handle, writeBuff, numBytesToWrite, ref bytesWritten, IntPtr.Zero); + if (ret != 0) + { + throw new Exception("call to write latch returned error: " + ret.ToString() + " on card: " + _name); + } + + if (numBytesToWrite != bytesWritten) + { + throw new Exception("Commanded " + numBytesToWrite + " bytes, wrote " + bytesWritten + " bytes on card: " + _name); + } + } + + /// + /// + /// + /// + /// + /// + private void WriteLatch(byte mask, byte latch) + { + int ret = SIUSBXP.SI_WriteLatch(_handle, mask, latch); + + if (ret != 0) + { + throw new Exception("call to write latch returned error: " + ret.ToString() + " on card: " + _name); + } + } + #endregion + + #region PublicClassFunctions + + /// + /// DIOSiUSBXp factory constructor + /// + /// + /// + public DIOSiUSBXp(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string dioModuleDefPath = _configuration.GetConfigurationValue(deviceName, ConfigXml.DIO_MODULE_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(dioModuleDefPath)) + dioModuleDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, dioModuleDefPath)); + + IConfigurationFile dioModuleConfig = new ConfigurationFile(dioModuleDefPath); + + Boolean.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION.ToString()), out _shallWeInitializeOutput); + + UInt32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.DEVICE_NUMBER.ToString()), out _deviceNum); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_INPUT_CHANNELS.ToString()), out _numInputChannels); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_OUTPUT_CHANNELS.ToString()), out _numOutputChannels); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_CHANNELS_PER_PORT.ToString()), out _numChannelPerPort); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.CHANNEL_START_INDEX.ToString()), out _channelStartIndex); + + if (!(_channelStartIndex == 0 || _channelStartIndex == 1)) + { + throw new Exception($"The value for key {ConfigIni.CHANNEL_START_INDEX.ToString()} in section {Name} must be 0 or 1 in {dioModuleDefPath}"); + } + + List outputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.OUTPUT_SIGNALS}"); + List intputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.INPUT_SIGNALS}"); + + IODatatypes.DIOChannelInfo info; + foreach (string signalName in outputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.OUTPUT_SIGNALS}", signalName); + string[] infoTokens = iniLine.Split('|'); + if (infoTokens.Length != 2) + { + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} does not contain 2 tokens"); + } + + info.channelNumber = Convert.ToUInt32(infoTokens[0]); + info.initialValue = Convert.ToInt32(infoTokens[1]); + + _signalNameToChannelMap[signalName] = info; + } + + foreach (string signalName in intputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.INPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.INPUT_SIGNALS}", signalName); + + info.channelNumber = Convert.ToUInt32(iniLine); + info.initialValue = -1; + + _signalNameToChannelMap[signalName] = info; + } + + _handle = IntPtr.Zero; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + /// + /// + public DIOSiUSBXp(string deviceName, uint deviceNum) + { + _deviceNum = deviceNum; + _name = deviceName; + _handle = IntPtr.Zero; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + _logger = LogManager.GetCurrentClassLogger(); + + //@@@ Do we need to pass in more args to configure the DIO (Baud?) + } + + /// + /// + /// + /// + public bool ClearErrors() + { + //could use this to cancel IO and flush the buffers + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + byte arrSize = 255; + byte[] deviceStringArray = new byte[arrSize]; + GetDeviceProductString(ref deviceStringArray, ref arrSize, true); + return "This is a Silicon Labs CP2108 device: " + deviceStringArray.ToString(); + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + byte latchValue = 0; + + ReadLatch(ref latchValue); + + BitVector32 bits = new BitVector32(latchValue); + + return (IODatatypes.BitState)(bits[bitIndex] ? 1 : 0); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + //@@@ call the other setup functions..Baud? Flow? Timeout? Others? + Open(); + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// Return list of signal names + /// + public List GetSignalNames() + { + return new List(_signalNameToChannelMap.Keys); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public uint NumberOfInputBits + { + get + { + return (uint)_numInputChannels; + } + } + + /// + /// + /// + public uint NumberOfOutputBits + { + get + { + return (uint)_numOutputChannels; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + // card does not support self test + //throw new NotImplementedException("card does not support self test" + " on card " + _name); + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + Close(); + Open(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + /// high(open) or low(closed) + /// + public void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + byte mask = (byte)bitIndex; + + if (state == IODatatypes.BitState.High) + { + WriteLatch(mask, 1); + } + else + { + WriteLatch(mask, 0); + } + } + } + + /// + /// + /// + /// + public void SetTristate(string signalName) + { + lock (_syncObj) + { + //@@@@ Is there a way to do this? + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + Close(); + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + /// + /// + /// + public void StartClock(uint bit, double frequencyInHz, double dutyCylePercentage) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void StopClock(uint bit) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXp.csproj b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXp.csproj new file mode 100644 index 0000000..d0c6c73 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXp.csproj @@ -0,0 +1,37 @@ + + + + + net472 + Raytheon.Instruments.DIOSiUSBXp + Raytheon.Instruments + implementation + implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXpFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXpFactory.cs new file mode 100644 index 0000000..b4e2bf5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/DIOSiUSBXpFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// DIOSiUSBXpFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DIOSiUSBXpFactory")] + public class DIOSiUSBXpFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DIOSiUSBXpFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DIOSiUSBXpFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOSiUSBXp(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DIOSim(name, _configurationManager, _logger); + else + return new DIOSiUSBXp(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/SiUSBXp.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/SiUSBXp.cs new file mode 100644 index 0000000..5537e48 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSiUSBXp/SiUSBXp.cs @@ -0,0 +1,274 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.InteropServices; + +namespace SIUSBXP_DLL +{ + public class SIUSBXP + { + static IntPtr zero = IntPtr.Zero; + + // Return codes + public const byte SI_SUCCESS = 0x00; + public const byte SI_DEVICE_NOT_FOUND = 0xFF; + public const byte SI_INVALID_HANDLE = 0x01; + public const byte SI_READ_ERROR = 0x02; + public const byte SI_RX_QUEUE_NOT_READY = 0x03; + public const byte SI_WRITE_ERROR = 0x04; + public const byte SI_RESET_ERROR = 0x05; + public const byte SI_INVALID_PARAMETER = 0x06; + public const byte SI_INVALID_REQUEST_LENGTH = 0x07; + public const byte SI_DEVICE_IO_FAILED = 0x08; + public const byte SI_INVALID_BAUDRATE = 0x09; + public const byte SI_FUNCTION_NOT_SUPPORTED = 0x0a; + public const byte SI_GLOBAL_DATA_ERROR = 0x0b; + public const byte SI_SYSTEM_ERROR_CODE = 0x0c; + public const byte SI_READ_TIMED_OUT = 0x0d; + public const byte SI_WRITE_TIMED_OUT = 0x0e; + public const byte SI_IO_PENDING = 0x0f; + public const byte SI_NOTHING_TO_CANCEL = 0xa0; + + // GetProductString() function flags + public const byte SI_RETURN_SERIAL_NUMBER = 0x00; + public const byte SI_RETURN_DESCRIPTION = 0x01; + public const byte SI_RETURN_LINK_NAME = 0x02; + public const byte SI_RETURN_VID = 0x03; + public const byte SI_RETURN_PID = 0x04; + + // RX Queue status flags + public const byte SI_RX_NO_OVERRUN = 0x00; + public const byte SI_RX_EMPTY = 0x00; + public const byte SI_RX_OVERRUN = 0x01; + public const byte SI_RX_READY = 0x02; + + // Buffer size limits + public const int SI_MAX_DEVICE_STRLEN = 256; + public const int SI_MAX_READ_SIZE = 4096 * 16; + public const int SI_MAX_WRITE_SIZE = 4096; + + // Input and Output pin Characteristics + public const byte SI_HELD_INACTIVE = 0x00; + public const byte SI_HELD_ACTIVE = 0x01; + public const byte SI_FIRMWARE_CONTROLLED = 0x02; + public const byte SI_RECEIVE_FLOW_CONTROL = 0x02; + public const byte SI_TRANSMIT_ACTIVE_SIGNAL = 0x03; + public const byte SI_STATUS_INPUT = 0x00; + public const byte SI_HANDSHAKE_LINE = 0x01; + + // Mask and Latch value bit definitions + public const int SI_GPIO_0 = 0x01; + public const int SI_GPIO_1 = 0x02; + public const int SI_GPIO_2 = 0x04; + public const int SI_GPIO_3 = 0x08; + public const int SI_GPIO_4 = 0x0010; + public const int SI_GPIO_5 = 0x0020; + public const int SI_GPIO_6 = 0x0040; + public const int SI_GPIO_7 = 0x0080; + public const int SI_GPIO_8 = 0x0100; + public const int SI_GPIO_9 = 0x0200; + public const int SI_GPIO_10 = 0x0400; + public const int SI_GPIO_11 = 0x0800; + public const int SI_GPIO_12 = 0x1000; + public const int SI_GPIO_13 = 0x2000; + public const int SI_GPIO_14 = 0x4000; + public const int SI_GPIO_15 = 0x8000; + + // GetDeviceVersion() return codes + public const byte SI_USBXPRESS_EFM8 = 0x80; + public const byte SI_USBXPRESS_EFM32 = 0x81; + public const byte SI_CP2101_VERSION = 0x01; + public const byte SI_CP2102_VERSION = 0x02; + public const byte SI_CP2103_VERSION = 0x03; + public const byte SI_CP2104_VERSION = 0x04; + public const byte SI_CP2105_VERSION = 0x05; + public const byte SI_CP2108_VERSION = 0x08; + public const byte SI_CP2109_VERSION = 0x09; + public const byte SI_CP2102N_QFN28_VERSION = 0x20; + public const byte SI_CP2102N_QFN24_VERSION = 0x21; + public const byte SI_CP2102N_QFN20_VERSION = 0x22; + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetNumDevices( + ref uint lpdwNumDevices + ); + + // Caller must set StringBuilder capacity to max possible + // returned string size before calling this function + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetProductString( + uint dwDeviceNum, + StringBuilder lpvDeviceString, + uint dwFlags + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_Open( + uint dwDevice, + ref IntPtr cyHandle + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_Close( + IntPtr cyHandle + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_Read( + IntPtr cyHandle, + [Out] byte[] lpBuffer, + uint dwBytesToRead, + ref uint lpdwBytesReturned, + IntPtr o + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_Write( + IntPtr cyHandle, + [In] byte[] lpBuffer, + uint dwBytesToWrite, + ref uint lpdwBytesWritten, + IntPtr o + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_FlushBuffers( + IntPtr cyHandle, + byte FlushTransmit, + byte FlushReceive + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_SetTimeouts( + uint dwReadTimeoutInMs, + uint dwWriteTimeoutInMs + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetTimeouts( + ref uint lpdwReadTimeout, + ref uint lpdwWriteTimeout + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_CheckRXQueue( + IntPtr cyHandle, + ref uint lpdwNumBytesInQueue, + ref uint lpdwQueueStatus + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_SetBaudRate( + IntPtr cyHandle, + uint dwBaudRate + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_SetBaudDivisor( + IntPtr cyHandle, + ushort wBaudDivisor + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_SetLineControl( + IntPtr cyHandle, + ushort wLineControl + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_SetFlowControl( + IntPtr cyHandle, + byte bCTS_MaskCode, + byte bRTS_MaskCode, + byte bDTR_MaskCode, + byte bDSR_MaskCode, + byte bDCD_MaskCode, + bool bFlowXonXoff + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetModemStatus( + IntPtr cyHandle, + ref byte ModemStatus + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_SetBreak( + IntPtr cyHandle, + ushort wBreakState + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_ReadLatch( + IntPtr cyHandle, + ref byte lpbLatch + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_WriteLatch( + IntPtr cyHandle, + byte bMask, + byte bLatch + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetPartNumber( + IntPtr cyHandle, + ref byte lpbPartNum + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_DeviceIOControl( + IntPtr cyHandle, + uint dwIoControlCode, + [In] byte[] lpInBuffer, + uint dwBytesToRead, + [Out] byte[] lpOutBuffer, + uint dwBytesToWrite, + ref uint lpdwBytesSucceeded + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetPartLibraryVersion( + IntPtr cyHandle, + ref int pLibVersion + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetInterfaceNumber( + IntPtr cyHandle, + ref byte pLibVersion + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetDeviceProductString( + IntPtr cyHandle, + [Out] byte[] lpProduct, + ref byte lpbLength, + bool bConvertToASCII + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetDLLVersion( + ref uint HighVersion, + ref uint LowVersion + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_GetDriverVersion( + ref uint HighVersion, + ref uint LowVersion + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_CancelIo( + IntPtr cyHandle + ); + + [DllImport("SiUSBXp.dll")] + public static extern int SI_CancelIoEx( + IntPtr cyHandle, + IntPtr o + ); + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSim.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSim.cs new file mode 100644 index 0000000..6124747 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSim.cs @@ -0,0 +1,428 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using Raytheon.Instruments.GeneralIO; +using System.Collections.Generic; +using Raytheon.Common; +using NLog; +using System.IO; +using System.Reflection; +using System.Runtime.Remoting; + +namespace Raytheon.Instruments +{ + /// + /// A Simulated DIO class + /// + public class DIOSim : IGeneralIO + { + #region PrivateClassMembers + private string _name; + private SelfTestResult _selfTestResult; + private State _state; + private object _syncObj = new Object(); + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + private const int _channelStartIndex = 0; + private int _numInputChannels; + private int _numOutputChannels; + + private Dictionary _signalNameToChannelMap = new Dictionary(); + + #endregion + + #region PrivateClassFunctions + + /// + /// The finalizer. + /// + ~DIOSim() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + // nothing to do here + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicClassFunctions + + /// + /// DIOSim factory constructor + /// + /// + /// + public DIOSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string dioModuleDefPath = _configuration.GetConfigurationValue(deviceName, ConfigXml.DIO_MODULE_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(dioModuleDefPath)) + dioModuleDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, dioModuleDefPath)); + + IConfigurationFile dioModuleConfig = new ConfigurationFile(dioModuleDefPath); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, "NUM_OUTPUT_CHANNELS"), out _numOutputChannels); + Int32.TryParse(dioModuleConfig.ReadValue(Name, "NUM_INPUT_CHANNELS"), out _numInputChannels); + + List outputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.OUTPUT_SIGNALS}"); + List intputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.INPUT_SIGNALS}"); + + IODatatypes.DIOChannelInfo info; + foreach (string signalName in outputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.OUTPUT_SIGNALS}", signalName); + string[] infoTokens = iniLine.Split('|'); + if (infoTokens.Length != 2) + { + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} does not contain 2 tokens"); + } + + info.channelNumber = Convert.ToUInt32(infoTokens[0]); + info.initialValue = Convert.ToInt32(infoTokens[1]); + + _signalNameToChannelMap[signalName] = info; + } + + foreach (string signalName in intputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.INPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.INPUT_SIGNALS}", signalName); + + info.channelNumber = Convert.ToUInt32(iniLine); + info.initialValue = -1; + + _signalNameToChannelMap[signalName] = info; + } + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + /// + /// Constructor for DIO simulation. + /// + /// + /// + /// + public DIOSim(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + /// + /// Return list of signal names + /// + public List GetSignalNames() + { + return new List(_signalNameToChannelMap.Keys); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a DIO Sim called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels} on card " + _name); + } + + return IODatatypes.BitState.Low; + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _state = State.Ready; + } + else + { + throw new Exception("DIOSim::Initialize() - expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public uint NumberOfInputBits + { + get + { + return (uint)_numInputChannels; + } + } + + /// + /// + /// + public uint NumberOfOutputBits + { + get + { + return (uint)_numOutputChannels; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + _selfTestResult = SelfTestResult.Pass; + return _selfTestResult; + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + /// + public void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels} on card " + _name); + } + } + } + + /// + /// + /// + /// + public void SetTristate(string signalName) + { + + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + _state = State.Uninitialized; + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSim.csproj b/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSim.csproj new file mode 100644 index 0000000..f2437b4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSim.csproj @@ -0,0 +1,22 @@ + + + + + net472 + Raytheon.Instruments.DIOSim + DIO Sim implementation + DIO Sim implementation + Library + + + + 1.1.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSimFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSimFactory.cs new file mode 100644 index 0000000..fad80d0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOSim/DIOSimFactory.cs @@ -0,0 +1,135 @@ +// ********************************************************************************************************** +// DIOSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DIOSimFactory")] + public class DIOSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DIOSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DIOSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020A.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020A.cs new file mode 100644 index 0000000..1323979 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020A.cs @@ -0,0 +1,719 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + + +/*Channels can operate in two modes. Static or dynamic.Static mode is sort of like have a register control the drive and expect states of a channel. +You load the register with the logic 1 or 0 that you want to drive or detect and then this is applied by to the UUT all at one time. +The 1 / 0 values are used to determine the high / low(VIH / VIL) from the drive side or the high / low expected(VOH / VOL) from the detector. +The channel is bidirectional.The various pin opcodes determine the whether you want to drive or detect or both. +IH or IL is drive only the detect is a don't care. OH or OL is detect only the drive is off. MH or ML is both drive and detect. +This later opcode is called monitor high/low. You might use this if you want to Monitor the drive to verify the signal is being output to the UUT. +In dynamic mode, the pin opcodes are loaded into a memory, the pattern memory, behind each channel. This is the dynamic pattern loading process. +A pattern controller is used to sequence the patterns out of the pattern memory and it has a instruction memory that is used to control this sequence of this pin opcodes +from the pattern memory.You can sequence patterns one after the other, repeat a pattern memory location several times, repeat a sequence of pattern memory locations +multiple times.The repeating pattern locations can be controlled by a count or a condition of the PASS/ FAIL test result of a pattern.The pattern controller also controls +whether a test should be associated with a pattern memory location. The are also pattern controller instruction halt that defines the last pattern of a sequence. +In dynamic mode you also have a timing sets that define the pattern time, when a channel will assert a high or low in that pattern time or when to observe the +detector in the pattern time.There is a memory for holding this information as well so that you can have different timing from one pattern to another. +After the memories have been loaded, operation of the pattern sequence is turned over to the pattern controller to run. +This starts applying the patterns under the pattern controller sequence instructions until a halt instruction is executed where it returns control back to the driver. +This is called dynamic pattern set execution or a dynamic burst.During the burst, another memory element is used to capture and record the pattern to pattern +pass fail information as well as what pin have failed.There are API functions to retrieve this information.*/ + +using Ivi.Driver; +using System; +using System.IO; +using System.Reflection; +using System.Collections.Generic; +using Teradyne.eDigital; +using Raytheon.Instruments.GeneralIO; +using NLog; +using Raytheon.Common; +using System.Xml.Linq; + +namespace Raytheon.Instruments +{ + /// + /// The EDigital 6020A 1_3_11 card + /// + public class DIOTeradyneEDigital6020A : IGeneralIO, IDisposable + { + #region PrivateClassMembers + private eDigital _dio; + private string _name; + private readonly string _dioAddress; + private Raytheon.Instruments.SelfTestResult _selfTestResult; + private State _state; + private readonly string _options; + private Dictionary _clocks; + private object _syncObj = new Object(); + + private int _numChannelPerPort = 8; + private int _channelStartIndex = 0; + private int _numInputChannels; + private int _numOutputChannels; + private bool _shallWeInitializeOutput = false; + + private Dictionary _signalNameToChannelMap = new Dictionary(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + /// + /// The finalizer. + /// + ~DIOTeradyneEDigital6020A() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _dio.Utility.Reset(); + + _dio.Close(); + + _dio.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicClassFunctions + + /// + /// DIOTeradyneEDigital6020A factory constructor + /// + /// + /// + public DIOTeradyneEDigital6020A(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string dioModuleDefPath = _configuration.GetConfigurationValue(deviceName, ConfigXml.DIO_MODULE_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(dioModuleDefPath)) + dioModuleDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, dioModuleDefPath)); + + IConfigurationFile dioModuleConfig = new ConfigurationFile(dioModuleDefPath); + + Boolean.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION.ToString()), out _shallWeInitializeOutput); + + _dioAddress = dioModuleConfig.ReadValue(Name, ConfigIni.DIO_ADDRESS.ToString()); + _dioAddress = dioModuleConfig.ReadValue(Name, ConfigIni.DIO_OPTIONS.ToString()); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_INPUT_CHANNELS.ToString()), out _numInputChannels); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_OUTPUT_CHANNELS.ToString()), out _numOutputChannels); + + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.NUM_CHANNELS_PER_PORT.ToString()), out _numChannelPerPort); + Int32.TryParse(dioModuleConfig.ReadValue(Name, ConfigIni.CHANNEL_START_INDEX.ToString()), out _channelStartIndex); + + if (!(_channelStartIndex == 0 || _channelStartIndex == 1)) + { + throw new Exception($"The value for key {ConfigIni.CHANNEL_START_INDEX.ToString()} in section {Name} must be 0 or 1 in {dioModuleDefPath}"); + } + + List outputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.OUTPUT_SIGNALS}"); + List intputSignalNames = dioModuleConfig.ReadAllKeys($"{Name}.{ConfigIni.INPUT_SIGNALS}"); + + IODatatypes.DIOChannelInfo info; + foreach (string signalName in outputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.OUTPUT_SIGNALS}", signalName); + string[] infoTokens = iniLine.Split('|'); + if (infoTokens.Length != 2) + { + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.OUTPUT_SIGNALS} does not contain 2 tokens"); + } + + info.channelNumber = Convert.ToUInt32(infoTokens[0]); + info.initialValue = Convert.ToInt32(infoTokens[1]); + + _signalNameToChannelMap[signalName] = info; + } + + foreach (string signalName in intputSignalNames) + { + if (_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Key {signalName} in section {Name}.{ConfigIni.INPUT_SIGNALS} conflicts with the same key defined in another section."); + + string iniLine = dioModuleConfig.ReadValue($"{Name}.{ConfigIni.INPUT_SIGNALS}", signalName); + + info.channelNumber = Convert.ToUInt32(iniLine); + info.initialValue = -1; + + _signalNameToChannelMap[signalName] = info; + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Unknown; + _state = State.Uninitialized; + _clocks = new Dictionary(); + + // set in Initialize() + _dio = null; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public DIOTeradyneEDigital6020A(string dioName, string dioAddress, string options) + { + _name = dioName; + _dioAddress = dioAddress; + _options = options; + _selfTestResult = Raytheon.Instruments.SelfTestResult.Unknown; + _state = State.Uninitialized; + _clocks = new Dictionary(); + _logger = LogManager.GetCurrentClassLogger(); + + // set in Initialize() + _dio = null; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is " + _name + " an EDigital 6020A static IO driver"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public IODatatypes.BitState GetBitState(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numInputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The input channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numInputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + int mappedChannal = _dio.Pinmap.Find("CH" + bitIndex); + + _dio.Pin.SetChannelMode(ChannelMode.Static, mappedChannal); + + IStaticPattern pattern = _dio.Static.Pattern.SetPinOpcode(PinOpcode.IOX, mappedChannal); + + pattern.Run(); + + return (IODatatypes.BitState)_dio.Static.FetchCapturedData(mappedChannal); + } + } + + /// + /// + /// + /// + /// + /*public DioMeasurementInstruments.SignalState GetOutputSignalState(uint channelNo) + { + lock (_syncObj) + { + int mappedChannal = Pinmap.Channel((int)channelNo); + + if (_outputPins.Contains((int)channelNo) == false) + { + throw new Exception("channel " + channelNo + " was not specified as an output channel at the time of construction"); + } + + // Monitor Low pin opcode specifies to drive and expect low. + IStaticPattern pattern = _dio.Static.Pattern.SetPinOpcode(PinOpcode.ML, mappedChannal); + // teradyne examples do not check the result, we wont either + Result res = pattern.Run(); + /*if (res != Result.Pass) + { + throw new Exception("SetPinOpcode for channel: " + channelNo + " failed with result: " + res.ToString()); + }*/ + + + /*var testResult = _dio.Static.FetchResult(); + if (testResult == Result.Pass) + { + return DioMeasurementInstruments.SignalState.LOW; + } + else + { + return DioMeasurementInstruments.SignalState.HIGH; + } + } + }*/ + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _dio = new eDigital(_dioAddress, false, true, _options); + + // these probably are not needed + _dio.Utility.Reset(); + _dio.Pinmap.Reset(); + + // enable the system + _dio.Instrument.SystemEnable = true; + _dio.Static.Delay = PrecisionTimeSpan.FromMicroseconds(100); + + // set the channel modes + for (int channel= _channelStartIndex; channel < (_numInputChannels + _channelStartIndex); channel++) + { + int mappedChannal = _dio.Pinmap.Find("CH" + channel); + if (mappedChannal == -1) + { + throw new Exception("input channel " + channel.ToString() + " is not valid"); + } + + _dio.Pin.SetChannelMode(ChannelMode.Static, mappedChannal); + } + + // set the channel modes + for (int channel = _channelStartIndex; channel < (_numOutputChannels + _channelStartIndex); channel++) + { + //tbd if this is needed + int mappedChannal = _dio.Pinmap.Find("CH" + channel); + if (mappedChannal == -1) + { + throw new Exception("output channel " + channel.ToString() + " is not valid"); + } + + _dio.Pin.SetChannelMode(ChannelMode.Static, mappedChannal); + } + + if (_shallWeInitializeOutput) + { + foreach (KeyValuePair item in _signalNameToChannelMap) + { + if (item.Value.initialValue != -1) + { + SetBit(item.Key, (IODatatypes.BitState)item.Value.initialValue); + } + } + } + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// Return list of signal names + /// + public List GetSignalNames() + { + return new List(_signalNameToChannelMap.Keys); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public uint NumberOfInputBits + { + get + { + return (uint)_numInputChannels; + } + } + + /// + /// + /// + public uint NumberOfOutputBits + { + get + { + return (uint)_numOutputChannels; + } + } + + /// + /// + /// + /// + public Raytheon.Instruments.SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + Ivi.Driver.SelfTestResult res = _dio.Utility.SelfTest(); + + if (res.Code != 0) + { + _selfTestResult = Raytheon.Instruments.SelfTestResult.Fail; + throw new Exception("self test returned: " + res.Code + "," + res.Message + " on card " + _name); + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + + return _selfTestResult; + } + } + + /// + /// + /// + public Raytheon.Instruments.SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + public void SetTristate(string signalName) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + Name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + int mappedChannal = _dio.Pinmap.Find("CH" + bitIndex); + IStaticPattern pattern = _dio.Static.Pattern.SetPinOpcode(PinOpcode.IOX, mappedChannal); + Result res = _dio.Static.Pattern.Run(); + //teradyne example does not check return value, we wont either + /*if (res != Result.Pass) + { + throw new Exception("SetPinOpcode for channel: " + channelNo + " to state " + state.ToString() + " failed with result: " + res.ToString()); + }*/ + } + } + + /// + /// + /// + /// + /// + public void SetBit(string signalName, IODatatypes.BitState state) + { + lock (_syncObj) + { + if (!_signalNameToChannelMap.ContainsKey(signalName)) + throw new Exception($"Signal name {signalName} doesn't exist for card: " + _name); + + if (_signalNameToChannelMap[signalName].channelNumber >= _numOutputChannels || _signalNameToChannelMap[signalName].channelNumber < _channelStartIndex) + { + throw new Exception($"The output channel number {_signalNameToChannelMap[signalName].channelNumber} specified must be >= {_channelStartIndex} and < {_numOutputChannels + _channelStartIndex} on card " + _name); + } + + int bitIndex = (int)_signalNameToChannelMap[signalName].channelNumber - _channelStartIndex; + + int mappedChannal = _dio.Pinmap.Find("CH" + bitIndex); + + IStaticPattern pattern = _dio.Static.Pattern.SetPinOpcode((PinOpcode)((int)state+1), mappedChannal); + _dio.Static.Pattern.Run(); + } + } + + /// + /// Generate a free run clock + /// + /// The channel index + /// The frequency in Hz + /// ex: .5 for 50% duty cycle + public void StartClock(uint bit, double frequencyInHz, double dutyCylePercentage) + { + lock (_syncObj) + { + if (_clocks.ContainsKey(bit) == true) + { + throw new Exception("DIO " + _name + " already has a clock running on channel " + bit + ", must stop it first starting a new one"); + } + + int mappedChannal = _dio.Pinmap.Find("CH" + bit); + + //set the pin to free run clock + double period = 1.0e6 / frequencyInHz; //period in Microsecond + + Teradyne.eDigital.ITiming timing = _dio.Timing; + Teradyne.eDigital.IPin pin = _dio.Pin; + Teradyne.eDigital.IDynamic dynamic = _dio.Dynamic; + pin.SetDigitalConnect(RelayState.Closed, mappedChannal); + + // Configure the channel attributes + pin.SetChannelMode(ChannelMode.Dynamic, mappedChannal); + pin.SetFormat(Format.ReturnToOne, mappedChannal); + pin.SetFreerun(true, mappedChannal); + + //create tset and edgeset + timing.ConfigureClockReference(ClockReference.Internal, ClockEdgeSelect.Rising); + int edgeSet1 = timing.CreateEdgeSet(); + var tset0 = timing.GetTimingSet(0); + tset0.ClockPeriod = PrecisionTimeSpan.FromMicroseconds(period); + tset0.SetDriveTiming(edgeSet1, PrecisionTimeSpan.FromMicroseconds(period * 0.25), PrecisionTimeSpan.FromMicroseconds(period * 0.75)); + tset0.SetDetectStrobe(edgeSet1, PrecisionTimeSpan.FromMicroseconds(period * 0.5)); + + //assign phase to pin + pin.SetEdgeSet(edgeSet1, mappedChannal); + + // Start of pattern + dynamic.BeginLoad(true); + + // Pattern: 0 + dynamic.Pattern.SetPinOpcode(PinOpcode.MH, mappedChannal) + .Modifiers.SetTimingSet(0) + .Modifiers.SetResultsCapture(false) + .End(TestInstruction.None); + + // Drive low to start clock Repeat for 1000000 times + dynamic.Pattern.SetPinOpcode(PinOpcode.ML, mappedChannal) + .Modifiers.SetResultsCapture(false) + .End(TestInstruction.PassFail); + + // End pattern + dynamic.Pattern.End(TestInstruction.PassFail); + dynamic.Pattern.Control.Halt().End(TestInstruction.PassFail); + dynamic.EndLoad(); + dynamic.Timeout = PrecisionTimeSpan.MaxValue; + dynamic.ExpandLoops = true; + + var testResult = dynamic.Run(); + + // hang onto the clock so we can stop it + _clocks[bit] = dynamic; + + System.Threading.Thread.Sleep(10); + } + } + + /// + /// + /// + /// + public void StopClock(uint bit) + { + lock (_syncObj) + { + if (_clocks.ContainsKey(bit) == false) + { + throw new Exception("DIO " + _name + " trying to stop clock on channel " + bit + ", that doesn't exist"); + } + + _clocks[bit].Execution.Stop(); + + _clocks.Remove(bit); + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + _dio.Utility.Reset(); + + _dio.Instrument.SystemEnable = true; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + _dio.Utility.Reset(); + + _dio.Close(); + + _state = State.Uninitialized; + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020A.csproj b/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020A.csproj new file mode 100644 index 0000000..158038a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020A.csproj @@ -0,0 +1,39 @@ + + + + + net472 + x86 + Raytheon.Instruments.DIOTeradyneEDigital6020A + Raytheon.Instruments + DIO Teradyne E Digital 6020A implementation + Digital IO Teradyne E Digital 6020A implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + False + ..\..\Common\COTS\IviFoundationSharedComponents_1.4.1\Ivi.Driver.dll + + + False + ..\..\Common\COTS\Teradyne_EDigital_1_3_11\Teradyne.eDigital.Fx40.dll + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020AFactory.cs b/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020AFactory.cs new file mode 100644 index 0000000..e438420 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DIO/DIOTeradyneEDigital6020A/DIOTeradyneEDigital6020AFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// DIOTeradyneEDigital6020AFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DIOTeradyneEDigital6020AFactory")] + public class DIOTeradyneEDigital6020AFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DIOTeradyneEDigital6020AFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DIOTeradyneEDigital6020AFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IGeneralIO)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DIOTeradyneEDigital6020A(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DIOSim(name, _configurationManager, _logger); + else + return new DIOTeradyneEDigital6020A(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183.cs new file mode 100644 index 0000000..6aca172 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183.cs @@ -0,0 +1,641 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Instruments; +using System; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; +using Agilent.AgM918x.Interop; +using NLog; +using Raytheon.Common; +using System.IO.Ports; + +namespace Raytheon.Instruments +{ + /// + /// A keysight implementation of the DMM interface + /// + public class DMMKeysightM9183 : IDmm + { + #region PrivateMemberVariables + + private AgM918x _dmm; + private string _name; + private readonly string _address; + private readonly string _options; + private MeasurementFunction _lastType; + private double _lastRange; + private double _lastResolution; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// Dispose of this objects resources + /// + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_34461A")] + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _dmm.Utility.Reset(); + + _dmm.Close(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + /// + /// + private double ReadCurrent(double range, double resolution, MeasurementFunction currentType) + { + bool shallWeUseAutoRange = false; + + if (range < 0) + { + shallWeUseAutoRange = true; + // set the starting range for auto range to 2 micro amps + range = 0.000002; + } + + if (currentType == MeasurementFunction.ACCurrent) + { + return _dmm.ACCurrent.Measure(range, resolution, shallWeUseAutoRange); + } + else if (currentType == MeasurementFunction.DCCurrent) + { + return _dmm.DCCurrent.Measure(range, resolution, shallWeUseAutoRange); + } + else + { + throw new Exception("only ac or dc current is acceptable for param type: " + currentType.ToString()); + } + } + + /// + /// Reads frequency from the dmm + /// + /// The range to use on the DMM + /// The resolution to use on the DMM + /// The voltage range for the measurement + /// The number of reads to make + /// The frequency or average of frequencies read + private double ReadFrequency(double range, double resolution, double voltRange, double numReads) + { + bool shallWeUseAutoRange = false; + + if (range < 0) + { + shallWeUseAutoRange = true; + // set the starting range for auto range to 10 + range = 10; + } + + return _dmm.Frequency.Measure(range, shallWeUseAutoRange, voltRange); + } + + /// + /// Reads resistance + /// + /// The range to use on the DMM + /// The resolution to use on the DMM\ + /// + /// The resistance + private double ReadResistance(double range, double resolution, MeasurementFunction resistanceType) + { + bool shallWeUseAutoRange = false; + + if (range < 0) + { + shallWeUseAutoRange = true; + // set the starting range for auto range to 10 + range = 10; + } + + if (resistanceType == MeasurementFunction.FourWireResistance) + { + return _dmm.Resistance4Wire.Measure(range, resolution, shallWeUseAutoRange); + } + else if (resistanceType == MeasurementFunction.TwoWireResistance) + { + return _dmm.Resistance.Measure(range, resolution, shallWeUseAutoRange); + } + else + { + throw new Exception("only 4 or 2 write resistance is acceptable for param type: " + resistanceType.ToString()); + } + } + + /// + /// Reads voltage + /// + /// The range to use on the DMM + /// The resolution to use on the DMM + /// + private double ReadVoltage(double range, double resolution, MeasurementFunction voltageType) + { + bool shallWeUseAutoRange = false; + + if (range < 0) + { + shallWeUseAutoRange = true; + // set the starting range for auto range to 10 + range = 10; + } + + if (voltageType == MeasurementFunction.ACVolts) + { + return _dmm.ACVoltage.Measure(range, resolution, shallWeUseAutoRange); + } + else if (voltageType == MeasurementFunction.DCVolts) + { + return _dmm.DCVoltage.Measure(range, resolution, shallWeUseAutoRange); + } + else + { + throw new Exception("only ac or dc volt is acceptable for param type: " + voltageType.ToString()); + } + } + + /// + /// Convert scpi data to string + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// + /// + /// + /// + private double GetFrequencyAvg(string numbers) + { + string[] numArr = numbers.Split(','); + double retVal = 0; + + foreach (string val in numArr) + { + retVal += Util.ConvertStringToDouble(val); + } + + retVal = retVal / numArr.Length; + + return retVal; + } + + #endregion + + #region PublicFunctions + + /// + /// DMMKeysightM9183 factory constructor + /// + /// + /// + public DMMKeysightM9183(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("DMMKeysightM9183", "Address", ""); + _options = _configuration.GetConfigurationValue("DMMKeysightM9183", "Options", ""); + + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + + //created in Initialize() + _dmm = null; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The constructor which opens the handle to the DMM and performs a self test on the instrument + /// + /// The name of this dmm + /// The address of the DMM + public DMMKeysightM9183(string name, string address, string options) + { + _name = name; + _address = address; + _options = options.Trim(); + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + + //created in Initialize() + _dmm = null; + _logger = LogManager.GetCurrentClassLogger(); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The Finalizer which will release resources if required + /// + ~DMMKeysightM9183() + { + Dispose(false); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + /// + public void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution) + { + if (type != MeasurementFunction.ACCurrent && type != MeasurementFunction.DCCurrent) + { + throw new Exception("only AC or DC Current types are acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Amps; + _lastResolution = resolution.Amps; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution) + { + if (type != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Hertz; + _lastResolution = resolution.Hertz; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution) + { + if (type != MeasurementFunction.FourWireResistance && type != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Ohms; + _lastResolution = resolution.Ohms; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution) + { + if (type != MeasurementFunction.DCVolts && type != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + type.ToString()); + } + + _lastType = type; + _lastRange = range.Volts; + _lastResolution = resolution.Volts; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Keysight Dmm"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _dmm = new AgM918x(); + + if (_options != "" && _options.ToUpper() != "NONE") + { + _dmm.Initialize(_address, false, true, _options); + } + else + { + _dmm.Initialize(_address, false, true); + } + + //_selfTestResult = PerformSelfTest(); + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public MeasurementFunction MeasurementType + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public Current MeasureCurrent(int timeout) + { + if (_lastType != MeasurementFunction.DCCurrent && _lastType != MeasurementFunction.ACCurrent) + { + throw new Exception("only DC or AC Current is acceptable for param type: " + _lastType.ToString()); + } + + return Current.FromAmps(ReadCurrent(_lastRange, _lastResolution, _lastType)); + } + + /// + /// + /// + /// + /// + public Frequency MeasureFrequency(int timeout) + { + if (_lastType != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + return Frequency.FromHertz(ReadFrequency(_lastRange, _lastResolution, _lastRange, 1)); + } + + /// + /// + /// + /// + /// + public Resistance MeasureResistance(int timeout) + { + if (_lastType != MeasurementFunction.FourWireResistance && _lastType != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + return Resistance.FromOhms(ReadResistance(_lastRange, _lastResolution, _lastType)); + } + + /// + /// + /// + /// + /// + public Voltage MeasureVoltage(int timeout) + { + if (_lastType != MeasurementFunction.DCVolts && _lastType != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + _lastType.ToString()); + } + + return Voltage.FromVolts(ReadVoltage(_lastRange, _lastResolution, _lastType)); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + int testResult = 0; + string result = ""; + _dmm.Utility.SelfTest(ref testResult, ref result); + + // Set measurement input to backplane after performing self test. Default is front panel. + // _dmm.Measurement.In = VTEXDmmInputSelectEnum.VTEXDmmInputSelectInternal; + + if (testResult > 0) + { + _selfTestResult = Raytheon.Instruments.SelfTestResult.Fail; + throw new Exception("self test failed with an Error Code: " + testResult + " and Error Message: " + result); + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + _dmm.Utility.Reset(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + _dmm.Utility.Reset(); + + _dmm.Close(); + + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183.csproj b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183.csproj new file mode 100644 index 0000000..7efe71d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183.csproj @@ -0,0 +1,39 @@ + + + + + net472 + x86 + Raytheon.Instruments.DMMKeysightM9183 + DMM Keysight M9183 implementation + DMM Keysight M9183 implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\Keysight\Agilent.AgM918x.Interop.dll + + + ..\..\Common\COTS\VTI\Ivi.Dmm.Interop.dll + + + ..\..\Common\COTS\VTI\Ivi.Driver.Interop.dll + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183Factory.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183Factory.cs new file mode 100644 index 0000000..937d937 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightM9183/DMMKeysightM9183Factory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// DMMKeysightM9183Factory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DMMKeysightM9183Factory")] + public class DMMKeysightM9183Factory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DMMKeysightM9183Factory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DMMKeysightM9183Factory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IDmm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DMMKeysightM9183(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DMMSim(name, _configurationManager, _logger); + else + return new DMMKeysightM9183(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpi.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpi.cs new file mode 100644 index 0000000..9e525e8 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpi.cs @@ -0,0 +1,785 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- + RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION + PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS + AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO + UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO + RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS + CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS + OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON + COMPANY. + + THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. + GOVERNMENT. + + UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. + -------------------------------------------------------------------------*/ + +using Raytheon.Instruments; +using System; +using System.Net.Sockets; +using System.Text; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; +using System.Threading; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A keysight implementation of the DMM interface + /// + public class DMMKeysightScpi : IDmm + { + #region PrivateMemberVariables + + private const string READ_ERROR_STATUS_CMD = "SYST:ERR?"; + private const string _SELFTESTCMD = "*TST?"; + private const string _RESETCMD = "*RST"; + private const string _MEASUREFRES = "MEAS:FRES? "; //Resistance 4-wire + private const string _MEASURERES = "MEAS:RES? "; //Resistance 2-wire + private const string _MEASUREDCVOLT = "MEAS:VOLT:DC? "; + private const string _MEASUREACVOLT = "MEAS:VOLT:AC? "; + + //Frequency + private const string _FREQ_SETUP1 = "CONF:FREQ "; + private const string _FREQ_SETUP2 = "SENS:FREQ:VOLT:RANGE:AUTO OFF"; + private const string _FREQ_SETUP3 = "FREQ:VOLT:RANG "; + private const string _FREQ_SETUP4 = "SAMPLE:COUNT "; + private const string _MEASUREFREQ = "READ? "; + + private const string _AUTO = "AUTO"; + private const string _DEFAULT = "DEF"; + + private const int _PORT = 5025; + private const int _READ_TIMEOUT = 5000; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + private string _name; + private readonly string _address; + private MeasurementFunction _lastType; + private double _lastRange; + private double _lastResolution; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// Dispose of this objects resources + /// + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_34461A")] + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _tcpStream.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Reads frequency from the dmm + /// + /// The range to use on the DMM + /// The resolution to use on the DMM + /// The voltage range for the measurement + /// The number of reads to make + /// The frequency or average of frequencies read + private double ReadFrequency(double range, double resolution, double voltRange, double numReads) + { + //Setup the frequency measurement + string command = _FREQ_SETUP1; + + if (range == -1) + { + command += _DEFAULT + ", " + _DEFAULT; + } + else + { + command += range + ", " + resolution; + } + + command += ";:" + _FREQ_SETUP2 + ";:" + _FREQ_SETUP3 + voltRange; + + //want to read frequency more than once + if (numReads > 1) + { + command += ";:" + _FREQ_SETUP4 + "\n"; + } + else + { + command += "\n"; + } + + // send the command + IOWrite(command); + + //read the frequency + command = _MEASUREFREQ + "\n"; + string rspStr = IOQuery(command); + + double frequency = 0.0; + + if (rspStr.IndexOf(',') > -1) + { + frequency = GetFrequencyAvg(rspStr); + } + else + { + frequency = Util.ConvertStringToDouble(rspStr); + } + + return frequency; + } + + /// + /// Reads resistance + /// + /// The range to use on the DMM + /// The resolution to use on the DMM\ + /// + /// The resistance + private double ReadResistance(double range, double resolution, MeasurementFunction resistanceType) + { + string command = ""; + + if (resistanceType == MeasurementFunction.FourWireResistance) + { + command = _MEASUREFRES; + } + else if (resistanceType == MeasurementFunction.TwoWireResistance) + { + command = _MEASURERES; + } + else + { + throw new Exception("only 4 or 2 write resistance is acceptable for param type: " + resistanceType.ToString()); + } + + if (range == -1) + { + command += _AUTO + ", " + _DEFAULT; + } + else + { + command += range + ", " + resolution; + } + + command += "\n"; + + string rspStr = IOQuery(command); + + double resistance = Util.ConvertStringToDouble(rspStr); + + return resistance; + } + + /// + /// Reads voltage + /// + /// The range to use on the DMM + /// The resolution to use on the DMM + /// + private double ReadVoltage(double range, double resolution, MeasurementFunction voltageType) + { + string command = ""; + + if (voltageType == MeasurementFunction.ACVolts) + { + command = _MEASUREACVOLT; + } + else if (voltageType == MeasurementFunction.DCVolts) + { + command = _MEASUREDCVOLT; + } + else + { + throw new Exception("only ac or dc volt is acceptable for param type: " + voltageType.ToString()); + } + + if (range == -1) + { + command += _AUTO + ", " + _DEFAULT; + } + else + { + command += range + ", " + resolution; + } + + command += "\n"; + string rspStr = IOQuery(command); + + double dcVoltage = Util.ConvertStringToDouble(rspStr); + return dcVoltage; + } + + /// + /// Convert scpi data to string + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// + /// + /// + /// + private double GetFrequencyAvg(string numbers) + { + string[] numArr = numbers.Split(','); + double retVal = 0; + + foreach (string val in numArr) + { + retVal += Util.ConvertStringToDouble(val); + } + + retVal = retVal / numArr.Length; + + return retVal; + } + + + /// + /// Get the error code. + /// + /// The error code (number). + private int GetErrorCode() + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string command = READ_ERROR_STATUS_CMD + "\n"; + + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert to a string + string rspStr = ConvertToString(ref _readBuffer); + + // parse the response + string[] tokens = rspStr.Split(','); + + int ret = Util.ConvertStringToInt32(tokens[0]); + + return ret; + } + + /// + /// Send a command to the DMM and get the response + /// + /// The command to send + /// The DMM response + private string IOQuery(string commandString) + { + // send the command + IOWrite(commandString, false); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + if (numBytesRead == 0) + { + throw new Exception($"DMMKeysightScpi:IOQuery() - Number of bytes read from stream was {numBytesRead}"); + } + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // check for errors + int err = GetErrorCode(); + if (err != 0) + { + throw new Exception("DMMKeysightScpi:IOQuery() - returned error code: " + err.ToString()); + } + + return rspStr; + } + + /// + /// Sends a SCPI Command to the instrument. + /// + /// The SCPI Command to be sent to the instrument. + private void IOWrite(string commandString, bool checkForError = true) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + if (checkForError) + { + // check for errors + int err = GetErrorCode(); + if (err != 0) + { + throw new Exception("DMMKeysightScpi:IOWrite() - returned error code: " + err.ToString()); + } + } + } + + #endregion + + #region PublicFunctions + + /// + /// DMMKeysightScpi factory constructor + /// + /// + /// + public DMMKeysightScpi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("DMMKeysightScpi", "Address", ""); + + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + + const int READ_BUFFER_SIZE = 512; + _readBuffer = new byte[READ_BUFFER_SIZE]; + + // created in initialize + _tcpStream = null; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The constructor which opens the handle to the DMM and performs a self test on the instrument + /// + /// The name of this dmm + /// The address of the DMM + public DMMKeysightScpi(string name, string address) + { + const int READ_BUFFER_SIZE = 512; + + _name = name; + _address = address; + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + + _readBuffer = new byte[READ_BUFFER_SIZE]; + + _logger = LogManager.GetCurrentClassLogger(); + + // created in initialize + _tcpStream = null; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The Finalizer which will release resources if required + /// + ~DMMKeysightScpi() + { + Dispose(false); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + /// + public void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution) + { + throw new NotImplementedException(); + /*_lastType = type; + _lastRange = range.Amps; + _lastResolution = resolution.Amps;*/ + } + + /// + /// + /// + /// + /// + /// + public void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution) + { + if (type != MeasurementFunction.DCVolts && type != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + type.ToString()); + } + + _lastType = type; + _lastRange = range.Volts; + _lastResolution = resolution.Volts; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution) + { + if (type != MeasurementFunction.FourWireResistance && type != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Ohms; + _lastResolution = resolution.Ohms; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution) + { + if (type != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Hertz; + _lastResolution = resolution.Hertz; + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Keysight Dmm"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + TcpClient dmmSocketConn = new TcpClient(_address, _PORT); + _tcpStream = dmmSocketConn.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + _selfTestResult = PerformSelfTest(); + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public MeasurementFunction MeasurementType + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public Current MeasureCurrent(int timeout) + { + throw new NotImplementedException(); + + /* + if (_lastType != MeasurementFunction.DCVolts && _lastType != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + type.ToString()); + } + + return Current.FromAmps(ReadCurrent();*/ + } + + /// + /// + /// + /// + /// + public Frequency MeasureFrequency(int timeout) + { + if (_lastType != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + return Frequency.FromHertz(ReadFrequency(_lastRange, _lastResolution, _lastRange, 1)); + } + + /// + /// + /// + /// + /// + public Resistance MeasureResistance(int timeout) + { + if (_lastType != MeasurementFunction.FourWireResistance && _lastType != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + return Resistance.FromOhms(ReadResistance(_lastRange, _lastResolution, _lastType)); + } + + /// + /// + /// + /// + /// + public Voltage MeasureVoltage(int timeout) + { + if (_lastType != MeasurementFunction.DCVolts && _lastType != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + _lastType.ToString()); + } + + return Voltage.FromVolts(ReadVoltage(_lastRange, _lastResolution, _lastType)); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + // change the timeout to account for the long self test + _tcpStream.ReadTimeout = 30000; + + // send the command and get the response + string command = _SELFTESTCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + int rsp = Util.ConvertStringToInt32(tokens[0].Replace("+", "").Split(',')[0]); + + + if (rsp != 0) + { + string errorMsg = "returned an error: " + rspStr; + _selfTestResult = SelfTestResult.Fail; + throw new Exception(errorMsg); + } + _selfTestResult = SelfTestResult.Pass; + } + catch (Exception) + { + throw; + } + finally + { + // restore the timeout + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + + return SelfTestResult; + } + + /// + /// + /// + public void Reset() + { + IOWrite(_RESETCMD + "\n"); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + Reset(); + + _tcpStream.Dispose(); + + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpi.csproj b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpi.csproj new file mode 100644 index 0000000..b102e11 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpi.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.DMMKeysightScpi + DMM Keysight Scpi implementation + DMM Keysight Scpi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpiFactory.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpiFactory.cs new file mode 100644 index 0000000..71f05ad --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMKeysightScpi/DMMKeysightScpiFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// DMMKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DMMKeysightScpiFactory")] + public class DMMKeysightScpiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DMMKeysightScpiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DMMKeysightScpiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IDmm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DMMKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DMMSim(name, _configurationManager, _logger); + else + return new DMMKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxi.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxi.cs new file mode 100644 index 0000000..0a631ce --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxi.cs @@ -0,0 +1,560 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using NationalInstruments.ModularInstruments.NIDmm; +using NLog; +using Raytheon.Common; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; + +namespace Raytheon.Instruments +{ + /// + /// A simulation implementation of the DMM interface. + /// This class basically just absorbs function calls and returns dummy data. + /// + public class DMMNiPxi : IDmm, IDisposable + { + #region PrivateMemberVariables + + private NIDmm _niDmm; + private string _name; + private readonly string _address; + //private readonly string _options; + private double _lastRange; + private double _lastResolution; + private MeasurementFunction _lastType; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer. + /// + ~DMMNiPxi() + { + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _niDmm.DriverUtility.Reset(); + + _niDmm.Close(); + + _niDmm.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFunctions + + /// + /// DMMNiPxi factory constructor + /// + /// + /// + public DMMNiPxi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("DMMNiPxi", "Address", ""); + //_options = _configuration.GetConfigurationValue("DMMNiPxi", "Options", ""); + + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + + //created in Initialize() + _niDmm = null; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + /// + public DMMNiPxi(string name, string address)//, string options) + { + _name = name; + _address = address; + //_options = options; + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + + // set in Initialize() + _niDmm = null; + _logger = LogManager.GetCurrentClassLogger(); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + /// + public void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution) + { + throw new NotImplementedException(); + /*_lastType = type; + _lastRange = range.Amps; + _lastResolution = resolution.Amps;*/ + } + + /// + /// + /// + /// + /// + /// + public void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution) + { + if (type != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Hertz; + _lastResolution = resolution.Hertz; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution) + { + if (type != MeasurementFunction.FourWireResistance && type != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Ohms; + _lastResolution = resolution.Ohms; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution) + { + if (type != MeasurementFunction.DCVolts && type != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + type.ToString()); + } + + _lastType = type; + _lastRange = range.Volts; + _lastResolution = resolution.Volts; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a NI Dmm"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _niDmm = new NIDmm(_address, false, true);// _options); + _selfTestResult = PerformSelfTest(); + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public MeasurementFunction MeasurementType + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public Current MeasureCurrent(int timeout) + { + throw new NotImplementedException(); + + /* + if (_lastType != MeasurementFunction.DCVolts && _lastType != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + type.ToString()); + } + + return Current.FromAmps(ReadCurrent();*/ + } + + /// + /// + /// + /// + /// + public Frequency MeasureFrequency(int timeout) + { + if (_lastType != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + DmmAuto auto = DmmAuto.Off; + + if (_lastRange < 0) + { + auto = DmmAuto.On; + // set the starting range for auto range to 10 + _lastRange = 10; + } + + _niDmm.MeasurementFunction = DmmMeasurementFunction.Frequency; + + _niDmm.Range = _lastRange; + + _niDmm.Resolution = _lastResolution; + + _niDmm.AutoRange = auto; + + double frequency = _niDmm.Measurement.Read(); + + return Frequency.FromHertz(frequency); + } + + /// + /// + /// + /// + /// + public Resistance MeasureResistance(int timeout) + { + if (_lastType != MeasurementFunction.FourWireResistance && _lastType != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + if (_lastType == MeasurementFunction.FourWireResistance) + { + _niDmm.MeasurementFunction = DmmMeasurementFunction.FourWireResistance; + } + else + { + _niDmm.MeasurementFunction = DmmMeasurementFunction.TwoWireResistance; + } + + DmmAuto auto = DmmAuto.Off; + + if (_lastRange < 0) + { + auto = DmmAuto.On; + // set the starting range for auto range to 10 + _lastRange = 10; + } + + _niDmm.Range = _lastRange; + + _niDmm.Resolution = _lastResolution; + + _niDmm.AutoRange = auto; + + double resistance = _niDmm.Measurement.Read(); + + if (double.IsNaN(resistance)) + { + resistance = double.MaxValue; + } + + return Resistance.FromOhms(resistance); + } + + /// + /// + /// + /// + /// + public Voltage MeasureVoltage(int timeout) + { + if (_lastType != MeasurementFunction.DCVolts && _lastType != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + _lastType.ToString()); + } + + if (_lastType == MeasurementFunction.ACVolts) + { + _niDmm.MeasurementFunction = DmmMeasurementFunction.ACVolts; + } + else + { + _niDmm.MeasurementFunction = DmmMeasurementFunction.DCVolts; + } + + DmmAuto auto = DmmAuto.Off; + + if (_lastRange < 0) + { + auto = DmmAuto.On; + // set the starting range for auto range to 10 + _lastRange = 10; + } + + _niDmm.Range = _lastRange; + + _niDmm.Resolution = _lastResolution; + + _niDmm.AutoRange = auto; + + double volts = _niDmm.Measurement.Read(); + + if (double.IsNaN(volts)) + { + volts = double.MaxValue; + } + + return Voltage.FromVolts(volts); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + DmmSelfTestResult res = _niDmm.DriverUtility.SelfTest(); + + if (res.Code != 0) + { + _selfTestResult = Raytheon.Instruments.SelfTestResult.Fail; + throw new Exception("self test returned: " + res.Code + "," + res.Message + " on card " + _name); + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + _niDmm.DriverUtility.Reset(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + _niDmm.DriverUtility.Reset(); + + _niDmm.Close(); + + _niDmm.Dispose(); + + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxi.csproj b/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxi.csproj new file mode 100644 index 0000000..28681b6 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxi.csproj @@ -0,0 +1,42 @@ + + + + + net472 + Raytheon.Instruments.DMMNiPxi + DMM NI Pxi implementation + DMM NI Pxi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\NI\NationalInstruments.ModularInstruments.NIDmm.Fx45.dll + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxiFactory.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxiFactory.cs new file mode 100644 index 0000000..df3bc0b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMNiPxi/DMMNiPxiFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// DMMKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DMMNiPxiFactory")] + public class DMMNiPxiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DMMNiPxiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DMMNiPxiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IDmm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DMMNiPxi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DMMSim(name, _configurationManager, _logger); + else + return new DMMNiPxi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSim.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSim.cs new file mode 100644 index 0000000..c25ff10 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSim.cs @@ -0,0 +1,435 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using NLog; +using Raytheon.Common; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; + +namespace Raytheon.Instruments +{ + /// + /// A simulation implementation of the DMM interface. + /// This class basically just absorbs function calls and returns dummy data. + /// + public class DMMSim : IDmm + { + #region PrivateMemberVariables + + private string _name; + private double _lastRange; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer. + /// + ~DMMSim() + { + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + // nothing to clean up + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFunctions + + /// + /// DMMSim factory constructor + /// + /// + /// + public DMMSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _lastRange = 0; + + _state = State.Uninitialized; + + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public DMMSim(string name) + { + _name = name; + + _lastRange = 0; + + _logger = LogManager.GetCurrentClassLogger(); + + _state = State.Uninitialized; + + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + /// + public void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution) + { + _lastRange = range.Amps; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution) + { + _lastRange = range.Hertz; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution) + { + _lastRange = range.Ohms; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution) + { + _lastRange = range.Volts; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Sim Dmm"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _selfTestResult = PerformSelfTest(); + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public Current MeasureCurrent(int timeout) + { + double max = _lastRange; + + double min = 1.0; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(200); + + return Current.FromAmps(dataToReturn); + } + + /// + /// + /// + /// + /// + public Frequency MeasureFrequency(int timeout) + { + double max = _lastRange; + + double min = 1.0; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(200); + + return Frequency.FromHertz(dataToReturn); + } + + /// + /// + /// + /// + /// + public Resistance MeasureResistance(int timeout) + { + double max = _lastRange; + + double min = 1.0; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(200); + + return Resistance.FromOhms(dataToReturn); + } + + /// + /// + /// + /// + /// + public Voltage MeasureVoltage(int timeout) + { + double max = _lastRange; + + double min = 1.0; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(200); + + return Voltage.FromVolts(dataToReturn); + } + + + /// + /// + /// + public MeasurementFunction MeasurementType + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Pass; + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + _state = State.Uninitialized; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSim.csproj b/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSim.csproj new file mode 100644 index 0000000..a0a5535 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSim.csproj @@ -0,0 +1,27 @@ + + + + + net472 + Raytheon.Instruments.DMMSim + Raytheon.Instruments + DMM Sim implementation + DMM Sim implementation + Library + + + + 1.0.0 + + + + NU1603 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSimFactory.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSimFactory.cs new file mode 100644 index 0000000..4728dd2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMSim/DMMSimFactory.cs @@ -0,0 +1,137 @@ +// ********************************************************************************************************** +// DMMSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DMMSimFactory")] + public class DMMSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DMMSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DMMSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IDmm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DMMSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new DMMSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAK.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAK.cs new file mode 100644 index 0000000..ebe8cde --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAK.cs @@ -0,0 +1,541 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; +using System.IO.Ports; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A Space Electronics (Squib meter) of the DMM interface + /// + public class DMMSquibMeter101SQBRAK : IDmm, IDisposable + { + #region PrivateMemberVariables + + private string _name; + private readonly string _address; + private readonly SerialPort _serialPort; + private MeasurementFunction _lastType; + private double _lastRange; + private double _lastResolution; + private State _state; + private SelfTestResult _selfTestResult; + private byte[] _readBuffer; + private string versionInfo; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// Dispose of this objects resources + /// + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_34461A")] + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + IOWrite("RST"); // send reset command + IOWrite("LM"); // sets squib meter to local mode (it is set to remote in initilize) + + _serialPort.Close(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// Send a command to the squib meter and get the response. + /// + /// The command to send. + /// The squib meter response as string. + + private string IOQuery(string commandString) + { + // Flush squib meter buffer + _serialPort.Write("FS"); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // send the data out + _serialPort.Write(commandString); + + // read from the response + int numBytesRead = _serialPort.Read(_readBuffer, 0, _readBuffer.Length); + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // split out the command responce from the return data (divided by carriage return) + string[] result = rspStr.Split(new string[] { "\n", "\r\n", "" }, StringSplitOptions.None); + + // Check command responce (0 = OK) + if (result[0] == "1") + { + throw new Exception("Unknown Command"); + } + if (result[0] == "2") + { + throw new Exception("Command now allowed in present mode"); + } + + return result[1]; + } + + /// + /// Sends a serial Command to the instrument. + /// + /// The serial Command to be sent to the instrument. + private void IOWrite(string commandString) + { + // note each command sent has different return data/status/error formatting, IOWrite is just a direct write + // IOQuery will do a read, and return all the data + + // send command to serial port + _serialPort.Write(commandString); + } + + + #endregion + + #region PublicFunctions + + /// + /// DMMSquibMeter101SQBRAK factory constructor + /// + /// + /// + public DMMSquibMeter101SQBRAK(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string comPortName = _configuration.GetConfigurationValue("DMMSquibMeter101SQBRAK", "ComPortName", "COM1"); + _address = comPortName; + int baudRate = _configuration.GetConfigurationValue("DMMSquibMeter101SQBRAK", "BaudRate", 9600); + Parity parity = _configuration.GetConfigurationValue("DMMSquibMeter101SQBRAK", "Parity", Parity.None); + int dataBits = _configuration.GetConfigurationValue("DMMSquibMeter101SQBRAK", "DataBits", 8); + StopBits stopBits = _configuration.GetConfigurationValue("DMMSquibMeter101SQBRAK", "StopBits", StopBits.One); + + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + _readBuffer = new byte[1000]; + + //created in Initialize() + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The constructor which opens the handle to the DMM and performs a self test on the instrument + /// + /// The name of this dmm + /// The address of the DMM + public DMMSquibMeter101SQBRAK(string name, string comPortName, int baudRate = 9600, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One) + { + _name = name; + _address = comPortName; + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + _readBuffer = new byte[1000]; + _logger = LogManager.GetCurrentClassLogger(); + + //created in Initialize() + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + + /// + /// The Finalizer which will release resources if required + /// + ~DMMSquibMeter101SQBRAK() + { + Dispose(false); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); // if serial command for clearing errors add here, if not leave as is + } + + /// + /// + /// + /// + /// + /// + public void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution) + { + throw new NotImplementedException(); // if serial command for clearing errors add here, if not leave as is + } + + /// + /// + /// + /// + /// + /// + public void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution) + { + throw new NotImplementedException(); // if serial command for clearing errors add here, if not leave as is + } + + /// + /// + /// + /// + /// + /// + public void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution) + { + if (type != MeasurementFunction.FourWireResistance && type != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Ohms; + _lastResolution = resolution.Ohms; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution) + { + throw new NotImplementedException(); // if serial command for clearing errors add here, if not leave as is + } + + /// + /// + /// + public string DetailedStatus + { + get + { + versionInfo = IOQuery("VR"); + return "Squib Meter version Information (Cage Code | Model Number | Serial Number | Firmware Version | Calibration Date): " + versionInfo; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + // Open the port + _serialPort.Open(); + + // set the squib meter to remote state + IOQuery("RM"); + + // Ensure continuous reading is off + IOQuery("COFF"); + + // Flush FIFO buffer + IOQuery("FS"); + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public MeasurementFunction MeasurementType + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public Current MeasureCurrent(int timeout) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + public Frequency MeasureFrequency(int timeout) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + public Resistance MeasureResistance(int timeout) + { + if (_lastType != MeasurementFunction.FourWireResistance && _lastType != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + IOQuery("SR"); //todo need to add in range values + + // send serial command to send & read response + // set range + // set resolution + // any other settings that need to be sent (write) before taking measurement + + string response = IOQuery("RV"); + + // parse the response //TODO Parse the return data (0= command ok, 1= unknown command, 2= command not allowed in present mode | reading | over range state | wiring error state | calibration state (ok or bad) | hardware state (ok or bad)) + double rsp = Util.ConvertStringToDouble(response); //if string is only number this is ok, if there are any other char must strip them off + + return Resistance.FromOhms(rsp); + } + + /// + /// + /// + /// + /// + public Voltage MeasureVoltage(int timeout) + { + throw new NotImplementedException(); // if serial command for clearing errors add here, if not leave as is + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + int testResult = 0; + const string BatteryState = "LOW"; + string result = IOQuery("RV"); + + // Set measurement input to backplane after performing self test. Default is front panel. + // _dmm.Measurement.In = VTEXDmmInputSelectEnum.VTEXDmmInputSelectInternal; + + if (result == BatteryState) + { + _selfTestResult = Raytheon.Instruments.SelfTestResult.Fail; + throw new Exception("Battery state: " + testResult + " Battery State Message: " + result); + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + IOWrite("RST"); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + IOWrite("RST"); // send reset command + IOWrite("LM"); // sets squib meter to local mode (it is set to remote in initilize) + + _serialPort.Close(); + + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAK.csproj b/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAK.csproj new file mode 100644 index 0000000..6a1d7b0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAK.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.DMMSquibMeter101SQBRAK + DMM Squib Meter 101SQBRAK implementation + DMM Squib Meter 101SQBRAK implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAKFactory.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAKFactory.cs new file mode 100644 index 0000000..96516b7 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMSquibMeter101SQBRAK/DMMSquibMeter101SQBRAKFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// DMMSquibMeter101SQBRAKFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DMMSquibMeter101SQBRAKFactory")] + public class DMMSquibMeter101SQBRAKFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DMMSquibMeter101SQBRAKFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DMMSquibMeter101SQBRAKFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IDmm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DMMSquibMeter101SQBRAK(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DMMSim(name, _configurationManager, _logger); + else + return new DMMSquibMeter101SQBRAK(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTI.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTI.cs new file mode 100644 index 0000000..a1e9b59 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTI.cs @@ -0,0 +1,533 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using VTI.VTEXDmm.Interop; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A VTI Dmm + /// + public class DMMVTI : IDmm + { + #region PrivateMemberVariables + private readonly string _address; + private VTEXDmm _dmm; + private State _state; + private SelfTestResult _selfTestResult; + private readonly string _options; + private const int _READ_TIMEOUT = 1000; + private string _name; + private MeasurementFunction _lastType; + private double _lastRange; + private double _lastResolution; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// Dispose of this object + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _dmm.Utility.Reset(); + + _dmm.Close(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFunctions + + /// + /// DMMVTI factory constructor + /// + /// + /// + public DMMVTI(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("DMMVTI", "Address", ""); + _options = _configuration.GetConfigurationValue("DMMVTI", "Options", ""); + + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + + //created in Initialize() + _dmm = null; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The constructor which opens the handle to the DMM instrument. + /// + /// The address of the DMM. + /// The options used for setting up the instrument. + public DMMVTI(string name, string address, string options) + { + _name = name; + _address = address; + _options = options; + _lastType = 0; + _lastRange = 0; + _lastResolution = 0; + _logger = LogManager.GetCurrentClassLogger(); + + // create in Initialize() + _dmm = null; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The Finalizer. + /// + ~DMMVTI() + { + Dispose(false); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + /// + public void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution) + { + throw new NotImplementedException(); + /*_lastType = type; + _lastRange = range.Amps; + _lastResolution = resolution.Amps;*/ + } + + /// + /// + /// + /// + /// + /// + public void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution) + { + if (type != MeasurementFunction.DCVolts && type != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + type.ToString()); + } + + _lastType = type; + _lastRange = range.Volts; + _lastResolution = resolution.Volts; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution) + { + if (type != MeasurementFunction.FourWireResistance && type != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Ohms; + _lastResolution = resolution.Ohms; + } + + /// + /// + /// + /// + /// + /// + public void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution) + { + if (type != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + _lastType = type; + _lastRange = range.Hertz; + _lastResolution = resolution.Hertz; + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a VTI Dmm"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotSupportedException(); + } + + set + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotSupportedException(); + } + + set + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _dmm = new VTEXDmm(); + + _dmm.Initialize(_address, true, true, _options); + + // Set measurement input to backplane after performing init(). Default is front panel. + _dmm.Measurement.Input = VTEXDmmInputSelectEnum.VTEXDmmInputSelectInternal; + + _selfTestResult = PerformSelfTest(); + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public MeasurementFunction MeasurementType + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + /// + /// + public Current MeasureCurrent(int timeout) + { + throw new NotImplementedException(); + + /* + if (_lastType != MeasurementFunction.DCVolts && _lastType != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + type.ToString()); + } + + return Current.FromAmps(ReadCurrent();*/ + } + + /// + /// + /// + /// + /// + public Frequency MeasureFrequency(int timeout) + { + if (_lastType != MeasurementFunction.Frequency) + { + throw new Exception("only frequency is acceptable for param type: " + _lastType.ToString()); + } + + double frequency = 0.0; + + _dmm.Function = VTEXDmmFunctionEnum.VTEXDmmFunctionFreq; + + _dmm.Range = _lastRange; + + _dmm.Resolution = _lastResolution; + + _dmm.Measurement.Read(_READ_TIMEOUT, ref frequency); + + return Frequency.FromHertz(frequency); + } + + /// + /// + /// + /// + /// + public Resistance MeasureResistance(int timeout) + { + if (_lastType != MeasurementFunction.FourWireResistance && _lastType != MeasurementFunction.TwoWireResistance) + { + throw new Exception("only FourWireResistance or TwoWireResistance is acceptable for param type: " + _lastType.ToString()); + } + + if (_lastType == MeasurementFunction.FourWireResistance) + { + _dmm.Function = VTEXDmmFunctionEnum.VTEXDmmFunction4WireRes; + } + else + { + _dmm.Function = VTEXDmmFunctionEnum.VTEXDmmFunction2WireRes; + } + + double resistance = 0.0; + + _dmm.Range = _lastRange; + + _dmm.Resolution = _lastResolution; + + _dmm.Measurement.Read(_READ_TIMEOUT, ref resistance); + + if (double.IsNaN(resistance)) + { + resistance = double.MaxValue; + } + + return Resistance.FromOhms(resistance); + } + + /// + /// + /// + /// + /// + public Voltage MeasureVoltage(int timeout) + { + if (_lastType != MeasurementFunction.DCVolts && _lastType != MeasurementFunction.ACVolts) + { + throw new Exception("only ac or dc volt is acceptable for param type: " + _lastType.ToString()); + } + + if (_lastType == MeasurementFunction.ACVolts) + { + _dmm.Function = VTEXDmmFunctionEnum.VTEXDmmFunctionACVolts; + } + else + { + _dmm.Function = VTEXDmmFunctionEnum.VTEXDmmFunctionDCVolts; + } + + double dcVoltage = 0.0; + + _dmm.Measurement.Read(_READ_TIMEOUT, ref dcVoltage); + + if (double.IsNaN(dcVoltage)) + { + dcVoltage = double.MaxValue; + } + + return Voltage.FromVolts(dcVoltage); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + int testResult = 0; + string result = ""; + _dmm.Utility.SelfTest(ref testResult, ref result); + + // Set measurement input to backplane after performing self test. Default is front panel. + _dmm.Measurement.Input = VTEXDmmInputSelectEnum.VTEXDmmInputSelectInternal; + + if (testResult > 0) + { + _selfTestResult = Raytheon.Instruments.SelfTestResult.Fail; + throw new Exception("self test failed with an Error Code: " + testResult + " and Error Message: " + result); + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + _dmm.Utility.Reset(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + _dmm.Utility.Reset(); + + _dmm.Close(); + + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTI.csproj b/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTI.csproj new file mode 100644 index 0000000..f52dccb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTI.csproj @@ -0,0 +1,39 @@ + + + + + net472 + x86 + Raytheon.Instruments.DMMVTI + DMM VTI implementation + DMM VTI implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\VTI\Ivi.Dmm.Interop.dll + + + ..\..\Common\COTS\VTI\Ivi.Driver.Interop.dll + + + ..\..\Common\COTS\VTI\VTI.VTEXDmm.Interop.dll + + + + diff --git a/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTIFactory.cs b/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTIFactory.cs new file mode 100644 index 0000000..ae1684d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/DMM/DMMVTI/DMMVTIFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// DMMVTIFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "DMMVTIFactory")] + public class DMMVTIFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public DMMVTIFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public DMMVTIFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IDmm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new DMMVTI(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new DMMSim(name, _configurationManager, _logger); + else + return new DMMVTI(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysight.cs b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysight.cs new file mode 100644 index 0000000..26b0aee --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysight.cs @@ -0,0 +1,767 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NationalInstruments.NI4882; +using System; +using System.IO.Ports; +using NLog; +using Raytheon.Common; +using Raytheon.Units; + +namespace Raytheon.Instruments +{ + /// + /// A class that provides an interface for controlling Eloads. + /// + public class ELoadScpiKeysight : IEload + { + #region PrivateClassMembers + + // General Commands + private const string _CHAN = "CHAN "; + private const string _INPUTON = "INP ON"; + private const string _INPUTOFF = "INP OFF"; + + // Resistance Commands + private const string _RESISTANCE = "RESistance "; + private const string _RESISTANCE_MODE = "MODE RESistance"; + private const string _RESISTANCE_MODE_FIXED = "RESistance:MODE FIXED "; + private const string _RESISTANCE_RANGE = "RESistance:RANGe "; + + // Current Commands + private const string _CURRENT = "CURRent "; + private const string _CURRENT_MODE = "MODE CURRent "; + private const string _CURRENT_MODE_FIXED = "CURRent:MODE FIXED "; + private const string _CURRENT_PROTECTION = "CURR:PROTection "; + private const string _CURRENT_PROTECTION_ENABLE = "CURRent:PROTection:STATe ON"; + private const string _CURRENT_RANGE = "CURRent:RANGe "; + + //voltage commands + private const string _VOLTAGE_PROTECTION = "VOLT:PROTection "; + private const string _VOLTAGE_PROTECTION_ENABLE = "VOLT:PROTection:STATe ON"; + + // read commands + private const string _CURRENT_SETPOINT_QUERY = "CURR?"; + private const string _CURRENT_QUERY = "MEAS:CURR?"; + private const string _READVOLTAGEQUERY = "MEAS:VOLT?"; + private const string _MODE_QUERY = "MODE? "; + private const string _INPUTONQUERY = "INP?"; + private const string _READRESISTANCEQUERY = "RESistance?"; + private const string _ERRORCODE_QUERY = "SYST:ERR?"; + private const string _CURRENT_PROTECTION_QUERY = "CURR:PROTection?"; + private const string _VOLTAGE_PROTECTION_QUERY = "VOLT:PROTection?"; + private const string _PROTECTION_STATUS_QUERY = "STATus:CHANnel:CONDition?"; + + private readonly int _channelNumber; + private EloadModuleMode _mode; + private EloadModuleMode _ini_mode; + private double _setpointVal; + private double _ini_setpointVal; + private double _overCurrentProtection; + private double _overVoltageProtection; + private SerialPort _serialPort; + private Device _gpibDevice; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get; set; } + public bool FrontPanelEnabled { get; set; } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + #endregion + + #region PrivateFuctions + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + Disable(); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Querys the Eload module for an error code. + /// + /// The error code. + private string GetErrorCode(out int errorCode) + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + SetChannel(); + + string rsp = ""; + + if (_serialPort != null) + { + _serialPort.WriteLine(_ERRORCODE_QUERY); + rsp = _serialPort.ReadLine(); + } + else + { + _gpibDevice.Write(_ERRORCODE_QUERY); + rsp = _gpibDevice.ReadString(); + } + + rsp = rsp.Replace("\r", ""); + + string[] tokens = rsp.Split(','); + + errorCode = Util.ConvertStringToInt32(tokens[0]); + + // it should always be 2 + if (tokens.Length >= 2) + { + return tokens[1]; + } + else + { + return ""; + } + } + + /// + /// Send the set channel command to the Eload module. + /// + private void SetChannel() + { + // not calling IOWrite so IOWrite can call this function each time + // no need to check for errors here since they are checked in IOWrite()/IOQuery() + + string channelCommand = _CHAN + _channelNumber.ToString(); + + if (_serialPort != null) + { + _serialPort.WriteLine(channelCommand); + } + else + { + _gpibDevice.Write(channelCommand); + } + } + + /// + /// Set the overcurrent protection value and verifies setting. + /// + /// The overcurrent value. + private void SetAndConfirmOverCurrentProtection(double overCurrentProtection) + { + string currentProtectionCommand = _CURRENT_PROTECTION + _overCurrentProtection.ToString(); + IOWrite(currentProtectionCommand); + + string currentProtectionEnableCommand = _CURRENT_PROTECTION_ENABLE; + IOWrite(currentProtectionEnableCommand); + + var programmedOcp = ReadOverCurrentProtection().Amps; + + if (programmedOcp != overCurrentProtection) + { + throw new Exception("Tried to set OCP to: " + overCurrentProtection.ToString() + ", but eload reports: " + programmedOcp.ToString()); + } + } + + /// + /// Set the overvoltage protection value and verifies setting. + /// + /// The overvoltage value. + private void SetAndConfirmOverVoltageProtection(double overVoltageProtection) + { + string voltageProtectionCommand = _VOLTAGE_PROTECTION + overVoltageProtection.ToString(); + IOWrite(voltageProtectionCommand); + + string voltageProtectionEnableCommand = _VOLTAGE_PROTECTION_ENABLE; + IOWrite(voltageProtectionEnableCommand); + + var programmedOvp = ReadOverVoltageProtection().Volts; + + if (programmedOvp != overVoltageProtection) + { + throw new Exception("Tried to set OVP to: " + overVoltageProtection.ToString() + ", but eload reports: " + programmedOvp.ToString()); + } + } + #endregion + + #region PublicFuctions + + /// + /// ELoadScpiKeysight factory constructor + /// + /// + /// + public ELoadScpiKeysight(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _gpibDevice = null; + _serialPort = _configuration.GetConfigurationValue("ELoadScpiKeysight", "SerialPort", new SerialPort()); + _channelNumber = _configuration.GetConfigurationValue("ELoadScpiKeysight", "ChannelNumber", 0); + _mode = _configuration.GetConfigurationValue("ELoadScpiKeysight", "Mode", EloadModuleMode.CURRENT); + _ini_mode = _configuration.GetConfigurationValue("ELoadScpiKeysight", "IniMode", EloadModuleMode.CURRENT); + _setpointVal = _configuration.GetConfigurationValue("ELoadScpiKeysight", "SetpointVal", 0.0); + _ini_setpointVal = _configuration.GetConfigurationValue("ELoadScpiKeysight", "IniSetpointVal", 0.0); + _overCurrentProtection = _configuration.GetConfigurationValue("ELoadScpiKeysight", "OverCurrentProtection", 0.0); + _overVoltageProtection = _configuration.GetConfigurationValue("ELoadScpiKeysight", "OverVoltageProtection", 0.0); + + // make sure it is off + Disable(); + + // set mode + SetMode(_mode); + + // set the setpoint + SetSetpoint(_setpointVal, _mode); + + //set OCP + SetAndConfirmOverCurrentProtection(_overCurrentProtection); + } + + + /// + /// The constructor for an Eload. + /// + /// The interface to the Eload instrument. + /// The channel number for the Eload module. + /// The operating mode of this Eload module. + /// The setpoint value of the Eload module. Depends on operation mode. + /// The overcurrent protection value. + public ELoadScpiKeysight(SerialPort serialPort, int channelNumber, EloadModuleMode mode, double setpointVal, double overCurrentProtection, double overVoltageProtection) + { + _gpibDevice = null; + _serialPort = serialPort; + _channelNumber = channelNumber; + _mode = mode; + _ini_mode = mode; + _setpointVal = setpointVal; + _ini_setpointVal = setpointVal; + _overCurrentProtection = overCurrentProtection; + _overVoltageProtection = overVoltageProtection; + _logger = LogManager.GetCurrentClassLogger(); + + // make sure it is off + Disable(); + + // set mode + SetMode(mode); + + // set the setpoint + SetSetpoint(setpointVal, mode); + + //set OCP + SetAndConfirmOverCurrentProtection(_overCurrentProtection); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public ELoadScpiKeysight(Device gpibDevice, int channelNumber, EloadModuleMode mode, double setpointVal, double overCurrentProtection, double overVoltageProtection) + { + _serialPort = null; + _gpibDevice = gpibDevice; + _channelNumber = channelNumber; + _mode = mode; + _ini_mode = mode; + _setpointVal = setpointVal; + _ini_setpointVal = setpointVal; + _overCurrentProtection = overCurrentProtection; + _overVoltageProtection = overVoltageProtection; + + // make sure it is off + Disable(); + + // set mode + SetMode(mode); + + // set the setpoint + SetSetpoint(setpointVal, mode); + + //set OCP + SetAndConfirmOverCurrentProtection(_overCurrentProtection); + } + + + /// + /// The finalizer. + /// + ~ELoadScpiKeysight() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Query if the Eload module input is on. + /// + /// Status of Eload. True = On, False = Off. + public bool IsInputOn() + { + string readCommand = _INPUTONQUERY; + + string rsp = IOQuery(readCommand); + + if (rsp == "0") + { + return false; + } + else + { + return true; + } + } + + /// + /// Send a SCPI Command to the instrument and get a response. + /// + /// The command to send. + /// THe instrument response. + public string IOQuery(string commandString) + { + // not calling IOWrite() so IOWrite() can check for errors after each write + + SetChannel(); + + string rsp = ""; + + if (_serialPort != null) + { + _serialPort.WriteLine(commandString); + rsp = _serialPort.ReadLine(); + } + else + { + _gpibDevice.Write(commandString); + rsp = _gpibDevice.ReadString(); + } + + rsp = rsp.Replace("\r", ""); + + // check for errors + int err = 0; + string errorMsg = GetErrorCode(out err); + if (err != 0) + { + throw new Exception(errorMsg); + } + + return rsp; + } + + /// + /// Send a SCPI Command to the instrument. + /// + /// The command to be send. + public void IOWrite(string commandString) + { + SetChannel(); + + if (_serialPort != null) + { + _serialPort.WriteLine(commandString); + } + else + { + _gpibDevice.Write(commandString); + } + + // check for errors + int err = 0; + string errorMsg = GetErrorCode(out err); + if (err != 0) + { + throw new Exception(errorMsg); + } + } + + /// + /// Turn off the Eload module. + /// + public void Disable() + { + IOWrite(_INPUTOFF); + } + + /// + /// Turn on the Eload module. + /// + public void Enable() + { + IOWrite(_INPUTON); + } + + /// + /// Reads the current of the Eload module. + /// + /// The current (Amps) + public Current ReadCurrent() + { + string readCommand = _CURRENT_QUERY; + + string rsp = IOQuery(readCommand); + + double ret = Util.ConvertStringToDouble(rsp); + + return Current.FromAmps(ret); + } + + /// + /// Reads the mode of the Eload module. + /// + /// The mode. + public EloadModuleMode ReadMode() + { + string readCommand = _MODE_QUERY; + string ret = Convert.ToString(IOQuery(readCommand)); + var mode = EloadModuleMode.RESISTANCE; + + // will ger RES, CURR, or VOLT(tbd) + if (EloadModuleMode.CURRENT.ToString().Contains(ret) == true) + { + mode = EloadModuleMode.CURRENT; + } + else if (EloadModuleMode.RESISTANCE.ToString().Contains(ret) == true) + { + mode = EloadModuleMode.RESISTANCE; + } + else if (EloadModuleMode.VOLTAGE.ToString().Contains(ret) == true) + { + mode = EloadModuleMode.VOLTAGE; + } + else + { + throw new Exception("Unknown return from load: " + ret); + } + + return mode; + } + + /// + /// Reads the overcurrent setting from an Eload module. + /// + /// The current (Amps). + public Current ReadOverCurrentProtection() + { + string currentProtectionCommand = _CURRENT_PROTECTION_QUERY; + + string rsp = IOQuery(currentProtectionCommand); + + double ret = Util.ConvertStringToDouble(rsp); + + return Current.FromAmps(ret); + } + + /// + /// Reads the overvoltage setting from an Eload module. + /// + /// The voltage (Volts). + public Voltage ReadOverVoltageProtection() + { + string voltageProtectionCommand = _VOLTAGE_PROTECTION_QUERY; + + string rsp = IOQuery(voltageProtectionCommand); + + double ret = Util.ConvertStringToDouble(rsp); + + return Voltage.FromVolts(ret); + } + + /// + /// Query the Eload module for the resistance. + /// + /// The resistance (Ohms). + public Resistance ReadResistance() + { + string readCommand = _READRESISTANCEQUERY; + + string rsp = IOQuery(readCommand); + + double ret = Util.ConvertStringToDouble(rsp); + + return Resistance.FromOhms(ret); + } + + /// + /// Queries the Eload module for the setpoint value. Depends on operation mode. + /// + /// The setpoint value. + public double ReadSetpoint() + { + string readCommand = ""; + + if (_mode == EloadModuleMode.CURRENT) + { + readCommand = _CURRENT_SETPOINT_QUERY; + } + else if (_mode == EloadModuleMode.RESISTANCE) + { + readCommand = _READRESISTANCEQUERY; + } + else if (_mode == EloadModuleMode.VOLTAGE) + { + throw new Exception("voltage mode not supported"); + } + else + { + throw new Exception("Unknown mode: " + _mode.ToString()); + } + + string rsp = IOQuery(readCommand); + + double ret = Util.ConvertStringToDouble(rsp); + + return ret; + } + + /// + /// Query the Eload module for the voltage. + /// + /// The voltage (Volts). + public Voltage ReadVoltage() + { + string readCommand = _READVOLTAGEQUERY; + + string rsp = IOQuery(readCommand); + + double ret = Util.ConvertStringToDouble(rsp); + + return Voltage.FromVolts(ret); + } + + /// + /// Reads the overvoltage setting from an Eload module. + /// + /// The voltage (Volts). + public ushort ReadProtectionStatus() + { + string ProtectionStatusCommand = _PROTECTION_STATUS_QUERY; + + string rsp = IOQuery(ProtectionStatusCommand); + + ushort ret = Util.ConvertStringToUInt16(rsp); + + return ret; + } + + /// + /// Resets the eload setpoint and mode to config file values + /// + public void SetInitialSetting() + { + SetMode(_ini_mode); + SetSetpoint(_ini_setpointVal, _ini_mode); + } + + /// + /// Change the mode for the Eload module. + /// + /// The desired Eload module mode. + public void SetMode(EloadModuleMode mode) + { + //make sure it is off + Disable(); + + string command = ""; + string fixedCommand = ""; + + if (mode == EloadModuleMode.CURRENT) + { + command = _CURRENT_MODE; + fixedCommand = _CURRENT_MODE_FIXED; + } + else if (mode == EloadModuleMode.RESISTANCE) + { + command = _RESISTANCE_MODE; + fixedCommand = _RESISTANCE_MODE_FIXED; + } + else if (mode == EloadModuleMode.VOLTAGE) + { + throw new Exception("Voltage mode is not yet supported"); + } + else + { + throw new Exception("unsupported mode: " + mode.ToString()); + } + + IOWrite(command); + + IOWrite(fixedCommand); + + _mode = mode; + } + + /// + /// Change the setpoint and operation mode of the Eload module. + /// + /// The new setpoint. + /// The new mode. + public void SetSetpoint(double newSetpoint, EloadModuleMode mode) + { + if (mode != _mode) + { + throw new Exception("the current mode and the specified mode do not match. Current Mode: " + _mode.ToString() + ", specified mode: " + mode.ToString()); + } + + string rangeCommand = ""; + string command = ""; + + if (_mode == EloadModuleMode.CURRENT) + { + if (newSetpoint > _overCurrentProtection) + { + throw new Exception("the setpoint " + newSetpoint + "is outside the limit"); + } + + rangeCommand = _CURRENT_RANGE + newSetpoint.ToString(); + command = _CURRENT + newSetpoint.ToString(); + } + else if (_mode == EloadModuleMode.RESISTANCE) + { + if (newSetpoint <= 0) + { + throw new Exception("Invalid resistance: " + newSetpoint.ToString()); + } + + //i = v/r + double tempVoltage = ReadVoltage().Volts; + + // if voltage is not 0, we will confirm that resulting current is within range. + // Having Abs() to ensure to cover both +/- voltage cases if there is any. + if (Math.Abs(tempVoltage) > 1) + { + //calculate the resulting current + double tempCurrent = Math.Abs(tempVoltage) / newSetpoint; + + if (tempCurrent > _overCurrentProtection) + { + throw new Exception("the setpoint " + newSetpoint + "is outside the limit"); + } + } + + rangeCommand = _RESISTANCE_RANGE + newSetpoint.ToString(); + command = _RESISTANCE + newSetpoint.ToString(); + } + else if (_mode == EloadModuleMode.VOLTAGE) + { + throw new Exception("voltage mode not supported"); + } + else + { + throw new Exception("Unknown mode: " + _mode.ToString()); + } + + IOWrite(rangeCommand); + + IOWrite(command); + + // update our member now that everything checks out + _setpointVal = newSetpoint; + } + + public bool ClearErrors() + { + return true; + } + + public void Initialize() + { + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + Disable(); + + Enable(); + } + + public void Shutdown() + { + Dispose(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysight.csproj b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysight.csproj new file mode 100644 index 0000000..bcc7451 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysight.csproj @@ -0,0 +1,41 @@ + + + + + net472 + Raytheon.Instruments.ELoadScpiKeysight + ELoad Scpi Keysight implementation + ELoad Scpi Keysight implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + ..\..\Common\COTS\NI\NationalInstruments.NI4882.dll + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysightFactory.cs b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysightFactory.cs new file mode 100644 index 0000000..df1eebb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadScpiKeysight/ELoadScpiKeysightFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// ELoadScpiKeysightFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ELoadScpiKeysightFactory")] + public class ELoadScpiKeysightFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ELoadScpiKeysightFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ELoadScpiKeysightFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IEload)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ELoadScpiKeysight(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new EloadSim(name, _configurationManager, _logger); + else + return new ELoadScpiKeysight(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSim.cs b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSim.cs new file mode 100644 index 0000000..67c3840 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSim.cs @@ -0,0 +1,388 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using NLog; +using Raytheon.Common; +using Raytheon.Units; + +namespace Raytheon.Instruments +{ + /// + /// A simulated eload + /// + public class EloadSim : IEload + { + #region PrivateClassMembers + private readonly double _overCurrentProtection; + private readonly double _overVoltageProtection; + private double _setpointVal; + private double _ini_setpointval; + private double _voltage; + private readonly int _channelNumber; + private bool _isOn; + private EloadModuleMode _mode; + private EloadModuleMode _originalMode; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get; set; } + public bool FrontPanelEnabled { get; set; } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + #endregion + + #region PublicFuctions + + /// + /// FlowMeterOmegaDPF20 factory constructor + /// + /// + /// + public EloadSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + const double SETPOINT_VOLTAGE = 28.0; + + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _channelNumber = _configuration.GetConfigurationValue("EloadSim", "ChannelNumber", 0); + _mode = _configuration.GetConfigurationValue("EloadSim", "Mode", EloadModuleMode.CURRENT); + _setpointVal = _configuration.GetConfigurationValue("EloadSim", "SetpointVal", 0.0); + _ini_setpointval = _configuration.GetConfigurationValue("EloadSim", "IniSetpointVal", 0.0); + _overCurrentProtection = _configuration.GetConfigurationValue("EloadSim", "OverCurrentProtection", 0.0); + _overVoltageProtection = _configuration.GetConfigurationValue("EloadSim", "OverVoltageProtection", 0.0); + _voltage = SETPOINT_VOLTAGE; + _originalMode = _mode; + // make sure it is off + Disable(); + } + + /// + /// The constructor for an Eload (Simulation). + /// + /// The channel number for the Eload. + /// The operation mode of the channel. Modes: Resistance, Voltage, Current. + /// The operation point of the load. This can be a voltage, current, or resistance. + /// Overcurrent setpoint that will turn off the channel if exceeded. + /// Overvoltage setpoint that will turn off channel if exceeded (double check). + public EloadSim(int channelNumber, EloadModuleMode mode, double setpointVal, double overCurrentProtection, double overVoltageProtection) + { + const double SETPOINT_VOLTAGE = 28.0; + _logger = LogManager.GetCurrentClassLogger(); + + _channelNumber = channelNumber; + _setpointVal = setpointVal; + _ini_setpointval = setpointVal; + _overCurrentProtection = overCurrentProtection; + _overVoltageProtection = overVoltageProtection; + _voltage = SETPOINT_VOLTAGE; + _mode = mode; + _originalMode = mode; + Disable(); + } + + /// + /// The finalizer. + /// + ~EloadSim() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Send a SCPI Command to the instrument and get a response. + /// + /// The command to send. + /// THe instrument response. + public string IOQuery(string commandString) + { + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + return "IOQuery Sim Response"; + } + + /// + /// Send a SCPI Command to the instrument. + /// + /// The command to be send. + public void IOWrite(string commandString) + { + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + } + + /// + /// Query if the Eload input is on (simulated). + /// + /// Status of Eload (simulated). True = On, False = Off. + public bool IsInputOn() + { + return _isOn; + } + + /// + /// Turns the Eload off (simulated). + /// + public void Enable() + { + _isOn = false; + } + + /// + /// Turns the Eload on (simulated). + /// + public void Disable() + { + _isOn = true; + } + + /// + /// Reads the current of the Eload. + /// + /// The current (simulated). + public Current ReadCurrent() + { + const double MIN_CURRENT = 1.0; + + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + + double currentToReturn = 0.0; + + if (_isOn) + { + double maxCurrent = _overCurrentProtection; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + currentToReturn = (seed * (maxCurrent - MIN_CURRENT)) + MIN_CURRENT; + } + + return Current.FromAmps(currentToReturn); + } + + /// + /// Reads the mode of the Eload. + /// + /// The mode (simulated). + public EloadModuleMode ReadMode() + { + return _mode; + } + + /// + /// Reads the overcurrent setting from an Eload. + /// + /// Overcurrent setting (simulated). + public Current ReadOverCurrentProtection() + { + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + + return Current.FromAmps(_overCurrentProtection); + } + + /// + /// Reads the overvoltage setting from an Eload. + /// + /// Overvoltage setting (simulated). + public Voltage ReadOverVoltageProtection() + { + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + + return Voltage.FromVolts(_overVoltageProtection); + } + + /// + /// Reads the resistance of the Eload. + /// + /// The resistance (simulated). + public Resistance ReadResistance() + { + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + + double resistanceToReturn = 0.0; + + if (_isOn) + { + double maxCurrent = _setpointVal + 1; + double minCurrent = _setpointVal - 1; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + resistanceToReturn = (seed * (maxCurrent - minCurrent)) + minCurrent; + } + + return Resistance.FromOhms(resistanceToReturn); + } + + /// + /// Reads the setpoint of the Eload. + /// + /// The setpoint (simulated). + public double ReadSetpoint() + { + return _setpointVal; + } + + /// + /// Reads the voltage of the Eload. + /// + /// The voltage (simulated). + public Voltage ReadVoltage() + { + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + + double voltageToReturn = 0.0; + + if (_isOn) + { + double maxVoltage = _voltage + 1; + double minVoltage = _voltage - 1; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + voltageToReturn = (seed * (maxVoltage - minVoltage)) + minVoltage; + } + + return Voltage.FromVolts(voltageToReturn); + } + + /// + /// Reads the protection status from an Eload. + /// + /// Protection status (simulated). + public ushort ReadProtectionStatus() + { + // just to provide a small delay 10ms for the sim + Thread.Sleep(10); + + // The sim never triggers the protection status + return 0; + } + + /// + /// Sets Initial Settings + /// + public void SetInitialSetting() + { + _mode = _originalMode; + _setpointVal = _ini_setpointval; + } + + /// + /// Change the operation mode of the Eload. + /// + /// The desired Eload mode. + public void SetMode(EloadModuleMode mode) + { + _mode = mode; + } + + /// + /// Change the setpoint of the Eload. + /// + /// The desired setpoint of the Eload. + public void SetSetpoint(double newSetpoint, EloadModuleMode mode) + { + if (mode != _mode) + { + throw new Exception("the current mode and the specified mode do not match. Current Mode: " + _mode.ToString() + ", specified mode: " + mode.ToString()); + } + + _setpointVal = newSetpoint; + } + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + } + + public bool ClearErrors() + { + return true; + } + + public void Initialize() + { + SetInitialSetting(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + Disable(); + + Enable(); + } + + public void Shutdown() + { + Dispose(); + } + + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSim.csproj b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSim.csproj new file mode 100644 index 0000000..70449c5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSim.csproj @@ -0,0 +1,22 @@ + + + + + net472 + Raytheon.Instruments.ELoadSim + ELoad Sim implementation + ELoad Sim implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSimFactory.cs b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSimFactory.cs new file mode 100644 index 0000000..daf6f59 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/ELoadSim/ELoadSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// ELoadSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ELoadSimFactory")] + public class ELoadSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ELoadSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ELoadSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IEload)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new EloadSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new EloadSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysight.cs b/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysight.cs new file mode 100644 index 0000000..08f8520 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysight.cs @@ -0,0 +1,973 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NationalInstruments.NI4882; +using NLog; +using Raytheon.Common; +using Raytheon.Units; +using System; +using System.Collections.Generic; +using System.IO.Ports; + +namespace Raytheon.Instruments +{ + /// + /// This class interfaces to a Keysight N3300 Eload system + /// + public class EloadSystemScpiKeysight : IELoadSystem + { + + #region PrivateClassMembers + + private enum ControlInterface + { + COM_PORT, + GPIB + } + + // system commands + private const string _CLEAREVENTREG = "*CLS"; + private const string _CLEARSERVICEREQUEST = "*SRE 0"; + private const string _CLEAREVENTSTATUSENABLEREGISTER = "*ESE 0"; + private const string _ERRORCODE = "SYST:ERR?"; + private const string _RESET = "*RST"; + private const string _SELFTEST = "*TST?"; + + private string _systemName; + private SerialPort _serialPort; + private Device _gpibDevice; + private ControlInterface _interface; + private readonly SortedDictionary _eloadChannelMap; + private readonly bool _isThereHardware; + private static object _syncObj = new Object(); + // default the timeout for responses to 5 seconds + private const int _READ_TIMEOUT = 5000; + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get; set; } + public bool FrontPanelEnabled { get; set; } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + + #endregion + + #region PrivateFuctions + + /// + /// Send a SCPI Command to the instrument and get a response. + /// + /// The command to send. + /// The instrument response. + private string IOQuery(string commandString) + { + // not calling IOWrite() so IOWrite() can check for errors after each write + + string rsp = ""; + + if (_interface == ControlInterface.COM_PORT) + { + _serialPort.WriteLine(commandString); + rsp = _serialPort.ReadLine(); + } + else if (_interface == ControlInterface.GPIB) + { + _gpibDevice.Write(commandString); + rsp = _gpibDevice.ReadString(); + } + else + { + throw new Exception("unknown interface type: " + _interface.ToString()); + } + + rsp = rsp.Replace("\r", ""); + + // check for errors + int err = 0; + string errorMsg = GetErrorCode(out err); + if (err != 0) + { + throw new Exception(errorMsg); + } + + return rsp; + } + + /// + /// Sends a SCPI Command to the instrument. + /// + /// The command to send. + private void IOWrite(string commandString) + { + if (_interface == ControlInterface.COM_PORT) + { + _serialPort.WriteLine(commandString); + } + else if (_interface == ControlInterface.GPIB) + { + _gpibDevice.Write(commandString); + } + else + { + throw new Exception("unknown interface type: " + _interface.ToString()); + } + + int err = 0; + string errorMsg = GetErrorCode(out err); + if (err != 0) + { + throw new Exception(errorMsg); + } + } + + /// + /// Resets the instrument and clears event registers, error queue, + /// service request enable register, and event status enable register. + /// + private void Reset() + { + IOWrite(_RESET); + + IOWrite(_CLEAREVENTREG); + + IOWrite(_CLEARSERVICEREQUEST); + + IOWrite(_CLEAREVENTSTATUSENABLEREGISTER); + } + + #endregion + + #region PublicFuctions + + /// + /// FlowMeterOmegaDPF20 factory constructor + /// + /// + /// + public EloadSystemScpiKeysight(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _gpibDevice = null; + _serialPort = _configuration.GetConfigurationValue("ELoadScpiKeysight", "SerialPort", new SerialPort()); + var flowControl = _configuration.GetConfigurationValue("ELoadScpiKeysight", "FlowControl", Handshake.None); + + try + { + _interface = ControlInterface.COM_PORT; + + _systemName = Name; + + _serialPort.Open(); + + _serialPort.ReadTimeout = _READ_TIMEOUT; + _serialPort.Handshake = flowControl; + + Reset(); + + _eloadChannelMap = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + } + catch (Exception) + { + if (_serialPort.IsOpen == true) + { + _serialPort.Close(); + } + + throw; + } + + } + + + /// + /// The constructor for com port interface which open up the comm port, resets the system and waits for additional commands + /// + /// The COM port name as it exists in windows device manager. + /// The bit rate of the host computer COM port. + /// The parity setting of the host computer. 0 = None, 1 = Odd, 2 = Even, 3 = Mark, 4 = Space. + /// The number of bits of data sent per transfer. + /// The number of stop bits used by host computer. + /// Handshake method. 0 = None, 1 = XonXoff, 2 = RTS, 3 = RTSXonXoff. + /// Software operation mode. True = Hardware available, False = Simulation Only. + public EloadSystemScpiKeysight(string systemName, string comPortName, int baudRate, Parity parity, int dataBits, StopBits stopBits, Handshake flowControl, bool isThereHardware) + { + try + { + _logger = LogManager.GetCurrentClassLogger(); + + _interface = ControlInterface.COM_PORT; + + _systemName = systemName; + + _isThereHardware = isThereHardware; + + _serialPort = null; + _gpibDevice = null; + + if (_isThereHardware == true) + { + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); + + _serialPort.Open(); + + _serialPort.ReadTimeout = _READ_TIMEOUT; + _serialPort.Handshake = flowControl; + + Reset(); + } + + _eloadChannelMap = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + } + catch (Exception ex) + { + if (_serialPort.IsOpen == true) + { + _serialPort.Close(); + } + _logger.Error(ex.Message); + throw; + } + } + + /// + /// The constructor for gpib interface which open up the comm port, resets the system and waits for additional commands + /// + /// + /// + /// + /// + public EloadSystemScpiKeysight(string systemName, int boardNumber, byte primaryAddress, bool isThereHardware) + { + try + { + _interface = ControlInterface.GPIB; + + _systemName = systemName; + + _isThereHardware = isThereHardware; + + _serialPort = null; + _gpibDevice = null; + + if (_isThereHardware == true) + { + _gpibDevice = new Device(boardNumber, primaryAddress); + + //@@@ TBD if this make the newline go out after each write + _gpibDevice.EndOfStringCharacter = 0xa; + + _gpibDevice.IOTimeout = TimeoutValue.T3s; + + Reset(); + } + + _eloadChannelMap = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + } + catch (Exception) + { + if (_gpibDevice != null) + { + _gpibDevice.Dispose(); + _gpibDevice = null; + } + + throw; + } + } + + /// + /// The finalizer + /// + ~EloadSystemScpiKeysight() + { + Dispose(false); + } + + /// + /// Add an Eload to the system. + /// + /// The name of the channel (module) for reference. + /// The channel number for the Eload.. + /// The operation mode of the channel. Modes: Resistance, Voltage, Current. + /// The operation point of the load. This can be a voltage, current, or resistance + /// Overcurrent setpoint that will turn off the channel if exceeded. + /// Overvoltage setpoint that will turn off channel if exceeded (double check). + public void AddEloadChannel(string name, int channelNumber, EloadModuleMode mode, double setpoint, Current overCurrentProtection, Voltage overVoltageProtection) + { + try + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(name.ToUpper()) == true) + { + throw new Exception("system already contains a module named: " + name.ToUpper()); + } + + IEload eload; + + if (_isThereHardware) + { + if (_interface == ControlInterface.COM_PORT) + { + eload = new ELoadScpiKeysight(_serialPort, channelNumber, mode, setpoint, overCurrentProtection.Amps, overVoltageProtection.Volts); + } + else if (_interface == ControlInterface.GPIB) + { + eload = new ELoadScpiKeysight(_gpibDevice, channelNumber, mode, setpoint, overCurrentProtection.Amps, overVoltageProtection.Volts); + } + else + { + throw new Exception("unknown interface: " + _interface.ToString()); + } + } + else + { + eload = new EloadSim(channelNumber, mode, setpoint, overCurrentProtection.Amps, overVoltageProtection.Volts); + } + + _eloadChannelMap.Add(name.ToUpper(), eload); + } + } + catch (Exception) + { + if (_interface == ControlInterface.COM_PORT) + { + _serialPort.Close(); + } + else if (_interface == ControlInterface.GPIB) + { + _gpibDevice.Dispose(); + _gpibDevice = null; + } + + throw; + } + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get the error code. + /// + /// The error code. + public string GetErrorCode(out int errorCode) + { + lock (_syncObj) + { + if (_isThereHardware == true) + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string rsp = ""; + + if (_interface == ControlInterface.COM_PORT) + { + _serialPort.WriteLine(_ERRORCODE); + rsp = _serialPort.ReadLine(); + } + else if (_interface == ControlInterface.GPIB) + { + _gpibDevice.Write(_ERRORCODE); + rsp = _gpibDevice.ReadString(); + } + else + { + throw new Exception("unknown interface type: " + _interface.ToString()); + } + + rsp = rsp.Replace("\r", ""); + + string[] tokens = rsp.Split(','); + + errorCode = Util.ConvertStringToInt32(tokens[0]); + + // it should always be 2 + if (tokens.Length >= 2) + { + return tokens[1]; + } + else + { + return ""; + } + } + else + { + errorCode = 0; + + return ""; + } + } + } + + /// + /// + /// + /// + public List GetModuleNames() + { + lock (_syncObj) + { + List moduleNames = new List(); + + foreach (KeyValuePair modules in _eloadChannelMap) + { + moduleNames.Add(modules.Key); + } + + return moduleNames; + } + } + + /// + /// + /// + /// + public string GetSystemName() + { + lock (_syncObj) + { + return _systemName; + } + } + + /// + /// Query if the Eload input is on. + /// + /// The name of the Eload. + /// Status of Eload. True = On, False = Off. + public bool IsInputOn(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + bool status = _eloadChannelMap[channelName.ToUpper()].IsInputOn(); + + return status; + } + } + + /// + /// Turn off the Eload input. + /// + /// The name of the Eload. + public void Disable(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + _eloadChannelMap[channelName.ToUpper()].Disable(); + } + } + + /// + /// Turn on the Eload input. + /// + /// The name of the Eload. + public void Enable(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + _eloadChannelMap[channelName.ToUpper()].Enable(); + } + } + + /// + /// + /// + /// + /// + /// + public string IOQuery(string channelName, string command) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + return _eloadChannelMap[channelName.ToUpper()].IOQuery(command); + } + } + + /// + /// + /// + /// + /// + public void IOWrite(string channelName, string command) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + _eloadChannelMap[channelName.ToUpper()].IOWrite(command); + } + } + + + /// + /// Reads the current of the Eload. + /// + /// The name of the Eload. + /// Measured current (Amps). + public Current ReadCurrent(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + var value = _eloadChannelMap[channelName.ToUpper()].ReadCurrent(); + + return value; + } + } + + /// + /// Reads all Eload data (voltage, current, resistance, setpoint, input state, mode). + /// + /// The name of the Eload. + /// The measured voltage (Volts). + /// The measured current (Amps). + /// The measured resistance (Ohms). + /// The setpoint of the Eload. Depends on mode of operation. + /// The state of the Eload. + /// The mode of the Eload. + public void ReadData(string channelName, out Voltage voltage, out Current current, out Resistance resistance, out double setpoint, out bool isInputOn, out EloadModuleMode mode, out ushort status) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + voltage = _eloadChannelMap[channelName.ToUpper()].ReadVoltage(); + + current = _eloadChannelMap[channelName.ToUpper()].ReadCurrent(); + + resistance = _eloadChannelMap[channelName.ToUpper()].ReadResistance(); + + setpoint = _eloadChannelMap[channelName.ToUpper()].ReadSetpoint(); + + isInputOn = _eloadChannelMap[channelName.ToUpper()].IsInputOn(); + + mode = _eloadChannelMap[channelName.ToUpper()].ReadMode(); + + status = _eloadChannelMap[channelName.ToUpper()].ReadProtectionStatus(); + } + } + + /// + /// Reads the mode of the Eload + /// + /// The name of the Eload. + /// The mode + public EloadModuleMode ReadMode(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + EloadModuleMode value = _eloadChannelMap[channelName.ToUpper()].ReadMode(); + + return value; + } + } + + /// + /// Reads the overcurrent setting from an Eload. + /// + /// The name of the Eload. + /// Overcurrent setting (Amps). + public Current ReadOverCurrentProtection(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + var value = _eloadChannelMap[channelName.ToUpper()].ReadOverCurrentProtection(); + + return value; + } + } + + /// + /// Reads the overvoltage setting from an Eload. + /// + /// The name of the Eload. + /// Overvoltage setting (Volts). + public Voltage ReadOverVoltageProtection(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + var value = _eloadChannelMap[channelName.ToUpper()].ReadOverVoltageProtection(); + + return value; + } + } + + /// + /// Read the resistance. + /// + /// The name of the Eload. + /// The resistance (Ohms). + public Resistance ReadResistance(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + var value = _eloadChannelMap[channelName.ToUpper()].ReadResistance(); + + return value; + } + } + + /// + /// Reads the setpoint of the Eload. + /// + /// The name of the Eload. + /// The setpoint. Depends on mode. + public double ReadSetpoint(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + return _eloadChannelMap[channelName.ToUpper()].ReadSetpoint(); + } + } + + /// + /// Reads the voltage of the Eload. + /// + /// The name of the Eload. + /// The voltage (Volts) + public Voltage ReadVoltage(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + var value = _eloadChannelMap[channelName.ToUpper()].ReadVoltage(); + + return value; + } + } + + /// + /// Reads the protection status from an Eload. + /// + /// The name of the Eload. + /// Protection status register. + public ushort ReadProtectionStatus(string channelName) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + ushort value = _eloadChannelMap[channelName.ToUpper()].ReadProtectionStatus(); + + return value; + } + } + + /// + /// Run a self-test. + /// + public void Selftest() + { + try + { + // change the timeout to account for the long self test to 30 seconds + if (_interface == ControlInterface.COM_PORT) + { + //@@@ is this the right time? + _serialPort.ReadTimeout = 30000; + } + else if (_interface == ControlInterface.GPIB) + { + //@@@ TBD + } + else + { + throw new Exception("unknown interface type: " + _interface.ToString()); + } + + // send the command + string rspStr = IOQuery(_SELFTEST); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + int rsp = Util.ConvertStringToInt32(tokens[0]); + + if (rsp != 0) + { + string errorMsg = "returned an error: " + rsp.ToString(); + throw new Exception(errorMsg); + } + } + catch (Exception) + { + throw; + } + finally + { + // restore the timeout + if (_interface == ControlInterface.COM_PORT) + { + _serialPort.ReadTimeout = _READ_TIMEOUT; + } + else if (_interface == ControlInterface.GPIB) + { + //@@@ TBD + } + else + { + throw new Exception("unknown interface type: " + _interface.ToString()); + } + } + } + + /// + /// Resets all channels to config file values + /// + public void SetInitialSetting(string module) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(module.ToUpper()) == false) + { + throw new Exception("could not find load: " + module.ToUpper()); + } + + _eloadChannelMap[module.ToUpper()].SetInitialSetting(); + } + } + + /// + /// Resets all channels to config file values + /// + public void SetInitialSettingAll() + { + lock (_syncObj) + { + foreach (KeyValuePair eload in _eloadChannelMap) + { + _eloadChannelMap[eload.Key].SetInitialSetting(); + } + } + } + + /// + /// Change the operation mode of the Eload. + /// + /// The name of the Eload. + /// The desired Eload mode. + public void SetMode(string channelName, EloadModuleMode mode) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + _eloadChannelMap[channelName.ToUpper()].SetMode(mode); + } + } + + /// + /// Change the setpoint and operation mode of the Eload. + /// + /// The name of the Eload. + /// The desired setpoint of the Eload. + /// The desired Eload mode. + public void SetSetpoint(string channelName, double newSetpoint, EloadModuleMode mode) + { + lock (_syncObj) + { + if (_eloadChannelMap.ContainsKey(channelName.ToUpper()) == false) + { + throw new Exception("could not find module: " + channelName.ToUpper()); + } + + _eloadChannelMap[channelName.ToUpper()].SetSetpoint(newSetpoint, mode); + } + } + + /// + /// Dispose of this objects resources + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + lock (_syncObj) + { + if (disposing) + { + foreach (KeyValuePair entry in _eloadChannelMap) + { + entry.Value.Shutdown(); + } + + if (_serialPort != null) + { + Reset(); + _serialPort.Dispose(); + _serialPort = null; + } + + if (_gpibDevice != null) + { + Reset(); + _gpibDevice.Dispose(); + _gpibDevice = null; + } + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + void IInstrument.Reset() + { + throw new NotImplementedException(); + } + + public void Shutdown() + { + throw new NotImplementedException(); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysight.csproj b/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysight.csproj new file mode 100644 index 0000000..557d7ef --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysight.csproj @@ -0,0 +1,42 @@ + + + + + net472 + Raytheon.Instruments.EloadSystemScpiKeysight + Eload System Scpi Keysight implementation + Eload System Scpi Keysight implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\NI\NationalInstruments.NI4882.dll + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysightFactory.cs b/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysightFactory.cs new file mode 100644 index 0000000..ac33cc5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/ELoad/EloadSystemScpiKeysight/EloadSystemScpiKeysightFactory.cs @@ -0,0 +1,277 @@ +// ********************************************************************************************************** +// EloadSystemScpiKeysightFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using Raytheon.Units; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.IO.Ports; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "EloadSystemScpiKeysightFactory")] + public class EloadSystemScpiKeysightFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public EloadSystemScpiKeysightFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public EloadSystemScpiKeysightFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IEload)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new EloadSystemScpiKeysight(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new EloadSystemScpiKeysight(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + + + #region PrivateFuctions + /// + /// Parses the power controller ini file. + /// This ini file defines the number of power systems/modules that this controller will manage. + /// Upon parsing the file, this function populates this class members with the ini file information + /// + private static IELoadSystem CreateEloadSystemInstrument(string instrumentDefFile, string iniSectionName, bool isThereHardware) + { + const char COMMA_DELIM = ','; + + // interface types + const string GPIB = "GPIB"; + const string RS232 = "232"; + + // system + const string BOARD_NUMBER_KEY = "BOARD_NUMBER"; + const string INTERFACE_KEY = "INTERFACE"; + const string ADDRESS_KEY = "ADDRESS"; + const string BAUD_RATE = "BAUD_RATE"; + const string PARITY = "PARITY"; + const string DATA_BITS = "DATA_BITS"; + const string STOP_BITS = "STOP_BITS"; + const string FLOW_CONTROL = "FLOW_CONTROL"; + const string MODULE_DEFINITION_KEY = "MODULE_DEFINITION"; + + // modules + const string MODE = "MODE"; + const string CHANNEL_NUM = "CHANNEL_NUM"; + const string SETPOINT_VALUE = "SETPOINT_VALUE"; + const string OCP = "OVER_CURRENT_PROTECTION"; + const string OVP = "OVER_VOLTAGE_PROTECTION"; + + IniFile iniReader = new IniFile(instrumentDefFile); + + // pull out the address and the list of definitions + string interfaceType = iniReader.ReadValue(iniSectionName, INTERFACE_KEY); + string[] moduleDefinitionList = null; + IELoadSystem loadSystem = null; + if (interfaceType.ToUpper() == GPIB) + { + int gpibBoardNumber = Convert.ToInt32(iniReader.ReadValue(iniSectionName, BOARD_NUMBER_KEY)); + byte gpibAddress = Convert.ToByte(iniReader.ReadValue(iniSectionName, ADDRESS_KEY)); + string moduleDefinitionSections = iniReader.ReadValue(iniSectionName, MODULE_DEFINITION_KEY); + moduleDefinitionList = moduleDefinitionSections.Split(COMMA_DELIM); + + loadSystem = new EloadSystemScpiKeysight(iniSectionName, gpibBoardNumber, gpibAddress, isThereHardware); + + } + else if (interfaceType.ToUpper() == RS232) + { + string eloadSystemComAddress = iniReader.ReadValue(iniSectionName, ADDRESS_KEY); + int eloadSystemComBaudRate = Convert.ToInt32(iniReader.ReadValue(iniSectionName, BAUD_RATE)); + Parity eloadSystemComParity = (Parity)Enum.Parse(typeof(Parity), iniReader.ReadValue(iniSectionName, PARITY)); + int eloadSystemComDataBits = Convert.ToInt32(iniReader.ReadValue(iniSectionName, DATA_BITS)); + Handshake flowControl = (Handshake)Enum.Parse(typeof(Handshake), iniReader.ReadValue(iniSectionName, FLOW_CONTROL)); + StopBits eloadSystemComStopBits = (StopBits)Enum.Parse(typeof(StopBits), iniReader.ReadValue(iniSectionName, STOP_BITS)); + + string moduleDefinitionSections = iniReader.ReadValue(iniSectionName, MODULE_DEFINITION_KEY); + moduleDefinitionList = moduleDefinitionSections.Split(COMMA_DELIM); + + loadSystem = new EloadSystemScpiKeysight(iniSectionName, eloadSystemComAddress, eloadSystemComBaudRate, eloadSystemComParity, eloadSystemComDataBits, eloadSystemComStopBits, flowControl, isThereHardware); + } + else + { + throw new Exception("EloadMeasurementInstruments::CreateEloadSystemInstrument() - Invalid Interface type in ini file. Ini file contained: " + interfaceType + ", supported types are: " + GPIB + "," + RS232); + } + + foreach (string module in moduleDefinitionList) + { + string trimmedModuleName = module.TrimStart(' '); + trimmedModuleName = trimmedModuleName.TrimEnd(' '); + + int modeTemp = Convert.ToInt32(iniReader.ReadValue(trimmedModuleName, MODE)); + int channelNumber = Convert.ToInt32(iniReader.ReadValue(trimmedModuleName, CHANNEL_NUM)); + double setpoint = Convert.ToDouble(iniReader.ReadValue(trimmedModuleName, SETPOINT_VALUE)); + double ocp = Convert.ToDouble(iniReader.ReadValue(trimmedModuleName, OCP)); + double ovp = Convert.ToDouble(iniReader.ReadValue(trimmedModuleName, OVP)); + + EloadModuleMode mode; + + if (modeTemp == 0) + { + mode = EloadModuleMode.RESISTANCE; + } + else if (modeTemp == 1) + { + mode = EloadModuleMode.VOLTAGE; + } + else if (modeTemp == 2) + { + mode = EloadModuleMode.CURRENT; + } + else + { + throw new Exception("EloadMeasurementInstruments::CreateEloadSystemInstrument() - Invalid mode input: " + modeTemp.ToString()); + } + + loadSystem.AddEloadChannel(trimmedModuleName.ToUpper(), channelNumber, mode, setpoint, Current.FromAmps(ocp), Voltage.FromVolts(ovp)); + } + + return loadSystem; + } + #endregion + + #region PublicFuctions + public static List CreateEloadSystemInstrument(string instrumentDefFile, bool isThereHardware) + { + const string KEYSIGHT_ELOAD_SCPI = "KEYSIGHT_SCPI_ELOAD_SYSTEM"; + + List loadSystemsToReturn = new List(); + + IniFile iniReader = new IniFile(instrumentDefFile); + + List loadSystemsToCreateKeys = iniReader.ReadAllKeys("ELOAD_SYSTEMS_TO_CREATE"); + + foreach (string loadSystemName in loadSystemsToCreateKeys) + { + string loadSystemType = iniReader.ReadValue("ELOAD_SYSTEMS_TO_CREATE", loadSystemName); + + if (loadSystemType.ToUpper() == KEYSIGHT_ELOAD_SCPI.ToUpper()) + { + IELoadSystem loadSystem = CreateEloadSystemInstrument(instrumentDefFile, loadSystemName, isThereHardware); + + loadSystemsToReturn.Add(loadSystem); + } + else + { + string errorMsg = "EloadMeasurementInstruments::CreateEloadSystemInstrument() - Unsupported ELoad instrument: " + loadSystemName + "\n"; + errorMsg += "Supported instrument are: " + KEYSIGHT_ELOAD_SCPI; + throw new Exception(errorMsg); + } + } + + return loadSystemsToReturn; + } + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CommFpgaCustomAsciiSerial.cs b/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CommFpgaCustomAsciiSerial.cs new file mode 100644 index 0000000..acfdbb5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CommFpgaCustomAsciiSerial.cs @@ -0,0 +1,565 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.IO.Ports; +using System.Text; +using System.Threading; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A class the provides an interface for read/write to registers on an FPGA that implement a custom ascii serial interface + /// + public class CommFpgaCustomAsciiSerial : IFpgaComm, IDisposable + { + #region PrivateClassMembers + private SerialPort _serialPort; + private byte[] _readBuf; + private static object _syncObj = new Object(); + private uint _delayBeforeReadMs; + private string _readFormat; + private string _writeFormat; + private SelfTestResult _selfTestResult; + private State _state; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The Finalizer + /// + ~CommFpgaCustomAsciiSerial() + { + Dispose(false); + } + + + /// + /// Reads the serial port until it is empty + /// + private void ClearBuffer() + { + lock (_syncObj) + { + bool isClearComplete = false; + + while (isClearComplete == false) + { + try + { + int numBytesRead = _serialPort.Read(_readBuf, 0, _readBuf.Length); + + if (numBytesRead < _readBuf.Length) + { + isClearComplete = true; + } + } + catch (Exception) + { + //expected if buffer is already cleared + isClearComplete = true; + } + } + } + } + + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _serialPort.Dispose(); + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// ELoadScpiKeysight factory constructor + /// + /// + /// + public CommFpgaCustomAsciiSerial(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + const int READ_BUF_SIZE = 1024; + + try + { + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + + string comPortName = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "ComPortName", "COM1"); + int baudRate = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "BaudRate", 9600); + Parity parity = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "Parity", Parity.None); + int dataBits = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "DataBits", 8); + StopBits stopBits = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "StopBits", StopBits.None); + + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); + _readFormat = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "ReadFormat", ""); + _writeFormat = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "WriteFormat", ""); + _serialPort.ReadTimeout = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "ReadTimeout", 100); + _delayBeforeReadMs = _configuration.GetConfigurationValue("CommFpgaCustomAsciiSerial", "DelayBeforeReadMs", 0); + + _readBuf = new byte[READ_BUF_SIZE]; + + //check format of readFormat and writeFormat + if (!_readFormat.Contains("
")) + { + throw new Exception("the read format input for card " + _name + " does not contain the
tag"); + } + + if (!_writeFormat.Contains("
")) + { + throw new Exception("the write format input for card " + _name + " does not contain the
tag"); + } + + if (!_writeFormat.Contains("")) + { + throw new Exception("the write format input for card " + _name + " does not contain the tag"); + } + } + catch (Exception ex) + { + _logger.Error(ex); + + if (_serialPort.IsOpen == true) + { + _serialPort.Close(); + } + + throw; + } + } + + /// + /// The constructor which opens up a serial port + /// + /// The port name. "Com1' for example + /// The num of ms to wait before a read + /// The baud rate + /// The parity + /// Number of data bits + /// Number of Stop Bits + public CommFpgaCustomAsciiSerial(string name, string comPortName, uint delayBeforeReadMs, string readFormat, string writeFormat, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One) + { + const int READ_BUF_SIZE = 1024; + + try + { + _name = name; + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); + + _readFormat = readFormat; + + _writeFormat = writeFormat; + + _serialPort.ReadTimeout = 100; + + _delayBeforeReadMs = delayBeforeReadMs; + + _readBuf = new byte[READ_BUF_SIZE]; + + Array.Clear(_readBuf, 0, _readBuf.Length); + + _logger = LogManager.GetCurrentClassLogger(); + + //check format of readFormat and writeFormat + if (readFormat.Contains("
") == false) + { + throw new Exception("the read format input for card " + _name + " does not contain the
tag"); + } + + if (writeFormat.Contains("
") == false) + { + throw new Exception("the write format input for card " + _name + " does not contain the
tag"); + } + + if (writeFormat.Contains("") == false) + { + throw new Exception("the write format input for card " + _name + " does not contain the tag"); + } + } + catch (Exception ex) + { + _logger.Error(ex); + + if (_serialPort.IsOpen == true) + { + _serialPort.Close(); + } + + throw; + } + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FPGA Custom Ascii called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + Initialize(string.Empty); + } + + /// + /// + /// + /// + public void Initialize(string fpga) + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + if (_serialPort.IsOpen == false) + { + _serialPort.Open(); + } + + //ClearBuffer(); + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + /// + /// + /// + /// + /// + /// + public uint Read(string fpga, uint address) + { + // lock up the FPGA resource + lock (_syncObj) + { + + string hexAddress = "0x" + address.ToString("X8"); + + string commandToSend = _readFormat.Replace("
", hexAddress); + + commandToSend = commandToSend.Trim(); + + _serialPort.Write(commandToSend); + + Thread.Sleep((int)_delayBeforeReadMs); + + int numBytesRead = _serialPort.Read(_readBuf, 0, _readBuf.Length); + + string data = Encoding.UTF8.GetString(_readBuf, 0, _readBuf.Length); + + // get rid of new lines + data = data.Replace("\r", " "); + data = data.Replace("\n", " "); + data = data.Trim(); + + uint dataToReturn = Convert.ToUInt32(data, 16); + + return dataToReturn; + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + // lock up the FPGA resource + lock (_syncObj) + { + Thread.Sleep((int)_delayBeforeReadMs); + + int bytesRead = _serialPort.Read(_readBuf, 0, _readBuf.Length); + + int bytesToCopy = Math.Min(bytesRead, dataRead.Length); + + Array.Copy(_readBuf, dataRead, bytesToCopy); + + Array.Clear(_readBuf, 0, _readBuf.Length); + } + } + + /// + /// + /// + public void Reset() + { + Shutdown(); + + Initialize(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + // lock up the FPGA resource + lock (_syncObj) + { + if (_state == State.Ready) + { + _serialPort.Dispose(); + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpga, uint address, uint data) + { + // lock up the FPGA resource + lock (_syncObj) + { + string hexAddress = "0x" + address.ToString("X8"); + + string hexData = "0x" + data.ToString("X8"); + + string commandToSend = _writeFormat.Replace("
", hexAddress); + + commandToSend = commandToSend.Replace("", hexData); + + commandToSend = commandToSend.Trim(); + + _serialPort.Write(commandToSend); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + // lock up the FPGA resource + lock (_syncObj) + { + throw new Exception("Not Implemented"); + } + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + Initialize(fpgaName); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CommFpgaCustomAsciiSerialFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CommFpgaCustomAsciiSerialFactory.cs new file mode 100644 index 0000000..e81468a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CommFpgaCustomAsciiSerialFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaCustomAsciiSerialFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaCustomAsciiSerialFactory")] + public class CommFpgaCustomAsciiSerialFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaCustomAsciiSerialFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaCustomAsciiSerialFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaCustomAsciiSerial(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaCustomAsciiSerial(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CustomAsciiSerial.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CustomAsciiSerial.csproj new file mode 100644 index 0000000..0f56d4e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/CustomAsciiSerial/CustomAsciiSerial.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FPGA.CustomAsciiSerial + Custom Ascii Serial implementation + FPGA Custom Ascii Serial implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/CommFpgaEthernet.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/CommFpgaEthernet.cs new file mode 100644 index 0000000..9d4d463 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/CommFpgaEthernet.cs @@ -0,0 +1,593 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using FpgaMeasurementInstrumentsLib; +using NLog; +using Raytheon.Common; +using System; +using System.Net; +using System.Net.Sockets; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// This class serves as an interface to FPGAs that implement a UDP interface. + /// It allows for the ability to read and write to registers. + /// + public class CommFpgaEthernet : IFpgaComm, IDisposable + { + #region PrivateClassMembers + private UdpClient _udpClient; + private readonly int _localPort; + private readonly int _remotePort; + private readonly string _remoteAddress; + private static object _syncObj = new Object(); + private SelfTestResult _selfTestResult; + private State _state; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The Finalizer + /// + ~CommFpgaEthernet() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _udpClient.Close(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Read data off of the socket + /// + /// The data that was read + /// The number of bytes read + private int ReadData(ref byte[] dataRead) + { + IPEndPoint remoteIPEndPoint = new IPEndPoint(IPAddress.Any, _localPort); + + dataRead = _udpClient.Receive(ref remoteIPEndPoint); + + int numBytesRead = dataRead.Length; + + return numBytesRead; + } + + /// + /// Send a command message and get a response message + /// + /// The message to send + /// The response + private void SendCommandGetResponse(FPGACmdMessage commandMsg, ref FPGARspMessage rspMsg) + { + uint rxBufferSize = rspMsg.GetEntireMsgLength(); + uint rxNumBytesExpected = rxBufferSize; + + uint dataToSendNumBytes = commandMsg.GetEntireMsgLength(); + + // send the command + byte[] dataToSend = new byte[dataToSendNumBytes]; + + // get a pointer to the data + GCHandle sendPinnedArray = GCHandle.Alloc(dataToSend, GCHandleType.Pinned); + IntPtr pByte = sendPinnedArray.AddrOfPinnedObject(); + commandMsg.Format(pByte); + sendPinnedArray.Free(); + + // send the data + int numBytesSent = SendData(dataToSend); + + if (dataToSendNumBytes != numBytesSent) + { + throw new Exception("wanted to send: " + dataToSendNumBytes.ToString() + " bytes, SendData() reported that it sent: " + numBytesSent.ToString()); + } + + // read the response + byte[] rspBuffer = new byte[rxBufferSize]; + int numBytesRead = ReadData(ref rspBuffer); + + if (numBytesRead != rxNumBytesExpected) + { + throw new Exception("received " + numBytesRead.ToString() + " bytes, expected " + rxNumBytesExpected.ToString()); + } + + // populate the rspMsg object + GCHandle rxPinnedArray = GCHandle.Alloc(rspBuffer, GCHandleType.Pinned); + IntPtr pBytePtr = rxPinnedArray.AddrOfPinnedObject(); + rspMsg.Parse(pBytePtr); + rxPinnedArray.Free(); + } + + /// + /// Send data out of the socket + /// + /// The data to send + /// The number of bytes sent + private int SendData(byte[] dataToSend) + { + IPAddress addy = IPAddress.Parse(_remoteAddress); + + IPEndPoint ipEndPoint = new IPEndPoint(addy, _remotePort); + + int numBytesSent = _udpClient.Send(dataToSend, dataToSend.Length, ipEndPoint); + + return numBytesSent; + } + #endregion + + #region PublicFuctions + + /// + /// CommFpgaEthernet factory constructor + /// + /// + /// + public CommFpgaEthernet(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + _localPort = _configuration.GetConfigurationValue("CommFpgaEthernet", "LocalPort", 0); + _remotePort = _configuration.GetConfigurationValue("CommFpgaEthernet", "RemotePort", 0); + _remoteAddress = _configuration.GetConfigurationValue("CommFpgaEthernet", "RemoteAddress", "127.0.0.1"); + } + + + /// + /// + /// + /// + /// The port on the local computer + /// The port that the FPGA is using + /// The address that the FPGA is using + public CommFpgaEthernet(string name, int localPort, int remotePort, string remoteAddress) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + _localPort = localPort; + _remotePort = remotePort; + _remoteAddress = remoteAddress; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FPGA Ethernet called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + Initialize(string.Empty); + } + + /// + /// + /// + /// + public void Initialize(string fpga) + { + //5 second timeout + const int TIMEOUT = 5000; + + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _udpClient = new UdpClient(_localPort); + + _udpClient.Client.ReceiveBufferSize = int.MaxValue; + + _udpClient.Client.SendBufferSize = int.MaxValue; + + _udpClient.Client.SendTimeout = TIMEOUT; + + _udpClient.Client.ReceiveTimeout = TIMEOUT; + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set + { + _name = value; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + /// + /// Reads a single register + /// + /// The page of the register to read from + /// The register address to read from + /// The data at the address + public uint Read(string fpgaName, uint address) + { + // lock up the FPGA resource + lock (_syncObj) + { + FPGACmdMessage cmd = new FPGAReadRegisterCmdMessage((FPGACmdMessage.Page)0, address); + + // this get populated in SendCommandGetResponse() + FPGARspMessage rsp = new FPGAReadRegisterRspMessage(0, 0); + + SendCommandGetResponse(cmd, ref rsp); + + return rsp.GetData(); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + // lock up the FPGA resource + lock (_syncObj) + { + if (shallWeIncrementAddress) + { + FPGACmdMessage cmd = new FPGAReadRegisterCmdBlockIncrMessage((FPGACmdMessage.Page)0, address, numberOfWordsToRead, false); + + // this get populated in SendCommandGetResponse() + FPGARspMessage rsp = new FPGAReadRegisterBlockIncrRspMessage(0, ref dataRead); + + SendCommandGetResponse(cmd, ref rsp); + } + else + { + throw new Exception("Not Implemented"); + } + } + } + + /// + /// + /// + public void Reset() + { + Shutdown(); + + Initialize(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public void Shutdown() + { + // lock up the FPGA resource + lock (_syncObj) + { + if (_state == State.Ready) + { + _udpClient.Close(); + + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// Write to a single register + /// + /// The page of the register to read from + /// The address to write to + /// The data to write + public void Write(string fpgaName, uint address, uint value) + { + // lock up the FPGA resource + lock (_syncObj) + { + FPGACmdMessage cmd = new FPGAWriteRegisterCmdMessage((FPGACmdMessage.Page)0, address, value); + + // this get populated in SendCommandGetResponse() + FPGARspMessage rsp = new FPGAWriteRegisterRspMessage(0, 0); + + SendCommandGetResponse(cmd, ref rsp); + + if (rsp.GetAddress() != address) + { + throw new Exception("Command write on address: " + address.ToString("X8") + ", received address: " + rsp.GetAddress().ToString("X8")); + } + else if (rsp.GetData() != 0xace0beef) + { + throw new Exception("Command write on address: " + address.ToString("X8") + " returned value: " + rsp.GetData().ToString("X8")); + } + } + } + + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + // lock up the FPGA resource + lock (_syncObj) + { + FPGACmdMessage cmd = null; + + if (shallWeIncrementAddress) + { + cmd = new FPGAWriteRegisterCmdBlockIncrMessage((FPGACmdMessage.Page)0, address, data, false); + } + else + { + cmd = new FPGAWriteRegisterCmdBlockMessage((FPGACmdMessage.Page)0, address, data, false); + } + + // this get populated in SendCommandGetResponse() + FPGARspMessage rsp = new FPGAWriteRegisterRspMessage(0, 0); + + SendCommandGetResponse(cmd, ref rsp); + + if (rsp.GetAddress() != address) + { + throw new Exception("Command write on address: " + address.ToString("X8") + ", received address: " + rsp.GetAddress().ToString("X8")); + } + else if (rsp.GetData() != 0xace0beef) + { + throw new Exception("Command write on address: " + address.ToString("X8") + " returned value: " + rsp.GetData().ToString("X8")); + } + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteRegister(uint page, uint address, uint[] data, bool incrementAddress = true, bool byteSwap = true) + { + // lock up the FPGA resource + lock (_syncObj) + { + if (page > (uint)FPGACmdMessage.Page.PAGE3) + { + throw new Exception("input parameter 'page' is out of range: " + page.ToString()); + } + + FPGACmdMessage cmd; + + if (incrementAddress) + { + cmd = new FPGAWriteRegisterCmdBlockIncrMessage((FPGACmdMessage.Page)page, address, data, byteSwap); + } + else + { + cmd = new FPGAWriteRegisterCmdBlockMessage((FPGACmdMessage.Page)page, address, data, byteSwap); + } + + + // this get populated in SendCommandGetResponse() + FPGARspMessage rsp = new FPGAWriteRegisterRspMessage(0, 0); + + SendCommandGetResponse(cmd, ref rsp); + + if (rsp.GetAddress() != address) + { + throw new Exception("Command write on address: " + address.ToString("X8") + ", received address: " + rsp.GetAddress().ToString("X8")); + } + else if (rsp.GetData() != 0xace0beef) + { + throw new Exception("Command write on address: " + address.ToString("X8") + " returned value: " + rsp.GetData().ToString("X8")); + } + } + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + Initialize(fpgaName); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/CommFpgaEthernetFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/CommFpgaEthernetFactory.cs new file mode 100644 index 0000000..12a4678 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/CommFpgaEthernetFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaEthernetFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaEthernetFactory")] + public class CommFpgaEthernetFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaEthernetFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaEthernetFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaEthernet(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaEthernet(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/Ethernet.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/Ethernet.csproj new file mode 100644 index 0000000..952fefc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/Ethernet.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FPGA.Ethernet + FPGA Ethernet implementation + FPGA Ethernet implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGACmdMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGACmdMessage.cs new file mode 100644 index 0000000..818a08d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGACmdMessage.cs @@ -0,0 +1,227 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// An abstract base class for FPGACmdMessages that go between the client and server + /// + internal abstract class FPGACmdMessage : ICloneable + { + #region PublicClassMembers + public enum Page + { + PAGE0, + PAGE1, + PAGE2, + PAGE3 + } + #endregion + + #region PrivateClassMembers + private readonly string m_description; + + protected FPGACmdMessageHeader m_header; + + protected static void SwapWord(ref byte[] input) + { + //Word Size + int WORD_SIZE = 4; + + for (int i = 0; i < input.Length; i = i + WORD_SIZE) + { + //Temp array for swap + byte[] temp = new byte[WORD_SIZE]; + + //Copy a word into temp + Buffer.BlockCopy(input, i, temp, 0, WORD_SIZE); + + //Swap bytes + Array.Reverse(temp); + + //Replace word + Buffer.BlockCopy(temp, 0, input, i, WORD_SIZE); + } + } + #endregion + + #region PrivateFuctions + /// + /// A command message constructor for all children to invoke + /// + /// The command message id + /// The page of the command message + /// The description of the command message + protected FPGACmdMessage(FPGACmdMsgIds commandType, Page page, string description) + { + try + { + m_description = description; + m_header = new FPGACmdMessageHeader(commandType, page); + } + catch (Exception) + { + throw; + } + } + + /// + /// Copy Constructor + /// + /// The FPGACmdMessage to copy from + protected FPGACmdMessage(FPGACmdMessage FPGACmdMessage) + { + try + { + m_header = new FPGACmdMessageHeader(FPGACmdMessage.m_header); + m_description = FPGACmdMessage.m_description; + } + catch (Exception) + { + throw; + } + } + + /// + /// A clone function for the children to implement + /// + /// a clone of the child object + protected abstract object CloneSelf(); + + /// + /// A function to encode outgoing data + /// + /// a pointer to the encoded data + protected abstract void FormatData(IntPtr pData); + + /// + /// + /// + /// + protected abstract int GetPayloadSize(); + + /// + /// a function to decode incoming data + /// + /// A pointer to data to populate this object with + protected abstract void ParseData(IntPtr pData); + #endregion + + #region PublicFuctions + + /// + /// Get a copy of the FPGACmdMessage object + /// + /// A clone of this object + public object Clone() + { + // tell the child to clone itself + return this.CloneSelf(); + } + + /// + /// Encode the FPGACmdMessage into a byte array for sending + /// + /// The buffer to put the FPGACmdMessage items + public void Format(IntPtr pData) + { + try + { + m_header.Format(pData); + + IntPtr pPayload = IntPtr.Add(pData, (int)GetHeaderLength()); + + // ask child class to format its data + FormatData(pPayload); + } + catch (Exception) + { + throw; + } + } + + /// + /// Getter for the description + /// + /// The description + public string GetDescription() + { + return m_description; + } + + /// + /// getter for the message id + /// + /// The id + public FPGACmdMsgIds GetMessageId() + { + return m_header.GetMessageId(); + } + + /// + /// getter for the header length + /// + /// The number of bytes in the header + public uint GetHeaderLength() + { + return m_header.GetHeaderLength(); + } + + /// + /// + /// + /// + public uint GetEntireMsgLength() + { + return m_header.GetHeaderLength() + (uint)GetPayloadSize(); + } + + /// + /// Takes an array of bytes and populates the FPGACmdMessage object + /// + /// The FPGACmdMessage in byte form + public void Parse(IntPtr pData) + { + try + { + m_header.Parse(pData); + + IntPtr pPayLoad = IntPtr.Add(pData, (int)GetHeaderLength()); + + ParseData(pPayLoad); + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this FPGACmdMessage into string form + /// + /// The FPGACmdMessage in string form + public override string ToString() + { + string desc = "Description: " + GetDescription() + "\n" + m_header.ToString(); + + return desc; + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGACmdMessageHeader.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGACmdMessageHeader.cs new file mode 100644 index 0000000..d491cd2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGACmdMessageHeader.cs @@ -0,0 +1,154 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// The header for all command messages + /// + internal class FPGACmdMessageHeader + { + #region PrivateClassMembers + private const int m_HEADER_SIZE = 1; + private byte m_headerCmd; + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The header to copy + public FPGACmdMessageHeader(FPGACmdMessageHeader header) + { + try + { + m_headerCmd = header.m_headerCmd; + } + catch (Exception) + { + throw; + } + } + + /// + /// Constructor for when receiving data. + /// Use this constructor and then parse to populate it + /// + public FPGACmdMessageHeader() + { + try + { + m_headerCmd = 0; + } + catch (Exception) + { + throw; + } + } + + /// + /// Constructor for sending + /// + /// the type of the message + /// The page to read or write to + public FPGACmdMessageHeader(FPGACmdMsgIds commandType, FPGACmdMessage.Page page) + { + try + { + m_headerCmd = (byte)((byte)commandType | (byte)page); + } + catch (Exception) + { + throw; + } + } + + /// + /// Encode the header into a byte array for sending + /// + /// The buffer to put the message items + public void Format(IntPtr pData) + { + try + { + Marshal.StructureToPtr(m_headerCmd, pData, true); + } + catch (Exception) + { + throw; + } + } + + /// + /// getter for the number of bytes in the header + /// + /// The header length in bytes + public uint GetHeaderLength() + { + try + { + return m_HEADER_SIZE; + } + catch (Exception) + { + throw; + } + } + + /// + /// getter for the message id + /// + /// The message id + public FPGACmdMsgIds GetMessageId() + { + byte temp = (byte)(m_headerCmd >> 4); + return (FPGACmdMsgIds)temp; + } + + /// + /// Takes an array of bytes and populates the header object + /// + /// The header in byte form + public void Parse(IntPtr pData) + { + try + { + m_headerCmd = System.Runtime.InteropServices.Marshal.ReadByte(pData, 0); + } + catch (Exception) + { + throw; + } + } + + /// + /// Creates a string version of the header members + /// + /// A string containning the header data + public override string ToString() + { + string msg = "Header Data:\r\n"; + msg += "Command: " + m_headerCmd.ToString("X") + "\r\n"; + return msg; + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAMessageIDs.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAMessageIDs.cs new file mode 100644 index 0000000..f77fe2e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAMessageIDs.cs @@ -0,0 +1,42 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +namespace FpgaMeasurementInstrumentsLib +{ + #region PublicClassMembers + /// + /// The command message IDs for messages that go between the host pc and the fpga + /// + internal enum FPGACmdMsgIds + { + TYPE_TWO_READ_CMD_ID = 0x40, + TYPE_TWO_WRITE_CMD_ID = 0xC0, + TYPE_THREE_READ_CMD_ID = 0x58, + TYPE_THREE_WRITE_CMD_ID = 0xD8 + }; + + /// + /// The command message IDs for messages that go between the host pc and the fpga + /// + internal enum FPGARspMsgIds + { + TYPE_TWO_READ_RSP_ID = 0xC0, + TYPE_TWO_WRITE_RSP_ID = 0xAA, + TYPE_THREE_WRITE_RSP_ID = 0x0 + }; + #endregion +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterCmdBlockIncrMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterCmdBlockIncrMessage.cs new file mode 100644 index 0000000..e81cdc2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterCmdBlockIncrMessage.cs @@ -0,0 +1,177 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using Raytheon.Common; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// A message to read a register of the FPGA + /// + internal class FPGAReadRegisterCmdBlockIncrMessage : FPGACmdMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + }; + + private Data m_dataStruct; + + //Dummy Array used to identify how much data will be sent back + private byte[] m_data; + + private bool m_byteSwap; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAReadRegisterCmdBlockIncrMessage msg = new FPGAReadRegisterCmdBlockIncrMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + try + { + // perform byte swapping and copy data into the buffer + Data dataTemp = m_dataStruct; + + //Swap address bytes + dataTemp.m_address = Util.Swap(dataTemp.m_address); + + //Create a pointer to message we want to send + Marshal.StructureToPtr(dataTemp, pData, true); + + //Increment pointer to account for the m_dataStruct struct + pData = IntPtr.Add(pData, Marshal.SizeOf(typeof(Data))); + + //Copy array into pointer + Marshal.Copy(m_data, 0, pData, m_data.Length); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + return Marshal.SizeOf(m_dataStruct) + m_data.Length; + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + // copy data into our structure + m_dataStruct = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + + //Increment point address to end of structure + pData = IntPtr.Add(pData, Marshal.SizeOf(typeof(Data))); + + //Copy data from pointer to array + Marshal.Copy(pData, m_data, 0, m_data.Length); + + //swap address + m_dataStruct.m_address = Util.Swap(m_dataStruct.m_address); + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + /// + /// Copy constructor + /// + /// The object to copy + public FPGAReadRegisterCmdBlockIncrMessage(FPGAReadRegisterCmdBlockIncrMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + m_byteSwap = rhs.m_byteSwap; + m_data = rhs.m_data; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// The page to read from + /// The address to read + public FPGAReadRegisterCmdBlockIncrMessage(Page page, uint address, uint numWords, bool swapDataBytes) + : base(FPGACmdMsgIds.TYPE_THREE_READ_CMD_ID, page, "Read Register Command") + { + try + { + m_dataStruct.m_address = address; + m_byteSwap = swapDataBytes; + + //Create an empty array the size of numWords + m_data = new byte[numWords * sizeof(uint)]; + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// A string representing this message + public override String ToString() + { + string msg = base.ToString(); + msg += " address: " + m_dataStruct.m_address.ToString() + "\r\n\r\n"; + return msg; + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterCmdMessage.cs new file mode 100644 index 0000000..c7e4c40 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterCmdMessage.cs @@ -0,0 +1,149 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// A message to read a register of the FPGA + /// + internal class FPGAReadRegisterCmdMessage : FPGACmdMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + public uint m_spare; + }; + + private Data m_dataStruct; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAReadRegisterCmdMessage msg = new FPGAReadRegisterCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + try + { + // perform byte swapping and copy data into the buffer + Data dataTemp = m_dataStruct; + dataTemp.m_address = Util.Swap(dataTemp.m_address); + Marshal.StructureToPtr(dataTemp, pData, true); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + return Marshal.SizeOf(m_dataStruct); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + // copy data into our structure and byte swap + m_dataStruct = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + m_dataStruct.m_address = Util.Swap(m_dataStruct.m_address); + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + /// + /// Copy constructor + /// + /// The object to copy + public FPGAReadRegisterCmdMessage(FPGAReadRegisterCmdMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// The page to read from + /// The address to read + public FPGAReadRegisterCmdMessage(Page page, uint address) + : base(FPGACmdMsgIds.TYPE_TWO_READ_CMD_ID, page, "Read Register Command") + { + try + { + m_dataStruct.m_address = address; + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// A string representing this message + public override String ToString() + { + string msg = base.ToString(); + msg += " address: " + m_dataStruct.m_address.ToString("X8") + "\r\n\r\n"; + return msg; + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterRspBlockIncrMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterRspBlockIncrMessage.cs new file mode 100644 index 0000000..59fac52 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterRspBlockIncrMessage.cs @@ -0,0 +1,188 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using Raytheon.Common; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// The response message for the FPGAReadRegisterCmdMessage + /// + internal class FPGAReadRegisterBlockIncrRspMessage : FPGARspMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + public uint m_data; + }; + + //array for all received data (address/data) + private Data[] m_dataArray; + + //Array(ref) for received data (data only) + private uint[] m_refArray; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAReadRegisterBlockIncrRspMessage msg = new FPGAReadRegisterBlockIncrRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + //From base class. Data does not need to be formatted (will not be sent out) + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + //Size of Data (address and data) * number of elements + return Marshal.SizeOf(typeof(Data)) * m_dataArray.Length; + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + for (int i = 0; i < m_dataArray.Length; i++) + { + //Copy data into the structure + m_dataArray[i] = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + + //Increment pointer + pData = IntPtr.Add(pData, Marshal.SizeOf(typeof(Data))); + + //Swap Address + m_dataArray[i].m_address = Util.Swap(m_dataArray[i].m_address); + + //Swap Data + m_dataArray[i].m_data = Util.Swap(m_dataArray[i].m_data); + + //Move data into referenced array + m_refArray[i] = m_dataArray[i].m_data; + } + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public FPGAReadRegisterBlockIncrRspMessage(FPGAReadRegisterBlockIncrRspMessage rhs) + : base(rhs) + { + try + { + m_dataArray = rhs.m_dataArray; + m_refArray = rhs.m_refArray; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor + /// + /// The address that was read from from + /// The data that was read + public FPGAReadRegisterBlockIncrRspMessage(uint address, ref uint[] data) + : base(FPGARspMsgIds.TYPE_TWO_READ_RSP_ID, "Read Register Response Message") + { + try + { + m_dataArray = new Data[data.Length]; + + m_refArray = data; + } + catch (Exception) + { + throw; + } + } + + /// + /// getter for the address + /// + /// TThe address + public override uint GetAddress() + { + //Array of data. This function would need to change + return 0; + } + + /// + /// getter for the data + /// + /// The data + public override uint GetData() + { + //Array of data. This function would need to change + return 0; + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override string ToString() + { + string msg = base.ToString(); + for (int i = 0; i < m_dataArray.Length; i++) + { + msg += " address: " + m_dataArray[i].m_address.ToString("X8") + "\r\n"; + msg += " data: " + m_dataArray[i].m_data.ToString("X8") + "\r\n\r\n"; + } + + return msg; + } + #endregion + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterRspMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterRspMessage.cs new file mode 100644 index 0000000..67213d3 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAReadRegisterRspMessage.cs @@ -0,0 +1,174 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using Raytheon.Common; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// The response message for the FPGAReadRegisterCmdMessage + /// + internal class FPGAReadRegisterRspMessage : FPGARspMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + public uint m_data; + }; + + private Data m_dataStruct; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAReadRegisterRspMessage msg = new FPGAReadRegisterRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + try + { + // perform byte swapping and copy data into the buffer + Data dataTemp = m_dataStruct; + dataTemp.m_address = Util.Swap(dataTemp.m_address); + dataTemp.m_data = Util.Swap(dataTemp.m_data); + Marshal.StructureToPtr(dataTemp, pData, true); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + return Marshal.SizeOf(typeof(Data)); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + // copy data into our structure and byte swap + m_dataStruct = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + m_dataStruct.m_address = Util.Swap(m_dataStruct.m_address); + m_dataStruct.m_data = Util.Swap(m_dataStruct.m_data); + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public FPGAReadRegisterRspMessage(FPGAReadRegisterRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor + /// + /// The address that was read from from + /// The data that was read + public FPGAReadRegisterRspMessage(uint address, uint data) + : base(FPGARspMsgIds.TYPE_TWO_READ_RSP_ID, "Read Register Response Message") + { + try + { + m_dataStruct.m_address = address; + m_dataStruct.m_data = data; + } + catch (Exception) + { + throw; + } + } + + /// + /// getter for the address + /// + /// TThe address + public override uint GetAddress() + { + return m_dataStruct.m_address; + } + + /// + /// getter for the data + /// + /// The data + public override uint GetData() + { + return m_dataStruct.m_data; + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override string ToString() + { + string msg = base.ToString(); + msg += " address: " + m_dataStruct.m_address.ToString("X8") + "\r\n"; + msg += " data: " + m_dataStruct.m_data.ToString("X8") + "\r\n\r\n"; + + return msg; + } + #endregion + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGARspMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGARspMessage.cs new file mode 100644 index 0000000..8acd40f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGARspMessage.cs @@ -0,0 +1,197 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// An abstract base class for FPGARspMessages that go between the client and server + /// + internal abstract class FPGARspMessage : ICloneable + { + #region PrivateClassMembers + protected FPGARspMessageHeader m_header; + private readonly string m_description; + #endregion + + #region PrivateFunctions + + /// + /// The constructor that the children will call + /// + /// The message id + /// The message description + protected FPGARspMessage(FPGARspMsgIds commandType, string description) + { + try + { + m_description = description; + m_header = new FPGARspMessageHeader(commandType); + } + catch (Exception) + { + throw; + } + } + + /// + /// Copy Constructor + /// + /// The FPGARspMessage to copy from + protected FPGARspMessage(FPGARspMessage FPGARspMessage) + { + try + { + m_header = new FPGARspMessageHeader(FPGARspMessage.m_header); + m_description = FPGARspMessage.m_description; + } + catch (Exception) + { + throw; + } + } + + /// + /// A function to create a copy of the object for all children to implement + /// + /// + protected abstract object CloneSelf(); + + /// + /// A function to encode data for sending + /// + /// A pointer to the spot to put the encoded data + protected abstract void FormatData(IntPtr pData); + + /// + /// Get the size of the payload + /// + /// The size of the message payload + protected abstract int GetPayloadSize(); + + /// + /// A function to decode data that was received + /// + /// A pointer to the data to decode + protected abstract void ParseData(IntPtr pData); + #endregion + + #region PublicFunctions + + /// + /// Get a copy of the FPGARspMessage object + /// + /// + public object Clone() + { + // tell the child to clone itself + return this.CloneSelf(); + } + + /// + /// Encode the FPGARspMessage into a byte array for sending + /// + /// The buffer to put the FPGARspMessage items + public void Format(IntPtr pData) + { + try + { + m_header.Format(pData); + + IntPtr pPayload = IntPtr.Add(pData, (int)GetHeaderLength()); + + // ask child class to format its data + FormatData(pPayload); + } + catch (Exception) + { + throw; + } + } + + /// + /// A getter function for the children to implement + /// + /// The address that was read + public abstract uint GetAddress(); + + /// + /// A getter function for the children to implement + /// + /// The data that was read + public abstract uint GetData(); + + /// + /// Getter for this message description + /// + /// The description + public string GetDescription() + { + return m_description; + } + + /// + /// Getter for the number of bytes in the entire message + /// + /// The number of bytes in the FPGARspMessage, including header + public uint GetEntireMsgLength() + { + return GetHeaderLength() + (uint)GetPayloadSize(); + } + + /// + /// getter for the number of bytes in the header + /// + /// The number of bytes in the head + public uint GetHeaderLength() + { + return m_header.GetHeaderLength(); + } + + /// + /// Takes an array of bytes and populates the FPGARspMessage object + /// + /// The FPGARspMessage in byte form + public void Parse(IntPtr pData) + { + try + { + m_header.Parse(pData); + + IntPtr pPayLoad = IntPtr.Add(pData, (int)GetHeaderLength()); + + ParseData(pPayLoad); + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this FPGARspMessage into string form + /// + /// The FPGARspMessage in string form + public override string ToString() + { + return "Description: " + GetDescription() + "\n" + m_header.ToString(); + } + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGARspMessageHeader.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGARspMessageHeader.cs new file mode 100644 index 0000000..fbd4533 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGARspMessageHeader.cs @@ -0,0 +1,154 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// The header for the response messages + /// + internal class FPGARspMessageHeader + { + #region PrivateClassMembers + private const int m_HEADER_SIZE = 0; + private const uint m_ENTIRE_MSG_SIZE = 8; + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The header to copy + public FPGARspMessageHeader(FPGARspMessageHeader header) + { + try + { + // m_data = header.m_data; + } + catch (Exception) + { + throw; + } + } + + /// + /// Constructor for when receiving data. + /// Use this constructor and then parse to populate it + /// + public FPGARspMessageHeader() + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// Constructor for sending + /// + /// the type of the message + public FPGARspMessageHeader(FPGARspMsgIds commandType) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// Encode the header into a byte array for sending + /// + /// The buffer to put the message items + public void Format(IntPtr pData) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// Getter for the entire message length in bytes + /// + /// The number of bytes in the message, including header + public uint GetEntireMsgLength() + { + try + { + return m_ENTIRE_MSG_SIZE; + } + catch (Exception) + { + throw; + } + } + + /// + /// getter for the header length in bytes + /// + /// The header length in bytes + public uint GetHeaderLength() + { + try + { + return m_HEADER_SIZE; + } + catch (Exception) + { + throw; + } + } + + /// + /// Takes an array of bytes and populates the header object + /// + /// The header in byte form + public void Parse(IntPtr pData) + { + try + { + // copy data into our structure and byte swap + } + catch (Exception) + { + throw; + } + } + + /// + /// Creates a string version of the header members + /// + /// A string containning the header data + public override string ToString() + { + string msg = "Header Data:\r\n\r\n"; + return msg; + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdBlockIncrMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdBlockIncrMessage.cs new file mode 100644 index 0000000..5bd98f4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdBlockIncrMessage.cs @@ -0,0 +1,202 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// + /// + internal class FPGAWriteRegisterCmdBlockIncrMessage : FPGACmdMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + }; + + private byte[] m_data; + + private Data m_dataStruct; + + private bool m_byteSwap; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAWriteRegisterCmdBlockIncrMessage msg = new FPGAWriteRegisterCmdBlockIncrMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + try + { + //Temporary storage for message data + Data dataTemp = m_dataStruct; + + //address swap + dataTemp.m_address = Util.Swap(dataTemp.m_address); + + //Do we need to swap bytes + if (m_byteSwap == true) + { + SwapWord(ref m_data); + } + + //Pointer to message + Marshal.StructureToPtr(dataTemp, pData, true); + pData = IntPtr.Add(pData, Marshal.SizeOf(typeof(Data))); + Marshal.Copy(m_data, 0, pData, m_data.Length); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + return Marshal.SizeOf(m_dataStruct) + m_data.Length; + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + //copy data into our structure + m_dataStruct = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + pData = IntPtr.Add(pData, Marshal.SizeOf(typeof(Data))); + Marshal.Copy(pData, m_data, 0, m_data.Length); + + m_dataStruct.m_address = Util.Swap(m_dataStruct.m_address); + + //Swap data if required + if (m_byteSwap) + { + SwapWord(ref m_data); + } + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public FPGAWriteRegisterCmdBlockIncrMessage(FPGAWriteRegisterCmdBlockIncrMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + m_byteSwap = rhs.m_byteSwap; + m_data = rhs.m_data; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + public FPGAWriteRegisterCmdBlockIncrMessage(Page page, uint address, byte[] data, bool swapDataBytes) + : base(FPGACmdMsgIds.TYPE_THREE_WRITE_CMD_ID, page, "Write Register Command Increment Block") + { + try + { + m_dataStruct.m_address = address; + m_data = data; + m_byteSwap = swapDataBytes; + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + /// + /// + /// + public FPGAWriteRegisterCmdBlockIncrMessage(Page page, uint address, uint[] data, bool swapDataBytes) + : base(FPGACmdMsgIds.TYPE_THREE_WRITE_CMD_ID, page, "Write Register Command Increment Block") + { + try + { + m_dataStruct.m_address = address; + m_byteSwap = swapDataBytes; + + //Convert to Byte Array + m_data = new byte[data.Length * sizeof(uint)]; + Buffer.BlockCopy(data, 0, m_data, 0, m_data.Length); + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override string ToString() + { + string msg = base.ToString(); + msg += " address: " + m_dataStruct.m_address.ToString("X8") + "\r\n\r\n"; + return msg; + } + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdBlockMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdBlockMessage.cs new file mode 100644 index 0000000..46fdc99 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdBlockMessage.cs @@ -0,0 +1,202 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// + /// + internal class FPGAWriteRegisterCmdBlockMessage : FPGACmdMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + }; + + private byte[] m_data; + + private Data m_dataStruct; + + private bool m_byteSwap; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAWriteRegisterCmdBlockMessage msg = new FPGAWriteRegisterCmdBlockMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + try + { + //Temporary storage for message data + Data dataTemp = m_dataStruct; + + //address swap + dataTemp.m_address = Util.Swap(dataTemp.m_address); + + //Do we need to swap bytes + if (m_byteSwap) + { + //Swap + SwapWord(ref m_data); + } + + //Pointer to message + Marshal.StructureToPtr(dataTemp, pData, true); + pData = IntPtr.Add(pData, Marshal.SizeOf(typeof(Data))); + Marshal.Copy(m_data, 0, pData, m_data.Length); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + return Marshal.SizeOf(m_dataStruct) + m_data.Length; + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + //copy data into our structure + m_dataStruct = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + pData = IntPtr.Add(pData, Marshal.SizeOf(typeof(Data))); + Marshal.Copy(pData, m_data, 0, m_data.Length); + + m_dataStruct.m_address = Util.Swap(m_dataStruct.m_address); + + //Swap data if required + if (m_byteSwap) + { + SwapWord(ref m_data); + } + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public FPGAWriteRegisterCmdBlockMessage(FPGAWriteRegisterCmdBlockMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + m_byteSwap = rhs.m_byteSwap; + m_data = rhs.m_data; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + public FPGAWriteRegisterCmdBlockMessage(Page page, uint address, byte[] data, bool swapDataBytes) + : base(FPGACmdMsgIds.TYPE_TWO_WRITE_CMD_ID, page, "Write Register Command Block") + { + try + { + m_dataStruct.m_address = address; + m_byteSwap = swapDataBytes; + m_data = data; + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + /// + /// + /// + public FPGAWriteRegisterCmdBlockMessage(Page page, uint address, uint[] data, bool swapDataBytes) + : base(FPGACmdMsgIds.TYPE_TWO_WRITE_CMD_ID, page, "Write Register Command Block") + { + try + { + m_dataStruct.m_address = address; + m_byteSwap = swapDataBytes; + + m_data = new byte[data.Length * sizeof(uint)]; + Buffer.BlockCopy(data, 0, m_data, 0, m_data.Length); + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override string ToString() + { + string msg = base.ToString(); + msg += " address: " + m_dataStruct.m_address.ToString("X8") + "\r\n\r\n"; + return msg; + } + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdMessage.cs new file mode 100644 index 0000000..b940e3c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterCmdMessage.cs @@ -0,0 +1,153 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// The message that targets the VRSUI to make a connection + /// + internal class FPGAWriteRegisterCmdMessage : FPGACmdMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + public uint m_data; + }; + + private Data m_dataStruct; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAWriteRegisterCmdMessage msg = new FPGAWriteRegisterCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + try + { + // perform byte swapping and copy data into the buffer + Data dataTemp = m_dataStruct; + dataTemp.m_address = Util.Swap(dataTemp.m_address); + dataTemp.m_data = Util.Swap(dataTemp.m_data); + Marshal.StructureToPtr(dataTemp, pData, true); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + return Marshal.SizeOf(m_dataStruct); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + // copy data into our structure and byte swap + m_dataStruct = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + m_dataStruct.m_address = Util.Swap(m_dataStruct.m_address); + m_dataStruct.m_data = Util.Swap(m_dataStruct.m_data); + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public FPGAWriteRegisterCmdMessage(FPGAWriteRegisterCmdMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + public FPGAWriteRegisterCmdMessage(Page page, uint address, uint data) + : base(FPGACmdMsgIds.TYPE_TWO_WRITE_CMD_ID, page, "Write Register Command") + { + try + { + m_dataStruct.m_address = address; + m_dataStruct.m_data = data; + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override string ToString() + { + string msg = base.ToString(); + msg += " address: " + m_dataStruct.m_address.ToString("X8") + "\r\n"; + msg += " data: " + m_dataStruct.m_data.ToString("X8") + "\r\n\r\n"; + return msg; + } + #endregion + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterRspMessage.cs b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterRspMessage.cs new file mode 100644 index 0000000..f4104ed --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/Ethernet/UdpMessages/FPGAWriteRegisterRspMessage.cs @@ -0,0 +1,174 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using Raytheon.Common; + +namespace FpgaMeasurementInstrumentsLib +{ + /// + /// The response message from the VRSUI upon receiving a VrsConnectCmdMessage + /// + internal class FPGAWriteRegisterRspMessage : FPGARspMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_address; + public uint m_data; + }; + + private Data m_dataStruct; + #endregion + + #region PrivateFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + FPGAWriteRegisterRspMessage msg = new FPGAWriteRegisterRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + try + { + // perform byte swapping and copy data into the buffer + Data dataTemp = m_dataStruct; + dataTemp.m_address = Util.Swap(dataTemp.m_address); + dataTemp.m_data = Util.Swap(dataTemp.m_data); + Marshal.StructureToPtr(dataTemp, pData, true); + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + protected override int GetPayloadSize() + { + return Marshal.SizeOf(typeof(Data)); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + try + { + // copy data into our structure and byte swap + m_dataStruct = (Data)(Marshal.PtrToStructure(pData, typeof(Data))); + m_dataStruct.m_address = Util.Swap(m_dataStruct.m_address); + m_dataStruct.m_data = Util.Swap(m_dataStruct.m_data); + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public FPGAWriteRegisterRspMessage(FPGAWriteRegisterRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// The address to write to + /// The data to write + public FPGAWriteRegisterRspMessage(uint address, uint data) + : base(FPGARspMsgIds.TYPE_TWO_WRITE_RSP_ID, "Write Register Response Message") + { + try + { + m_dataStruct.m_address = address; + m_dataStruct.m_data = data; + } + catch (Exception) + { + throw; + } + } + + /// + /// getter for the address + /// + /// The address + public override uint GetAddress() + { + return m_dataStruct.m_address; + } + + /// + /// getter for the data + /// + /// The data + public override uint GetData() + { + return m_dataStruct.m_data; + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override string ToString() + { + string msg = base.ToString(); + msg += " address: " + m_dataStruct.m_address.ToString("X8") + "\r\n"; + msg += " data: " + m_dataStruct.m_data.ToString("X8") + "\r\n\r\n"; + + return msg; + } + #endregion + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/CommFpgaHssubChassisSs.cs b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/CommFpgaHssubChassisSs.cs new file mode 100644 index 0000000..5ecf14e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/CommFpgaHssubChassisSs.cs @@ -0,0 +1,499 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements the Teradyne HSS Sub System Chassis + /// + public unsafe class CommFpgaHssubChassisSs : IFpgaComm + { + #region PrivateClassMembers +#pragma warning disable CS0649 + public struct CardInfo + { + internal string cardName; + internal string cardAddress; + internal int startingOffset; + internal string cardFirmwareFile; + internal string memMap; + } +#pragma warning restore + + private static object _syncObj = new Object(); + + private SortedDictionary _hssCardNameMap; + private List _cardList; + private SelfTestResult _selfTestResult; + private State _state; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The finalizer. + /// + ~CommFpgaHssubChassisSs() + { + Dispose(false); + } + + /// + /// + /// + /// + /// + /// + /// + private void CreateCard(string cardName, string cardAddress, int startingOffset, string cardFirmwareFile, string memMap) + { + lock (_syncObj) + { + // create the card + CommFpgaHssubCardSs card = new CommFpgaHssubCardSs(cardName, cardAddress, startingOffset, cardFirmwareFile, memMap); + + // hold onto the card + _hssCardNameMap[cardName] = card; + } + } + + /// + /// + /// + /// + public void LoadFirmware(string fpgaName) + { + // lock up the FPGA resource + lock (_syncObj) + { + _hssCardNameMap[fpgaName].LoadFirmware(); + } + } + + /// + /// + /// + private void SelfTest() + { + // loop through each card and command self test + + /*short testResults = -1; + + StringBuilder errorStrTemp = new StringBuilder(512); + + int ret = HssubNativeMethods.terHss_self_test(_chassisHandle, ref testResults, errorStrTemp); + + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _chassisLogicalName); + + throw new Exception("terHss_self_test returned an error(" + ret + ")" + ": " + errorStr); + } + else if (testResults != 0) + { + throw new Exception("HSSub Self Test returned an error: " + testResults.ToString() + ": " + errorStrTemp.ToString()); + }*/ + } + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + lock (_syncObj) + { + if (_state == State.Ready) + { + foreach (KeyValuePair entry in _hssCardNameMap) + { + entry.Value.Dispose(); + } + + _state = State.Uninitialized; + } + } + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFuctions + + /// + /// CommFpgaHssubChassisSs factory constructor + /// + /// + /// + public CommFpgaHssubChassisSs(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _cardList = new List(); + + // hold onto the card objects + _hssCardNameMap = new SortedDictionary(); + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public CommFpgaHssubChassisSs(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _cardList = new List(); + + // hold onto the card objects + _hssCardNameMap = new SortedDictionary(); + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public void AddCard(CardInfo cardInfo) + { + _cardList.Add(cardInfo); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FPGA HSS Chassis SS " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + // lock up the FPGA resource + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /// + public string GetMemMap(string fpga) + { + // lock up the FPGA resource + lock (_syncObj) + { + return _hssCardNameMap[fpga].GetMemMap(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + Initialize(string.Empty); + } + + /// + /// + /// + /// + public void Initialize(string fpga) + { + // lock up the FPGA resource + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + // init each card + for (int i = 0; i < _cardList.Count; i++) + { + CreateCard(_cardList[i].cardName, _cardList[i].cardAddress, _cardList[i].startingOffset, _cardList[i].cardFirmwareFile, _cardList[i].memMap); + } + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + /// + /// + /// + /// + /// + /// + public uint Read(string fpgaName, uint address) + { + // lock up the FPGA resource + lock (_syncObj) + { + return _hssCardNameMap[fpgaName].Read(fpgaName, address); + } + } + + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + // lock up the FPGA resource + lock (_syncObj) + { + _hssCardNameMap[fpgaName].ReadBlock(fpgaName, address, numberOfWordsToRead, shallWeIncrementAddress, ref dataRead); + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public void Shutdown() + { + // lock up the FPGA resource + lock (_syncObj) + { + if (_state == State.Ready) + { + foreach (KeyValuePair entry in _hssCardNameMap) + { + entry.Value.Dispose(); + } + + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpgaName, uint address, uint value) + { + // lock up the FPGA resource + lock (_syncObj) + { + _hssCardNameMap[fpgaName].Write(fpgaName, address, value); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + // lock up the FPGA resource + lock (_syncObj) + { + _hssCardNameMap[fpgaName].WriteBlock(fpgaName, address, numberOfWordsToWrite, data, shallWeIncrementAddress); + } + } + + #endregion + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/CommFpgaHssubChassisSsFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/CommFpgaHssubChassisSsFactory.cs new file mode 100644 index 0000000..2525aec --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/CommFpgaHssubChassisSsFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaHssubCardSsFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaHssubChassisSsFactory")] + public class CommFpgaHssubChassisSsFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaHssubChassisSsFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaHssubChassisSsFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaHssubChassisSs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaHssubChassisSs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/FpgaHssubChassisSs.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/FpgaHssubChassisSs.csproj new file mode 100644 index 0000000..161493f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisSs/FpgaHssubChassisSs.csproj @@ -0,0 +1,38 @@ + + + + + net472 + Raytheon.Instruments.FPGA.HssubChassisSs + FPGA Hssub Chassis Ss implementation + FPGA Hssub Chassis Ss implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/CommFpgaHssubChassisTs.cs b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/CommFpgaHssubChassisTs.cs new file mode 100644 index 0000000..21c056c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/CommFpgaHssubChassisTs.cs @@ -0,0 +1,717 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using FpgaMeasurementInstrumentsLib; +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements the Teradyne HSS Test Station Chassis + /// + public unsafe class CommFpgaHssubChassisTs : IFpgaComm + { + #region PrivateClassMembers + public struct LocalBusParams + { + public int cardHandle; + public int address; + public int data; + } + + public struct CardInfo + { + public string cardName; + public string cardAddress; + public int startingOffset; + public string cardFirmwareFile; + public string memMap; + } + + private static object _syncObj = new Object(); + + private SortedDictionary _hssCardNameMap; + private SortedDictionary _hssCardHandleMap; + + private readonly string _chassisAddress; + private readonly string _killHandlerAppName; + private readonly string _msgHandlerAppName; + private uint _chassisHandle; + private int _hssubAppInit; + private int _hssubSubSystemApp; + private int _hssubSubSystemAppSync; + private int _hssubCloseAppSync; + private int _hssubKillApp; + private int _hsiHandle; + private List _cardList; + private SelfTestResult _selfTestResult; + private State _state; + private string _name; + + private HssubNativeMethods.MessageCallbackDelagate _callBack; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The finalizer. + /// + ~CommFpgaHssubChassisTs() + { + Dispose(false); + } + + /// + /// + /// + /// + /// + /// + /// + private void CreateCard(string cardName, string cardAddress, int startingOffset, string cardFirmwareFile, string memMap) + { + lock (_syncObj) + { + // create the card + CommFpgaHssubCardTs card = new CommFpgaHssubCardTs(cardName, cardAddress, startingOffset, cardFirmwareFile, _chassisHandle, _hssubSubSystemApp, _hssubSubSystemAppSync, memMap); + + // wait for the chassis to respond + HssUtilTs.WaitForSync(_chassisHandle, _hssubSubSystemAppSync, _name); + + // make sure the chassis gave us a good card handle + if (_hsiHandle == 0) + { + throw new Exception("_hsiHandle is 0"); + } + + // give the card its handle + card.SetHandle(_hsiHandle); + + // hold onto the card + _hssCardNameMap[cardName] = card; + _hssCardHandleMap[_hsiHandle] = card; + + // set the _hsiHandle back to zero for the next card + _hsiHandle = 0; + } + } + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + lock (_syncObj) + { + if (_state == State.Ready) + { + int ret = HssubNativeMethods.terHss_close(_chassisHandle); + + _state = State.Uninitialized; + } + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + private void InitChassis() + { + //0 is VI_FALSE, 1 is VI_TRUE + int ret = HssubNativeMethods.terHss_init(_chassisAddress, 0, 1, ref _chassisHandle); + + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_init returned returned an error(" + ret + ")" + ": " + errorStr); + } + + // start the message application + LoadMessageApp(); + } + + /// + /// + /// + private void LoadMessageApp() + { + int ret = HssubNativeMethods.terHss_Application_CreateSyncObject(_chassisHandle, "AppInit", ref _hssubAppInit); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_CreateSyncObject(AppInit) returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Application_CreateSyncObject(_chassisHandle, "AppSync", ref _hssubSubSystemAppSync); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_CreateSyncObject(AppSync) returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Application_CreateSyncObject(_chassisHandle, "SubAppQuit", ref _hssubCloseAppSync); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_CreateSyncObject(SubAppQuit) returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Application_RegisterMessageCallback(_chassisHandle, _callBack); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_RegisterMessageCallback() returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Subsystem_SendFile(_chassisHandle, _killHandlerAppName, "c:\\temp\\killhndlr.bat", HssubNativeMethods.TERHSS_OPTION_ALLOW_OVERWRITE); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_SubSyste_SendFile(Killer App) returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Application_Load(_chassisHandle, "Killer App", "c:\\temp\\killhndlr.bat", ref _hssubKillApp); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_Load(Killer App) returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Application_Start(_chassisHandle, _hssubKillApp, "", 1); + /*if (ret != 0) + { + string errorStr = HssUtil.BuildErrorString(_chassisHandle, ret, _chassisLogicalName); + + throw new Exception("terHss_Application_Start(Killer App) returned an error(" + ret + ")" + ": " + errorStr); + }*/ + + ret = HssubNativeMethods.terHss_Subsystem_SendFile(_chassisHandle, _msgHandlerAppName, "c:\\temp\\hndlr.exe", HssubNativeMethods.TERHSS_OPTION_ALLOW_OVERWRITE); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_SubSyste_SendFile(Msg Handler App) returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Application_Load(_chassisHandle, "Subsystem App", "c:\\temp\\hndlr.exe", ref _hssubSubSystemApp); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_Load(Msg Handler App) returned an error(" + ret + ")" + ": " + errorStr); + } + + ret = HssubNativeMethods.terHss_Application_Start(_chassisHandle, _hssubSubSystemApp, "", HssubNativeMethods.TERHSS_TIMEOUT_60SEC); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_Start(Msg Handler App) returned an error(" + ret + ")" + ": " + errorStr); + } + + // wait for the chassis to respond + HssUtilTs.WaitForSync(_chassisHandle, _hssubAppInit, _name); + } + + /// + /// + /// + /// + /// + /// + /// + /// + private void MessageCallback(uint sessionHandle, int applicationHandle, int messageContext, uint messageSize, byte* pMessage) + { + try + { + //ErrorLogger.Instance().Write("received message ID: " + messageContext.ToString(), ErrorLogger.LogLevel.INFO); + + if (messageContext == HssubNativeMethods.MESSAGE_CONTEXT_INIT_INSTRUMENT) + { + int* pTemp = (int*)pMessage; + _hsiHandle = *pTemp; + } + else if (messageContext == HssubNativeMethods.MESSAGE_CONTEXT_LB_READ32) + { + // get data into array and convert to the LocalBusParams structure + byte[] arr = new byte[messageSize]; + + Marshal.Copy((IntPtr)pMessage, arr, 0, (int)messageSize); + + HssUtilTs.LocalBusParams lbParams = HssUtilTs.ByteArrayToLocalBusParms(arr); + + _hssCardHandleMap[lbParams.cardHandle].SetLocalBusRxData(lbParams.address, lbParams.data); + } + /*else if (messageContext == HssubNativeMethods.MESSAGE_CONTEXT_LB_WRITE32)//@@@ this case does not exist... + { + //HssubChassis.LocalBusParams lbParams = HssUtil.ByteArrayToLocalBusParms(message); + + //_hssCardHandleMap[lbParams.cardHandle].SetLocalBusRxData(lbParams.address, lbParams.data); + }*/ + else + { + //ErrorLogger.Instance().Write("" + messageContext + " not yet handled"); + } + } + catch (Exception) + { + //ErrorLogger.Instance().Write("" + err.Message); + } + } + + #endregion + + #region PublicFuctions + + /// + /// CommFpgaHssubChassisTs factory constructor + /// + /// + /// + public CommFpgaHssubChassisTs(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _chassisAddress = _configuration.GetConfigurationValue("CommFpgaHssubChassisTs", "ChassisAddress", "127.0.0.1"); + _killHandlerAppName = _configuration.GetConfigurationValue("CommFpgaHssubChassisTs", "KillHandlerAppName", ""); + _msgHandlerAppName = _configuration.GetConfigurationValue("CommFpgaHssubChassisTs", "MsgHandlerAppName", ""); + + _cardList = new List(); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + // hold onto callback + _callBack = new HssubNativeMethods.MessageCallbackDelagate(MessageCallback); + + // _chassisHandle gets set in Initialize + _chassisHandle = 0; + + // these get initialized in LoadMessageApp() + _hssubAppInit = 0; + _hssubSubSystemApp = 0; + _hssubSubSystemAppSync = 0; + _hssubCloseAppSync = 0; + _hssubKillApp = 0; + + // this is for card handles, it gets set in the MessageCallback() and passed over to the card object + _hsiHandle = 0; + + // hold onto the card objects + _hssCardNameMap = new SortedDictionary(); + _hssCardHandleMap = new SortedDictionary(); + } + + /// + /// + /// + /// + /// + /// + /// + public CommFpgaHssubChassisTs(string name, string chassisAddress, string killHandlerAppName, string msgHandlerAppName) + { + // hang onto passed in args + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _chassisAddress = chassisAddress; + _killHandlerAppName = killHandlerAppName; + _msgHandlerAppName = msgHandlerAppName; + _cardList = new List(); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + // hold onto callback + _callBack = new HssubNativeMethods.MessageCallbackDelagate(MessageCallback); + + // _chassisHandle gets set in Initialize + _chassisHandle = 0; + + // these get initialized in LoadMessageApp() + _hssubAppInit = 0; + _hssubSubSystemApp = 0; + _hssubSubSystemAppSync = 0; + _hssubCloseAppSync = 0; + _hssubKillApp = 0; + + // this is for card handles, it gets set in the MessageCallback() and passed over to the card object + _hsiHandle = 0; + + // hold onto the card objects + _hssCardNameMap = new SortedDictionary(); + _hssCardHandleMap = new SortedDictionary(); + } + + /// + /// + /// + /// + public void AddCard(CardInfo cardInfo) + { + // lock up the FPGA resource + lock (_syncObj) + { + _cardList.Add(cardInfo); + } + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FPGA HSS TS called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + // lock up the FPGA resource + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Initialize(string fpga) + { + // lock up the FPGA resource + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + InitChassis(); + + // init each card + for (int i = 0; i < _cardList.Count; i++) + { + CreateCard(_cardList[i].cardName, _cardList[i].cardAddress, _cardList[i].startingOffset, _cardList[i].cardFirmwareFile, _cardList[i].memMap); + } + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + // lock up the FPGA resource + lock (_syncObj) + { + short testResults = -1; + + StringBuilder errorStrTemp = new StringBuilder(512); + + int ret = HssubNativeMethods.terHss_self_test(_chassisHandle, ref testResults, errorStrTemp); + + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_self_test returned an error(" + ret + ")" + ": " + errorStr); + } + else if (testResults != 0) + { + _selfTestResult = SelfTestResult.Fail; + throw new Exception("HSSub Self Test returned an error: " + testResults.ToString() + ": " + errorStrTemp.ToString()); + } + else + { + _selfTestResult = SelfTestResult.Pass; + } + + return _selfTestResult; + } + } + + /// + /// + /// + /// + /// + /// + public uint Read(string fpgaName, uint address) + { + // lock up the FPGA resource + lock (_syncObj) + { + return _hssCardNameMap[fpgaName].Read(fpgaName, address); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + // lock up the FPGA resource + lock (_syncObj) + { + _hssCardNameMap[fpgaName].ReadBlock(fpgaName, address, numberOfWordsToRead, shallWeIncrementAddress, ref dataRead); + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public void Shutdown() + { + // lock up the FPGA resource + lock (_syncObj) + { + if (_state == State.Ready) + { + int ret = HssubNativeMethods.terHss_close(_chassisHandle); + + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpgaName, uint address, uint value) + { + // lock up the FPGA resource + lock (_syncObj) + { + _hssCardNameMap[fpgaName].Write(fpgaName, address, value); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + // lock up the FPGA resource + lock (_syncObj) + { + _hssCardNameMap[fpgaName].WriteBlock(fpgaName, address, numberOfWordsToWrite, data, shallWeIncrementAddress); + } + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + Initialize(fpgaName); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/CommFpgaHssubChassisTsFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/CommFpgaHssubChassisTsFactory.cs new file mode 100644 index 0000000..d5370bf --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/CommFpgaHssubChassisTsFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaHssubCardSsFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaHssubChassisTsFactory")] + public class CommFpgaHssubChassisTsFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaHssubChassisTsFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaHssubChassisTsFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaHssubChassisTs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaHssubChassisTs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/FpgaHssubChassisTs.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/FpgaHssubChassisTs.csproj new file mode 100644 index 0000000..959da9b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaHssubChassisTs/FpgaHssubChassisTs.csproj @@ -0,0 +1,38 @@ + + + + + net472 + Raytheon.Instruments.FPGA.HssubChassisTs + FPGA Hssub Chassis Ts implementation + FPGA Hssub Chassis Ts implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/CommFpgaSim.cs b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/CommFpgaSim.cs new file mode 100644 index 0000000..aade51e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/CommFpgaSim.cs @@ -0,0 +1,403 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// A simulated fpga + /// + public class CommFpgaSim : IFpgaComm + { + #region PrivateClassMembers + private Dictionary _registers; + private static object _syncObj = new Object(); + private SelfTestResult _selfTestResult; + private State _state; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// The finalizer. + /// + ~CommFpgaSim() + { + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFuctions + + /// + /// CommFpgaSim factory constructor + /// + /// + /// + public CommFpgaSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + _registers = null; + } + + /// + /// + /// + /// + public CommFpgaSim(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + _registers = null; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FPGA Sim called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Dispose() + { + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Initialize(string fpga) + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _state = State.Ready; + _registers = new Dictionary(); + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + /// + /// + /// + /// + /// + /// + public uint Read(string fpgaName, uint address) + { + lock (_syncObj) + { + Thread.Sleep(50); + + if (_registers.ContainsKey(address) == true) + { + return _registers[address]; + } + else + { + return 0xffffffff; + } + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + lock (_syncObj) + { + Thread.Sleep(50); + + for (int i = 0; i < numberOfWordsToRead; i++) + { + dataRead[i] = Read(fpgaName, address); + + if (shallWeIncrementAddress == true) + { + address += 4; + } + } + } + } + + /// + /// + /// + public void Reset() + { + Shutdown(); + + Initialize(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + _state = State.Uninitialized; + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpgaName, uint address, uint value) + { + lock (_syncObj) + { + Thread.Sleep(50); + + _registers[address] = value; + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + lock (_syncObj) + { + Thread.Sleep(50); + + for (int i = 0; i < numberOfWordsToWrite; i++) + { + uint dataItem = data[i]; + + Write(fpgaName, address, dataItem); + + if (shallWeIncrementAddress == true) + { + address += 4; + } + } + } + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + Initialize(fpgaName); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/CommFpgaSimFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/CommFpgaSimFactory.cs new file mode 100644 index 0000000..d01ba50 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/CommFpgaSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// CommFpgaSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaSimFactory")] + public class CommFpgaSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new CommFpgaSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/FpgaSim.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/FpgaSim.csproj new file mode 100644 index 0000000..8e81c3d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/FpgaSim/FpgaSim.csproj @@ -0,0 +1,22 @@ + + + + + net472 + Raytheon.Instruments.FPGASim + FPGA SIM implementation + FPGA SIM implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/CommFpgaHssubCardSs.cs b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/CommFpgaHssubCardSs.cs new file mode 100644 index 0000000..316427c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/CommFpgaHssubCardSs.cs @@ -0,0 +1,308 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using FpgaMeasurementInstrumentsLib; +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements the Teradyne HSS Sub System Card + /// + public class CommFpgaHssubCardSs : IFpgaComm + { + #region PrivateClassMembers + private readonly string _name; + private readonly string _cardAddress; + private readonly uint _startingOffset; + private readonly string _firmware; + private readonly string _memMap; + private uint _cardHandle; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set; } + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + #endregion + + #region PrivateFunctions + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + int ret = HssubNativeMethods.terHsi_close(_cardHandle); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public void LoadFirmware() + { + ushort customerId = 0; + ushort appId = 0; + uint revId = 0; + + int ret = HssubNativeMethods.terHsi_Firmware_Load(_cardHandle, HssubNativeMethods.TERHSI_FPGA_TEST_DEFINED, _firmware, ref customerId, ref appId, ref revId); + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_Firmware_Load() returned an error(" + ret + ")" + ": " + errorStr); + } + } + + #endregion + + #region PublicFuctions + + /// + /// CommFpgaHssubCardSs factory constructor + /// + /// + /// + public CommFpgaHssubCardSs(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _cardAddress = _configuration.GetConfigurationValue("CommFpgaHssubCardSs", "CardAddress", "127.0.0.1"); + _startingOffset = _configuration.GetConfigurationValue("CommFpgaHssubCardSs", "StartingOffset", 0); + _firmware = _configuration.GetConfigurationValue("CommFpgaHssubCardSs", "Firmware", ""); + _memMap = _configuration.GetConfigurationValue("CommFpgaHssubCardSs", "MemMap", ""); + _cardHandle = 0; + + LoadFirmware(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public CommFpgaHssubCardSs(string name, string cardAddress, int startingOffset, string firmware, string memMap) + { + // hold onto args + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _cardAddress = cardAddress; + _startingOffset = (uint)startingOffset; + _firmware = firmware; + _memMap = memMap; + _cardHandle = 0; + + LoadFirmware(); + } + + /// + /// The finalizer. + /// + ~CommFpgaHssubCardSs() + { + Dispose(false); + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + public string GetMemMap() + { + return _memMap; + } + + /// + /// reads FPGA value from address + /// + /// + /// + /// + /// + public uint Read(string fpgaName, uint address) + { + uint dataRead = 0; + int ret = HssubNativeMethods.terHsi_LB_Read32(_cardHandle, _startingOffset + address, ref dataRead); + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_LB_Read32() returned an error(" + ret + ")" + ": " + errorStr); + } + + return dataRead; + } + + /// + /// reads block + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + throw new NotImplementedException(); + } + + /// + /// writes value to fpga address + /// + /// + /// + public void Write(string fpgaName, uint address, uint value) + { + int ret = HssubNativeMethods.terHsi_LB_Write32(_cardHandle, _startingOffset + address, value); + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_LB_Write32() returned an error(" + ret + ")" + ": " + errorStr); + } + } + + /// + /// writes block + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + throw new Exception("Not Implemented"); + } + + /// + /// initialize fpga + /// + /// + public void Initialize(string fpgaName) + { + Initialize(); + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + Initialize(fpgaName); + } + + public bool ClearErrors() + { + return false; + } + + public void Initialize() + { + LoadFirmware(); + } + + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + public void Reset() + { + Shutdown(); + + Initialize(); + } + + public void Shutdown() + { + Dispose(); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/CommFpgaHssubCardSsFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/CommFpgaHssubCardSsFactory.cs new file mode 100644 index 0000000..855d782 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/CommFpgaHssubCardSsFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaHssubCardSsFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaHssubCardSsFactory")] + public class CommFpgaHssubCardSsFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaHssubCardSsFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaHssubCardSsFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaHssubCardSs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaHssubCardSs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/HssubCardSs.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/HssubCardSs.csproj new file mode 100644 index 0000000..8ce603e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSs/HssubCardSs.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FPGA.HssubCardSs + FPGA Hssub Card Ss implementation + FPGA Hssub Card Ss implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/CommFpgaHssubCardSsHsi.cs b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/CommFpgaHssubCardSsHsi.cs new file mode 100644 index 0000000..8b8ab75 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/CommFpgaHssubCardSsHsi.cs @@ -0,0 +1,561 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using FpgaMeasurementInstrumentsLib; +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements the Teradyne HSS Sub System Card with the HSI Library + /// + public unsafe class CommFpgaHssubCardSsHsi : IFpgaComm + { + #region PrivateClassMembers + private enum Mode + { + PRIMARY_CONTROL, + SECONDARY_CONTROL + }; + + private readonly string _cardAddress; + private readonly uint _startingOffset; + private readonly string _cardFirmwareFile; + private uint _cardHandle; + private static object _syncObj = new Object(); + private readonly Mode __mode; + private SelfTestResult _selfTestResult; + private State _state; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The finalizer. + /// + ~CommFpgaHssubCardSsHsi() + { + Dispose(false); + } + + /// + /// + /// + private void LoadFirmware() + { + // lock up the FPGA resource + lock (_syncObj) + { + //ErrorLogger.Instance().Write("begin for " + _cardAddress.ToString(), ErrorLogger.LogLevel.INFO); + + ushort customerId = 0; + ushort appId = 0; + uint revId = 0; + + int ret = HssubNativeMethods.terHsi_Firmware_Load(_cardHandle, HssubNativeMethods.TERHSI_FPGA_TEST_DEFINED, _cardFirmwareFile, ref customerId, ref appId, ref revId); + if ((uint)ret == 0xbffa4442) + { + // expected, load still seems to work + } + else if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_Firmware_Load() returned an error(" + ret + ")" + ": " + errorStr + " on card " + _name); + } + } + } + + /// + /// + /// + private void SelfTest() + { + // loop through each card and command self test + + /*short testResults = -1; + + StringBuilder errorStrTemp = new StringBuilder(512); + + int ret = HssubNativeMethods.terHss_self_test(_chassisHandle, ref testResults, errorStrTemp); + + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _chassisLogicalName); + + throw new Exception("terHss_self_test returned an error(" + ret + ")" + ": " + errorStr); + } + else if (testResults != 0) + { + throw new Exception("HSSub Self Test returned an error: " + testResults.ToString() + ": " + errorStrTemp.ToString()); + }*/ + } + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + lock (_syncObj) + { + if (_state == State.Ready) + { + int ret = HssubNativeMethods.terHsi_close(_cardHandle); + + _state = State.Uninitialized; + } + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFuctions + + /// + /// CommFpgaHssubCardSsHsi factory constructor + /// + /// + /// + public CommFpgaHssubCardSsHsi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _cardAddress = _configuration.GetConfigurationValue("CommFpgaHssubCardSsHsi", "CardAddress", "127.0.0.1"); + _startingOffset = _configuration.GetConfigurationValue("CommFpgaHssubCardSsHsi", "StartingOffset", 0); + _cardFirmwareFile = _configuration.GetConfigurationValue("CommFpgaHssubCardSsHsi", "CardFirmwareFile", ""); + _cardHandle = 0; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + __mode = Mode.PRIMARY_CONTROL; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public CommFpgaHssubCardSsHsi(string name, string cardAddress, uint startingOffset, string cardFirmwareFile) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _cardAddress = cardAddress; + _startingOffset = startingOffset; + _cardFirmwareFile = cardFirmwareFile; + _cardHandle = 0; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + __mode = Mode.PRIMARY_CONTROL; + } + + /// + /// Overloaded constructor for a secondary hsi control. (Firmware load done elsewhere, device reset done elsewhere) + /// Using this constructor will allow the hsot access to the HSS, but it will not load firmware or reset the device + /// + /// + /// + /// + public CommFpgaHssubCardSsHsi(string name, string cardAddress, uint startingOffset) + { + _name = name; + _cardAddress = cardAddress; + _startingOffset = startingOffset; + _cardFirmwareFile = null; + _cardHandle = 0; + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + __mode = Mode.SECONDARY_CONTROL; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FPGA HSS HSI called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + // lock up the FPGA resource + lock (_syncObj) + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + Initialize(string.Empty); + } + + /// + /// + /// + /// + public void Initialize(string fpgaName) + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + int ret = HssubNativeMethods.terHsi_init(_cardAddress, 0, 0, ref _cardHandle); + + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(0, ret, _name); + + throw new Exception("terHsi_init returned an error(" + ret + ")" + ": " + errorStr + " on card " + _name + " on card " + _name); + } + + // reset it and load firmware if this is the primary controller of the HSS + if (__mode == Mode.PRIMARY_CONTROL) + { + Reset(); + + LoadFirmware(); + } + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + /// + /// + /// + /// + /// + /// + public uint Read(string fpgaName, uint address) + { + // lock up the FPGA resource + lock (_syncObj) + { + uint dataRead = 0; + int ret = HssubNativeMethods.terHsi_LB_Read32(_cardHandle, _startingOffset + address, ref dataRead); + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_LB_Read32() returned an error(" + ret + ")" + ": " + errorStr + " on card " + _name); + } + + return dataRead; + } + } + + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + // lock up the FPGA resource + lock (_syncObj) + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + int ret = HssubNativeMethods.terHsi_reset(_cardHandle); + + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_reset() returned an error(" + ret + ")" + ": " + errorStr + " on card " + _name); + } + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public void Shutdown() + { + // lock up the FPGA resource + lock (_syncObj) + { + string errorMsg = ""; + bool wasThereAnError = false; + + if (_state == State.Ready) + { + int ret = 0; + + // reset it if this is the primary controller of the HSS + if (__mode == Mode.PRIMARY_CONTROL) + { + ret = HssubNativeMethods.terHsi_reset(_cardHandle); + if (ret != 0) + { + wasThereAnError = true; + errorMsg += "terHsi_reset returned error code: " + ret.ToString() + ". "; + } + } + + ret = HssubNativeMethods.terHsi_close(_cardHandle); + if (ret != 0) + { + wasThereAnError = true; + errorMsg += "terHsi_close returned error code: " + ret.ToString(); + } + _state = State.Uninitialized; + + if (wasThereAnError == true) + { + throw new Exception(errorMsg); + } + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpgaName, uint address, uint value) + { + // lock up the FPGA resource + lock (_syncObj) + { + int ret = HssubNativeMethods.terHsi_LB_Write32(_cardHandle, _startingOffset + address, value); + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_LB_Write32() returned an error(" + ret + ")" + ": " + errorStr + " on card " + _name); + } + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + // lock up the FPGA resource + lock (_syncObj) + { + if (shallWeIncrementAddress == false) + { + throw new Exception("terHsi_LB_WriteBlock32() does not support shallWeIncrementAddress = false command on card " + _name); + } + else + { + int ret = HssubNativeMethods.terHsi_LB_WriteBlock32(_cardHandle, _startingOffset + address, numberOfWordsToWrite, data); + if (ret != 0) + { + string errorStr = HssUtilSs.BuildErrorString(_cardHandle, ret, _name); + + throw new Exception("terHsi_LB_WriteBlock32() returned an error(" + ret + ")" + ": " + errorStr + " on card " + _name); + } + } + } + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + LoadFirmware(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/CommFpgaHssubCardSsHsiFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/CommFpgaHssubCardSsHsiFactory.cs new file mode 100644 index 0000000..a599b62 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/CommFpgaHssubCardSsHsiFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaHssubCardSsHsiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaHssubCardSsHsiFactory")] + public class CommFpgaHssubCardSsHsiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaHssubCardSsHsiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaHssubCardSsHsiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaHssubCardSsHsi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaHssubCardSsHsi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/HssubCardSsHsi.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/HssubCardSsHsi.csproj new file mode 100644 index 0000000..0ca99af --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardSsHsi/HssubCardSsHsi.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FPGA.HssubCardSsHsi + FPGA HssubCardSsHsi implementation + FPGA HsSub Card SS HSI implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/CommFpgaHssubCardTs.cs b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/CommFpgaHssubCardTs.cs new file mode 100644 index 0000000..ee330ed --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/CommFpgaHssubCardTs.cs @@ -0,0 +1,441 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using FpgaMeasurementInstrumentsLib; +using NLog; +using Raytheon.Common; +using System; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// A class that implements the Teradyne HSS Test Station Card + /// + public class CommFpgaHssubCardTs : IFpgaComm + { + #region PrivateClassMembers + private string _name; + private readonly string _cardAddress; + private readonly int _startingOffset; + private readonly string _firmware; + private readonly uint _chassisHandle; + private readonly int _hssubAppSyncHandle; + private readonly int _hssubAppHandle; + private readonly string _memMap; + private SelfTestResult _selfTestResult; + private int _cardHandle; + + private int _latestLbAddress; + private int _latestLbData; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get => _name; set { _name = value; } } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status => State.Ready; + + #endregion + + #region PrivateFuctions + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + HssubNativeMethods.terHss_close(_chassisHandle); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public void Initialize() + { + int ret = HssubNativeMethods.terHss_Application_SendMessage(_chassisHandle, _hssubAppHandle, HssubNativeMethods.MESSAGE_CONTEXT_INIT_INSTRUMENT, _cardAddress.Length, Encoding.ASCII.GetBytes(_cardAddress), HssubNativeMethods.TERHSS_TIMEOUT_60SEC); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_SendMessage() returned an error(" + ret + ")" + ": " + errorStr); + } + + LoadFirmware(); + } + + /// + /// + /// + private void LoadFirmware() + { + // send the file to the subsystem + int ret = HssubNativeMethods.terHss_Subsystem_SendFile(_chassisHandle, _firmware, "c:\\temp\\FPGAFile.hsi", HssubNativeMethods.TERHSS_OPTION_ALLOW_OVERWRITE); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_SubSyste_SendFile() returned an error(" + ret + ")" + ": " + errorStr); + } + + // load the instrument + ret = HssubNativeMethods.terHss_Application_SendMessage(_chassisHandle, _hssubAppHandle, HssubNativeMethods.MESSAGE_CONTEXT_LOAD_INSTRUMENT, 4, BitConverter.GetBytes(_cardHandle), HssubNativeMethods.TERHSS_TIMEOUT_60SEC); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_SendMessage() returned an error(" + ret + ")" + ": " + errorStr); + } + + // wait for the callback event + HssUtilTs.WaitForSync(_chassisHandle, _hssubAppSyncHandle, _name); + + // delete the file + ret = HssubNativeMethods.terHss_Subsystem_DeleteFile(_chassisHandle, "c:\\temp\\FPGAFile.hsi", HssubNativeMethods.TERHSS_OPTION_NONE); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_SubSyste_DeleteFile() returned an error(" + ret + ")" + ": " + errorStr); + } + } + #endregion + + #region PublicFuctions + + /// + /// CommFpgaHssubCardTs factory constructor + /// + /// + /// + public CommFpgaHssubCardTs(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _cardAddress = _configuration.GetConfigurationValue("CommFpgaHssubCardTs", "CardAddress", "127.0.0.1"); + _startingOffset = _configuration.GetConfigurationValue("CommFpgaHssubCardTs", "StartingOffset", 0); + _firmware = _configuration.GetConfigurationValue("CommFpgaHssubCardTs", "Firmware", ""); + _chassisHandle = _configuration.GetConfigurationValue("CommFpgaHssubCardTs", "ChassisHandle", 0); + _hssubAppHandle = _configuration.GetConfigurationValue("CommFpgaHssubCardTs", "HssubAppHandle", 0); + _hssubAppSyncHandle = _configuration.GetConfigurationValue("CommFpgaHssubCardTs", "HssubAppSyncHandle", 0); + _memMap = _configuration.GetConfigurationValue("CommFpgaHssubCardTs", "MemMap", ""); + _cardHandle = 0; + + // this gets set by the HssubChassis when a LB Read callback arrives + _latestLbAddress = -1; + _latestLbData = -1; + + Initialize(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public CommFpgaHssubCardTs(string name, string cardAddress, int startingOffset, string firmware, uint chassisHandle, int hssubAppHandle, int hssubAppSyncHandle, string memMap) + { + // hold onto args + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _cardAddress = cardAddress; + _startingOffset = startingOffset; + _firmware = firmware; + _chassisHandle = chassisHandle; + _hssubAppHandle = hssubAppHandle; + _hssubAppSyncHandle = hssubAppSyncHandle; + _memMap = memMap; + + // this gets set by the HssubChassis in SetHandle() + _cardHandle = 0; + + // this gets set by the HssubChassis when a LB Read callback arrives + _latestLbAddress = -1; + _latestLbData = -1; + + Initialize(); + } + + /// + /// The finalizer. + /// + ~CommFpgaHssubCardTs() + { + Dispose(false); + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + public string GetMemMap() + { + return _memMap; + } + + /// + /// + /// + /// + public uint Read(string fpgaName, uint address) + { + // populate the structure + HssUtilTs.LocalBusParams lbParams; + lbParams.cardHandle = _cardHandle; + lbParams.address = (int)(_startingOffset + address); + lbParams.data = 0; + + // get the byte array + byte[] dataToSend = HssUtilTs.LocalBusParmsToByteArray(lbParams); + + // reset the callback data items + _latestLbAddress = -1; + _latestLbData = -1; + + // send the message + int ret = HssubNativeMethods.terHss_Application_SendMessage(_chassisHandle, _hssubAppHandle, HssubNativeMethods.MESSAGE_CONTEXT_LB_READ32, dataToSend.Length, dataToSend, HssubNativeMethods.TERHSS_TIMEOUT_10SEC); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_SendMessage() returned an error(" + ret + ")" + ": " + errorStr); + } + + // wait for the callback event + HssUtilTs.WaitForSync(_chassisHandle, _hssubAppSyncHandle, _name); + + // confirm the address is what we requested (Set in SetLocalBusReadData()) + if (_latestLbAddress != lbParams.address) + { + throw new Exception("Received address: " + _latestLbAddress.ToString("X8") + " Expected: " + lbParams.address.ToString("X8")); + } + + return (uint)_latestLbData; + } + + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + throw new Exception("Not Implemented"); + } + + /// + /// + /// + /// + public void SetHandle(int cardHandle) + { + // this gets set in + _cardHandle = cardHandle; + } + + /// + /// + /// + /// + /// + public void SetLocalBusRxData(int address, int data) + { + _latestLbAddress = address; + _latestLbData = data; + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpgaName, uint address, uint value) + { + + // populate the structure + HssUtilTs.LocalBusParams lbParams; + lbParams.cardHandle = _cardHandle; + lbParams.address = (int)(_startingOffset + address); + lbParams.data = (int)value; + + // get the byte array + byte[] dataToSend = HssUtilTs.LocalBusParmsToByteArray(lbParams); + + // reset the callback data items + _latestLbAddress = -1; + _latestLbData = -1; + + // send the message + int ret = HssubNativeMethods.terHss_Application_SendMessage(_chassisHandle, _hssubAppHandle, HssubNativeMethods.MESSAGE_CONTEXT_LB_WRITE32, dataToSend.Length, dataToSend, HssubNativeMethods.TERHSS_TIMEOUT_10SEC); + if (ret != 0) + { + string errorStr = HssUtilTs.BuildErrorString(_chassisHandle, ret, _name); + + throw new Exception("terHss_Application_SendMessage() returned an error(" + ret + ")" + ": " + errorStr); + } + + // wait for the callback event + HssUtilTs.WaitForSync(_chassisHandle, _hssubAppSyncHandle, _name); + + // confirm the address is what we requested (Set in SetLocalBusReadData()) + /*if (_latestLbAddress != lbParams.address) + { + throw new Exception("Received address: " + _latestLbAddress.ToString("X8") + " Expected: " + lbParams.address.ToString("X8")); + }*/ + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Initialize(string fpgaName) + { + Initialize(); + } + + /// + /// + /// + /// + public void LoadFirmware(string fpgaName) + { + LoadFirmware(); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + /// + /// + /// + public void Reset() + { + Shutdown(); + + Initialize(); + } + + /// + /// + /// + public void Shutdown() + { + Dispose(); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/CommFpgaHssubCardTsFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/CommFpgaHssubCardTsFactory.cs new file mode 100644 index 0000000..eee3ff5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/CommFpgaHssubCardTsFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaHssubCardTsFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaHssubCardTsFactory")] + public class CommFpgaHssubCardTsFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaHssubCardTsFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaHssubCardTsFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaHssubCardTs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaHssubCardTs(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/HssubCardTs.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/HssubCardTs.csproj new file mode 100644 index 0000000..b6a38e9 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/HssubCardTs/HssubCardTs.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FPGA.HssubCardTs + FPGA HssubCardTs implementation + FPGA Hssub Card Ts implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/CommFpgaPcNode2x.cs b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/CommFpgaPcNode2x.cs new file mode 100644 index 0000000..760405c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/CommFpgaPcNode2x.cs @@ -0,0 +1,576 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.IO.Ports; +using System.Threading; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A class the provides an interface for read/write to registers on an FPGA that implement PC Node communication + /// + public class CommFpgaPcNode2x : IFpgaComm, IDisposable + { + #region PrivateClassMembers + private SerialPort _serialPort; + private readonly uint _pcNodeAddress; + private byte[] _readBuf; + private static object _syncObj = new Object(); + private uint _delayBeforeReadMs; + private SelfTestResult _selfTestResult; + private State _state; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The Finalizer + /// + ~CommFpgaPcNode2x() + { + Dispose(false); + } + + /// + /// Builds a command in the PC node format + /// + /// The address to write to + /// The data to write + /// True is the command is to perform a read, false to perform a write + /// The formatted command + private byte[] BuildCommand(uint address, uint data, bool isForRead) + { + byte[] command = new byte[9]; + + byte type = 0; + + // 2 bit shift per the spec, regardless of its a read or write + address = address >> 2; + + if (isForRead == true) + { + type = 0xf1; + + // 2 bit shift per the spec for the read (this would be the PC node address) + data = data >> 2; + } + else + { + type = 0xf0; + } + + command[0] = type; + byte[] addressBytes = BitConverter.GetBytes(address); + Array.Copy(addressBytes, 0, command, 1, addressBytes.Length); + + byte[] dataBytes = BitConverter.GetBytes(data); + Array.Copy(dataBytes, 0, command, 5, dataBytes.Length); + + return command; + } + + /// + /// Reads the serial port until it is empty + /// + private void ClearBuffer() + { + lock (_syncObj) + { + bool isClearComplete = false; + + while (isClearComplete == false) + { + try + { + int numBytesRead = _serialPort.Read(_readBuf, 0, _readBuf.Length); + + if (numBytesRead < _readBuf.Length) + { + isClearComplete = true; + } + } + catch (Exception) + { + //expected if buffer is already cleared + isClearComplete = true; + } + } + } + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _serialPort.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// CommFpgaPcNode2x factory constructor + /// + /// + /// + public CommFpgaPcNode2x(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _pcNodeAddress = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "PCNodeAddress", 0); + + string comPortName = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "ComPortName", "COM1"); + int baudRate = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "BaudRate", 115200); + Parity parity = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "Parity", Parity.None); + int dataBits = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "DataBits", 8); + StopBits stopBits = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "StopBits", StopBits.None); + + _delayBeforeReadMs = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "DelayBeforeReadMs", 0); + _pcNodeAddress = _configuration.GetConfigurationValue("CommFpgaPcNode2x", "PcNodeAddress", 0); + + const int READ_BUF_SIZE = 100; + + try + { + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits) + { + ReadTimeout = 100 + }; + } + catch (Exception ex) + { + _logger.Error(ex); + + if (_serialPort.IsOpen == true) + { + _serialPort.Close(); + } + throw; + } + + _readBuf = new byte[READ_BUF_SIZE]; + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + + + /// + /// The constructor which opens up a serial port + /// + /// The address of the PC node + /// The port name. "Com1' for example + /// The num of ms to wait before a read + /// The baud rate + /// The parity + /// Number of data bits + /// Number of Stop Bits + public CommFpgaPcNode2x(string name, uint pcNodeAddress, string comPortName, uint delayBeforeReadMs, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One) + { + const int READ_BUF_SIZE = 100; + + try + { + _name = name; + + _logger = LogManager.GetCurrentClassLogger(); + + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); + + _serialPort.ReadTimeout = 100; + + _delayBeforeReadMs = delayBeforeReadMs; + + _pcNodeAddress = pcNodeAddress; + + _readBuf = new byte[READ_BUF_SIZE]; + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + catch (Exception) + { + if (_serialPort.IsOpen == true) + { + _serialPort.Close(); + } + + throw; + } + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a FPGA PC Node called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + Initialize(string.Empty); + } + + /// + /// + /// + /// + public void Initialize(string fpga) + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + if (_serialPort.IsOpen == false) + { + _serialPort.Open(); + } + + ClearBuffer(); + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + /// + /// + /// + /// + /// + /// + public uint Read(string fpga, uint address) + { + const int NUM_BYTES_EXPECTED_ON_READ = 9; + + int numBytesRead = 0; + + // lock up the FPGA resource + lock (_syncObj) + { + byte[] command = BuildCommand(address, _pcNodeAddress, true); + + for (uint numTries = 0; numTries < 2; numTries++) + { + _serialPort.Write(command, 0, command.Length); + + Array.Clear(_readBuf, 0, _readBuf.Length); + + Thread.Sleep((int)_delayBeforeReadMs); + + numBytesRead = _serialPort.Read(_readBuf, 0, _readBuf.Length); + + int numBytesExpectedToRead = NUM_BYTES_EXPECTED_ON_READ; + + if (numBytesRead != numBytesExpectedToRead) + { + //put out diagnostic + byte[] errorDiag = new byte[numBytesRead]; + + Array.Copy(_readBuf, errorDiag, numBytesRead); + + string errMessage = Util.ByteArrayToHexString(errorDiag); + + //ErrorLogger.Instance().Write("Read got wrong size. expected to read: " + numBytesExpectedToRead.ToString() + ", read: " + numBytesRead.ToString() + " The data received is: " + errMessage); + + if (numTries != 0) + { + //second time - not a good read + throw new Exception("expected to read: " + numBytesExpectedToRead.ToString() + ", read: " + numBytesRead.ToString()); + } + } + else + { + break;//continue processing + } + } + + // Grab the last 4 bytes + uint data = BitConverter.ToUInt32(_readBuf, numBytesRead - 4); + + return data; + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + // lock up the FPGA resource + lock (_syncObj) + { + throw new Exception("Not Implemented"); + } + } + + /// + /// + /// + public void Reset() + { + // lock up the FPGA resource + lock (_syncObj) + { + ClearBuffer(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public void Shutdown() + { + // lock up the FPGA resource + lock (_syncObj) + { + if (_state == State.Ready) + { + _serialPort.Dispose(); + + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpga, uint address, uint data) + { + byte[] command = BuildCommand(address, data, false); + + // lock up the FPGA resource + lock (_syncObj) + { + _serialPort.Write(command, 0, command.Length); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + // lock up the FPGA resource + lock (_syncObj) + { + throw new Exception("Not Implemented"); + } + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + Initialize(fpgaName); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/CommFpgaPcNode2xFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/CommFpgaPcNode2xFactory.cs new file mode 100644 index 0000000..ebfb0eb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/CommFpgaPcNode2xFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaPcNode2xFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaPcNode2xFactory")] + public class CommFpgaPcNode2xFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaPcNode2xFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaPcNode2xFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaPcNode2x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaPcNode2x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/PcNode2x.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/PcNode2x.csproj new file mode 100644 index 0000000..605dca3 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode2x/PcNode2x.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FPGA.PcNode2x + FPGA PcNode 2x implementation + FPGA PcNode 2x implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/CommFpgaPcNode3x.cs b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/CommFpgaPcNode3x.cs new file mode 100644 index 0000000..3831f2b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/CommFpgaPcNode3x.cs @@ -0,0 +1,653 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.IO.Ports; +using System.Threading; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A class the provides an interface for read/write to registers on an FPGA that implement PC Node communication + /// + public class CommFpgaPcNode3x : IFpgaComm, IDisposable + { + #region PrivateClassMembers + private string _name; + private SerialPort _serialPort; + private readonly uint _pcNodeAddress; + private byte[] _readBuf; + private static object _syncObj = new Object(); + private readonly bool _areUsingStartFrameDelim; + private readonly ushort _startFrameDelim; + private readonly uint _delayBeforeReadMs; + private SelfTestResult _selfTestResult; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + + /// + /// The Finalizer + /// + ~CommFpgaPcNode3x() + { + Dispose(false); + } + + /// + /// Builds a command in the PC node format + /// + /// The address to write to + /// The data to write + /// True is the command is to perform a read, false to perform a write + /// The formatted command + private byte[] BuildCommand(uint address, uint data, bool isForRead) + { + /* + 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Byte En | XGRID Data / Return Address | T | R | Upper 32 - Bit XGRID Address | R | R | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + Bit 35 T = TType(Transmission Type) 0 = Write 1 = Read + R = Reserved + */ + const ulong READ_OP_CODE_MASK = 0x800000000; + + // the data (PC NODE ADDRESS) is actually only 30 bits when reading + if (isForRead == true) + { + data = data >> 2; + } + + // The address is always 30 bits + address = address >> 2; + + // shift the data into place + ulong commandLow = data; + commandLow = commandLow << 34; + + // or in the address and put it in its place + commandLow = commandLow | address; + commandLow = commandLow << 2; + + // set the op code bit + if (isForRead == true) + { + commandLow = commandLow | READ_OP_CODE_MASK; + } + + // set the byte enables (All high by default) + byte commandHigh = 0xF0; + + // 4 high bits of data go to 4 low bits of commandHigh + data = data >> 28; + commandHigh = (byte)(commandHigh | data); + + // place bytes in correct order and return + byte[] commandLowBytes = BitConverter.GetBytes(commandLow); + + if (_areUsingStartFrameDelim == true) + { + byte[] finalCommand = new byte[11]; + + byte[] frameDelimBytes = BitConverter.GetBytes(_startFrameDelim); + + Array.Copy(frameDelimBytes, finalCommand, frameDelimBytes.Length); + + Array.Copy(commandLowBytes, 0, finalCommand, frameDelimBytes.Length, commandLowBytes.Length); + + finalCommand[10] = commandHigh; + + return finalCommand; + } + else + { + byte[] finalCommand = new byte[9]; + + Array.Copy(commandLowBytes, finalCommand, commandLowBytes.Length); + + finalCommand[8] = commandHigh; + + return finalCommand; + } + } + + + /// + /// Reads the serial port until it is empty + /// + private void ClearBuffer() + { + lock (_syncObj) + { + bool isClearComplete = false; + + while (isClearComplete == false) + { + try + { + int numBytesRead = _serialPort.Read(_readBuf, 0, _readBuf.Length); + + if (numBytesRead < _readBuf.Length) + { + isClearComplete = true; + } + } + catch (Exception) + { + //expected if buffer is already cleared + isClearComplete = true; + } + } + } + } + + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _serialPort.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// CommFpgaPcNode2x factory constructor + /// + /// + /// + public CommFpgaPcNode3x(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _pcNodeAddress = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "PCNodeAddress", 0); + + string comPortName = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "ComPortName", "COM1"); + int baudRate = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "BaudRate", 115200); + Parity parity = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "Parity", Parity.None); + int dataBits = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "DataBits", 8); + StopBits stopBits = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "StopBits", StopBits.None); + + _delayBeforeReadMs = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "DelayBeforeReadMs", 0); + _pcNodeAddress = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "PcNodeAddress", 0); + _startFrameDelim = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "StartFrameDelim", 0); + _areUsingStartFrameDelim = _configuration.GetConfigurationValue("CommFpgaPcNode3x", "AreUsingStartFrameDelim", false); + + const int READ_BUF_SIZE = 100; + + try + { + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits) + { + ReadTimeout = 100 + }; + } + catch (Exception ex) + { + _logger.Error(ex); + + if (_serialPort.IsOpen == true) + { + _serialPort.Close(); + } + throw; + } + + _readBuf = new byte[READ_BUF_SIZE]; + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + /// + /// The constructor which opens up a serial port + /// + /// The address of the PC node + /// The port name. "Com1' for example + /// The num of ms to wait before a read + /// 0 for no delim + /// The baud rate + /// The parity + /// Number of data bits + /// Number of Stop Bits + public CommFpgaPcNode3x(string name, uint pcNodeAddress, string comPortName, uint delayBeforeReadMs, ushort startFrameDelim, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One) + { + const int READ_BUF_SIZE = 100; + + try + { + _name = name; + + _logger = LogManager.GetCurrentClassLogger(); + + _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); + + _serialPort.ReadTimeout = 100; + + _delayBeforeReadMs = delayBeforeReadMs; + + _pcNodeAddress = pcNodeAddress; + + _readBuf = new byte[READ_BUF_SIZE]; + + _startFrameDelim = startFrameDelim; + + _areUsingStartFrameDelim = false; + + if (startFrameDelim != 0) + { + _areUsingStartFrameDelim = true; + } + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + } + catch (Exception) + { + if (_serialPort != null && _serialPort.IsOpen == true) + { + _serialPort.Close(); + } + + throw; + } + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a CommFpgaPcNode3x called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Initialize(string fpga) + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + if (_serialPort.IsOpen == false) + { + _serialPort.Open(); + } + + ClearBuffer(); + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Unknown; + return _selfTestResult; + } + + /// + /// + /// + /// + /// + /// + public uint Read(string fpga, uint address) + { + const int NUM_BYTES_EXPECTED_ON_READ = 9; + + /* + 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Byte En | XGRID Data / Return Address | T | R | Upper 32 - Bit XGRID Address | R | R | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + Bit 35 T = TType(Transmission Type) 0 = Write 1 = Read + R = Reserved + */ + int numBytesRead = 0; + + // lock up the FPGA resource + lock (_syncObj) + { + byte[] command = BuildCommand(address, _pcNodeAddress, true); + + for (uint numTries = 0; numTries < 2; numTries++) + { + _serialPort.Write(command, 0, command.Length); + + Array.Clear(_readBuf, 0, _readBuf.Length); + + Thread.Sleep((int)_delayBeforeReadMs); + + numBytesRead = _serialPort.Read(_readBuf, 0, _readBuf.Length); + + int numBytesExpectedToRead = NUM_BYTES_EXPECTED_ON_READ; + + if (_areUsingStartFrameDelim == true) + { + // plus 2 for the delim + numBytesExpectedToRead += 2; + } + + if (numBytesRead != numBytesExpectedToRead) + { + //put out diagnostic + byte[] errorDiag = new byte[numBytesRead]; + + Array.Copy(_readBuf, errorDiag, numBytesRead); + + string errMessage = Util.ByteArrayToHexString(errorDiag); + + //ErrorLogger.Instance().Write("Read got wrong size. expected to read: " + numBytesExpectedToRead.ToString() + ", read: " + numBytesRead.ToString() + " The data received is: " + errMessage); + + if (numTries != 0) + { + //second time - not a good read + throw new Exception("expected to read: " + numBytesExpectedToRead.ToString() + ", read: " + numBytesRead.ToString()); + } + } + else + { + break;//continue processing + } + } + + // Grab the last 5 bytes + ulong temp = BitConverter.ToUInt64(_readBuf, numBytesRead - 5); + + // ditch the first 4 bits + temp = temp >> 4; + + // clear out everything but the 4 bytes we want + temp = temp << 32; + temp = temp >> 32; + + // return the next 32 bits + uint finalData = (uint)temp; + + return finalData; + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + // lock up the FPGA resource + lock (_syncObj) + { + throw new Exception("Not Implemented"); + } + } + + /// + /// + /// + public void Reset() + { + // lock up the FPGA resource + lock (_syncObj) + { + ClearBuffer(); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + if (_state == State.Ready) + { + _serialPort.Dispose(); + _state = State.Uninitialized; + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + /// + /// + public void Write(string fpga, uint address, uint data) + { + byte[] command = BuildCommand(address, data, false); + + // lock up the FPGA resource + lock (_syncObj) + { + _serialPort.Write(command, 0, command.Length); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress) + { + // lock up the FPGA resource + lock (_syncObj) + { + throw new Exception("Not Implemented"); + } + } + + /// + /// Loads firmware + /// + /// + public void LoadFirmware(string fpgaName) + { + Initialize(fpgaName); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/CommFpgaPcNode3xFactory.cs b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/CommFpgaPcNode3xFactory.cs new file mode 100644 index 0000000..6870044 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/CommFpgaPcNode3xFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// CommFpgaPcNode3xFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "CommFpgaPcNode3xFactory")] + public class CommFpgaPcNode3xFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public CommFpgaPcNode3xFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public CommFpgaPcNode3xFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFpgaComm)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new CommFpgaPcNode3x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new CommFpgaSim(name, _configurationManager, _logger); + else + return new CommFpgaPcNode3x(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/PcNode3x.csproj b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/PcNode3x.csproj new file mode 100644 index 0000000..7a2cae2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FPGA/PcNode3x/PcNode3x.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FPGA.PcNode3x + FPGA PcNode 3x implementation + FPGA PcNode 3x implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20.cs b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20.cs new file mode 100644 index 0000000..780e009 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20.cs @@ -0,0 +1,287 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.IO.Ports; +using System.Net.Sockets; +using System.Threading; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Flow Meter class used to interact with flow meter. + /// It supports the Omega DPF20 when configured to slave mode (where data is pulled as opposed to pushed). + /// Set to slave mode on the front panel + /// + public class FlowMeterOmegaDPF20 : IFlowMeter + { + #region PublicMembers + public enum FlowMeterMode + { + MASTER, + SLAVE + }; + #endregion + #region PrivateMembers + + //Prevent Collisions + private static object _sync = new object(); + + //Ethernet Communication + private readonly string _ipAddr; + private readonly int _port; + private readonly byte _flowMeterAddress; + private readonly FlowMeterOmegaDPF20.FlowMeterMode _mode; + private const int _READ_BUFFER_SIZE = 1024; + private const int _READ_TIMEOUT = 5500; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + TcpClient _flowSocket; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name {get; set;} + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + #endregion + + #region PrivateFunctions + /// + /// Destructor + /// + ~FlowMeterOmegaDPF20() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources + /// + /// Currently disposing + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + //Close Connection (if available) + _tcpStream?.Close(); + _flowSocket?.Close(); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFunctions + + /// + /// FlowMeterOmegaDPF20 factory constructor + /// + /// + /// + public FlowMeterOmegaDPF20(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + + _ipAddr = _configuration.GetConfigurationValue("FlowMeterOmegaDPF20", "IpAddr", ""); + _port = _configuration.GetConfigurationValue("FlowMeterOmegaDPF20", "Port", 0); + + _readBuffer = new byte[_READ_BUFFER_SIZE]; + + //Create and open a socket to flow meter + _flowSocket = new TcpClient(_ipAddr, _port); + _tcpStream = _flowSocket.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + + /// + /// Constructor for the DPF20 flow meter. It makes a socket connection upon construction + /// + /// The name. Anything the hosts wants it to be + /// IP Address of the flow meter server + /// Port of the flow meter server + /// The address on the front display of the flow meter + /// The mode on the front display of the flow meter + public FlowMeterOmegaDPF20(string name, string ipAddress, int port, byte flowMeterAddress, FlowMeterOmegaDPF20.FlowMeterMode mode) + { + Name = name; + _logger = LogManager.GetCurrentClassLogger(); + + _ipAddr = ipAddress; + _port = port; + _flowMeterAddress = flowMeterAddress; + _mode = mode; + + //Initialize read buffer + _readBuffer = new byte[_READ_BUFFER_SIZE]; + + //Create and open a socket to flow meter + _flowSocket = new TcpClient(_ipAddr, _port); + _tcpStream = _flowSocket.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The address on the front display of the flow meter + /// The mode on the front display of the flow meter + public FlowMeterOmegaDPF20(string name, string comPortName, uint delayBeforeReadMs, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One, byte flowMeterAddress = 128, FlowMeterOmegaDPF20.FlowMeterMode mode = FlowMeterMode.SLAVE) + { + throw new NotImplementedException(); + } + + // This code added to correctly implement the disposable pattern. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + lock (_sync) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + } + } + + /// + /// Query the flow rate from the flow meter + /// + /// the flow rate. + public double ReadFlow() + { + lock (_sync) + { + if (_mode == FlowMeterMode.SLAVE) + { + byte[] cmd = FlowMeterOmegaDPF20DataParser.CreateReadFlowCmd(_flowMeterAddress); + + _tcpStream.Write(cmd, 0, cmd.Length); + + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + double flow = FlowMeterOmegaDPF20DataParser.ParseReadFlowRsp(_readBuffer, numBytesRead); + + return flow; + } + else if (_mode == FlowMeterMode.MASTER) + { + const int EXPECTED_DATA_LEN = 18; + + // ensure we have at least one full message + // need at least 35 bytes (worst case partial msg plus a full message) + int numBytesAvailable = _flowSocket.Available; + while (numBytesAvailable < (EXPECTED_DATA_LEN * 2) - 1) + { + Thread.Sleep(5); + numBytesAvailable = _flowSocket.Available; + } + + byte[] readBuf = new byte[numBytesAvailable]; + + int numBytesRead = _tcpStream.Read(readBuf, 0, readBuf.Length); + + double flow = FlowMeterOmegaDPF20DataParser.ParseMasterFlowMsg(readBuf, numBytesRead); + + return flow; + } + else + { + throw new Exception("unknown mode: " + _mode.ToString()); + } + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public void Shutdown() + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20.csproj b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20.csproj new file mode 100644 index 0000000..03d41ad --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FlowMeterOmegaDPF20 + Flow Meter Omega DPF20 implementation + Flow Meter Omega DPF20 implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20DataParser.cs b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20DataParser.cs new file mode 100644 index 0000000..7d8361a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20DataParser.cs @@ -0,0 +1,304 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using System.Text; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Parse and Format Util for the DPF2 flow meter serial interface + /// + internal static class FlowMeterOmegaDPF20DataParser + { + #region PublicMembers + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct HeaderStruct + { + public byte startOfFrame;//2 + public byte frameType;//32,33,35,36,37,38 + public byte reserved;//32 + public byte orginAddress;//32 + real value + public byte destinationAddress;//32 + real value + public byte registerLocation;//32 + real value + public byte reserved2;//32 + public byte dataLength;//num data bytes that follow + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ReadDisplayCmdStruct + { + public HeaderStruct header; + public FooterStruct footer; + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ReadDisplayRspStruct + { + public HeaderStruct header; + public byte byte1; + public byte byte2; + public byte byte3; + public byte byte4; + public byte byte5; + public byte byte6; + public byte byte7; + public byte byte8; + public FooterStruct footer; + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FooterStruct + { + public byte crc; + public byte endOfFrame;//3 + }; + + #endregion + + #region PublicFunctions + + /// + /// Calculate the CRC per the DPF20 manual + /// + /// The data to run the crc on + /// The number of bytes to use for the crc + /// + public static byte PerformCrc(byte[] data, int numBytesToProcess) + { + byte crc = 0; + + for (int i = 0; i < numBytesToProcess; i++) + { + crc = (byte)(crc ^ data[i]); + } + + if (crc < 32) + { + crc = (byte)~crc; + } + + return crc; + } + + /// + /// Creates the byte array for the read display command + /// + /// a byte array that is the command to send to the meter to read the display + public static byte[] CreateReadFlowCmd(byte flowMeterAddress) + { + // populate the header per the manual + HeaderStruct header = new HeaderStruct(); + header.startOfFrame = 2; + header.frameType = 36; + header.reserved = 32; + header.orginAddress = 32; + header.destinationAddress = (byte)(flowMeterAddress + 32); + header.registerLocation = 32; + header.reserved2 = 32; + header.dataLength = 32; + + // populate the footer + FooterStruct footer = new FooterStruct(); + footer.crc = 0;// set at end of function + footer.endOfFrame = 3; + + // create the message + ReadDisplayCmdStruct cmd = new ReadDisplayCmdStruct(); + cmd.header = header; + cmd.footer = footer; + + // allocate the final buffer + int messageSize = (int)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(ReadDisplayCmdStruct))); + byte[] buff = new byte[messageSize]; + + //Get a pointer to the Buffer + GCHandle pinnedArray = GCHandle.Alloc(buff, GCHandleType.Pinned); + + //Pinned pointer to array + IntPtr pData = pinnedArray.AddrOfPinnedObject(); + + //Place message into buffer + Marshal.StructureToPtr(cmd, pData, true); + + //Release array pointer + pinnedArray.Free(); + + // calculate and set crc + byte calculatedCrc = PerformCrc(buff, 8); + buff[8] = calculatedCrc; + + return buff; + } + + /// + /// Parse out the flow from the read display response + /// + /// + /// + /// + public static double ParseReadFlowRsp(byte[] data, int numBytes) + { + const int DISPLAY_REGISTER = 32; + const int DATA_OFFSET = 32; + const int EXPECTED_MSG_ID = 37; + const int EXPECTED_DATA_LEN = 18; + + if (numBytes < 18) + { + throw new Exception("Need at least " + EXPECTED_DATA_LEN + " to form the rsp message, received: " + numBytes); + } + + // get a pointer to the data + GCHandle messagePinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned); + IntPtr pMessageData = messagePinnedArray.AddrOfPinnedObject(); + + // populate the structure + ReadDisplayRspStruct msgStruct = (ReadDisplayRspStruct)Marshal.PtrToStructure(pMessageData, typeof(ReadDisplayRspStruct)); + + // free the ptr + messagePinnedArray.Free(); + + if (msgStruct.header.frameType != EXPECTED_MSG_ID) + { + throw new Exception("expected msg id: " + EXPECTED_MSG_ID + ", received: " + msgStruct.header.frameType); + } + + // subtract the DATA_OFFSET because that is what the manual says to do:) + int numDataBytes = msgStruct.header.dataLength - DATA_OFFSET; + + int headerSize = (int)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(HeaderStruct))); + + byte calculatedCrc = PerformCrc(data, numDataBytes + headerSize); + byte receivedCrc = msgStruct.footer.crc; + if (calculatedCrc != receivedCrc) + { + throw new Exception("calculated crc: " + calculatedCrc + ", is not equal to the received crc: " + receivedCrc); + } + + // confirm the from register + int fromRegister = msgStruct.header.registerLocation; + if (fromRegister != DISPLAY_REGISTER) + { + throw new Exception("from register: " + fromRegister + ", is not the expected register: " + DISPLAY_REGISTER); + } + + // get the data + byte[] dataPayload = new byte[numDataBytes]; + Array.Copy(data, headerSize, dataPayload, 0, numDataBytes); + + // convert it to a string + string rspStr = Encoding.ASCII.GetString(dataPayload); + + //Convert string value to double and return + return double.Parse(rspStr); + } + + /// + /// parse out flow from the master flow message (ID 35) + /// + /// the flow rate. + public static double ParseMasterFlowMsg(byte[] data, int numBytes) + { + const int DISPLAY_REGISTER = 32; + const int DATA_OFFSET = 32; + const int EXPECTED_MSG_ID = 35; + const int EXPECTED_DATA_LEN = 18; + + // start of message data pattern + byte[] startOfMesage = new byte[] { 2, 35 }; + + // data search index + int searchIndex = 0; + + // need at least 18 bytes + if (numBytes < EXPECTED_DATA_LEN) + { + throw new Exception("Need at least " + EXPECTED_DATA_LEN + " to form the rsp message, received: " + numBytes); + } + // if there are more than two messages, just need the end of the buffer + // worst case scenario for 1 complete message would be 35 bytes (17 from an incomplete message and then 18 for the complete one) + else if (numBytes >= (EXPECTED_DATA_LEN * 2) - 1) + { + searchIndex = numBytes - ((EXPECTED_DATA_LEN * 2) - 1); + } + + int finalMsgStartIndex = Util.ByteArraySearch(data, searchIndex, startOfMesage); + + if (finalMsgStartIndex == -1) + { + throw new Exception("Could not find start of message"); + } + else if((numBytes - finalMsgStartIndex) < EXPECTED_DATA_LEN) + { + throw new Exception("Found start of message, but not enough bytes for a complete message"); + } + + byte[] messagePayload = new byte[EXPECTED_DATA_LEN]; + Array.Copy(data, finalMsgStartIndex, messagePayload, 0, EXPECTED_DATA_LEN); + + // get a pointer to the data + GCHandle messagePinnedArray = GCHandle.Alloc(messagePayload, GCHandleType.Pinned); + IntPtr pMessageData = messagePinnedArray.AddrOfPinnedObject(); + + // populate the structure + HeaderStruct headerStruct = (HeaderStruct)Marshal.PtrToStructure(pMessageData, typeof(HeaderStruct)); + + // free the ptr + messagePinnedArray.Free(); + + if (headerStruct.frameType != EXPECTED_MSG_ID) + { + throw new Exception("expected msg id: " + EXPECTED_MSG_ID + ", received: " + headerStruct.frameType); + } + + // subtract the DATA_OFFSET because that is what the manual says to do:) + int numDataBytes = headerStruct.dataLength - DATA_OFFSET; + + int headerSize = (int)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(HeaderStruct))); + + // confirm the crc + byte calculatedCrc = PerformCrc(messagePayload, numDataBytes + headerSize); + byte receivedCrc = messagePayload[numDataBytes + headerSize]; + if (calculatedCrc != receivedCrc) + { + throw new Exception("calculated crc: " + calculatedCrc + ", is not equal to the received crc: " + receivedCrc); + } + + // confirm the from register + int fromRegister = headerStruct.registerLocation; + if (fromRegister != DISPLAY_REGISTER) + { + throw new Exception("from register: " + fromRegister + ", is not the expected register: " + DISPLAY_REGISTER); + } + + // get the data + byte[] dataPayload = new byte[numDataBytes]; + Array.Copy(messagePayload, headerSize, dataPayload, 0, numDataBytes); + + // convert to a string + string rspStr = Encoding.ASCII.GetString(dataPayload); + + //Convert string value to double and return + return double.Parse(rspStr); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20Factory.cs b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20Factory.cs new file mode 100644 index 0000000..fbb579a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaDPF20/FlowMeterOmegaDPF20Factory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// FlowMeterOmegaDPF20Factory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "FlowMeterOmegaDPF20Factory")] + public class FlowMeterOmegaDPF20Factory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public FlowMeterOmegaDPF20Factory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public FlowMeterOmegaDPF20Factory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFlowMeter)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new FlowMeterOmegaDPF20(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new FlowMeterSim(name, _configurationManager, _logger); + else + return new FlowMeterOmegaDPF20(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676.cs b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676.cs new file mode 100644 index 0000000..1486c68 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676.cs @@ -0,0 +1,378 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.IO.Ports; +using System.Net.Sockets; +using System.Text; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Flow Meter class used to interact with M1676 flow meter + /// + public class FlowMeterOmegaM1676 : IFlowMeter + { + #region PrivateMembers + //Commands + private const string _CARRIAGE_RTN = "\r"; + private const string _FLOW = "@U?V"; + private const string _GET_VERSION = "@U?SC"; + private const string _SET_CONFIG = "@U?SP2B"; + private const string _SET_DEC_POINT = "@U?SP2A0"; + private const string _SET_SCALE_1ST_BYTE = "@U?SP2F"; + private const string _SET_SCALE_2ND_BYTE = "@U?SP30"; + private const string _SET_SCALE_3RD_BYTE = "@U?SP31"; + + //Prevent Collisions + private static object _sync = new object(); + + //Ethernet Communication + private readonly string _ipAddr; + private readonly int _port; + private const int _READ_BUFFER_SIZE = 1024; + private const int _READ_TIMEOUT = 5000; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set;} + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + #endregion + + #region PrivateFunctions + /// + /// Destructor + /// + ~FlowMeterOmegaM1676() + { + Dispose(false); + } + + /// + /// Open socket to the flow meter + /// + private void ConnectEthernet() + { + //Create and open a socket to flow meter + TcpClient flowSocket = new TcpClient(_ipAddr, _port); + _tcpStream = flowSocket.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + + + /// + /// Turn off the alarm feature of the flow meter + /// + private void ConfigureAlarm() + { + lock (_sync) + { + //Turn off the Alarm in the response messages -> 000001 + SendMessageNoResponse(_SET_CONFIG + "01"); + } + } + + /// + /// Used to set the decimal place of the measurement and display: + /// 0 --> Auto Range + /// 1 --> FFFFFF. + /// 2 --> FFFFF.F + /// 3 --> FFFF.FF + /// 4 --> FFF.FFF + /// 5 --> FF.FFFF + /// 6 --> F.FFFFF + /// + /// Set the decimal place of the measurement. + private void ConfigureDecimalOutput(int option) + { + lock (_sync) + { + if (option < 0) + { + option = 0; + } + else if (option > 6) + { + option = 0; + } + + SendMessageNoResponse(_SET_DEC_POINT + option.ToString()); + } + } + + /// + /// Configure the scale factor to .002 (per CIL manual) + /// + private void ConfigureScaleFactor() + { + lock (_sync) + { + //Per manual .002 --> 0x400002 + //Send a byte at a time (0x40, 0x00, 0x02) + SendMessageNoResponse(_SET_SCALE_1ST_BYTE + "02"); + SendMessageNoResponse(_SET_SCALE_2ND_BYTE + "00"); + SendMessageNoResponse(_SET_SCALE_3RD_BYTE + "40"); + } + } + + /// + /// Dispose of this object's resources + /// + /// Currently disposing + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + //Close Connection (if available) + _tcpStream?.Close(); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Send a command to the flow meter and request a response + /// + /// Command to send. + /// Response from the flow meter. + private string SendMessageGetResponse(string cmd) + { + lock (_sync) + { + //Send the data + SendMessageNoResponse(cmd); + + //clear the buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + //read from the response buffer + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + //convert response to a string + string rspStr = Encoding.ASCII.GetString(_readBuffer); + + //Check Response + if (rspStr.Contains(_CARRIAGE_RTN)) + { + //Parse string ("/r") + char[] delimit = { '\r' }; + string[] parsed = rspStr.Split(delimit, StringSplitOptions.RemoveEmptyEntries); + + //Return parsed message + return parsed[0]; + } + else + { + throw new Exception("Command message not successful"); + } + } + } + + /// + /// Send a command to the flow meter + /// + /// The command to send + private void SendMessageNoResponse(string cmd) + { + lock (_sync) + { + //Format the command before sending + string commandString = cmd + _CARRIAGE_RTN; + + //convert to byte array for sending + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + //send the data + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + } + } + #endregion + + #region PublicFunctions + + /// + /// FlowMeterOmegaM1676 factory constructor + /// + /// + /// + public FlowMeterOmegaM1676(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + + _ipAddr = _configuration.GetConfigurationValue("FlowMeterOmegaM1676", "IpAddr", ""); + _port = _configuration.GetConfigurationValue("FlowMeterOmegaM1676", "Port", 0); + + _readBuffer = new byte[_READ_BUFFER_SIZE]; + //Connect to and configure device + ConnectEthernet(); + + //Configuration + ConfigureAlarm(); + ConfigureDecimalOutput(4); + ConfigureScaleFactor(); + } + + /// + /// Constructor for the M1676 flow meter. Forms a socket connection upon construction + /// + /// The name. Anything the host wants it to be + /// IP Address of the flow meter + /// Port of the flow meter + public FlowMeterOmegaM1676(string name, string ipAddress, int port) + { + Name = name; + _logger = LogManager.GetCurrentClassLogger(); + _ipAddr = ipAddress; + _port = port; + + //Initialize read buffer + _readBuffer = new byte[_READ_BUFFER_SIZE]; + + //Connect to and configure device + ConnectEthernet(); + + //Configuration + ConfigureAlarm(); + ConfigureDecimalOutput(4); + ConfigureScaleFactor(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public FlowMeterOmegaM1676(string name, string comPortName, uint delayBeforeReadMs, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One) + { + throw new NotImplementedException(); + } + + // This code added to correctly implement the disposable pattern. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + lock (_sync) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Query the flow rate from the flow meter + /// + /// the flow rate. + public double ReadFlow() + { + lock (_sync) + { + string rsp = SendMessageGetResponse(_FLOW); + + //Convert string value to double and return + return double.Parse(rsp); + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public void Shutdown() + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676.csproj b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676.csproj new file mode 100644 index 0000000..4a5aee5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.FlowMeterOmegaM1676 + FLow Meter Omega M1676 implementation + Flow Meter Omega M1676 implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676Factory.cs b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676Factory.cs new file mode 100644 index 0000000..abb2a9b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterOmegaM1676/FlowMeterOmegaM1676Factory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// FlowMeterOmegaM1676Factory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "FlowMeterOmegaM1676Factory")] + public class FlowMeterOmegaM1676Factory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public FlowMeterOmegaM1676Factory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public FlowMeterOmegaM1676Factory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFlowMeter)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new FlowMeterOmegaM1676(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new FlowMeterSim(name, _configurationManager, _logger); + else + return new FlowMeterOmegaM1676(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSim.cs b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSim.cs new file mode 100644 index 0000000..cd66585 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSim.cs @@ -0,0 +1,198 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Flow Meter Sim Class + /// + public class FlowMeterSim : IFlowMeter + { + #region PrivateMembers + private static object _sync = new object(); + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set; } + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + /// + /// Destructor + /// + ~FlowMeterSim() + { + Dispose(false); + } + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// Dispose of this object's resources + /// + /// Currently disposing + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFunctions + + /// + /// FlowMeterOmegaDPF20 factory constructor + /// + /// + /// + public FlowMeterSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + /// + /// + /// + /// + public FlowMeterSim(string name) + { + Name = name; + _logger = LogManager.GetCurrentClassLogger(); + } + + // This code added to correctly implement the disposable pattern. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + lock (_sync) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Query the flow rate from the flow meter + /// + /// the flow rate. + public double ReadFlow() + { + lock (_sync) + { + double max = 0.15; + + double min = .35; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(100); + + return dataToReturn; + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public void Shutdown() + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSim.csproj b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSim.csproj new file mode 100644 index 0000000..a915078 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSim.csproj @@ -0,0 +1,27 @@ + + + + + net472 + Raytheon.Instruments.FlowMeterSim + Flow Meter SIM implementation + Flow Meter SIM implementation + Library + + + + 1.0.0 + + + + NU1603 + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSimFactory.cs b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSimFactory.cs new file mode 100644 index 0000000..fb88774 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/FlowMeter/FlowMeterSim/FlowMeterSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// FlowMeterSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "FlowMeterSimFactory")] + public class FlowMeterSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public FlowMeterSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public FlowMeterSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IFlowMeter)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new FlowMeterSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new FlowMeterSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsole.cs b/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsole.cs new file mode 100644 index 0000000..9b7941b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsole.cs @@ -0,0 +1,347 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.Diagnostics; +using System.IO; + +namespace Raytheon.Instruments +{ + /// + /// + public class JtagConsole : IJtag + { + #region PrivateMembers + private string _name; + private static object _syncObj = new Object(); + private SelfTestResult _selfTestResult; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// Finalizer. + /// + ~JtagConsole() + { + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + private void GetDiagData(string bsxFilePath, string diag1File, string diag1CmdLine, string jobName, string diagFileName) + { + ProcessStartInfo startinfo = new ProcessStartInfo(diag1File, diag1CmdLine); + Process proc = Process.Start(startinfo); + proc.WaitForExit(); + int exitCode = proc.ExitCode; + + // failed to get diag data + if (exitCode != 0) + { + throw new Exception("Could not capture JTAG diag file. Job: " + jobName + ", Diag Name: " + diagFileName + ", please inspect the JTAG failure manually"); + } + + // copy over the output of diag output + string outputFileName = bsxFilePath + Util.GetTimeString() + diagFileName; + File.Copy(bsxFilePath + jobName + diagFileName, outputFileName); + } + + #endregion + + #region PublicFuctions + + /// + /// JtagConsole factory constructor + /// + /// + /// + public JtagConsole(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + public JtagConsole(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a JTAG Console called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + lock (_syncObj) + { + if (_state == State.Uninitialized) + { + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name= value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + lock (_syncObj) + { + _selfTestResult = SelfTestResult.Pass; + return _selfTestResult; + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// Perform a JTAG cob + /// + /// The jtag job information + /// + public int PerformJtagJob(JtagJobInfo measurement) + { + lock (_syncObj) + { + ProcessStartInfo startinfo = new ProcessStartInfo(measurement.bsxFilePath + measurement.bsxFile, measurement.bsxFileCommandline); + Process proc = Process.Start(startinfo); + proc.WaitForExit(); + int exitCode = proc.ExitCode; + + // test failed + if (exitCode != 0) + { + if (measurement.shallWeUseDiag1 == true) + { + GetDiagData(measurement.bsxFilePath, measurement.diag1File, measurement.diag1CmdLine, measurement.jobName, "_ttr.rtf"); + } + + if (measurement.shallWeUseDiag2 == true) + { + GetDiagData(measurement.bsxFilePath, measurement.diag2File, measurement.diag2CmdLine, measurement.jobName, ".dia"); + } + + return exitCode; + } + else + { + return exitCode; + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + lock (_syncObj) + { + _state = State.Uninitialized; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsole.csproj b/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsole.csproj new file mode 100644 index 0000000..d7f8a4c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsole.csproj @@ -0,0 +1,40 @@ + + + + + net472 + Raytheon.Instruments.JtagConsole + Jtag Console implementation + Jtag Console implementation + Library + + + + 1.0.0 + + + + NU1603 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsoleFactory.cs b/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsoleFactory.cs new file mode 100644 index 0000000..55ba914 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagConsole/JtagConsoleFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// JtagConsoleFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "JtagConsoleFactory")] + public class JtagConsoleFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public JtagConsoleFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public JtagConsoleFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IJtag)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new JtagConsole(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new JtagSim(name, _configurationManager, _logger); + else + return new JtagConsole(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSim.cs b/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSim.cs new file mode 100644 index 0000000..afc5594 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSim.cs @@ -0,0 +1,282 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// + public class JtagSim : IJtag + { + #region PrivateClassMembers + private string _name; + private SelfTestResult _selfTestResult; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + + #endregion + + #region PrivateClassFunctions + /// + /// The finalizer. + /// + ~JtagSim() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicClassFunctions + + /// + /// JtagSim factory constructor + /// + /// + /// + public JtagSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + + public JtagSim(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a JTAG Sim called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString() + " on card " + _name); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Pass; + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + /// + public int PerformJtagJob(JtagJobInfo jobInfo) + { + return 0; + } + + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + _state = State.Uninitialized; + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSim.csproj b/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSim.csproj new file mode 100644 index 0000000..b3c1817 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSim.csproj @@ -0,0 +1,26 @@ + + + + + net472 + Raytheon.Instruments.JtagSim + Jtag SIM implementation + Jtag SIM implementation + Library + + + + 1.0.0 + + + + NU1603 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSimFactory.cs b/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSimFactory.cs new file mode 100644 index 0000000..7ef1aca --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagSim/JtagSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// JtagSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "JtagSimFactory")] + public class JtagSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public JtagSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public JtagSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IJtag)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new JtagSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new JtagSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020A.cs b/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020A.cs new file mode 100644 index 0000000..3826ffd --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020A.cs @@ -0,0 +1,197 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// + public class JtagTeradyneEDigital6020A : IJtag + { + #region PrivateClassMembers + private string _logicalName; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get => _logicalName; set { _logicalName = value; } } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status => throw new NotImplementedException(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + /// + /// The finalizer. + /// + ~JtagTeradyneEDigital6020A() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicClassFunctions + + /// + /// JtagTeradyneEDigital6020A factory constructor + /// + /// + /// + public JtagTeradyneEDigital6020A(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + /// + /// + /// + /// + public JtagTeradyneEDigital6020A(string logicalName) + { + _logicalName = logicalName; + _logger = LogManager.GetCurrentClassLogger(); + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected. + } + } + } + + /// + /// + /// + /// + /// + public int PerformJtagJob(JtagJobInfo jobInfo) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public void Initialize() + { + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + return SelfTestResult.Unknown; + } + + /// + /// + /// + public void Reset() + { + Shutdown(); + + Initialize(); + } + + /// + /// + /// + public void Shutdown() + { + Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020A.csproj b/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020A.csproj new file mode 100644 index 0000000..593131e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020A.csproj @@ -0,0 +1,39 @@ + + + + + net472 + Raytheon.Instruments.JtagTeradyneEDigital6020A + Jtag Teradyne EDigital 6020A implementation + Jtag Teradyne EDigital 6020A implementation + Library + + + + 1.0.0 + + + + NU1603 + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020AFactory.cs b/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020AFactory.cs new file mode 100644 index 0000000..c9e78fc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/JTAG/JtagTeradyneEDigital6020A/JtagTeradyneEDigital6020AFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// JtagTeradyneEDigital6020AFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "JtagTeradyneEDigital6020AFactory")] + public class JtagTeradyneEDigital6020AFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public JtagTeradyneEDigital6020AFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public JtagTeradyneEDigital6020AFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IJtag)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new JtagTeradyneEDigital6020A(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new JtagSim(name, _configurationManager, _logger); + else + return new JtagTeradyneEDigital6020A(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/ChamberException.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/ChamberException.cs new file mode 100644 index 0000000..66b5761 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/ChamberException.cs @@ -0,0 +1,53 @@ +// ********************************************************************************************************** +// ChamberException.cs +// 1/8/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Instruments.Lib +{ + public class ChamberException : Exception + { + public ChamberException() + { + } + + public ChamberException(string message) + : base(message) + { + } + + public ChamberException(string message, Exception inner) + : base(message, inner) + { + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/Constants.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/Constants.cs new file mode 100644 index 0000000..3525ee1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/Constants.cs @@ -0,0 +1,101 @@ +// ********************************************************************************************************** +// Constants.cs +// 6/8/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +namespace Raytheon.Instruments.Lib +{ + public static class Constants + { + // LSPS (ATK) Constants + public const int LSPS_AUTOFILL_STATE_OFF = 0; + public const int LSPS_AUTOFILL_STATE_COOLING = 1; + public const int LSPS_AUTOFILL_STATE_WARMING = 2; + public const int LSPS_BB_CSTATE_LN2_COOLING = 0; + public const int LSPS_BB_CSTATE_CONTROLLING = 1; + public const int LSPS_BB_CSTATE_NOT_CONTROLLING = 2; + public const int LSPS_CHOPPER_STATE_OFF = 10; + public const int LSPS_CHOPPER_STATE_ON = 11; + public const int LSPS_CHOPPER_STATE_MOVING = 12; + public const int LSPS_CHOPPER_STATE_STOP_OPEN = 13; + public const int LSPS_CHOPPER_STATE_STOP_CLOSED = 14; + public const int LSPS_CHOPPER_STATE_FIND_ERROR = 15; + public const int LSPS_CHOPPER_STATE_MOVE_ERROR = 16; + public const int LSPS_CHOPPER_STATE_CHANGE_DIR = 17; + public const int LSPS_CHOPPER_STATE_CHANGE_SPEED = 18; + public const int LSPS_CHOPPER_STATE_LOOKING_FOR_STOP_OPEN = 19; + public const int LSPS_CHOPPER_STATE_LOOKING_FOR_STOP_CLOSED = 20; + public const int LSPS_GALIL_WSTATUS_NEEDS_HOME = 0; + public const int LSPS_GALIL_WSTATUS_HOMING = 1; + public const int LSPS_GALIL_WSTATUS_MOVING = 2; + public const int LSPS_GALIL_WSTATUS_HOME_SWITCH_ERR = 3; + public const int LSPS_GALIL_WSTATUS_POS_SWITCH_ERR = 4; + public const int LSPS_GALIL_WSTATUS_FIND_POS_ERR = 5; + public const int LSPS_GALIL_WSTATUS_FIND_HOME_ERR = 6; + public const int LSPS_GALIL_WSTATUS_IN_POSITION = 7; + public const int LSPS_GALIL_WSTATUS_TIMEOUT = 8; + public const int LSPS_GALIL_SM_STATUS_LIMIT_SWITCH_ERR = -3; + public const int LSPS_GALIL_SM_STATUS_NEEDS_HOME = -2; + public const int LSPS_GALIL_SM_STATUS_MOVING = -1; + public const int LSPS_GALIL_SM_STATUS_IN_POSITION = 0; + public const int LSPS_GALIL_SM_STATUS_VELOCITY = 1; + public const int LSPS_GALIL_SM_CSTATUS_BEGINNING_OF_ROUTINE = -1; + public const int LSPS_GALIL_SM_CSTATUS_COMPLETED_ROUTINE = 1; + public const int LSPS_GALIL_SM_PSTATUS_PROFILE_ITT_ERR = -1; + public const int LSPS_GALIL_SM_PSTATUS_NO_PROFILE_LOADED = 0; + public const int LSPS_GALIL_SM_PSTATUS_LOADING_PROFILE = 1; + public const int LSPS_GALIL_SM_PSTATUS_FINISHED_LOADING_PROFILE = 2; + public const int LSPS_GALIL_SM_PSTATUS_MOVING_TO_START = 3; + public const int LSPS_GALIL_SM_PSTATUS_FINISHED_MOVING_TO_START = 4; + public const int LSPS_GALIL_SM_PSTATUS_RUNNING_PROFILE = 5; + public const int LSPS_NEEDS_HOME = 0; + public const int LSPS_TW_POS_HOME = 1; + public const int LSPS_TW_STATUS_HOMING = 1; + public const int LSPS_TW_STATUS_MOVING = 2; + public const int LSPS_TW_STATUS_HOME_SWITCH_ERR = 3; + public const int LSPS_TW_STATUS_POS_SWITCH_ERR = 4; + public const int LSPS_TW_STATUS_FIND_POS_ERR = 5; + public const int LSPS_TW_STATUS_FIND_HOME_ERR = 6; + public const int LSPS_TW_STATUS_IN_POSITION = 7; + public const int LSPS_FW_POS_MOVING = -1; + public const int LSPS_FW_POS_NEEDS_HOME = -2; + public const int LSPS_FW_POS_LIMIT_SW_ERR = -3; + public const int LSPS_FW_POS_HOME = 1; + public const int LSPS_FW_STATUS_HOMING = 1; + public const int LSPS_FW_STATUS_MOVING = 2; + public const int LSPS_FW_STATUS_HOME_SW_ERR = 3; + public const int LSPS_FW_STATUS_POS_SW_ERR = 4; + public const int LSPS_FW_STATUS_FIND_POS_ERR = 5; + public const int LSPS_FW_STATUS_FIND_HOME_ERR = 6; + public const int LSPS_FW_STATUS_IN_POSITION = 7; + public const int LSPS_FW_STATUS_TIMEOUT = 8; + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/TcpClientSock.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/TcpClientSock.cs new file mode 100644 index 0000000..74ecc31 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Lib/TcpClientSock.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + /// + /// Class for TCP client communication + /// + internal class TcpClientSock + { + private Socket sock_; + private string remoteAddress_; + private int remotePort_; + IPEndPoint remoteEP_; + IPAddress ipAddress_ = null; + private static object _syncObj = new object(); + + /// + /// Constructor + /// + /// + /// + public TcpClientSock(string remoteAddress, int remotePort) + { + remoteAddress_ = remoteAddress; + remotePort_ = remotePort; + + // if remoteAddress is a hostname + if (!IPAddress.TryParse(remoteAddress_, out ipAddress_)) + { + string preferredSubnet = ""; + + IPHostEntry host = Dns.GetHostEntry(remoteAddress_); + foreach (IPAddress ip in host.AddressList) + { + AddressFamily af = ip.AddressFamily; + if (af == AddressFamily.InterNetwork) + { + if (preferredSubnet != String.Empty) + { + if (Regex.IsMatch(ip.ToString(), preferredSubnet, RegexOptions.IgnoreCase)) + ipAddress_ = ip; + } + else + ipAddress_ = ip; + + if (ipAddress_ != null) + break; + } + } + } + + if (ipAddress_ != null) + { + remoteEP_ = new IPEndPoint(ipAddress_, remotePort_); + } + else + throw new Exception("Unable to connect to " + remoteAddress_); + + sock_ = new Socket(ipAddress_.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + } + + /// + /// Connect to remote host + /// + /// + public void Connect() + { + lock (_syncObj) + { + try + { + if (!sock_.Connected && IsRemoteHostAlive()) + sock_.Connect(remoteEP_); + } + catch (ObjectDisposedException) + { + sock_ = new Socket(ipAddress_.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + if (IsRemoteHostAlive()) + sock_.Connect(remoteEP_); + } + catch (Exception) { throw; } + } + } + + /// + /// Disconnect from remote host + /// + /// + public void Disconnect() + { + lock (_syncObj) + { + if (sock_.Connected) + { + sock_.Shutdown(SocketShutdown.Both); + sock_.Disconnect(true); + sock_.Close(); + } + } + } + + /// + /// Ping if remote host is alive + /// + /// true/false + bool IsRemoteHostAlive() + { + bool isRemoteHostAlive = true; + + //Do a ping test to see if the server is reachable + try + { + Ping pingTest = new Ping(); + PingReply reply = pingTest.Send(ipAddress_); + if (reply.Status != IPStatus.Success) + isRemoteHostAlive = false; + } + catch (PingException) + { + isRemoteHostAlive = false; + } + + //See if the tcp state is ok + if (sock_.Poll(5000, SelectMode.SelectRead) && (sock_.Available == 0)) + { + isRemoteHostAlive = false; + } + + return isRemoteHostAlive; + } + + /// + /// Send Command and Get Response + /// + /// + /// + /// + /// response in ASCII format + public string SendCommandAndGetResponse(string command, int responseTimeOutMs = 5000, int responseBufSize = 1024) + { + byte[] bytes = new byte[responseBufSize]; + sock_.ReceiveTimeout = responseTimeOutMs; + + int bytesRec = 0; + + byte[] msg = Encoding.ASCII.GetBytes(command); + + lock (_syncObj) + { + sock_.Send(msg); + + try + { + bytesRec = sock_.Receive(bytes); + } + catch (SocketException ex) + { + throw new Exception("SocketException Error Code: " + ex.ErrorCode + $" ({((SocketError)ex.ErrorCode).ToString()})"); + } + } + + return Encoding.ASCII.GetString(bytes, 0, bytesRec); + } + + /// + /// Read data from the device. + /// + /// + /// + /// The number of bytes read + public int Read(ref byte[] dataBuf, int responseTimeOutMs = 5000) + { + int bytesRec = 0; + sock_.ReceiveTimeout = responseTimeOutMs; + lock (_syncObj) + { + try + { + bytesRec = sock_.Receive(dataBuf); + } + catch (SocketException) + { + bytesRec = 0; + } + } + + return bytesRec; + } + + /// + /// Write data to device. + /// + /// + /// The number of bytes written + public int Write(byte[] dataBuf) + { + int bytesWritten = 0; + lock (_syncObj) + { + try + { + bytesWritten = sock_.Send(dataBuf); + } + catch (SocketException) + { + bytesWritten = 0; + } + } + + return bytesWritten; + } + + /// + /// Write data to device. + /// + /// + /// The number of bytes written + public int Write(string data) + { + int bytesWritten = 0; + byte[] msg = Encoding.ASCII.GetBytes(data); + + lock (_syncObj) + { + try + { + bytesWritten = sock_.Send(msg); + } + catch (SocketException) + { + bytesWritten = 0; + } + } + + return bytesWritten; + } + + /// + /// Clear Hardware Receiver Buffer of residual data + /// + /// none + public void ClearReceiveBuffer() + { + byte[] bytes = new byte[1024]; + sock_.ReceiveTimeout = 100; + + int bytesRec = 0; + + lock (_syncObj) + { + do + { + try + { + bytesRec = sock_.Receive(bytes); + } + catch (SocketException) + { + bytesRec = 0; + } + } while (bytesRec > 0); + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LpspChamberFactory.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LpspChamberFactory.cs new file mode 100644 index 0000000..6f2fd76 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LpspChamberFactory.cs @@ -0,0 +1,137 @@ +// ********************************************************************************************************** +// LSPSMotionFactory.cs +// 1/8/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "LspsChamberFactory")] + public class LpspChamberFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private static ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public LpspChamberFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public LpspChamberFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + _logger = LogManager.GetCurrentClassLogger(); + + if (NLog.LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ILspsChamber)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new LspsChamber(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new LspsChamber(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsChamber.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsChamber.cs new file mode 100644 index 0000000..ea216f6 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsChamber.cs @@ -0,0 +1,1051 @@ +// ********************************************************************************************************** +// LSPSMotion.cs +// 1/8/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using Raytheon.Instruments.Lib; +using Raytheon.Instruments.LSPS; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text.RegularExpressions; + +namespace Raytheon.Instruments +{ + /// + /// Low-Background Scanning Point Source instrument + /// + public class LspsChamber : ILspsChamber + { + public enum UutType + { + SENSOR_SELF_TEST_BOX = 0, + SENSOR = 1, + SENSOR_W_IMU = 2, + IMU = 3, + SEEKER_SELF_TEST_BOX = 4, + SEEKER = 5, + NOTCONNECTED + }; + + public enum FilterWheelPos + { + NEEDS_HOME = 0, + HOMING = 1, + MOVING = 2, + HOME_SWITCH_ERROR = 3, + POSITION_SWITCH_ERROR = 4, + FIND_POSITION_ERROR = 5, + IN_POSITION = 6 + }; + + public enum Events + { + QUIT, + SCRIPT_ABORT, + NUM_EVENTS + }; + + public enum StartEvents + { + START, + QUIT_THREAD, + NUM_EVENTS + }; + + public enum TargetSize + { + BIG_TARGET = 7, + SMALL_TARGET = 6 + }; + + /// + /// NLog logger + /// + private static ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + private List _profiles = new List(); + private int _profileSteps = 0; + private int _currentProfileStep = 0; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set; } + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + private LSPS.TcpClientSock _tcpClientSock; + + private readonly int SendCommandResponseTimeoutMs; // ms + private readonly int SleepDelayBeforeMonitoringMs; // ms + + private string lspsAddress_; + private int lspsPort_; + + private static Dictionary commandToStopwatchDict = new Dictionary(); + + public bool ClearErrors() => false; + public SelfTestResult PerformSelfTest() => throw new NotImplementedException(); + + /// + /// Initialize the device + /// + public void Initialize() + { + _logger?.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + _tcpClientSock = new LSPS.TcpClientSock(lspsAddress_, lspsPort_); + _tcpClientSock.Connect(); + _tcpClientSock.ClearReceiveBuffer(); + } + + /// + /// Shuts down the device + /// + public void Shutdown() + { + _logger?.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + _tcpClientSock.Disconnect(); + } + + public void Reset() + { + _logger?.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + Shutdown(); + Initialize(); + } + + /// + /// LSPS factory constructor + /// + /// + /// + public LspsChamber(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + SendCommandResponseTimeoutMs = _configuration.GetConfigurationValue("LSPSMotion", "SendCommandResponseTimeoutMs", 5000); + SleepDelayBeforeMonitoringMs = _configuration.GetConfigurationValue("LSPSMotion", "SleepDelayBeforeMonitoringMs", 2000); + + lspsAddress_ = _configuration.GetConfigurationValue("LSPS_Controller", "address", "127.0.0.1"); + lspsPort_ = _configuration.GetConfigurationValue("LSPS_Controller", "port", 2300); + } + + #region Autofill Functions + /// + /// Autofill Cool Down command + /// + public void AutoFillCoolDown() + { + string command = LSPS.Autofill.GetFullCommand(LSPS.Autofill.Command.COOLDOWN); + + SendCommandAndGetResponse(command); + } + + /// + /// Autofill Warm Up command + /// + public void AutoFillWarmUp() + { + string command = LSPS.Autofill.GetFullCommand(LSPS.Autofill.Command.WARMUP); + + SendCommandAndGetResponse(command); + } + + /// + /// Autofill Fill Force command + /// + public void AutoFillForce() + { + string command = LSPS.Autofill.GetFullCommand(LSPS.Autofill.Command.FORCE); + + SendCommandAndGetResponse(command); + } + + /// + /// Autofill Turn off command + /// + public void AutoFillTurnOff() + { + string command = LSPS.Autofill.GetFullCommand(LSPS.Autofill.Command.TURN_OFF); + + SendCommandAndGetResponse(command); + } + + public LSPS.AutoFillState GetAutoFillState() + { + int state = 0; + + string command = LSPS.Autofill.GetFullCommand(LSPS.Autofill.Command.GET_STATE); + + string response = SendCommandAndGetResponse(command); + string[] stringArray = response.Split(' '); + Int32.TryParse(stringArray[0], out state); + return (LSPS.AutoFillState)state; + } + + public double GetTimeToFill() + { + double ttf = 0.0; + + string command = LSPS.Autofill.GetFullCommand(LSPS.Autofill.Command.GET_TIME_TO_FILL); + + Double.TryParse(SendCommandAndGetResponse(command), out ttf); + return ttf; + } + #endregion Autofill Functions + + #region NIF Functions + + /// + /// closes gate valve + /// + public void CloseLspsGateValve() + { + string command = LSPS.NIF.GetFullCommand(LSPS.NIF.Command.CLOSE_UUT_GV); + + SendCommandAndGetResponse(command); + } + + /// + /// opens gate valve + /// + public void OpenLspsGateValve() + { + string command = LSPS.NIF.GetFullCommand(LSPS.NIF.Command.OPEN_UUT_GV); + + SendCommandAndGetResponse(command); + } + + /// + /// Get UUT Gate Valve Position + /// + public GateValvePosition GetLspsGateValvePosition() + { + GateValvePosition pos = GateValvePosition.OPEN; + int val = 0; + string command = $"{LSPS.NIF.GetFullCommand(LSPS.NIF.Command.GET_INPUT_INDEX)} INDEX={(int)LSPS.NIF.InputIndex.UUT_GV_CLOSE}"; + string response = SendCommandAndGetResponse(command); + string[] stringArray = response.Split(','); + Int32.TryParse(stringArray[0], out val); + + if (val == 1) + pos = GateValvePosition.CLOSE; + + return pos; + + } + + /// + /// Get Input Index + /// + public int GetInputIndex(int inputIndex) + { + int val = 0; + string command = $"{LSPS.NIF.GetFullCommand(LSPS.NIF.Command.GET_INPUT_INDEX)} INDEX={inputIndex}"; + string response = SendCommandAndGetResponse(command); + string[] stringArray = response.Split(','); + Int32.TryParse(stringArray[0], out val); + return val; + } + + public double GetTemperature(LSPS.TemperatureIndex tempIndex) + { + double val = 0; + string command = $"{LSPS.NIF.GetFullCommand(LSPS.NIF.Command.GET_TEMP_INDEX)} INDEX={(int)tempIndex}"; + string response = SendCommandAndGetResponse(command); + string[] stringArray = response.Split(','); + Double.TryParse(stringArray[0], out val); + + return val; + } + #endregion + + #region RIO Functions + + /// + /// closes gate valve + /// + public void CloseVhfGateValve() + { + string command = LSPS.RIO.GetFullCommand(LSPS.RIO.Command.GV_CLOSE); + + SendCommandAndGetResponse(command); + } + + /// + /// opens gate valve + /// + public void OpenVhfGateValve() + { + string command = LSPS.RIO.GetFullCommand(LSPS.RIO.Command.GV_OPEN); + + SendCommandAndGetResponse(command); + } + + /// + /// Get Gate Valve Chamber Pressure + /// + public double GetVhfGateValveChamberPressure() + { + string command = LSPS.RIO.GetFullCommand(LSPS.RIO.Command.GET_GV_CHAMBER_PRESSURE); + + string response = SendCommandAndGetResponse(command); + double val = 0.0; + Double.TryParse(response, out val); + + return val; + } + + /// + /// Get Gate Valve UUT Pressure + /// + public double GetVhfGateValveUutPressure() + { + string command = LSPS.RIO.GetFullCommand(LSPS.RIO.Command.GET_GV_CANISTER_PRESSURE); + + string response = SendCommandAndGetResponse(command); + double val = 0.0; + Double.TryParse(response, out val); + + return val; + } + + /// + /// Get VHF Gate Valve Closed Input + /// + public int GetVhfGateValveClosedInput() + { + string command = LSPS.RIO.GetFullCommand(LSPS.RIO.Command.GET_GV_CLOSED_INPUT); + + string response = SendCommandAndGetResponse(command); + int val = 0; + Int32.TryParse(response, out val); + + return val; + } + + /// + /// Get VHF Gate Valve Open Input + /// + public int GetVhfGateValveOpenInput() + { + string command = LSPS.RIO.GetFullCommand(LSPS.RIO.Command.GET_GV_OPEN_INPUT); + + string response = SendCommandAndGetResponse(command); + int val = 0; + Int32.TryParse(response, out val); + + return val; + } + #endregion + + #region Chamber Vacuum Functions + /// + /// Get Chamber Pressure (CVAC) + /// + public double GetLspsChamberPressure() + { + string command = LSPS.ChamberVacuum.GetFullCommand(LSPS.ChamberVacuum.Command.GET_CVAC); + + string response = SendCommandAndGetResponse(command); + double val = 0.0; + Double.TryParse(response, out val); + + return val; + } + + /// + /// Get Sensor Pressure (SVAC) + /// + public double GetLspsUutPressure() + { + string command = LSPS.ChamberVacuum.GetFullCommand(LSPS.ChamberVacuum.Command.GET_SVAC); + + string response = SendCommandAndGetResponse(command); + double val = 0.0; + Double.TryParse(response, out val); + + return val; + } + #endregion + + #region GALIL Functions + /// + /// home filter wheel + /// + public void FilterWheelHome() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.FW_HOME); + + SendCommandAndGetResponse(command); + } + + /// + /// sets filter wheel position + /// + /// + public void SetFilterWheelPosition(int position) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.FW_SET_POS)} POS={position}"; + + SendCommandAndGetResponse(command); + } + + /// + /// Get filter wheel position + /// + public int GetFilterWheelPosition() + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.FW_GET_POS)}"; + + string response = SendCommandAndGetResponse(command); + int val = 0; + Int32.TryParse(response, out val); + return val; + } + + /// + /// get filter wheel status + /// + public LSPS.TargetAndFilterWheelStatus GetFilterWheelStatus() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.FW_GET_STATUS); + + string response = SendCommandAndGetResponse(command); + + int val = 0; + Int32.TryParse(response, out val); + + return (LSPS.TargetAndFilterWheelStatus)val; + } + + /// + /// home filter wheel + /// + public void TargetWheelHome() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.TW_HOME); + + SendCommandAndGetResponse(command); + } + + /// + /// Sets target wheel position + /// + /// + public void SetTargetWheelPosition(int position) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.TW_SET_POS)} POS={(int)position}"; + + SendCommandAndGetResponse(command); + } + + /// + /// Get target wheel position + /// + public int GetTargetWheelPosition() + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.TW_GET_POS)}"; + + string response = SendCommandAndGetResponse(command); + int val = 0; + Int32.TryParse(response, out val); + return val; + } + + /// + /// get target wheel status + /// + public LSPS.TargetAndFilterWheelStatus GetTargetWheelStatus() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.TW_GET_STATUS); + + string response = SendCommandAndGetResponse(command); + + int val = 0; + Int32.TryParse(response, out val); + + return (LSPS.TargetAndFilterWheelStatus)val; + } + + /// + /// steering mirror home + /// + public void SteeringMirrorHome() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_HOME); + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror stop + /// + public void SteeringMirrorStop() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_STOP); + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror move + /// + public void SteeringMirrorMove(double az, double el, double speed) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_SET_BEAM_ANGLES)} AZ={az} EL={el} SPEED={speed}"; + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror get beam angles + /// + public Tuple SteeringMirrorGetBeamAngles() + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_GET_BEAM_ANGLES)}"; + + string response = SendCommandAndGetResponse(command); + string[] stringArray = response.Split(','); + double az = 0.0; + double el = 0.0; + Double.TryParse(stringArray[0], out az); + Double.TryParse(stringArray[1], out el); + + return new Tuple(az, el); + } + + /// + /// steering mirror set beam speed + /// + public void SteeringMirrorSetBeamSpeed(double speed) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_SET_BEAM_SPEED)} SPEED={speed}"; + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror set right left arrow angle + /// + public void SteeringMirrorSetRightLeftArrowAngle(double angle) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_SET_RIGHT_LEFT_ARROW_ANGLE)} ANGLE={angle}"; + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror set up down arrow angle + /// + public void SteeringMirrorSetUpDownArrowAngle(double angle) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_SET_UP_DOWN_ARROW_ANGLE)} ANGLE={angle}"; + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror status + /// + public Tuple GetSteeringMirrorStatus() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_GET_AZ_STATUS); + + string response = SendCommandAndGetResponse(command); + + int az = 0; + int el = 0; + Int32.TryParse(response, out az); + + command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_GET_EL_STATUS); + + response = SendCommandAndGetResponse(command); + Int32.TryParse(response, out el); + + return new Tuple((LSPS.SteeringMirrorStatus)az, (LSPS.SteeringMirrorStatus)el); + } + + /// + /// steering mirror load profile from file + /// + public void SteeringMirrorLoadProfileFromFile(string profileFilePath) + { + try + { + using (var fileStream = new FileStream(profileFilePath, FileMode.Open, FileAccess.Read)) + using (var streamReader = new StreamReader(fileStream)) + { + string line; + while ((line = streamReader.ReadLine()) != null) + { + Match regexMatch; + regexMatch = Regex.Match(line, @"^[\s]*([\d-\.]+)[\s]*,[\s]*([\d-\.]+)[\s]*,[\s]*([\d-\.]+).*", RegexOptions.IgnoreCase); + + if (regexMatch.Success) + { + double az = 0.0; + double el = 0.0; + double speed = 0.0; + + Double.TryParse(regexMatch.Groups[1].Value, out speed); + Double.TryParse(regexMatch.Groups[2].Value, out az); + Double.TryParse(regexMatch.Groups[3].Value, out el); + + SteeringMirrorLoadProfileStep(az, el, speed); + _profileSteps++; + } + } + } + } + catch (IOException) + { + throw; + } + + if (_profileSteps == 0) + { + throw new ChamberException("Invalid profile provided. Please load a valid Steering Mirror's profile!"); + } + + _currentProfileStep = 0; + } + + /// + /// steering mirror load profile step + /// + public void SteeringMirrorLoadProfileStep(double az, double el, double speed) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_LOAD_PROFILE)} AZ={az} EL={el} SPEED={speed}"; + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror reset profile + /// + public void SteeringMirrorResetProfile() + { + string command = LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_RESET_PROFILE); + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror run profile + /// + public void SteeringMirrorRunProfile(LSPS.SteeringMirrorProfileMode profileMode, LSPS.SteeringMirrorMovementMode movementMode) + { + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_MOVE_PROFILE)} MODE={(int)profileMode} TYPE={(int)movementMode}"; + + SendCommandAndGetResponse(command); + } + + /// + /// steering mirror move to beginning of profile + /// + public void SteeringMirrorMoveToBeginningOfProfile() + { + _currentProfileStep = 0; + SteeringMirrorRunNextStepInProfile(); + } + + /// + /// steering mirror run next step in profile + /// + public void SteeringMirrorRunNextStepInProfile() + { + if (_profileSteps == 0) + { + string msg = "Please load a valid Steering Mirror's profile!"; + throw new ChamberException(msg); + } + + if (_currentProfileStep == _profileSteps) + { + _currentProfileStep = 0; + } + + string command = $"{LSPS.GALIL.GetFullCommand(LSPS.GALIL.Command.SM_GET_PROFILE)} INDEX={_currentProfileStep}"; + _currentProfileStep++; + + string response = SendCommandAndGetResponse(command); + double az = 0.0; + double el = 0.0; + double speed = 0.0; + string[] stringArray = response.Split(','); + Double.TryParse(stringArray[0], out az); + Double.TryParse(stringArray[1], out el); + Double.TryParse(stringArray[2], out speed); + + SteeringMirrorMove(az, el, speed); + } + #endregion + + #region BlackBody Functions + /// + /// sets BlackBody setpoint temperature + /// + /// + /// + /// + /// + public void SetBlackBodySetpointTemperature(double temperature) + { + string command = $"{LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.CONTROL_SETPOINT)} SETPOINT={temperature}"; + + SendCommandAndGetResponse(command); + } + + /// + /// Get BlackBody Temperature + /// + public Tuple GetBlackbodyTemperature() + { + string command = LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.GET_TEMP); + + string response = SendCommandAndGetResponse(command); + + string[] stringArray = response.Split(','); + + double tempA = 0.0; + double tempB = 0.0; + Double.TryParse(stringArray[0], out tempA); + Double.TryParse(stringArray[1], out tempB); + return new Tuple(tempA, tempB); + } + + /// + /// Get BlackBody Rate of Change + /// + public double GetBlackbodyRateOfChange() + { + double val = 0.0; + + string command = LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.GET_RATE_OF_CHANGE); + + Double.TryParse(SendCommandAndGetResponse(command), out val); + return val; + } + + /// + /// Get BlackBody Control State + /// + public LSPS.BlackBodyControlState GetBlackbodyControlState() + { + int val = 0; + + string command = LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.GET_CONTROL_STATE); + + Int32.TryParse(SendCommandAndGetResponse(command), out val); + return (LSPS.BlackBodyControlState)val; + } + + /// + /// Get BlackBody Stability + /// + public Tuple GetBlackbodyStability(int? logRateInMs = null) + { + string command = LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.GET_STABILITY); + + string response = SendCommandAndGetResponse(command, logRateInMs); + + string[] stringArray = response.Split(','); + int stabilityA = 0; + int stabilityB = 0; + Int32.TryParse(stringArray[0], out stabilityA); + Int32.TryParse(stringArray[1], out stabilityB); + return new Tuple((LSPS.Stability)stabilityA, (LSPS.Stability)stabilityB); + } + + /// + /// Get BlackBody Setpoint + /// + public double GetBlackbodySetpoint() + { + double val = 0.0; + + string command = LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.GET_CONTROL_SETPOINT); + + Double.TryParse(SendCommandAndGetResponse(command), out val); + return val; + } + + /// + /// Get BlackBody Heater Percent + /// + public double GetBlackbodyHeaterPercent() + { + double val = 0.0; + + string command = LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.GET_HTR); + + Double.TryParse(SendCommandAndGetResponse(command), out val); + return val; + } + + /// + /// Get BlackBody BIT + /// + public int GetBlackbodyBIT() + { + int val = 0; + + string command = LSPS.BlackBody.GetFullCommand(LSPS.BlackBody.Command.GET_BIT); + + Int32.TryParse(SendCommandAndGetResponse(command), out val); + return val; + } + #endregion + + #region Chopper Functions + + /// + /// Sets chopper frequency + /// + /// + public void SetChopperFrequency(double frequency) + { + string command = $"{LSPS.Chopper.GetFullCommand(LSPS.Chopper.Command.CW_SET_SETPOINT)} SETPOINT={frequency}"; + + SendCommandAndGetResponse(command); + } + + public double GetChopperFrequency() + { + double frequency = 0.0; + + string command = LSPS.Chopper.GetFullCommand(LSPS.Chopper.Command.CW_GET_CHOP_FREQ); + + Double.TryParse(SendCommandAndGetResponse(command), out frequency); + return frequency; + } + + public LSPS.Stability GetChopperStability() + { + string command = LSPS.Chopper.GetFullCommand(LSPS.Chopper.Command.CW_GET_STABILITY); + + int stability = 0; + Int32.TryParse(SendCommandAndGetResponse(command), out stability); + + return (LSPS.Stability)stability; + } + + /// + /// Turn off chopper wheel + /// + public void TurnOffChopperWheel() + { + string command = LSPS.Chopper.GetFullCommand(LSPS.Chopper.Command.CW_TURN_OFF); + + SendCommandAndGetResponse(command); + } + + /// + /// Stopping chopper wheel at open position + /// + /// + public void SetStopOpen() + { + string command = LSPS.Chopper.GetFullCommand(LSPS.Chopper.Command.CW_STOP_OPEN); + + SendCommandAndGetResponse(command); + } + + /// + /// Stopping chopper wheel at closed position + /// + /// + public void SetStopClosed() + { + string command = LSPS.Chopper.GetFullCommand(LSPS.Chopper.Command.CW_STOP_CLOSED); + + SendCommandAndGetResponse(command); + } + + /// + /// Sets chopper state + /// + /// + public LSPS.ChopperState GetChopperState() + { + string command = LSPS.Chopper.GetFullCommand(LSPS.Chopper.Command.CW_GET_STATE); + + int state = 0; + string response = SendCommandAndGetResponse(command); + string[] stringArray = response.Split(' '); + Int32.TryParse(stringArray[0], out state); + + return (LSPS.ChopperState)state; + } + + #endregion Chopper Functions + + #region Misc Functions + /// + /// Send A Command. Only for SET commands. + /// DO NOT use for GET Commands as they require processing of returned data + /// + /// + public void SendACommand(string command) + { + SendCommandAndGetResponse(command); + } + #endregion + + #region Undefined and Not Implemented + + /// + /// not implemented + /// + /// + public void StartJogging() + { + throw new NotImplementedException(); + } + /// + /// not implemented + /// + /// + public void StopJogging() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + public void SetBackgroundScene(int scene) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + public void SetTargetSource(int source) + { + throw new NotImplementedException(); + } + + /// + /// ??? + /// + /// + /// + public void SendMessageGetResponse(uint message) + { + throw new NotImplementedException(); + } + + #endregion + + #region Private Functions + /// + /// standard message sending function + /// + /// + private string SendCommandAndGetResponse(string command, int? logRateInMs = null) + { + if (logRateInMs == null || ToLog(command, logRateInMs)) + _logger?.Trace("Executing LSPS Command: " + command); + + LSPS.LspsResponse response = new LSPS.LspsResponse(_tcpClientSock.SendCommandAndGetResponse(command + "\r\n")); + + if (response.commandType_ == LSPS.LspsResponse.CommandType.SET && !response.successful_) + { + throw new ChamberException("LSPS Command Failed with error: " + response.text_); + } + + return response.text_; + } + + /// + /// If we have a thread sending command at a high rate, we want to slow down the logging of the command + /// otherwise the log will be inundated with this high-rate message + /// + /// + private bool ToLog(string command, int? logRateInMs) + { + bool toLog = true; + + if (logRateInMs != null) + { + if (commandToStopwatchDict.ContainsKey(command)) + { + if (commandToStopwatchDict[command].ElapsedMilliseconds >= logRateInMs) + { + toLog = true; + commandToStopwatchDict[command].Reset(); + commandToStopwatchDict[command].Start(); + } + else + { + toLog = false; + } + } + else + { + toLog = true; + commandToStopwatchDict[command] = new Stopwatch(); + commandToStopwatchDict[command].Start(); + } + } + + return toLog; + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsChamber.csproj b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsChamber.csproj new file mode 100644 index 0000000..f84bdd4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsChamber.csproj @@ -0,0 +1,31 @@ + + + + + net472 + Raytheon.Instruments.LspsChamber + LSPS Chamber implementation + LSPS Chamber implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsResponse.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsResponse.cs new file mode 100644 index 0000000..7c67b64 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/LspsResponse.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + internal class LspsResponse + { + public enum CommandType + { + GET, + SET + } + + public CommandType commandType_ = CommandType.GET; + public readonly bool successful_ = true; + // this text_ can be an error message for a SET command or can be a value from a GET command + public readonly string text_ = String.Empty; + + public LspsResponse(string response) + { + string str = String.Empty; + Match regexMatch; + + regexMatch = Regex.Match(response, @"result=([^\s]+).(.+)", RegexOptions.IgnoreCase | RegexOptions.Singleline); + + if (regexMatch.Success) + { + commandType_ = CommandType.SET; + if (regexMatch.Groups[1].Value == "0") + { + successful_ = false; + } + text_ = regexMatch.Groups[2].Value; + } + else if (Regex.IsMatch(response, @"error:.+", RegexOptions.IgnoreCase | RegexOptions.Singleline)) + { + commandType_ = CommandType.SET; + successful_ = false; + text_ = response; + } + + // process response for SET command + text_ = Regex.Replace(text_, @"error:.(.+)", "$1", RegexOptions.IgnoreCase | RegexOptions.Singleline); + text_ = Regex.Replace(text_, @"([^\r]+).+", "$1", RegexOptions.IgnoreCase | RegexOptions.Singleline); + + // process response for GET command + if (commandType_ != CommandType.SET) + { + MatchCollection matches = Regex.Matches(response, @"[^\s=]+=[^\s=,]+", RegexOptions.IgnoreCase | RegexOptions.Singleline); + + // if there are multiple data points, we return all the data in a string delimited by comma + if (matches.Count > 1) + { + text_ = String.Empty; + foreach (Match match in matches) + { + if (text_.Length > 0) + { + text_ += ","; + } + text_ += Regex.Replace(match.Value, @"[^=]+=([^=]+)", "$1", RegexOptions.IgnoreCase | RegexOptions.Singleline); + } + } + else + { + text_ = Regex.Replace(response, @"[^=]+=([^\r]+).+", "$1", RegexOptions.IgnoreCase | RegexOptions.Singleline); + } + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/Autofill.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/Autofill.cs new file mode 100644 index 0000000..80327c5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/Autofill.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + public static class Autofill + { + public enum Command + { + COOLDOWN, + WARMUP, + TURN_OFF, + FORCE, + GET_STATE, + GET_TIME_TO_FILL + }; + + private const string name_ = "AUTOFILL"; + + public static string GetFullCommand(Enum command) + { + return $"{name_} {command.ToString()}"; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/BlackBody.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/BlackBody.cs new file mode 100644 index 0000000..fe3a5b0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/BlackBody.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + public static class BlackBody + { + public enum Command + { + CONTROL_SETPOINT, + GET_TEMP, + GET_SETPOINT, + GET_HTR, + GET_STABILITY, + GET_CONTROL_STATE, + GET_RATE_OF_CHANGE, + GET_TEMP_ERROR, + GET_TEMPA, + GET_TEMPB, + GET_CONTROL_SETPOINT, + GET_STATUS, + GET_BIT + }; + + private const string name_ = "BB"; + + public static string GetFullCommand(Enum command) + { + return $"{name_} {command.ToString()}"; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/ChamberVacuum.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/ChamberVacuum.cs new file mode 100644 index 0000000..ecf0a35 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/ChamberVacuum.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + public static class ChamberVacuum + { + public enum Command + { + GET_CVAC, + GET_SVAC + }; + + private const string name_ = "CVAC"; + + public static string GetFullCommand(Enum command) + { + return $"{name_} {command.ToString()}"; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/Chopper.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/Chopper.cs new file mode 100644 index 0000000..4b70f1b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/Chopper.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + public static class Chopper + { + public enum Command + { + CW_SET_SETPOINT, + CW_STOP_OPEN, + CW_STOP_CLOSED, + CW_TURN_OFF, + CW_GET_SETPOINT, + CW_GET_CHOP_FREQ, + CW_GET_STATE, + CW_GET_STATUS, + CW_GET_STABILITY, + GET_BIT + }; + + private const string name_ = "CHOPPER"; + + public static string GetFullCommand(Enum command) + { + return $"{name_} {command.ToString()}"; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/GALIL.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/GALIL.cs new file mode 100644 index 0000000..8cb72a4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/GALIL.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + public static class GALIL + { + public enum Command + { + FW_HOME, + FW_SET_POS, + FW_GET_POS, + FW_GET_STATUS, + TW_HOME, + TW_SET_POS, + TW_GET_POS, + TW_GET_STATUS, + SM_HOME, + SM_STOP, + SM_SET_BEAM_ANGLES, + SM_GET_BEAM_ANGLES, + SM_SET_BEAM_SPEED, + SM_DRAW_CIRCLE_NUMREVS, + SM_SET_RIGHT_LEFT_ARROW_ANGLE, + SM_SET_UP_DOWN_ARROW_ANGLE, + SM_GET_AZ_STATUS, + SM_GET_EL_STATUS, + SM_LOAD_PROFILE_FROM_FILE, + SM_LOAD_PROFILE, + SM_MOVE_PROFILE, + SM_MOVE_TO_START_PROFILE, + SM_RESET_PROFILE, + SM_GET_PROFILE_SIZE, + SM_GET_PROFILE + }; + + private const string name_ = "GALIL"; + + public static string GetFullCommand(Enum command) + { + return $"{name_} {command.ToString()}"; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/NIF.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/NIF.cs new file mode 100644 index 0000000..adba4c4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/NIF.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + public static class NIF + { + public enum InputIndex + { + UUT_GV_OPEN, + UUT_GV_CLOSE + } + + public enum Command + { + CLOSE_UUT_GV, + OPEN_UUT_GV, + GET_STATUS, + GET_INPUT_INDEX, + GET_TEMP_INDEX + }; + + private const string name_ = "NIF"; + + public static string GetFullCommand(Enum command) + { + return $"{name_} {command.ToString()}"; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/RIO.cs b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/RIO.cs new file mode 100644 index 0000000..b9d16cc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/LSPS/LspsChamber/Messages/RIO.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments.LSPS +{ + public static class RIO + { + public enum Command + { + GV_CLOSE, + GV_OPEN, + GET_GV_CLOSED_INPUT, + GET_GV_OPEN_INPUT, + GET_GV_CHAMBER_PRESSURE, + GET_GV_CANISTER_PRESSURE + }; + + private const string name_ = "RIO"; + + public static string GetFullCommand(Enum command) + { + return $"{name_} {command.ToString()}"; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfData.cs b/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfData.cs new file mode 100644 index 0000000..aaaee1a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfData.cs @@ -0,0 +1,527 @@ +// ********************************************************************************************************** +// LSPSMotion.cs +// 1/8/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.IO; + +namespace Raytheon.Instruments +{ + /// + /// NCDF Data instrument + /// + public class NetCdfData : INetCdfData + { + /// + /// NLog logger + /// + private static ILogger logger_; + + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); } + + public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set; } + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + public bool ClearErrors() => false; + + public SelfTestResult PerformSelfTest() => throw new NotImplementedException(); + + /// + /// Initialize the device + /// + public void Initialize() + { + logger_.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + } + + /// + /// Shuts down the device + /// + public void Shutdown() + { + logger_.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + } + + public void Reset() + { + logger_.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + } + + /// + /// LSPS factory constructor + /// + /// + /// + public NetCdfData(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + logger_ = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + public void ProcessNcdfData(string prefix, string suffix, string testDataPath) + { + AddDefaultNetCdfData(); + + string attributeFilename = prefix + "_" + DateTime.Now.ToString("yyyMMdd_HHmmss") + "_" + suffix + ".txt"; + + if (testDataPath != null) + { + string attributeFilePath = Path.Combine(testDataPath, attributeFilename); + + WriteNcdfDataLog(attributeFilePath); + } + } + + public void WriteNcdfDataLog(string attributeFilePath) + { + const char separator = '\t'; + using (var fileStream = new FileStream(attributeFilePath, FileMode.Create, FileAccess.ReadWrite)) + using (var streamWriter = new StreamWriter(fileStream)) + { + foreach (KeyValuePair entry in valueMap_) + { + if (entry.Value.set_) + { + streamWriter.WriteLine(entry.Value.name_ + separator + entry.Value.videoId_.ToString() + separator + entry.Value.value_ + separator + "NONE" + separator + entry.Value.type_); + + } + } + } + } + + private void AddDefaultNetCdfData() + { + SetValue(NCDF.Names.DATA_FOLDER, "---", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SITE_LOCATION, "---", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.BENCH, "---", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TESTPOSITIONTYPE, "---", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.BUILDING, "809", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.C_O_L, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.OPERATOR, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.T_E_B_B_CONTROLLER_S_N, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TEST_PROCEDURE_DOC_REV, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TEST_PROCEDURE_DOC, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TEST_TYPE_CODE, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TEST_TYPE_VARIANT, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.REMARKS, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.SEEKER_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SEEKER_PN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.GEU_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.GEU_PN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SENSOR_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SENSOR_PN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.IMU_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.IMU_PN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.IICCA_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.IICCA_PN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.IDA_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.IDA_PN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.CRYOSTAT_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.CRYOSTAT_PN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SEEKER_BUILD, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.FPA_SN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.DATE, DateTime.Now.ToString("yyyMMdd"), NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TIME_RECORDED, DateTime.Now.ToString("HHmmss"), NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.X_START, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.Y_START, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.X_SIZE, 512, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.Y_SIZE, 512, NCDF.AttrPosition.GLOBAL); + } + + private void AddVobVideoData() + { + SetValue(NCDF.Names.CHOPPER_STATUS, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.V_O_B_CHOPPER_STATUS, 0, NCDF.AttrPosition.GLOBAL); + + // target wheel pos + SetValue(NCDF.Names.MEASURED_APERTURE_POSITION, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.APERTURE, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.V_O_B_APERTURE, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TARGET_WHEEL_POSITION, 0, NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.MEASURED_FILTER_POSITION, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.VOB_FILTER_POS, 0, NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.VOB_GATE_VALVE_STATUS, 0, NCDF.AttrPosition.GLOBAL); + + // az beam pos + SetValue(NCDF.Names.MEASURED_AZ_POSITION, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.AZ_LOCATION, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SCAN_MIRROR_X_POSITION, 0.0, NCDF.AttrPosition.GLOBAL); + + // el beam pos + SetValue(NCDF.Names.MEASURED_EL_POSITION, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.EL_LOCATION, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SCAN_MIRROR_Y_POSITION, 0.0, NCDF.AttrPosition.GLOBAL); + + //vacuum pressure + SetValue(NCDF.Names.CHAMBER_PRESSURE, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.V_O_B_CHAMBER_PRESSURE, 0.0, NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.FOCUS_POSITION, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.GALILC_FOCUS_POSITION, 0.0, NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.GALILC_ABS_FOCUS_POSITION, 0.0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.GALILC_ENCODER_FOCUS_POSITION, 0, NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.B_B_E_S_TARGET, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.EMISSIVITY, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.CUTOFFWAVELENGTH, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.CUTONWAVELENGTH, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.REGION, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.TARGET_REGION, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SCAN_PATTERN, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.SCAN_RADIUS, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + + if (!IsValueSet(NCDF.Names.MONOCHROMETER_POSITION)) + { + SetValue(NCDF.Names.MONOCHROMETER_POSITION, 0, NCDF.AttrPosition.GLOBAL); + } + + SetValue(NCDF.Names.MEASURED_MONOCHROMETER_POSITION, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.MEASURED_BLACK_BODY_TEMPERATURE, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.V_O_B_CAN_TEMP, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.V_O_B_LAMBDA, 0, NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.VOB_REGION, 0, NCDF.AttrPosition.GLOBAL); + + SetValue(NCDF.Names.VOB_TARGET_REGION, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + SetValue(NCDF.Names.VOB_GATE_VALVE_STATUS, "UNKNOWN", NCDF.AttrPosition.GLOBAL); + } + + public void SetValue(NCDF.Names name, T value, NCDF.AttrPosition videoId) + { + if (typeof(T) == typeof(double)) + { + valueMap_[name] = new NCDF.NetCdfValue(value.ToString(), valueMap_[name].name_, true, videoId, NCDF.DataType.FLOAT); + } + else if (typeof(T) == typeof(int)) + { + valueMap_[name] = new NCDF.NetCdfValue(value.ToString(), valueMap_[name].name_, true, videoId, NCDF.DataType.INT); + } + else if (typeof(T) == typeof(string)) + { + valueMap_[name] = new NCDF.NetCdfValue((string)(object)value, valueMap_[name].name_, true, videoId, NCDF.DataType.STRING); + } + } + + public void GetValue(NCDF.Names name, ref string value, ref NCDF.AttrPosition videoId, ref NCDF.DataType type) + { + value = valueMap_[name].value_; + videoId = valueMap_[name].videoId_; + type = valueMap_[name].type_; + } + + public bool IsValueSet(NCDF.Names name) + { + return valueMap_[name].set_; + } + + public Dictionary valueMap_ = new Dictionary + { + {NCDF.Names.ACTIVITY, new NCDF.NetCdfValue("Not Used", "Activity", false) }, + {NCDF.Names.APERTURE, new NCDF.NetCdfValue("Not Used", "Aperture", false) }, + {NCDF.Names.AZ_LOCATION, new NCDF.NetCdfValue("Not Used", "Az_Location", false) }, + {NCDF.Names.B_B_CONTROLER, new NCDF.NetCdfValue("Not Used", "BB_Controler", false) }, + {NCDF.Names.CHOPPER_FREQ, new NCDF.NetCdfValue("Not Used", "Chopper_Freq", false) }, + {NCDF.Names.DATA_FOLDER, new NCDF.NetCdfValue("Not Used", "Data_Folder", false) }, + {NCDF.Names.DATE, new NCDF.NetCdfValue("Not Used", "Date", false) }, + {NCDF.Names.EL_LOCATION, new NCDF.NetCdfValue("Not Used", "El_Location", false) }, + {NCDF.Names.FILENAME, new NCDF.NetCdfValue("Not Used", "Filename", false) }, + {NCDF.Names.F_P_A, new NCDF.NetCdfValue("Not Used", "F_p_a", false) }, + {NCDF.Names.INDICATOR_CODE, new NCDF.NetCdfValue("Not Used", "Indicator_Code", false) }, + {NCDF.Names.SITE_LOCATION, new NCDF.NetCdfValue("Not Used", "Site_Location", false) }, + {NCDF.Names.MEASURED_APERTURE_POSITION, new NCDF.NetCdfValue("Not Used", "Measured_Aperture_Position", false) }, + {NCDF.Names.MEASURED_AZ_POSITION, new NCDF.NetCdfValue("Not Used", "Measured_Az_Position", false) }, + {NCDF.Names._B_B_TEMP, new NCDF.NetCdfValue("Not Used", "BBTemp", false) }, + {NCDF.Names.MEASURED_EL_POSITION, new NCDF.NetCdfValue("Not Used", "Measured_El_Position", false) }, + {NCDF.Names.MEASURED_FILTER_POSITION, new NCDF.NetCdfValue("Not Used", "Measured_Filter_Position", false) }, + {NCDF.Names.N_FRAMES, new NCDF.NetCdfValue("Not Used", "N_Frames", false) }, + {NCDF.Names.OPERATOR, new NCDF.NetCdfValue("Not Used", "Operator", false) }, + {NCDF.Names.POSITION, new NCDF.NetCdfValue("Not Used", "Position", false) }, + {NCDF.Names.REMARKS, new NCDF.NetCdfValue("Not Used", "Remarks", false) }, + {NCDF.Names.RADCAL_AUTOFILL_STATE, new NCDF.NetCdfValue("Not Used", "Radcal_Autofill_State", false) }, + {NCDF.Names.RADCAL_AUTOFILL_TIMETOFILL, new NCDF.NetCdfValue("Not Used", "Radcal_Autofill_Timetofill", false) }, + {NCDF.Names.RADCAL_BB_BIT, new NCDF.NetCdfValue("Not Used", "Radcal_Bb_Bit", false) }, + {NCDF.Names.RADCAL_BB_CTRL_STATE, new NCDF.NetCdfValue("Not Used", "Radcal_Bb_Ctrl_State", false) }, + {NCDF.Names.RADCAL_BB_HEATER, new NCDF.NetCdfValue("Not Used", "Radcal_Bb_Heater", false) }, + {NCDF.Names.RADCAL_BB_RATE_O_CHANGE, new NCDF.NetCdfValue("Not Used", "Radcal_Bb_Rate_O_Change", false) }, + {NCDF.Names.RADCAL_BB_SETPOINT, new NCDF.NetCdfValue("Not Used", "Radcal_Bb_Setpoint", false) }, + {NCDF.Names.RADCAL_BB_STABILITY_A, new NCDF.NetCdfValue("Not Used", "Radcal_Bb_Stability_A", false) }, + {NCDF.Names.RADCAL_BB_STABILITY_B, new NCDF.NetCdfValue("Not Used", "Radcal_Bb_Stability_B", false) }, + {NCDF.Names.RADCAL_C_VAC, new NCDF.NetCdfValue("Not Used", "Radcal_C_Vac", false) }, + {NCDF.Names.RADCAL_CHOPPER_FREQ, new NCDF.NetCdfValue("Not Used", "Radcal_Chopper_Freq", false) }, + {NCDF.Names.RADCAL_CHOPPER_STABILITY, new NCDF.NetCdfValue("Not Used", "Radcal_Chopper_Stability", false) }, + {NCDF.Names.RADCAL_CHOPPER_STATE, new NCDF.NetCdfValue("Not Used", "Radcal_Chopper_State", false) }, + {NCDF.Names.RADCAL_GATE_VALVE, new NCDF.NetCdfValue("Not Used", "Radcal_Gate_Valve", false) }, + {NCDF.Names.RADCAL_NIF_TEMP_TANK_BOTTOM, new NCDF.NetCdfValue("Not Used", "Radcal_Nif_Temp_Tank_Bottom", false) }, + {NCDF.Names.RADCAL_NIF_TEMP_TANK_TOP, new NCDF.NetCdfValue("Not Used", "Radcal_Nif_Temp_Tank_Top", false) }, + {NCDF.Names.RADCAL_PVAC_RVAC, new NCDF.NetCdfValue("Not Used", "Radcal_Pvac_Rvac", false) }, + {NCDF.Names.RADCAL_PVAC_TVAC, new NCDF.NetCdfValue("Not Used", "Radcal_Pvac_Tvac", false) }, + {NCDF.Names.RADCAL_S_VAC, new NCDF.NetCdfValue("Not Used", "Radcal_S_Vac", false) }, + {NCDF.Names.VHF_GV_CHAMBER_VAC, new NCDF.NetCdfValue("Not Used", "Vhf_Gv_Chamber_Vac", false) }, + {NCDF.Names.VHF_GV_UUT_VAC, new NCDF.NetCdfValue("Not Used", "Vhf_Gv_Uut_Vac", false) }, + {NCDF.Names.REGION, new NCDF.NetCdfValue("Not Used", "Region", false) }, + {NCDF.Names.SCAN_MIRROR_X_POSITION, new NCDF.NetCdfValue("Not Used", "Scan_mirror_x_position", false) }, + {NCDF.Names.SCAN_MIRROR_Y_POSITION, new NCDF.NetCdfValue("Not Used", "Scan_mirror_y_position", false) }, + {NCDF.Names.SCAN_SPEED, new NCDF.NetCdfValue("Not Used", "Scan_Speed", false) }, + {NCDF.Names.SCAN_PATTERN, new NCDF.NetCdfValue("Not Used", "Scan_Pattern", false) }, + {NCDF.Names.SCAN_RADIUS, new NCDF.NetCdfValue("Not Used", "Scan_Radius", false) }, + {NCDF.Names.SCRIPT_NAME, new NCDF.NetCdfValue("Not Used", "Script_Name", false) }, + {NCDF.Names.SET_POINT_AZ, new NCDF.NetCdfValue("Not Used", "Set_Point_Az", false) }, + {NCDF.Names.SET_POINT_EL, new NCDF.NetCdfValue("Not Used", "Set_Point_El", false) }, + {NCDF.Names.TARGET_WHEEL_POSITION, new NCDF.NetCdfValue("Not Used", "Target_Wheel_Position", false) }, + {NCDF.Names.TEST_POSITION_NO, new NCDF.NetCdfValue("Not Used", "TestPositionNo", false) }, + {NCDF.Names.TEST_PROCEDURE_DOC, new NCDF.NetCdfValue("Not Used", "TestProcedureDoc", false) }, + {NCDF.Names.TEST_PROCEDURE_DOC_REV, new NCDF.NetCdfValue("Not Used", "TestProcedureDocRev", false) }, + {NCDF.Names.TEST_STEP, new NCDF.NetCdfValue("Not Used", "Test_Step", false) }, + {NCDF.Names.TEST_TYPE_CODE, new NCDF.NetCdfValue("Not Used", "TestTypeCode", false) }, + {NCDF.Names.TIME_RECORDED, new NCDF.NetCdfValue("Not Used", "Time_Recorded", false) }, + {NCDF.Names.VERSION, new NCDF.NetCdfValue("Not Used", "Version", false) }, + {NCDF.Names.V_O_B_APERTURE, new NCDF.NetCdfValue("Not Used", "VOB_Aperture", false) }, + {NCDF.Names.VOB_CAN_TEMP, new NCDF.NetCdfValue("Not Used", "Vob_Can_Temp", false) }, + {NCDF.Names.CHOPPER_STATUS, new NCDF.NetCdfValue("Not Used", "Chopper_Status", false) }, + {NCDF.Names.VOB_FILTER_POS, new NCDF.NetCdfValue("Not Used", "Vob_Filter_Pos", false) }, + {NCDF.Names.VOB_GATE_VALVE_STATUS, new NCDF.NetCdfValue("Not Used", "Vob_Gate_Valve_Status", false) }, + {NCDF.Names.VOB_LAMBDA, new NCDF.NetCdfValue("Not Used", "Vob_Lambda", false) }, + {NCDF.Names.VOB_REGION, new NCDF.NetCdfValue("Not Used", "Vob_Region", false) }, + {NCDF.Names.VOB_TARGET_REGION, new NCDF.NetCdfValue("Not Used", "Vob_Target_Region", false) }, + {NCDF.Names.CHAMBER_PRESSURE, new NCDF.NetCdfValue("Not Used", "Chamber_Pressure", false) }, + {NCDF.Names.VOB_CHOPPER_FREQ, new NCDF.NetCdfValue("Not Used", "Vob_Chopper_Freq", false) }, + {NCDF.Names.VSS_INPUT_CHOPPER_FREQ, new NCDF.NetCdfValue("Not Used", "Vss_Input_Chopper_Freq", false) }, + {NCDF.Names.VSS_INPUT_CHOPPER_STATUS, new NCDF.NetCdfValue("Not Used", "Vss_Input_Chopper_Status", false) }, + {NCDF.Names.VSS_MID_CHOPPER_FREQ, new NCDF.NetCdfValue("Not Used", "Vss_Mid_Chopper_Freq", false) }, + {NCDF.Names.VSS_MID_CHOPPER_STATUS, new NCDF.NetCdfValue("Not Used", "Vss_Mid_Chopper_Status", false) }, + {NCDF.Names.X_LOCATION, new NCDF.NetCdfValue("Not Used", "X_Location", false) }, + {NCDF.Names.X_SIZE, new NCDF.NetCdfValue("Not Used", "X_Size", false) }, + {NCDF.Names.X_TARGET, new NCDF.NetCdfValue("Not Used", "X_Target", false) }, + {NCDF.Names.Y_LOCATION, new NCDF.NetCdfValue("Not Used", "Y_Location", false) }, + {NCDF.Names.Y_SIZE, new NCDF.NetCdfValue("Not Used", "Y_Size", false) }, + {NCDF.Names.Y_TARGET, new NCDF.NetCdfValue("Not Used", "Y_Target", false) }, + {NCDF.Names.LAST_BAND_SEL, new NCDF.NetCdfValue("Not Used", "LastBandSel", false) }, + {NCDF.Names.BAND_SEL, new NCDF.NetCdfValue("Not Used", "BandSel", false) }, + {NCDF.Names.READ_SEQ_DEL, new NCDF.NetCdfValue("Not Used", "ReadSeqDel", false) }, + {NCDF.Names.ROW_START, new NCDF.NetCdfValue("Not Used", "RowStart", false) }, + {NCDF.Names.ROW_STOP, new NCDF.NetCdfValue("Not Used", "RowStop", false) }, + {NCDF.Names.INTEGRATION_TIME, new NCDF.NetCdfValue("Not Used", "Integration_Time", false) }, + {NCDF.Names.B1_DET_BIAS_OFFS, new NCDF.NetCdfValue("Not Used", "B1DetBiasOffs", false) }, + {NCDF.Names.B1_DET_BIAS, new NCDF.NetCdfValue("Not Used", "B1DetBias", false) }, + {NCDF.Names.B2_DET_BIAS, new NCDF.NetCdfValue("Not Used", "B2DetBias", false) }, + {NCDF.Names.UC_GAIN, new NCDF.NetCdfValue("Not Used", "UcGain", false) }, + {NCDF.Names.BGSEN, new NCDF.NetCdfValue("Not Used", "Bgsen", false) }, + {NCDF.Names.B1_RAMP, new NCDF.NetCdfValue("Not Used", "B1Ramp", false) }, + {NCDF.Names.B2_RAMP, new NCDF.NetCdfValue("Not Used", "B2Ramp", false) }, + {NCDF.Names.COL_AMP_GAIN, new NCDF.NetCdfValue("Not Used", "ColAmpGain", false) }, + {NCDF.Names.COL_AMP_IN_OFFS, new NCDF.NetCdfValue("Not Used", "ColAmpInOffs", false) }, + {NCDF.Names.COL_AMP_OUT_OFFS, new NCDF.NetCdfValue("Not Used", "ColAmpOutOffs", false) }, + {NCDF.Names.OUT_BUF_SLEW, new NCDF.NetCdfValue("Not Used", "OutBufSlew", false) }, + {NCDF.Names.OUT_BUF_CAS, new NCDF.NetCdfValue("Not Used", "OutBufCas", false) }, + {NCDF.Names.RESET_TIME, new NCDF.NetCdfValue("Not Used", "ResetTime", false) }, + {NCDF.Names.GLOBAL_TEST_ENABLE, new NCDF.NetCdfValue("Not Used", "GlobalTestEnable", false) }, + {NCDF.Names.UC_RAMP_TEST, new NCDF.NetCdfValue("Not Used", "UcRampTest", false) }, + {NCDF.Names.SEEKER_SN, new NCDF.NetCdfValue("Not Used", "SeekerSn", false) }, + {NCDF.Names.SEEKER_PN, new NCDF.NetCdfValue("Not Used", "SeekerPn", false) }, + {NCDF.Names.GEU_PN, new NCDF.NetCdfValue("Not Used", "GeuPn", false) }, + {NCDF.Names.GEU_SN, new NCDF.NetCdfValue("Not Used", "GeuSn", false) }, + {NCDF.Names.SENSOR_SN, new NCDF.NetCdfValue("Not Used", "Sensor_Sn", false) }, + {NCDF.Names.SENSOR_PN, new NCDF.NetCdfValue("Not Used", "Sensor_Pn", false) }, + {NCDF.Names.IMU_SN, new NCDF.NetCdfValue("Not Used", "ImuSn", false) }, + {NCDF.Names.IMU_PN, new NCDF.NetCdfValue("Not Used", "ImuPn", false) }, + {NCDF.Names.IICCA_SN, new NCDF.NetCdfValue("Not Used", "IiccaSn", false) }, + {NCDF.Names.IICCA_PN, new NCDF.NetCdfValue("Not Used", "IiccaPn", false) }, + {NCDF.Names.IDA_SN, new NCDF.NetCdfValue("Not Used", "IdaSn", false) }, + {NCDF.Names.IDA_PN, new NCDF.NetCdfValue("Not Used", "IdaPn", false) }, + {NCDF.Names.CRYOSTAT_SN, new NCDF.NetCdfValue("Not Used", "CryostatSn", false) }, + {NCDF.Names.CRYOSTAT_PN, new NCDF.NetCdfValue("Not Used", "CryostatPn", false) }, + {NCDF.Names.ENVIRONMENT_ERROR, new NCDF.NetCdfValue("Not Used", "Environment_error", false) }, + {NCDF.Names.SET_LAST_BAND_SEL, new NCDF.NetCdfValue("Not Used", "SetLastBandSel", false) }, + {NCDF.Names.SET_BAND_SEL, new NCDF.NetCdfValue("Not Used", "SetBandSel", false) }, + {NCDF.Names.SET_READ_SEQ_DEL, new NCDF.NetCdfValue("Not Used", "SetReadSeqDel", false) }, + {NCDF.Names.SET_ROW_START, new NCDF.NetCdfValue("Not Used", "SetRowStart", false) }, + {NCDF.Names.SET_ROW_STOP, new NCDF.NetCdfValue("Not Used", "SetRowStop", false) }, + {NCDF.Names.SET_INTEG_TIME, new NCDF.NetCdfValue("Not Used", "SetIntegTime", false) }, + {NCDF.Names.SET_B1_DET_BIAS_OFFS, new NCDF.NetCdfValue("Not Used", "SetB1DetBiasOffs", false) }, + {NCDF.Names.SET_B1_DET_BIAS, new NCDF.NetCdfValue("Not Used", "SetB1DetBias", false) }, + {NCDF.Names.SET_B2_DET_BIAS, new NCDF.NetCdfValue("Not Used", "SetB2DetBias", false) }, + {NCDF.Names.SET_UC_GAIN, new NCDF.NetCdfValue("Not Used", "SetUcGain", false) }, + {NCDF.Names.SET_BGSEN, new NCDF.NetCdfValue("Not Used", "SetBgsen", false) }, + {NCDF.Names.SET_B1_RAMP, new NCDF.NetCdfValue("Not Used", "SetB1Ramp", false) }, + {NCDF.Names.SET_B2_RAMP, new NCDF.NetCdfValue("Not Used", "SetB2Ramp", false) }, + {NCDF.Names.SET_COL_AMP_GAIN, new NCDF.NetCdfValue("Not Used", "SetColAmpGain", false) }, + {NCDF.Names.SET_COL_AMP_IN_OFFS, new NCDF.NetCdfValue("Not Used", "SetColAmpInOffs", false) }, + {NCDF.Names.SET_COL_AMP_OUT_OFFS, new NCDF.NetCdfValue("Not Used", "SetColAmpOutOffs", false) }, + {NCDF.Names.SET_OUT_BUF_SLEW, new NCDF.NetCdfValue("Not Used", "SetOutBufSlew", false) }, + {NCDF.Names.SET_OUT_BUF_CAS, new NCDF.NetCdfValue("Not Used", "SetOutBufCas", false) }, + {NCDF.Names.SET_RESET_TIME, new NCDF.NetCdfValue("Not Used", "SetResetTime", false) }, + {NCDF.Names.SET_GLOBAL_TEST_ENABLE, new NCDF.NetCdfValue("Not Used", "SetGlobalTestEnable", false) }, + {NCDF.Names.SET_UC_RAMP_TEST, new NCDF.NetCdfValue("Not Used", "SetUcRampTest", false) }, + {NCDF.Names.BAND, new NCDF.NetCdfValue("Not Used", "Band", false) }, + {NCDF.Names.FILE_TYPE, new NCDF.NetCdfValue("Not Used", "File_Type", false) }, + {NCDF.Names.FRAME_RATE, new NCDF.NetCdfValue("Not Used", "Frame_Rate", false) }, + {NCDF.Names.INTEGRATION_TIME_BAND1, new NCDF.NetCdfValue("Not Used", "Integration_Time_Band1", false) }, + {NCDF.Names.INTEGRATION_TIME_BAND2, new NCDF.NetCdfValue("Not Used", "Integration_Time_Band2", false) }, + {NCDF.Names.LAKESHORE_SLOPE, new NCDF.NetCdfValue("Not Used", "Lakeshore_Slope", false) }, + {NCDF.Names.LAKESHORE_INTERCEPT, new NCDF.NetCdfValue("Not Used", "Lakeshore_Intercept", false) }, + {NCDF.Names.LOCATION_ORIGIN, new NCDF.NetCdfValue("Not Used", "Location_Origin", false) }, + {NCDF.Names.SENSOR_CONFIGURATION, new NCDF.NetCdfValue("Not Used", "Sensor_Configuration", false) }, + {NCDF.Names.SERIAL, new NCDF.NetCdfValue("Not Used", "Serial", false) }, + {NCDF.Names.VIDEO_TEST, new NCDF.NetCdfValue("Not Used", "Video_test", false) }, + {NCDF.Names.X_START, new NCDF.NetCdfValue("Not Used", "X_Start", false) }, + {NCDF.Names.Y_START, new NCDF.NetCdfValue("Not Used", "Y_Start", false) }, + {NCDF.Names._V_DET_COM, new NCDF.NetCdfValue("Not Used", "vDetCom", false) }, + {NCDF.Names.VRAMP, new NCDF.NetCdfValue("Not Used", "Vramp", false) }, + {NCDF.Names.IICCA_FIRM_VER, new NCDF.NetCdfValue("Not Used", "Iicca_Firm_Ver", false) }, + {NCDF.Names.IDA_VOLTS, new NCDF.NetCdfValue("Not Used", "Ida_Volts", false) }, + {NCDF.Names.IDA_TEMP, new NCDF.NetCdfValue("Not Used", "Ida_Temp", false) }, + {NCDF.Names.V_P3_R4_A_S, new NCDF.NetCdfValue("Not Used", "VP3R4AS", false) }, + {NCDF.Names.V_N3_R4_A, new NCDF.NetCdfValue("Not Used", "VN3R4A", false) }, + {NCDF.Names.V_P5_R3_A, new NCDF.NetCdfValue("Not Used", "VP5R3A", false) }, + {NCDF.Names.BIAS_RESERVE, new NCDF.NetCdfValue("Not Used", "BiasReserve", false) }, + {NCDF.Names.VP_DET_COM_B1, new NCDF.NetCdfValue("Not Used", "VpDetComB1", false) }, + {NCDF.Names.VP_E_S_D, new NCDF.NetCdfValue("Not Used", "VpESD", false) }, + {NCDF.Names.VN_OUT, new NCDF.NetCdfValue("Not Used", "VnOut", false) }, + {NCDF.Names.VP_OUT, new NCDF.NetCdfValue("Not Used", "VpOut", false) }, + {NCDF.Names.VN_UC, new NCDF.NetCdfValue("Not Used", "VnUc", false) }, + {NCDF.Names.VP_UC, new NCDF.NetCdfValue("Not Used", "VpUc", false) }, + {NCDF.Names.VN_D, new NCDF.NetCdfValue("Not Used", "VnD", false) }, + {NCDF.Names.VP_D, new NCDF.NetCdfValue("Not Used", "VpD", false) }, + {NCDF.Names.VN_A, new NCDF.NetCdfValue("Not Used", "VnA", false) }, + {NCDF.Names.VP_A, new NCDF.NetCdfValue("Not Used", "VpA", false) }, + {NCDF.Names.BENCH, new NCDF.NetCdfValue("Not Used", "Bench", false) }, + {NCDF.Names.SEEKER_BUILD, new NCDF.NetCdfValue("Not Used", "Seeker_Build", false) }, + {NCDF.Names.SENSOR_BUILD, new NCDF.NetCdfValue("Not Used", "Sensor_Build", false) }, + {NCDF.Names.PROGRAM_NAME, new NCDF.NetCdfValue("Not Used", "Program_Name", false) }, + {NCDF.Names.TESTPOSITIONTYPE, new NCDF.NetCdfValue("Not Used", "Testpositiontype", false) }, + {NCDF.Names.TEST_TYPE_VARIANT, new NCDF.NetCdfValue("Not Used", "TestTypeVariant", false) }, + {NCDF.Names.ENVIRONMENT_ERROR_NOTES, new NCDF.NetCdfValue("Not Used", "Environment_error_notes", false) }, + {NCDF.Names.T_E_CHAMBER_I_D, new NCDF.NetCdfValue("Not Used", "TE_Chamber_ID", false) }, + {NCDF.Names.T_E_G_U_T_S_I_D, new NCDF.NetCdfValue("Not Used", "TE_GUTS_ID", false) }, + {NCDF.Names.T_E_C_T_S_I_D, new NCDF.NetCdfValue("Not Used", "TE_CTS_ID", false) }, + {NCDF.Names.T_E_SHAKER_I_D, new NCDF.NetCdfValue("Not Used", "TE_Shaker_ID", false) }, + {NCDF.Names.T_E_THERMOTRON_I_D, new NCDF.NetCdfValue("Not Used", "TE_Thermotron_ID", false) }, + {NCDF.Names.T_E_CHAMBER_WINDOW_I_D, new NCDF.NetCdfValue("Not Used", "TE_Chamber_Window_ID", false) }, + {NCDF.Names.T_E_U_U_T_WINDOW_I_D, new NCDF.NetCdfValue("Not Used", "TE_UUT_Window_ID", false) }, + {NCDF.Names.T_E_B_B_CONTROLLER_S_N, new NCDF.NetCdfValue("Not Used", "TE_BB_Controller_SN", false) }, + {NCDF.Names.T_E_V_S_S_PYRO_DET, new NCDF.NetCdfValue("Not Used", "TE_VSS_Pyro_Det", false) }, + {NCDF.Names.T_E_CHAMBER_SW_VERSION, new NCDF.NetCdfValue("Not Used", "TE_Chamber_Sw_Version", false) }, + {NCDF.Names.T_E_CHAMBER_SW_BUILD, new NCDF.NetCdfValue("Not Used", "TE_Chamber_Sw_Build", false) }, + {NCDF.Names.T_E_G_U_T_S_S_W_VERSION, new NCDF.NetCdfValue("Not Used", "TE_GUTS_SW_Version", false) }, + {NCDF.Names.T_E_G_U_T_S_S_W_BUILD, new NCDF.NetCdfValue("Not Used", "TE_GUTS_SW_Build", false) }, + {NCDF.Names.T_E_V_T_I_FIRMWARE_VERSION, new NCDF.NetCdfValue("Not Used", "TE_VTI_Firmware_Version", false) }, + {NCDF.Names.T_E_V_T_I_FIRMWARE_BUILD, new NCDF.NetCdfValue("Not Used", "TE_VTI_Firmware_Build", false) }, + {NCDF.Names.T_E_I_A_F_S_W_VERSION, new NCDF.NetCdfValue("Not Used", "TE_IAF_SW_Version", false) }, + {NCDF.Names.T_E_I_A_F_S_W_BUILD, new NCDF.NetCdfValue("Not Used", "TE_IAF_SW_Build", false) }, + {NCDF.Names.MONOCHROMETER_POSITION, new NCDF.NetCdfValue("Not Used", "Monochrometer_Position", false) }, + {NCDF.Names.B_B_E_S_TARGET, new NCDF.NetCdfValue("Not Used", "BBES_Target", false) }, + {NCDF.Names.EMISSIVITY, new NCDF.NetCdfValue("Not Used", "Emissivity", false) }, + {NCDF.Names.CUTOFFWAVELENGTH, new NCDF.NetCdfValue("Not Used", "Cutoffwavelength", false) }, + {NCDF.Names.CUTONWAVELENGTH, new NCDF.NetCdfValue("Not Used", "Cutonwavelength", false) }, + {NCDF.Names.TARGET_REGION, new NCDF.NetCdfValue("Not Used", "Target_Region", false) }, + {NCDF.Names.MEASURED_BLACK_BODY_TEMPERATURE, new NCDF.NetCdfValue("Not Used", "Measured_Black_Body_Temperature", false) }, + {NCDF.Names.MEASURED_MONOCHROMETER_POSITION, new NCDF.NetCdfValue("Not Used", "Measured_Monochrometer_Position", false) }, + {NCDF.Names.V_O_B_CAN_TEMP, new NCDF.NetCdfValue("Not Used", "VOB_Can_Temp", false) }, + {NCDF.Names.V_O_B_CHAMBER_PRESSURE, new NCDF.NetCdfValue("Not Used", "VOB_Chamber_Pressure", false) }, + {NCDF.Names.V_O_B_CHOPPER_STATUS, new NCDF.NetCdfValue("Not Used", "VOB_Chopper_Status", false) }, + {NCDF.Names.V_O_B_LAMBDA, new NCDF.NetCdfValue("Not Used", "VOB_Lambda", false) }, + {NCDF.Names.L_S_P_S_GATE_VALVE_STATUS, new NCDF.NetCdfValue("Not Used", "LSPS_gate_valve_status", false) }, + {NCDF.Names.SENSOR, new NCDF.NetCdfValue("Not Used", "Sensor", false) }, + {NCDF.Names.VGATE, new NCDF.NetCdfValue("Not Used", "Vgate", false) }, + {NCDF.Names.VOFFSET, new NCDF.NetCdfValue("Not Used", "Voffset", false) }, + {NCDF.Names.EXTERNAL_A_D_C_V_DET_COM, new NCDF.NetCdfValue("Not Used", "External_ADC_vDetCom", false) }, + {NCDF.Names.INTEG_TIME, new NCDF.NetCdfValue("Not Used", "IntegTime", false) }, + {NCDF.Names.AUTOCOLLIMATOR_EL, new NCDF.NetCdfValue("Not Used", "Autocollimator_El", false) }, + {NCDF.Names.AUTOCOLLIMATOR_AZ, new NCDF.NetCdfValue("Not Used", "Autocollimator_Az", false) }, + {NCDF.Names.B_B_E_S_TEMP, new NCDF.NetCdfValue("Not Used", "BBES_Temp", false) }, + {NCDF.Names.B_B_E_S_FILTER_WHEEL, new NCDF.NetCdfValue("Not Used", "BBES_Filter_Wheel", false) }, + {NCDF.Names.VOB_AMP_AVG_R, new NCDF.NetCdfValue("Not Used", "Vob_Amp_Avg_R", false) }, + {NCDF.Names.VOB_AVG_X_VOLTAGE, new NCDF.NetCdfValue("Not Used", "Vob_Avg_X_Voltage", false) }, + {NCDF.Names.VSS_LOCKIN_1_COUPLE, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_1_Couple", false) }, + {NCDF.Names.VSS_LOCKIN_1_GROUND, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_1_Ground", false) }, + {NCDF.Names.VSS_LOCKIN_1_RESERVE, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_1_Reserve", false) }, + {NCDF.Names.VOB_AMP_SEN, new NCDF.NetCdfValue("Not Used", "Vob_Amp_Sen", false) }, + {NCDF.Names.VSS_LOCKIN_1_SLOPE, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_1_Slope", false) }, + {NCDF.Names.VOB_AMP_TIME_CONST, new NCDF.NetCdfValue("Not Used", "Vob_Amp_Time_Const", false) }, + {NCDF.Names.VOB_AMP2_AVG_R, new NCDF.NetCdfValue("Not Used", "Vob_Amp2_Avg_R", false) }, + {NCDF.Names.VOB_AVG2_X_VOLTAGE, new NCDF.NetCdfValue("Not Used", "Vob_Avg2_X_Voltage", false) }, + {NCDF.Names.VSS_LOCKIN_2_COUPLE, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_2_Couple", false) }, + {NCDF.Names.VSS_LOCKIN_2_GROUND, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_2_Ground", false) }, + {NCDF.Names.VSS_LOCKIN_2_RESERVE, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_2_Reserve", false) }, + {NCDF.Names.VOB_AMP2_SEN, new NCDF.NetCdfValue("Not Used", "Vob_Amp2_Sen", false) }, + {NCDF.Names.VSS_LOCKIN_2_SLOPE, new NCDF.NetCdfValue("Not Used", "Vss_Lockin_2_Slope", false) }, + {NCDF.Names.VOB_AMP2_TIME_CONST, new NCDF.NetCdfValue("Not Used", "Vob_Amp2_Time_Const", false) }, + {NCDF.Names.SET_V_DET_COM, new NCDF.NetCdfValue("Not Used", "SetVDetCom", false) }, + {NCDF.Names.MONOCHROMETER_1_POSITION, new NCDF.NetCdfValue("Not Used", "Monochrometer_1_Position", false) }, + {NCDF.Names.MONOCHROMETER_2_POSITION, new NCDF.NetCdfValue("Not Used", "Monochrometer_2_position", false) }, + {NCDF.Names.FILTER, new NCDF.NetCdfValue("Not Used", "Filter", false) }, + {NCDF.Names.FPA_SN, new NCDF.NetCdfValue("Not Used", "FpaSn", false) }, + {NCDF.Names.T_E_I_A_F_I_D, new NCDF.NetCdfValue("Not Used", "TE_IAF_ID", false) }, + {NCDF.Names.T_E_V_T_I_I_D, new NCDF.NetCdfValue("Not Used", "TE_VTI_ID", false) }, + {NCDF.Names.BUILDING, new NCDF.NetCdfValue("Not Used", "Building", false) }, + {NCDF.Names.FOCUS_POSITION, new NCDF.NetCdfValue("Not Used", "FocusPosition", false) }, + {NCDF.Names.F_C_D_START_TIME, new NCDF.NetCdfValue("Not Used", "FCD_Start_Time", false) }, + {NCDF.Names.F_C_D_FRAMECNT, new NCDF.NetCdfValue("Not Used", "FCD_Framecnt", false) }, + {NCDF.Names.F_C_D_LINECUT_TIME, new NCDF.NetCdfValue("Not Used", "FCD_Linecut_Time", false) }, + {NCDF.Names.F_C_D_LINECUT_FRAMECNT, new NCDF.NetCdfValue("Not Used", "FCD_Linecut_Framecnt", false) }, + {NCDF.Names.C_O_L, new NCDF.NetCdfValue("Not Used", "COL", false) }, + {NCDF.Names.SOAK_TEMPERATURE, new NCDF.NetCdfValue("Not Used", "Soak_Temperature", false) }, + {NCDF.Names.SCAN_RATE, new NCDF.NetCdfValue("Not Used", "Scan_Rate", false) }, + {NCDF.Names.ORIENTATION, new NCDF.NetCdfValue("Not Used", "Orientation", false) }, + {NCDF.Names.GALILC_FOCUS_POSITION, new NCDF.NetCdfValue("Not Used", "Galilc_focus_position", false) }, + {NCDF.Names.GALILC_ABS_FOCUS_POSITION, new NCDF.NetCdfValue("Not Used", "Galilc_abs_focus_position", false) }, + {NCDF.Names.GALILC_ENCODER_FOCUS_POSITION, new NCDF.NetCdfValue("Not Used", "Galilc_encoder_focus_position", false) }, + }; + } +} diff --git a/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfData.csproj b/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfData.csproj new file mode 100644 index 0000000..87c1a98 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfData.csproj @@ -0,0 +1,31 @@ + + + + + net472 + Raytheon.Instruments.NetCdfData + NCDF implementation + NCDF implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfDataFactory.cs b/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfDataFactory.cs new file mode 100644 index 0000000..129a333 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/NetCdfData/NetCdfDataFactory.cs @@ -0,0 +1,137 @@ +// ********************************************************************************************************** +// LSPSMotionFactory.cs +// 1/8/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "NetCdfDataFactory")] + public class NetCdfDataFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public NetCdfDataFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public NetCdfDataFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(INetCdfData)); + } + + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new NetCdfData(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new NetCdfData(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpi.cs b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpi.cs new file mode 100644 index 0000000..5f83734 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpi.cs @@ -0,0 +1,787 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using NLog; +using Raytheon.Common; +using Raytheon.Units; +using System; +using System.Net.Sockets; +using System.Text; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// + public class PowerMeterKeysightScpi : IPowerMeter + { + #region PublicMembers + #endregion + + #region PrivateMembers + + private const string _READ_ERROR_CODE_CMD = "SYST:ERR?"; + private const string _RESETCMD = "*RST"; + private const string _ISOPCCMD = "*STB? "; + private const string _SELFTESTCMD = "*TST? "; + private const string _MEASURE = "MEAS?"; + private const string _FREE_RUN_MODE = "INIT:CONT ON"; + private const string _SENSE = "SENS"; + private const string _AVERAGE = ":AVER"; + private const string _STATE = ":STAT"; + private const string _DISPLAY = "DISP"; + private const string _WINDOW = ":WIND"; + private const string _NUMERIC = ":NUM"; + private const string _RESOLUTION = ":RES"; + private const string _ZERO = "CALibration:ZERO:AUTO ONCE"; + private const string _AUTO = ":AUTO"; + private const string _CAL = "CAL"; + private const string _ONCE = "ONCE"; + + private int m_PORT = 5025; + private const int m_READ_TIMEOUT = 10000; + + private readonly string _address; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~PowerMeterKeysightScpi() + { + Dispose(false); + } + + /// + /// Calibrate Chanel A or B + /// Channel A = 1 + /// Channel B = 2 + /// + /// + private void Calibrate(int channelNumber) + { + if ((channelNumber < 1) || (channelNumber > 2)) + { + string errMsg = "Channel [" + channelNumber.ToString() + "] Invalid "; + throw new Exception("" + errMsg); + } + + // write calibrate + string command = _CAL + channelNumber.ToString() + _AUTO + " " + _ONCE; + IOWrite(command); + } + + /// + /// Convert scpi data to string + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _tcpStream.Close(); + + _tcpStream.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get the error code. + /// + /// The error code. + /// The error description. + private string GetErrorCode(out int errorCode) + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string command = _READ_ERROR_CODE_CMD + "\n"; + + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert to a string + string rspStr = ConvertToString(ref _readBuffer); + + // parse the response + string[] tokens = rspStr.Split(','); + + errorCode = Util.ConvertStringToInt32(tokens[0]); + + // it should always be 2 + if (tokens.Length >= 2) + { + return tokens[1]; + } + else + { + return ""; + } + } + + /// + /// + /// + /// + private bool HasItTriggered() + { + return false; + // Check the Trigger Event register to see if the event has properly triggered + /*string command = m_ISITCOMPLETEDCMD + "\n"; + string rspStr = IOQuery(command); + bool isTriggered = false; + + string[] tokens = rspStr.Split('\n'); + + // check to see if it is triggered. + if (IsOperationCompleted(tokens[0]) == true) + { + isTriggered = true; + } + + return isTriggered;*/ + } + + /// + /// + /// + /// + /// + private string IOQuery(string command) + { + // send the command + IOWrite(command, false); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // check for errors + int err = 0; + string message = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("PowerMeterKeysightScpi:IOQuery() - Power Meter " + _name + " returned error code: " + err.ToString() + ", " + message); + } + + return rspStr; + } + + /// + /// + /// + /// + private void IOWrite(string command, bool shallWeCheckForError = true) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // check for errors + if (shallWeCheckForError == true) + { + int err = 0; + string errorMessage = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("PowerMeterKeysightScpi:IOWrite() - Device " + _name + " returned error code: " + err.ToString() + "," + errorMessage); + } + } + } + + /// + /// + /// + /// + /// + /// + private bool IsOperationCompleted(string statusString, string expectedResult = "1") + { + bool completed = false; + + // If Scope returns '+x' instead of 'x', where 'x' is any character, trim it. + if (statusString.IndexOf('+') == 0) + { + statusString = statusString.TrimStart('+'); + } + + if (statusString.Equals(expectedResult) == true) + { + completed = true; + } + + return completed; + } + + /// + /// - Set auto averaging + /// - enable or disable filtering + /// + /// + /// + private void SetAverage(int SenseCount, bool enableAutoAverage) + { + string errMsg; + if ((SenseCount < 1) || (SenseCount > 2)) + { + errMsg = "Sensor Count [" + SenseCount.ToString() + "] Invalid "; + throw new Exception(errMsg); + } + + string command = _SENSE + SenseCount.ToString() + _AVERAGE + _STATE + enableAutoAverage.ToString(); + + IOWrite(command); + } + + /*@@@ Not Needed I don't think + /// + /// Set Power Meter Interface + /// + /// + /// + /// + private void SetInterface(uint IPAddress, uint GPIBAddress) + { + // UP Address + // strip off all but last byte + const UInt32 Mask = 0x00000000FF; + + byte[] ByteArray = new byte[sizeof(uint)]; // 4 bytes in a Uint32 + for (int i = 0; i < sizeof(uint); i++) + { + ByteArray[i] = (byte)(IPAddress & Mask); + IPAddress = (IPAddress >> 8); // right shift to next byte + } + + // output SYSTem:COMMunicaiton:LAN:ADDRess + IP Address formatted 0.0.0.0 to 255.255.255.255 + string command = m_SysComm + m_IPAddr + ByteArray[3].ToString() + '.' + ByteArray[2].ToString() + '.' + ByteArray[1].ToString() + '.' + ByteArray[0].ToString(); + IOWrite(command); + + //GPIB Address + if (GPIBAddress > 30) + { + string GPIB_errMsg = "GPIB Address: [" + GPIBAddress + "] Out of Range"; + throw new Exception(GPIB_errMsg); + } + + command = m_SysComm + m_GPIB + GPIBAddress.ToString(); + IOWrite(command); + }*/ + + /// + /// + /// + /// + /// + /// + private void SetResolution(int windowNumber, int numValue, int resolution) + { + + string errMsg; + if ((windowNumber < 1) || (windowNumber > 2)) + { + errMsg = "Window Number[" + windowNumber.ToString() + "] Invalid "; + throw new Exception(errMsg); + } + + if ((numValue < 1) || (numValue > 2)) + { + errMsg = "Numeric [" + numValue.ToString() + "] Invalid "; + throw new Exception(errMsg); + } + + if ((resolution < 1) || (resolution > 4)) + { + errMsg = "Resolution Level [" + resolution.ToString() + "] Invalid "; + throw new Exception(errMsg); + } + + string command = _DISPLAY + _WINDOW + windowNumber.ToString() + _NUMERIC + numValue.ToString() + _RESOLUTION + " " + resolution.ToString(); + + IOWrite(command); + } + + #endregion + + /// + /// PowerMeterKeysightScpi factory constructor + /// + /// + /// + public PowerMeterKeysightScpi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + const int READ_BUFFER_SIZE = 512; + + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + + _readBuffer = new byte[READ_BUFFER_SIZE]; + + _address = _configuration.GetConfigurationValue("PowerMeterKeysightScpi", "Address", "127.0.0.1"); + m_PORT = _configuration.GetConfigurationValue("PowerMeterKeysightScpi", "Address", 5025); + + TcpClient scopeSocketConn = new TcpClient(_address, m_PORT); + + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + + /// + /// + /// + /// + /// + public PowerMeterKeysightScpi(string name, string address) + { + const int READ_BUFFER_SIZE = 512; + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _address = address; + _readBuffer = new byte[READ_BUFFER_SIZE]; + TcpClient scopeSocketConn = new TcpClient(_address, m_PORT); + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + public int Channels + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Scpi Power Meter"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + /// + public bool EnableChannel(int channel, bool enable) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public Power GetMeasurement(int channel) + { + // for now, just use free running mode with default expected power levels + const string EXPECTED_POWER = "DEF"; + const string RESOLUTION = "DEF"; + + //@@@ TBD if this is needed turn off system header + // for now, just use free running mode with default expected power levels + // if we need better resolution, we will extend the IPowerInterface + string command = _FREE_RUN_MODE + "\n"; + IOWrite(command); + + //MEAS1? DEF,DEF,(@1) + //MEAS? DEF,DEF,(@1) + command = _MEASURE + " " + EXPECTED_POWER + "," + RESOLUTION + ",(@" + channel.ToString() + ")" + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + double power = Util.ConvertStringToDouble(tokens[0]); + + return Power.FromWatts(power); + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + // change the timeout to account for the long self test + _tcpStream.ReadTimeout = 90000; + + // send the command and get the response + string command = _SELFTESTCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + //Check if self test is completed; returns status of "0". + if (IsOperationCompleted(tokens[0], "0") == false) + { + string errorMsg = "Power Meter " + _name + " returned an error: " + tokens[0]; + throw new Exception(errorMsg); + } + + _selfTestResult = SelfTestResult.Pass; + + return SelfTestResult.Pass; + } + catch (Exception) + { + throw; + } + finally + { + // restore the timeout + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + } + } + + /// + /// + /// + public void Reset() + { + // Resets the power meter + string command = _RESETCMD + "\n"; + IOWrite(command); + + Thread.Sleep(3000); + + /*command = _ISOPCCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + if (IsOperationCompleted(tokens[0]) == false) + { + throw new Exception("Reset was not completed."); + }*/ + } + + /// + /// + /// + /// + /// + /// + public bool SetFrequency(int channel, Frequency frequency) + { + int freq = Convert.ToInt32(frequency.Hertz); + + string command = "SENSe1:FREQuency " + freq.ToString() + "HZ" + "\n"; + IOWrite(command); + + return true; + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here + try + { + if (_tcpStream != null) + { + _tcpStream.Dispose(); + _tcpStream = null; + } + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + if (errorMsg != "") + { + throw new Exception("System " + _name + " Had an error: " + errorMsg); + } + } + + /// + /// + /// + /// + public bool ZeroMeter() + { + throw new NotImplementedException(); + + // zero the power meter + /* + string command = _ZERO + "\n"; + IOWrite(command); + + // or + if ((channelNumber < 1) || (channelNumber > 4)) + { + string errMsg = "Channel [" + channelNumber.ToString() + "] Invalid "; + throw new Exception(errMsg); + } + + string command = m_CAL + channelNumber.ToString() + m_Zero + m_Auto + m_Space + m_Once; + IOWrite(command);*/ + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpi.csproj b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpi.csproj new file mode 100644 index 0000000..e68df16 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpi.csproj @@ -0,0 +1,34 @@ + + + + net472 + Raytheon.Instruments.PowerMeterKeysightScpi + Power Meter Keysight Scpi implementation + Power Meter Keysight Scpi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpiFactory.cs b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpiFactory.cs new file mode 100644 index 0000000..0ba251e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterKeysightScpi/PowerMeterKeysightScpiFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// PowerMeterKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "PowerMeterKeysightScpiFactory")] + public class PowerMeterKeysightScpiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public PowerMeterKeysightScpiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public PowerMeterKeysightScpiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IPowerMeter)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new PowerMeterKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new PowerMeterSim(name, _configurationManager, _logger); + else + return new PowerMeterKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSim.cs b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSim.cs new file mode 100644 index 0000000..abdf563 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSim.cs @@ -0,0 +1,378 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using NLog; +using Raytheon.Common; +using Raytheon.Units; +using System; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// + public class PowerMeterSim : IPowerMeter + { + #region PublicMembers + #endregion + + #region PrivateMembers + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + private double _lastPowerLevel; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~PowerMeterSim() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + /// + /// PowerMeterSim factory constructor + /// + /// + /// + public PowerMeterSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + _lastPowerLevel = 100.0; + } + + /// + /// + /// + /// + public PowerMeterSim(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + _lastPowerLevel = 100.0; + } + + /// + /// + /// + public int Channels + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Sim Power Meter"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + /// + public bool EnableChannel(int channel, bool enable) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public Power GetMeasurement(int channel) + { + double max = _lastPowerLevel; + + double min = 1.0; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(200); + + return Power.FromWatts(dataToReturn); + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + _selfTestResult = SelfTestResult.Pass; + return _selfTestResult; + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + public void Reset() + { + } + + /// + /// + /// + /// + /// + /// + public bool SetFrequency(int channel, Frequency frequency) + { + return true; + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + _state = State.Uninitialized; + } + } + + /// + /// + /// + /// + public bool ZeroMeter() + { + throw new NotImplementedException(); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSim.csproj b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSim.csproj new file mode 100644 index 0000000..6fe3e1d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSim.csproj @@ -0,0 +1,21 @@ + + + + net472 + Raytheon.Instruments.PowerMeterSim + Power Meter Sim implementation + Power Meter Sim implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSimFactory.cs b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSimFactory.cs new file mode 100644 index 0000000..0fce204 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerMeter/PowerMeterSim/PowerMeterSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// PowerMeterSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "PowerMeterSimFactory")] + public class PowerMeterSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public PowerMeterSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public PowerMeterSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IPowerMeter)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new PowerMeterSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new PowerMeterSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerScpiCommands.cs b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerScpiCommands.cs new file mode 100644 index 0000000..30d5f9a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerScpiCommands.cs @@ -0,0 +1,127 @@ +// Ignore Spelling: FRONTPANEL WATCHDOGDELAY WATCHDOGON WATCHDOGOFF OCP OVP SELFTEST + +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + public class PowerScpiCommands + { + // module current commands + public string _SET_OCP_INRUSH_DELAY_CMD; + public string _SET_OCP_CMD; + public string _SET_OCP_ON_CMD; + public string _READ_CURRENT_CMD; + public string _READ_OCP_CMD; + public string _READ_INRUSH_DELAY_CMD; + //public string _READ_OCP_CMD = "CURR:LIM" ?; + + // module voltage commands + public string _SET_OVP_CMD; + public string _SET_VOLTAGE_SLEW_CMD; + public string _SET_VOLTAGE_SETPOINT_CMD; + public string _SET_CONSTANT_VOLTAGE_CMD; + public string _READ_VOLTAGE_CMD; + public string _READ_VOLTAGE_SETPOINT_CMD; + public string _READ_OVP_CMD; + public string _READ_VOLTAGE_SLEW_CMD; + + // module set output commands + public string _SET_OUTPUT_DISABLE_CMD; + public string _SET_OUTPUT_ENABLE_CMD; + + // module query status + public string _READ_OUTPUT_STATUS_CMD; + public string _READ_ERROR_STATUS_CMD; + public string _READ_PROTECTION_STATUS_CMD; + + // system commands + public string _CLEAR_CMD; + public string _RESET_CMD; + public string _SELFTEST_CMD; + public string _REBOOT_CMD; + public string _READ_ERROR_CODE_CMD; + + // system disable/enable commands + public string _SET_FRONTPANEL_DISABLE_CMD; + public string _SET_FRONTPANEL_ENABLE_CMD; + + // system watchdog commands + public string _SET_WATCHDOGDELAY_CMD; + public string _SET_WATCHDOGON_CMD; + public string _SET_WATCHDOGOFF_CMD; + + // system coupling commands + public string _SET_COUPLE_CHANNELS_CMD; + public string _SET_COUPLE_ON_CMD; + public string _SET_COUPLE_OUTPUT_PROTECT_ON_CMD; + public string _QUERY_COUPLE_CHANNELS_CMD; + public string _QUERY_COUPLE_STATE_CMD; + + // system grouping Commands + public string _SET_GROUP_DEFINE_CMD; + public string _UNGROUP_ALL_CHANNELS_CMD; + public string _QUERY_GROUP_CHANNELS_CMD; + + private void ReadModuleCommands(string defFile) + { + IniFile ini = new IniFile(defFile); + _SET_OCP_INRUSH_DELAY_CMD = ini.ReadValue("MODULE", "SET_INRUSH_DELAY_CMD"); + _SET_OCP_CMD = ini.ReadValue("MODULE", "SET_OCP_CMD"); + _SET_OCP_ON_CMD = ini.ReadValue("MODULE", "SET_OCP_ON_CMD"); + _READ_CURRENT_CMD = ini.ReadValue("MODULE", "READ_CURRENT_CMD"); + _READ_OCP_CMD = ini.ReadValue("MODULE", "READ_OCP_CMD"); + _READ_INRUSH_DELAY_CMD = ini.ReadValue("MODULE", "READ_INRUSH_DELAY_CMD"); + + _SET_OVP_CMD = ini.ReadValue("MODULE", "SET_OVP_CMD"); + _SET_VOLTAGE_SLEW_CMD = ini.ReadValue("MODULE", "SET_VOLTAGE_SLEW_CMD"); + _SET_VOLTAGE_SETPOINT_CMD = ini.ReadValue("MODULE", "SET_VOLTAGE_SETPOINT_CMD"); + _SET_CONSTANT_VOLTAGE_CMD = ini.ReadValue("MODULE", "SET_CONSTANT_VOLTAGE_CMD"); + _READ_VOLTAGE_CMD = ini.ReadValue("MODULE", "READ_VOLTAGE_CMD"); + _READ_VOLTAGE_SETPOINT_CMD = ini.ReadValue("MODULE", "READ_VOLTAGE_SETPOINT_CMD"); + _READ_OVP_CMD = ini.ReadValue("MODULE", "READ_OVP_CMD"); + _READ_VOLTAGE_SLEW_CMD = ini.ReadValue("MODULE", "READ_VOLTAGE_SLEW_CMD"); + + _SET_OUTPUT_DISABLE_CMD = ini.ReadValue("MODULE", "SET_OUTPUT_DISABLE_CMD"); + _SET_OUTPUT_ENABLE_CMD = ini.ReadValue("MODULE", "SET_OUTPUT_ENABLE_CMD"); + _READ_OUTPUT_STATUS_CMD = ini.ReadValue("MODULE", "READ_OUTPUT_STATUS_CMD"); + _READ_ERROR_STATUS_CMD = ini.ReadValue("MODULE", "READ_ERROR_STATUS_CMD"); + _READ_PROTECTION_STATUS_CMD = ini.ReadValue("MODULE", "READ_PROTECTION_STATUS_CMD"); + } + + private void ReadSystemCommands(string defFile) + { + IniFile ini = new IniFile(defFile); + + _CLEAR_CMD = ini.ReadValue("SYSTEM", "CLEAR_CMD"); + _RESET_CMD = ini.ReadValue("SYSTEM", "RESET_CMD"); + _SELFTEST_CMD = ini.ReadValue("SYSTEM", "SELFTEST_CMD"); + _REBOOT_CMD = ini.ReadValue("SYSTEM", "REBOOT_CMD"); + _READ_ERROR_CODE_CMD = ini.ReadValue("SYSTEM", "READ_ERROR_CODE_CMD"); + + _SET_FRONTPANEL_DISABLE_CMD = ini.ReadValue("SYSTEM", "SET_FRONTPANEL_DISABLE_CMD"); + _SET_FRONTPANEL_ENABLE_CMD = ini.ReadValue("SYSTEM", "SET_FRONTPANEL_ENABLE_CMD"); + + _SET_WATCHDOGDELAY_CMD = ini.ReadValue("SYSTEM", "SET_WATCHDOGDELAY_CMD"); + _SET_WATCHDOGON_CMD = ini.ReadValue("SYSTEM", "SET_WATCHDOGON_CMD"); + _SET_WATCHDOGOFF_CMD = ini.ReadValue("SYSTEM", "SET_WATCHDOGOFF_CMD"); + + _SET_COUPLE_CHANNELS_CMD = ini.ReadValue("SYSTEM", "SET_COUPLE_CHANNELS_CMD"); + _SET_COUPLE_ON_CMD = ini.ReadValue("SYSTEM", "SET_COUPLE_ON_CMD"); + _SET_COUPLE_OUTPUT_PROTECT_ON_CMD = ini.ReadValue("SYSTEM", "SET_COUPLE_OUTPUT_PROTECT_ON_CMD"); + _QUERY_COUPLE_CHANNELS_CMD = ini.ReadValue("SYSTEM", "QUERY_COUPLE_CHANNELS"); + _QUERY_COUPLE_STATE_CMD = ini.ReadValue("SYSTEM", "QUERY_COUPLE_STATE"); + + _SET_GROUP_DEFINE_CMD = ini.ReadValue("SYSTEM", "SET_GROUP_DEFINE_CMD"); + _UNGROUP_ALL_CHANNELS_CMD = ini.ReadValue("SYSTEM", "UNGROUP_ALL_CHANNELS_CMD"); + _QUERY_GROUP_CHANNELS_CMD = ini.ReadValue("SYSTEM", "QUERY_GROUP_CHANNELS"); + } + + public PowerScpiCommands(string scpiDefFile) + { + IniFile ini = new IniFile(scpiDefFile); + + ReadModuleCommands(scpiDefFile); + ReadSystemCommands(scpiDefFile); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplyKeysight.cs b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplyKeysight.cs new file mode 100644 index 0000000..bba9a17 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplyKeysight.cs @@ -0,0 +1,979 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Units; +using System; +using System.Net.Sockets; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// A class that provides an interface for controlling power supply modules via SCPI commands. + /// + public class PowerSupplyKeysight : IDCPwr + { + #region PublicClassMembers +#pragma warning disable CS0067 + public event EventHandler OverCurrent; + public event EventHandler OverVoltage; +#pragma warning restore + + #endregion + + #region PrivateClassMembers + + private string _name; + private readonly PowerScpiCommands _scpiCommands; + private double _overCurrentProtection; + private double _overVoltageProtection; + private double _voltageSetpoint; + private readonly double _voltageSetpointInitial; + private readonly double _maxVoltageSetpoint; + private readonly double _minVoltageSetpoint; + private readonly double _inRushDelay; + private readonly double _slewRateVoltsPerSecond; + private readonly int _moduleNumber; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + private State _state; + private const int _READ_TIMEOUT = 5000; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + + #endregion + + #region PublicFuctions + + /// + /// The constructor which sets the power supply to constant voltage mode, set the OCP, OVP and setpoint voltage + /// + /// The logical name of the supply. + /// Scpi commands to use. + /// The overcurrent protection setting (Amps). + /// The overvoltage protection setting (Volts). + /// The voltage setpoint (Volts). + /// The voltage setpoint max (Volts) soft limit. + /// The voltage setpoint min (Volts) soft limit. + /// In rush delay in seconds.-1 to leave it as default + /// The ramp up rate.-1 to leave it as default + /// TCP Stream (Ethernet). + /// The module number (multiple modules in a system). + public PowerSupplyKeysight(string name, PowerScpiCommands scpiCommands, double overCurrentProtection, double overVoltageProtection, double voltageSetpoint, double maxVoltageSetpoint, double minVoltageSetpoint, double inRushDelayInSeconds, double slewRateVoltsPerSecond, NetworkStream tcpStream, int moduleNumber = -1) + { + const int READ_BUFFER_SIZE = 512; + + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _scpiCommands = scpiCommands; + _overCurrentProtection = overCurrentProtection; + _overVoltageProtection = overVoltageProtection; + _voltageSetpoint = voltageSetpoint; + _voltageSetpointInitial = voltageSetpoint; + _maxVoltageSetpoint = maxVoltageSetpoint; + _minVoltageSetpoint = minVoltageSetpoint; + _inRushDelay = inRushDelayInSeconds; + _slewRateVoltsPerSecond = slewRateVoltsPerSecond; + _moduleNumber = moduleNumber; + _readBuffer = new byte[READ_BUFFER_SIZE]; + + _tcpStream = tcpStream; + + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return _state == State.Uninitialized; + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public Current CurrentLimit + { + get + { + return Current.FromAmps(ReadOcpSetpoint()); + } + + set + { + _overCurrentProtection = value.Amps; + + SetAndConfirmOCP(); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Keysight Scpi Power Supply"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool Enabled + { + get + { + return IsOutputOn(); + } + + set + { + if (value == false) + { + Off(); + } + else + { + On(); + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Returns this object's module number. + /// + /// The module number. + /*public int GetModuleNumber() + { + return _moduleNumber; + }*/ + + /// + /// + /// + public bool InhibitEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + // make sure it is off + Off(); + + // set up power supply + // for 6702 look at page 36 + SetConstantVoltageMode(); + SetAndConfirmOVP(); + SetAndConfirmOCP(); + SetVoltageSetpoint(_voltageSetpoint); + + // -1.0 means leave as default + if (_inRushDelay != -1.0) + { + SetAndConfirmInRushDelay(); + } + + // -1.0 means leave as default + if (_slewRateVoltsPerSecond != -1.0) + { + SetAndConfirmSlewRate(); + } + + _state = State.Ready; + } + else + { + throw new Exception("PowerSupplyKeysight::Initialize() - " + _name + " expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + + /// + /// Control the power supply internal mechanical relay state + /// + /// True to connect, false to disconnect + public void MechanicalRelayOutputControl(bool shallWeConnect) + { + throw new Exception("Not yet implemented"); + } + + /// + /// + /// + /// + public Current MeasureCurrent() + { + return Current.FromAmps(ReadCurrent()); + } + + /// + /// + /// + /// + public Voltage MeasureVoltage() + { + return Voltage.FromVolts(ReadVoltage()); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public Voltage OutputVoltage + { + get + { + return Voltage.FromVolts(ReadVoltageSetpoint()); + } + + set + { + double volts = value.Volts; + + // do not let host set the voltage out of range, unless it is being set to 0 + if (volts != 0.0) + { + if (volts > _maxVoltageSetpoint || volts < _minVoltageSetpoint) + { + throw new Exception("PowerSupplyKeysight::OutputVoltage() - Desired voltage setpoint out of range for supply " + _name + ". Commanded setpoint: " + value.ToString() + ", Max: " + _maxVoltageSetpoint.ToString() + ", Min: " + _minVoltageSetpoint.ToString()); + } + } + + SetVoltageSetpoint(volts); + } + } + + /// + /// + /// + public Voltage OverVoltageProtection + { + get + { + return Voltage.FromVolts(ReadOvpSetpoint()); + } + + set + { + _overVoltageProtection = value.Volts; + + SetAndConfirmOVP(); + } + } + + /// + /// + /// + public bool OverVoltageProtectionEnabled + { + get + { + return true; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException("PowerSupplyKeysight::PerformSelfTest() - self test is not implemented in the " + _name + " supply"); + } + + /// + /// Read the overvoltage and overcurrent protection status. + /// + /// The binary sum of all bits (decimal value) set in the Questionable Status Condition register. + public int ReadProtectionStatus() + { + // send the command + string command = _scpiCommands._READ_PROTECTION_STATUS_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + int ret = Util.ConvertStringToInt32(tokens[0]); + + return ret; + } + + /// + /// + /// + public void Reset() + { + throw new NotImplementedException("PowerSupplyKeysight::Reset() - cant reset a module, only the system"); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + + public void Shutdown() + { + if (_state == State.Ready) + { + string errorMsg = ""; + + try + { + Off(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + + if (errorMsg != "") + { + throw new Exception("PowerSupplyKeysight::ShutdDown() - Power Supply " + _name + " had an error: " + errorMsg); + } + } + } + + /// + /// + /// + public Voltage VoltageSoftLimit + { + get + { + return Voltage.FromVolts(_maxVoltageSetpoint); + } + + set + { + throw new NotImplementedException(); + } + } + + #endregion + + #region PrivateFuctions + /// + /// The finalizer. + /// + ~PowerSupplyKeysight() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + try + { + Off(); + } + catch (Exception) + { + } + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + private double GetSlewRate() + { + // send the command + string command = _scpiCommands._READ_VOLTAGE_SLEW_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // parse the response + double rsp = Util.ConvertStringToDouble(tokens[0]); + + return rsp; + } + + /// + /// Query the output state. + /// + /// The output state. True = On, False = Off. + private bool IsOutputOn() + { + // send the command and read the rsp + string command = _scpiCommands._READ_OUTPUT_STATUS_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + int rsp = Util.ConvertStringToInt32(tokens[0]); + + if (rsp == 0) + { + return false; + } + else + { + return true; + } + } + + /// + /// Turn off the output. + /// + private void Off() + { + // send the command + string command = _scpiCommands._SET_OUTPUT_DISABLE_CMD + "," + GetModuleCmd() + "\n"; + IOWrite(command); + } + + /// + /// Turn on the output. + /// + private void On() + { + // send the command + string command = _scpiCommands._SET_OUTPUT_ENABLE_CMD + "," + GetModuleCmd() + "\n"; + IOWrite(command); + } + + /// + /// Read the current. + /// + /// The current (Amps). + private double ReadCurrent() + { + // send the command + string command = _scpiCommands._READ_CURRENT_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // parse the response + double rsp = Util.ConvertStringToDouble(tokens[0]); + + return rsp; + } + + /// + /// Read the voltage. + /// + /// The voltage (Volts). + private double ReadVoltage() + { + // send the command + string command = _scpiCommands._READ_VOLTAGE_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // parse the response + double rsp = Util.ConvertStringToDouble(tokens[0]); + + return rsp; + } + + /// + /// set the slew rate of the supply + /// + /// slew in volts per second + private void SetAndConfirmSlewRate() + { + // send the command + string command = _scpiCommands._SET_VOLTAGE_SLEW_CMD + " " + _slewRateVoltsPerSecond + "," + GetModuleCmd() + "\n"; + IOWrite(command); + + // read back the slew + double programmedSlewValue = GetSlewRate(); + + if (programmedSlewValue != _slewRateVoltsPerSecond) + { + string errMsg = "PowerSupplyKeysight:SetAndConfirmSlewRate() - power supply " + _name + " reported a setpoint slew rate that was not cmmanded. Trying to set it to: " + _slewRateVoltsPerSecond + ", the power supply returned: " + programmedSlewValue; + throw new Exception(errMsg); + } + } + + /// + /// Set the voltage setpoint. + /// + /// The desired voltage setpoint. + private void SetVoltageSetpoint(double voltage) + { + const double TOLERANCE = .1; + + // do not let host set the voltage out of range, unless it is being set to 0 + if (voltage != 0.0) + { + if (voltage > _maxVoltageSetpoint || voltage < _minVoltageSetpoint) + { + throw new Exception("PowerSupplyKeysight:SetVoltageSetpoint() - Desired voltage setpoint for supply " + _name + " out of range. Commanded setpoint: " + voltage.ToString() + ", Max: " + _maxVoltageSetpoint.ToString() + ", Min: " + _minVoltageSetpoint.ToString()); + } + + if (voltage > _overVoltageProtection) + { + throw new Exception("PowerSupplyKeysight:SetVoltageSetpoint() - Desired voltage setpoint for supply " + _name + " out of range. Commanded setpoint: " + voltage.ToString() + ", OVP is: " + _overVoltageProtection.ToString()); + } + } + + // send the command + string voltageCommand = _scpiCommands._SET_VOLTAGE_SETPOINT_CMD + " " + voltage + "," + GetModuleCmd() + "\n"; + IOWrite(voltageCommand); + + // read back the voltage to make sure the command worked + double voltageSetpointReturned = ReadVoltageSetpoint(); + + if (voltageSetpointReturned < (voltage - TOLERANCE)) + { + string errMsg = "PowerSupplyKeysight:SetVoltageSetpoint() - power supply " + _name + " reported setpoint voltage lower than expected. Trying to set it to: " + voltage + ", the power supply returned: " + voltageSetpointReturned; + throw new Exception(errMsg); + } + else if (voltageSetpointReturned > (voltage + TOLERANCE)) + { + string errMsg = "PowerSupplyKeysight:SetVoltageSetpoint() - power supply " + _name + " reported setpoint voltage higher than expected. Trying to set it to: " + voltage + ", the power supply returned: " + voltageSetpointReturned; + throw new Exception(errMsg); + } + + // update our member now that everything checks out + _voltageSetpoint = voltage; + } + + /// + /// + /// + private string GetResponse() + { + string response = String.Empty; + + int bytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + if (bytesRead > 0) + { + response = Encoding.ASCII.GetString(_readBuffer, 0, bytesRead); + } + + return response; + } + + /// + /// + /// + /// + private void CommSetReadTimeout(int readTimeout) + { + _tcpStream.ReadTimeout = readTimeout; + } + + /// + /// + /// + private void CommInterfaceWrite(byte[] dataToWrite) + { + _tcpStream.Write(dataToWrite, 0, dataToWrite.Length); + } + + /// + /// Get the error code. + /// + /// The error code (number). + private int GetErrorCode() + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string command = _scpiCommands._READ_ERROR_STATUS_CMD + "\n"; + + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + CommInterfaceWrite(commandBuffer); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + string rspStr = GetResponse(); + + // parse the response + string[] tokens = rspStr.Split(','); + + int ret = Util.ConvertStringToInt32(tokens[0]); + + return ret; + } + + /// + /// Get the module formatted string. + /// + /// The module formatted string. + private string GetModuleCmd() + { + string ret = ""; + + if (_moduleNumber > 0) + { + ret = "(@" + _moduleNumber + ")"; + } + + return ret; + } + + /// + /// Send a command to the power supply and get the response. + /// + /// The command to send. + /// The response. + private string IOQuery(string commandString) + { + // not calling IOWrite() so IOWrite() can check for errors after each write + + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + // send the data out + CommInterfaceWrite(commandBuffer); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + string rspStr = GetResponse(); + + // check for errors + int err = GetErrorCode(); + if (err != 0) + { + throw new Exception("PowerSupplyKeysight:IOQuery() - Power Supply " + _name + " returned error code: " + err.ToString()); + } + + return rspStr; + } + + /// + /// Sends a SCPI Command to the instrument. + /// + /// The SCPI Command to be sent to the instrument. + private void IOWrite(string commandString) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + // send the data out + CommInterfaceWrite(commandBuffer); + + // check for errors + int err = GetErrorCode(); + if (err != 0) + { + throw new Exception("PowerSupplyKeysight:IOWrite() - Power Supply " + _name + " returned error code: " + err.ToString()); + } + } + + /// + /// Reads the overcurrent protection setting from the supply. + /// + /// The overcurrent setting (Amps). + private double ReadOcpSetpoint() + { + // send the command + string command = _scpiCommands._READ_OCP_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // parse the response + double rsp = Util.ConvertStringToDouble(tokens[0]); + + return rsp; + } + + /// + /// + /// + /// + private double ReadInrushDelaySetpoint() + { + // send the command + string command = _scpiCommands._READ_INRUSH_DELAY_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // parse the response + double rsp = Util.ConvertStringToDouble(tokens[0]); + + return rsp; + } + + /// + /// Read the overvoltage protection setting from the supply. + /// + /// The overvoltage setting (Volts). + private double ReadOvpSetpoint() + { + // send the command + string command = _scpiCommands._READ_OVP_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // parse the response + double rsp = Util.ConvertStringToDouble(tokens[0]); + + return rsp; + } + + /// + /// Read the voltage setpoint. + /// + /// The voltage< setpoint (Volts)./returns> + private double ReadVoltageSetpoint() + { + // send the command + string command = _scpiCommands._READ_VOLTAGE_SETPOINT_CMD + " " + GetModuleCmd() + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // parse the response + double rsp = Util.ConvertStringToDouble(tokens[0]); + + return rsp; + } + + /// + /// Put supply in constant voltage mode. + /// + private void SetConstantVoltageMode() + { + // send the command + string command = _scpiCommands._SET_CONSTANT_VOLTAGE_CMD + "," + GetModuleCmd() + "\n"; + IOWrite(command); + } + + /// + /// + /// + private void SetAndConfirmInRushDelay() + { + // set in rush delay + if (_inRushDelay != -1) + { + string inrushCommand = _scpiCommands._SET_OCP_INRUSH_DELAY_CMD + " " + _inRushDelay + "," + GetModuleCmd() + "\n"; + IOWrite(inrushCommand); + + // confirm + double inrushCommandSetpointReturned = ReadInrushDelaySetpoint(); + if (inrushCommandSetpointReturned != _inRushDelay) + { + string errMsg = "PowerSupplyKeysight::SetAndConfirmInRushDelay() - power supply " + _name + " reported in rush delay not as expected. Trying to set it to: " + _inRushDelay + ", the power supply returned: " + inrushCommandSetpointReturned; + throw new Exception(errMsg); + } + } + } + + /// + /// Sets and confirms the overcurrent protection value. + /// + private void SetAndConfirmOCP() + { + // set current + string setCurrentCommand = _scpiCommands._SET_OCP_CMD + " " + _overCurrentProtection + "," + GetModuleCmd() + "\n"; + IOWrite(setCurrentCommand); + + // confirm + double currentSetpointReturned = ReadOcpSetpoint(); + if (currentSetpointReturned != _overCurrentProtection) + { + string errMsg = "PowerSupplyKeysight::SetAndConfirmOCP() - power supply " + _name + " reported setpoint current not as expected. Trying to set it to: " + _overCurrentProtection + ", the power supply returned: " + currentSetpointReturned; + throw new Exception(errMsg); + } + + //enable OCP + string ocpEnableCommand = _scpiCommands._SET_OCP_ON_CMD + "," + GetModuleCmd() + "\n"; + IOWrite(ocpEnableCommand); + } + + /// + /// Sets and confirms the overvoltage protection value. + /// + private void SetAndConfirmOVP() + { + // send the command + string command = _scpiCommands._SET_OVP_CMD + " " + _overVoltageProtection + "," + GetModuleCmd() + "\n"; + IOWrite(command); + + // confirm + double ovpReturned = ReadOvpSetpoint(); + + if (ovpReturned != _overVoltageProtection) + { + string errMsg = "PowerSupplyKeysight:SetAndConfirmOVP() - power supply " + _name + " reported setpoint ovp not as expected. Trying to set it to: " + _overVoltageProtection + ", the power supply returned: " + ovpReturned; + throw new Exception(errMsg); + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysight.cs b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysight.cs new file mode 100644 index 0000000..4dcab0b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysight.cs @@ -0,0 +1,1238 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + + +// Ignore Spelling: ocp ovp + +using System; +using System.Collections.Generic; +using System.Net.Sockets; +using System.Text; +using Raytheon.Common; +using Raytheon.Units; +using NLog; +using System.IO; +using System.Reflection; +using System.Linq; +using Raytheon.Instruments.PowerSupply; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// A class to control a power supply system. + /// + public class PowerSupplySystemKeysight : IPowerSupplySystem, IDisposable + { + #region PrivateClassMembers + + private byte[] _readBuffer; + private NetworkStream _tcpStream; + private readonly SortedDictionary _powerModuleMap; + private Dictionary _powerModuleInfoDict = new Dictionary(); + + //@@@ Don't want this here, but until the interface can change..this is the only option + private readonly SortedDictionary _powerModuleInitialVoltageSetpoint; + private string _name; + private object _syncObj = new Object(); + private const int _READ_TIMEOUT = 5000; + private readonly List _moduleNumbersThatHaveBeenAdded; + private readonly PowerScpiCommands _scpiCommands; + private State _state; + private readonly string _address; + private readonly int _port; + private SelfTestResult _selfTestResult; + private readonly bool _shallWeCoupleOutputProtection; + + private List _groupedModules; + private List _coupledModules; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + private IConfigurationFile _powerSupplySystemConfig; + + #endregion + + #region PublicFuctions + + /// + /// PowerSupplySystemKeysight factory constructor + /// + /// + /// + /// + public PowerSupplySystemKeysight(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + const int READ_BUFFER_SIZE = 512; + + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string powerSupplySystemDefPath = _configuration.GetConfigurationValue(deviceName, PowerSupply.ConfigXml.POWER_SUPPLY_SYSTEM_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(powerSupplySystemDefPath)) + powerSupplySystemDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, powerSupplySystemDefPath)); + + _powerSupplySystemConfig = new ConfigurationFile(powerSupplySystemDefPath); + + _address = _powerSupplySystemConfig.ReadValue(deviceName, PowerSupply.ConfigIni.ETHERNET_ADDRESS.ToString()); + Int32.TryParse(_powerSupplySystemConfig.ReadValue(deviceName, PowerSupply.ConfigIni.ETHERNET_PORT.ToString()), out _port); + _port = _powerSupplySystemConfig.ReadValue(deviceName, PowerSupply.ConfigIni.ETHERNET_PORT.ToString(), 1); + + _shallWeCoupleOutputProtection = _powerSupplySystemConfig.ReadValue(deviceName, PowerSupply.ConfigIni.ENABLE_OUTPUT_COUPLING_PROTECTION.ToString(), false); + + _readBuffer = new byte[READ_BUFFER_SIZE]; + _powerModuleInitialVoltageSetpoint = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + _moduleNumbersThatHaveBeenAdded = new List(); + _powerModuleMap = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + + var scpiDefPath = _powerSupplySystemConfig.ReadValue(deviceName, PowerSupply.ConfigIni.SCPI_DEF_FILEPATH.ToString()); + if (!Path.IsPathRooted(scpiDefPath)) + scpiDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, scpiDefPath)); + _scpiCommands = new PowerScpiCommands(scpiDefPath); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Keysight Scpi Power Supply System called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + lock (_syncObj) + { + if (value == true) + { + // send the command + string command = _scpiCommands._SET_FRONTPANEL_ENABLE_CMD + "\n"; + IOWrite(command); + } + else + { + string command = _scpiCommands._SET_FRONTPANEL_DISABLE_CMD + "\n"; + IOWrite(command); + } + } + } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + lock (_syncObj) + { + if (value == true) + { + // send the command + string command = _scpiCommands._SET_FRONTPANEL_ENABLE_CMD + "\n"; + IOWrite(command); + } + else + { + string command = _scpiCommands._SET_FRONTPANEL_DISABLE_CMD + "\n"; + IOWrite(command); + } + } + } + } + + /// + /// Get the error code. + /// + /// The error code. + /// The error description. + public string GetErrorCode(out int errorCode) + { + lock (_syncObj) + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string command = _scpiCommands._READ_ERROR_CODE_CMD + "\n"; + + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + CommInterfaceWrite(commandBuffer); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + string rspStr = GetResponse(); + + // parse the response + string[] tokens = rspStr.Split(','); + + errorCode = Util.ConvertStringToInt32(tokens[0]); + + // it should always be 2 + if (tokens.Length >= 2) + { + return tokens[1]; + } + else + { + return ""; + } + } + } + + /// + /// Get the names of the modules in this system + /// + /// + public List GetModuleNames() + { + lock (_syncObj) + { + List moduleNames = new List(); + + foreach (KeyValuePair modules in _powerModuleMap) + { + moduleNames.Add(modules.Key); + } + + return moduleNames; + } + } + + /// + /// Get the dictionary that contains configuration information for each module + /// + /// + public Dictionary GetPowerSupplyModuleInfoDict(string powerSystem) + { + lock (_syncObj) + { + return _powerModuleInfoDict; + } + } + + /// + /// Get the overcurrent protection setting. + /// + /// The module to get the overcurrent protection setting. + /// The current (Amps). + public double GetOverCurrentSetting(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::GetOverCurrentSetting() - could not find supply: " + name.ToUpper() + " in System " + _name); + } + + return _powerModuleMap[name.ToUpper()].CurrentLimit.Amps; + } + } + + /// + /// Get the overvoltage protection setting. + /// + /// The module to get the overvoltage protection setting. + /// The voltage (Volts). + public double GetOverVoltageSetting(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::GetOverVoltageSetting() - could not find supply: " + name.ToUpper() + " in System " + _name); + } + + return _powerModuleMap[name.ToUpper()].OverVoltageProtection.Volts; + } + } + + /// + /// + /// + /// + public double GetSlewRate(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::GetSlewRate() - could not find supply: " + name.ToUpper() + " in System " + _name); + } + + throw new NotImplementedException(); + + //return _powerModuleMap[name.ToUpper()].GetSlewRate(); + } + } + + /// + /// Get the voltage setpoint. + /// + /// The module to get the voltage setpoint setting. + /// the voltage setpoint (Volts). + public double GetVoltageSetting(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::GetVoltageSetting() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].OutputVoltage.Volts; + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + try + { + TcpClient powerSupplySocketConn = new TcpClient(_address, _port); + // connect to the supply and setup stream + _tcpStream = powerSupplySocketConn.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + + Reset(); + + string coupledModules = _powerSupplySystemConfig.ReadValue(Name, PowerSupply.ConfigIni.COUPLED_MODULES.ToString()); + string groupedModules = _powerSupplySystemConfig.ReadValue(Name, PowerSupply.ConfigIni.GROUPED_MODULES.ToString()); + + string moduleDef = _powerSupplySystemConfig.ReadValue(Name, PowerSupply.ConfigIni.MODULE_DEFINITION.ToString()); + _coupledModules = coupledModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); + _groupedModules = groupedModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); + List powerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); + + bool systemRebooted = false; + if (_groupedModules.Count() > 1) + GroupModules(_groupedModules, out systemRebooted); + else if (_coupledModules.Count() > 1) + CoupleModules(_coupledModules); + + if (systemRebooted) + { + _tcpStream.Close(); + powerSupplySocketConn.Close(); + powerSupplySocketConn = new TcpClient(_address, _port); + _tcpStream = powerSupplySocketConn.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + + if (_groupedModules.Count() > 1) + { + powerModules.Clear(); + // since modules are grouped, we pick the first module as the representative module + powerModules.Add(_groupedModules[0]); + } + + double overCurrentProtection; + double overVoltageProtection; + double voltageSetpoint; + double maxVoltageSetpoint; + double minVoltageSetpoint; + double slewRateVoltsPerSecond; + double inRushDelaySecs; + int moduleNumber = -1; + for (int i = 0; i < powerModules.Count(); i++) + { + string moduleName = powerModules[i]; + + int.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.INDEX.ToString()), out moduleNumber); + Double.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.OCP.ToString()), out overCurrentProtection); + Double.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.OVP.ToString()), out overVoltageProtection); + Double.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.VOLTAGE_SETPOINT.ToString()), out voltageSetpoint); + Double.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.MIN_VOLTAGE.ToString()), out minVoltageSetpoint); + Double.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.MAX_VOLTAGE.ToString()), out maxVoltageSetpoint); + + try + { + if (!Double.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.VOLTAGE_SLEW_RATE.ToString()), out slewRateVoltsPerSecond)) + slewRateVoltsPerSecond = -1.0; + } + catch + { + slewRateVoltsPerSecond = -1.0; + } + + try + { + if (!Double.TryParse(_powerSupplySystemConfig.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.IN_RUSH_DELAY_SECS.ToString()), out inRushDelaySecs)) + inRushDelaySecs = -1.0; + } + catch + { + inRushDelaySecs = -1.0; + } + + _powerModuleInfoDict[moduleName] = new PowerSupplyModuleInfo(moduleNumber, overCurrentProtection, overVoltageProtection, voltageSetpoint, slewRateVoltsPerSecond, minVoltageSetpoint, maxVoltageSetpoint); + + // create and initialize the power module + IDCPwr powerSupply = new PowerSupplyKeysight(moduleName, _scpiCommands, overCurrentProtection, overVoltageProtection, voltageSetpoint, maxVoltageSetpoint, minVoltageSetpoint, inRushDelaySecs, slewRateVoltsPerSecond, _tcpStream, moduleNumber); + + // remember that we have added this module + _moduleNumbersThatHaveBeenAdded.Add(moduleNumber); + + // remember the module name + _powerModuleMap.Add(moduleName.ToUpper(), powerSupply); + + // remember the initial voltage setpoint + _powerModuleInitialVoltageSetpoint.Add(moduleName.ToUpper(), voltageSetpoint); + + powerSupply.Initialize(); + } + + if (_shallWeCoupleOutputProtection == true) + { + EnableOutputProtectionCoupling(); + } + + _state = State.Ready; + } + catch (Exception) + { + throw; + } + } + else + { + throw new Exception("PowerSupplySystemKeysight::Initialize() - expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// Query the output state. + /// + /// The module to query. + /// The output state. True = On, False = Off. + public bool IsOutputOn(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::IsOutputOn() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].Enabled; + } + } + + /// + /// Send a command to the power supply and get the response. + /// + /// The command to send. + /// The power supply response. + public string IOQuery(string commandString) + { + lock (_syncObj) + { + // not calling IOWrite() so IOWrite() can check for errors after each write + + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + // send the data out + CommInterfaceWrite(commandBuffer); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + string rspStr = GetResponse(); + + // check for errors + int errorCode = -1; + string err = GetErrorCode(out errorCode); + if (errorCode != 0) + { + throw new Exception("PowerSupplySystemKeysight::IOQuery() - System " + _name + " returned error: " + err); + } + + return rspStr; + } + } + + /// + /// Sends a SCPI Command to the instrument. + /// + /// The SCPI Command to be sent to the instrument. + public void IOWrite(string commandString) + { + lock (_syncObj) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + // send the data out + CommInterfaceWrite(commandBuffer); + + // check for errors + int errorCode = -1; + string err = GetErrorCode(out errorCode); + if (errorCode != 0) + { + throw new Exception("PowerSupplySystemKeysight::IOWrite() - System " + _name + " returned error: " + err); + } + } + } + + /// + /// Control the power supply internal mechanical relay state + /// + /// The module to act on + /// True to connect, false to disconnect + public void MechanicalRelayOutputControl(string name, bool shallWeConnect) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::MechanicalRelayOutputControl() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + _powerModuleMap[name.ToUpper()].MechanicalRelayOutputControl(shallWeConnect); + } + } + + /// + /// Read the current. + /// + /// The name of the module. + /// The current (Amps). + public double MeasureCurrent(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::MeasureCurrent() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].MeasureCurrent().Amps; + } + } + + /// + /// Read the voltage. + /// + /// The name of the module. + /// The voltage (Volts). + public double MeasureVoltage(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::MeasureVoltage() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].MeasureVoltage().Volts; + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// Turn the output off. + /// + /// The name of the module. + public void Off(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::Off() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + _powerModuleMap[name.ToUpper()].Enabled = false; + } + } + + /// + /// Turn the output on. + /// + /// The name of the module. + public void On(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::On() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + _powerModuleMap[name.ToUpper()].Enabled = true; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + lock (_syncObj) + { + // change the timeout to account for the long self test + CommSetReadTimeout(30000); + + // send the command and get the response + string command = _scpiCommands._SELFTEST_CMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + int rsp = Util.ConvertStringToInt32(tokens[0]); + + if (rsp != 0) + { + _selfTestResult = SelfTestResult.Fail; + string errorMsg = "PowerSupplySystemKeysight::PerformSelfTest() - System " + _name + " returned an error: " + rsp.ToString(); + throw new Exception(errorMsg); + } + + _selfTestResult = SelfTestResult.Pass; + + return SelfTestResult.Pass; + } + } + catch (Exception) + { + _selfTestResult = SelfTestResult.Fail; + throw; + } + finally + { + // restore the timeout + CommSetReadTimeout(_READ_TIMEOUT); + } + } + + /// + /// Read the overvoltage and overcurrent protection status. + /// + /// The name of the module. + /// The binary sum of all bits (decimal value) set in the Questionable Status Enable register. + public int ReadProtectionStatus(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::ReadProtectionStatus() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].ReadProtectionStatus(); + } + } + + /// + /// reads power data + /// + /// + /// A Power Data Object + public PowerData ReadPowerData(string name) + { + lock (_syncObj) + { + // voltage, voltage setpoint, current, output status + double voltage = MeasureVoltage(name); + double voltageSetpoint = GetVoltageSetting(name); + double current = MeasureCurrent(name); + bool outputStatus = IsOutputOn(name); + int faultStatus = ReadProtectionStatus(name); + double overVoltageProtection = GetOverVoltageSetting(name); + double overCurrentProtection = GetOverCurrentSetting(name); + + return new PowerData(voltage, voltageSetpoint, overVoltageProtection, current, overCurrentProtection, outputStatus, faultStatus); + } + } + + /// + /// reads power data + /// + /// + /// + /// + /// + /// + /// + public void ReadPowerData(string moduleName, out double voltage, out double voltageSetpoint, out double current, out bool outputStatus, out int faultStatus) + { + lock (_syncObj) + { + // voltage, voltage setpoint, current, output status + voltage = MeasureVoltage(moduleName); + voltageSetpoint = GetVoltageSetting(moduleName); + current = MeasureCurrent(moduleName); + outputStatus = IsOutputOn(moduleName); + faultStatus = ReadProtectionStatus(moduleName); + } + } + + /// + /// Resets the instrument + /// + public void Reset() + { + lock (_syncObj) + { + // send the command + string command = _scpiCommands._RESET_CMD + "\n"; + IOWrite(command); + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// Changes the setpoint voltage back to the value that was passed into the constructor + /// + /// The name of the power module + public void SetInitialVoltage(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::SetInitialVoltage() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + double initializeVoltage = _powerModuleInitialVoltageSetpoint[name.ToUpper()]; + + SetVoltageSetpoint(name.ToUpper(), initializeVoltage); + } + } + + /// + /// Set the slew rate + /// + /// slew in volts per second + public void SetSlewRate(string name, double commandedSlew) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::SetSlewRate() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + throw new NotImplementedException(); + + //_powerModuleMap[name.ToUpper()].SetSlewRate(commandedSlew); + } + } + + /// + /// Set the OCP value + /// + /// The name of the power module + /// The value in amps to set as the OCP + public void SetOverCurrentProtection(string moduleName, double ocpValue) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::SetOverCurrentrotection() - could not find supply: " + moduleName.ToUpper() + " In System " + _name); + } + + _powerModuleMap[moduleName.ToUpper()].CurrentLimit = Current.FromAmps(ocpValue); + } + } + + /// + /// + /// + /// The name of the module + /// The value in volts to set as the OVP + public void SetOverVoltageProtection(string moduleName, double ovpValue) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::SetOverVoltageProtection() - could not find supply: " + moduleName.ToUpper() + " In System " + _name); + } + + _powerModuleMap[moduleName.ToUpper()].OverVoltageProtection = Voltage.FromVolts(ovpValue); + } + } + + /// + /// Set the voltage setpoint. + /// + /// The name of the module. + /// The desired voltage (in volts). + public void SetVoltageSetpoint(string name, double volts) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemKeysight::SetVoltageSetpoint() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + _powerModuleMap[name.ToUpper()].OutputVoltage = Voltage.FromVolts(volts); + } + } + + /// + /// Turns off each supply, resets the system and disposes the socket + /// + public void Shutdown() + { + lock (_syncObj) + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + foreach (KeyValuePair entry in _powerModuleMap) + { + entry.Value.Shutdown(); + } + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + + try + { + //Reset System + Reset(); + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here + try + { + if (_tcpStream != null) + { + _tcpStream.Dispose(); + _tcpStream = null; + } + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + + if (errorMsg != "") + { + throw new Exception("PowerSupplySystemKeysight::ShutdDown() - System " + _name + " Had an error: " + errorMsg); + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// Turn off the watchdog capability. + /// + public void WatchdogDisable() + { + lock (_syncObj) + { + // send the command + string command = _scpiCommands._SET_WATCHDOGOFF_CMD + "\n"; + IOWrite(command); + } + } + + /// + /// Turn on the watchdog capability. + /// + /// The watchdog time in seconds. + public void WatchdogEnable(uint time) + { + lock (_syncObj) + { + string timeCommand = _scpiCommands._SET_WATCHDOGDELAY_CMD + " " + time.ToString() + "\n"; + IOWrite(timeCommand); + + // send the command + string onCommand = _scpiCommands._SET_WATCHDOGON_CMD + "\n"; + IOWrite(onCommand); + } + } + + /// + /// gets system name + /// + /// + public string GetSystemName() + { + return _name; + } + + #endregion + + #region PrivateFuctions + /// + /// The Finalizer. + /// + ~PowerSupplySystemKeysight() + { + Dispose(false); + } + + /// + /// Read data from the comm interface + /// + private string GetResponse() + { + string response = String.Empty; + + int bytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + if (bytesRead > 0) + { + response = Encoding.ASCII.GetString(_readBuffer, 0, bytesRead); + } + + return response; + } + + /// + /// Set the comm interface timeout + /// + /// + private void CommSetReadTimeout(int readTimeout) + { + _tcpStream.ReadTimeout = readTimeout; + } + + /// + /// Write data to the comm interface + /// + private void CommInterfaceWrite(byte[] dataToWrite) + { + _tcpStream.Write(dataToWrite, 0, dataToWrite.Length); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + lock (_syncObj) + { + if (disposing) + { + if (_state == State.Ready) + { + try + { + foreach (KeyValuePair entry in _powerModuleMap) + { + entry.Value.Shutdown(); + } + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + + try + { + //Reset System + Reset(); + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here if it is not null (Could be null if Shutdown() was called) + try + { + if (_tcpStream != null) + { + _tcpStream.Dispose(); + _tcpStream = null; + } + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + } + } + } + + /// + /// Turns on the output protection coupling + /// + private void EnableOutputProtectionCoupling() + { + string command = _scpiCommands._SET_COUPLE_OUTPUT_PROTECT_ON_CMD + "\n"; + IOWrite(command); + } + + /// + /// Group Modules Together + /// + /// + private void GroupModules(List moduleNameList, out bool systemRebooted) + { + // 1. Group the channels + string groupListToDefine = "(@"; + string groupListToQuery = ""; + string moduleNumber = ""; + + systemRebooted = false; + + for (int i = 0; i < moduleNameList.Count; i++) + { + moduleNumber = _powerSupplySystemConfig.ReadValue(moduleNameList[i], PowerSupply.ConfigIni.INDEX.ToString()); + + groupListToDefine += moduleNumber; + groupListToQuery += moduleNumber; + + // add a ',' if this is not the final element in the list + if (i < moduleNameList.Count() - 1) + { + groupListToDefine += ","; + groupListToQuery += ","; + } + else + { + groupListToDefine += ")"; + } + } + + groupListToQuery = "\"" + groupListToQuery + "\"\n"; + + // see if channels are grouped + string queryGroupCommand = _scpiCommands._QUERY_COUPLE_CHANNELS_CMD+ "\n"; + + for (int i = 1; i <= 2; i++) + { + string respStr = IOQuery(queryGroupCommand); + + // if modules are not grouped + if (respStr != groupListToQuery) + { + groupListToDefine += "\n"; + + string groupCommand = _scpiCommands._SET_GROUP_DEFINE_CMD + " " + groupListToDefine; + + IOWrite(groupCommand); + } + else if (i == 1) + { + break; + } + else + { + string command = _scpiCommands._REBOOT_CMD + "\n"; + // after grouping the modules, need to reboot system for it to take effect + IOWrite(command); + + // wait 20 seconds for reboot + Thread.Sleep(20000); + + systemRebooted = true; + } + } + } + + /// + /// Couple modules together (output synchronization) + /// + /// + private void CoupleModules(List moduleNameList) + { + string coupleListToDefine = ""; + string moduleNumber = ""; + + for (int i = 0; i < moduleNameList.Count(); i++) + { + moduleNumber = _powerSupplySystemConfig.ReadValue($"{Name}.{moduleNameList[i]}", PowerSupply.ConfigIni.INDEX.ToString()); + + coupleListToDefine += moduleNumber; + + // add a ',' if this is not the final element in the list + if (i < moduleNameList.Count() - 1) + { + coupleListToDefine += ","; + } + } + + coupleListToDefine += "\n"; + + // see if channels are coupled + string queryCoupleChannelCommand = _scpiCommands._QUERY_COUPLE_CHANNELS_CMD + "\n"; + + for (int i = 1; i <= 2; i++) + { + string respStr = IOQuery(queryCoupleChannelCommand); + + string queryCoupleStateCommand = _scpiCommands._QUERY_COUPLE_STATE_CMD + "\n"; + string respStr2 = IOQuery(queryCoupleStateCommand); + + if (coupleListToDefine != respStr || respStr2 == "0\n") + { + // send command to couple modules + string command = _scpiCommands._SET_COUPLE_CHANNELS_CMD + " " + coupleListToDefine; + IOWrite(command); + + // turn coupling on + command = _scpiCommands._SET_COUPLE_ON_CMD + "\n"; + IOWrite(command); + + // output protection on + command = _scpiCommands._SET_COUPLE_OUTPUT_PROTECT_ON_CMD + "\n"; + IOWrite(command); + } + else if (i == 1) + break; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysight.csproj b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysight.csproj new file mode 100644 index 0000000..ffcb647 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysight.csproj @@ -0,0 +1,36 @@ + + + + + net472 + Raytheon.Instruments.PowerSupplySystemKeysight + Power Supply System Keysight Manual implementation + Power Supply System Keysight Manual implementation + Library + + + + 1.1.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysightFactory.cs b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysightFactory.cs new file mode 100644 index 0000000..0d48e51 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemKeysight/PowerSupplySystemKeysightFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// PowerSupplySystemKeysightFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "PowerSupplySystemKeysightFactory")] + public class PowerSupplySystemKeysightFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public PowerSupplySystemKeysightFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public PowerSupplySystemKeysightFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IPowerSupplySystem)); + } + + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new PowerSupplySystemKeysight(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new PowerSupplySystemSim(name, _configurationManager, _logger); + else + return new PowerSupplySystemKeysight(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySim.cs b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySim.cs new file mode 100644 index 0000000..53401cb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySim.cs @@ -0,0 +1,600 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Units; +using System; +using System.Net.Sockets; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// A class that provides an interface for controlling simulated power supply systems and their modules. + /// + public class PowerSupplySim : IDCPwr + { + #region PublicClassMembers +#pragma warning disable CS0067 + public event EventHandler OverCurrent; + public event EventHandler OverVoltage; +#pragma warning restore + + #endregion + + #region PublicFuctions + + /// + /// The constructor for a sim power supply (simulated). + /// + /// The overcurrent protection setting (Amps). + /// The overvoltage protection setting (Volts). + /// The voltage setpoint (Volts). + /// The max voltage setpoint (Volts). + /// The min voltage setpoint (Volts). + /// The module number (multiple modules in a system). + public PowerSupplySim(string name, double overCurrentProtection, double overVoltageProtection, double voltageSetpoint, double maxVoltageSetpoint, double minVoltageSetpoint, double slewRateVoltsPerSecond, int moduleNumber = -1) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _overCurrentProtection = overCurrentProtection; + _overVoltageProtection = overVoltageProtection; + _voltageSetpoint = voltageSetpoint; + _voltageSetpointInitial = voltageSetpoint; + _maxVoltageSetpoint = maxVoltageSetpoint; + _minVoltageSetpoint = minVoltageSetpoint; + _moduleNumber = moduleNumber; + _isPowerOn = false; + _slewRateVoltsPerSecond = slewRateVoltsPerSecond; + + // make sure it is off + Enabled = false; + + // set up power supply + OutputVoltage = Voltage.FromVolts(_voltageSetpoint); + + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public Current CurrentLimit + { + get + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + return Current.FromAmps(_overCurrentProtection); + } + + set + { + _overCurrentProtection = value.Amps; + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Sim Power Supply called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this object's resources. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool Enabled + { + get + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + return _isPowerOn; + } + + set + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + if (value == false) + { + + _isPowerOn = false; + } + else + { + _isPowerOn = true; + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public double GetSlewRate() + { + return _slewRateVoltsPerSecond; + } + + /// + /// + /// + public bool InhibitEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + _state = State.Ready; + } + else + { + throw new Exception("PowerSupplySim::Initialize() - expected the supply " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// Control the power supply internal mechanical relay state + /// + /// True to connect, false to disconnect + public void MechanicalRelayOutputControl(bool shallWeConnect) + { + // nothing to do here + } + + /// + /// + /// + /// + public Current MeasureCurrent() + { + return Current.FromAmps(ReadCurrent()); + } + + /// + /// + /// + /// + public Voltage MeasureVoltage() + { + return Voltage.FromVolts(ReadVoltage()); + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + public Voltage OutputVoltage + { + get + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + return Voltage.FromVolts(_voltageSetpoint); + } + + set + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + double volts = value.Volts; + + // do not let host set the voltage out of range, unless it is being set to 0 + if (volts != 0.0) + { + if (volts > _maxVoltageSetpoint || volts < _minVoltageSetpoint) + { + throw new Exception("PowerSupplySim::OutputVoltage() - Desired voltage setpoint out of range for supply " + _name + ". Commanded setpoint: " + value.ToString() + ", Max: " + _maxVoltageSetpoint.ToString() + ", Min: " + _minVoltageSetpoint.ToString()); + } + } + + _voltageSetpoint = volts; + } + } + + /// + /// + /// + public Voltage OverVoltageProtection + { + get + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + return Voltage.FromVolts(_overVoltageProtection); + } + + set + { + _overVoltageProtection = value.Volts; + } + } + + /// + /// + /// + public bool OverVoltageProtectionEnabled + { + get + { + return true; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// Reads the overcurrent and overvoltage protection (simulation). + /// + /// No Errors (simulated). + public int ReadProtectionStatus() + { + const int PROTECTION_STATUS = 0; + + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + return PROTECTION_STATUS; + } + + /// + /// + /// + public void Reset() + { + // nothing to do + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + /*public void SetSlewRate(double slew) + { + _slew = slew; + }*/ + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + Off(); + + Reset(); + + _state = State.Uninitialized; + } + } + + /// + /// + /// + public Voltage VoltageSoftLimit + { + get + { + return Voltage.FromVolts(_maxVoltageSetpoint); + } + set + { + throw new NotImplementedException(); + } + } + + #endregion + + #region PrivateClassMembers + + private string _name; + private double _overCurrentProtection; + private double _overVoltageProtection; + private double _voltageSetpoint; + private double _voltageSetpointInitial; + private readonly double _maxVoltageSetpoint; + private readonly double _minVoltageSetpoint; + private readonly int _moduleNumber; + private bool _isPowerOn; + private double _slewRateVoltsPerSecond; + private State _state; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + + #endregion + + #region PrivateFuctions + + /// + /// The finalizer. + /// + ~PowerSupplySim() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Off(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Returns this object module number. + /// + /// The module number. + /*public int GetModuleNumber() + { + return _moduleNumber; + }*/ + + /// + /// Turn the output off (simulated). + /// + private void Off() + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + _isPowerOn = false; + } + + /// + /// Turn the output on (simulated). + /// + private void On() + { + // a small 10 ms sleep for simulation + Thread.Sleep(10); + + _isPowerOn = true; + } + + /// + /// Read the current (simulated). + /// + /// The current (simulated). + private double ReadCurrent() + { + // a small 10 ms sleep for simulation + Thread.Sleep(100); + + double currentToReturn = 0.0; + + if (_isPowerOn) + { + double maxCurrent = _overCurrentProtection; + double minCurrent = _overCurrentProtection - .5; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + currentToReturn = (seed * (maxCurrent - minCurrent)) + minCurrent; + } + + return currentToReturn; + } + + /// + /// Read the voltage. + /// + /// The voltage (simulated). + private double ReadVoltage() + { + // a small 10 ms sleep for simulation + Thread.Sleep(100); + + double voltageToReturn = 0.0; + + if (_isPowerOn) + { + double maxVoltage = _voltageSetpoint + 1; + double minVoltage = _voltageSetpoint - 1; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + voltageToReturn = (seed * (maxVoltage - minVoltage)) + minVoltage; + } + + return voltageToReturn; + } + + #endregion + + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSim.cs b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSim.cs new file mode 100644 index 0000000..bf94212 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSim.cs @@ -0,0 +1,934 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + + +// Ignore Spelling: ocp + +using System; +using System.Collections.Generic; +using Raytheon.Units; +using System.Threading; +using NLog; +using Raytheon.Common; +using System.Net.Sockets; +using System.Linq; +using System.IO; +using System.Reflection; +using Raytheon.Instruments.PowerSupply; + +namespace Raytheon.Instruments +{ + /// + /// A class to control a power supply system. + /// + public class PowerSupplySystemSim : IPowerSupplySystem + { + #region PrivateClassMembers + private SortedDictionary _powerModuleMap; + private Dictionary _powerModuleInfoDict = new Dictionary(); + + private SortedDictionary _powerModuleInitialVoltageSetpoint; + private string _name; + private object _syncObj = new Object(); + private List _moduleNumbersThatHaveBeenAdded; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFuctions + /// + /// The Finalizer. + /// + ~PowerSupplySystemSim() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + lock (_syncObj) + { + if (disposing) + { + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception) + { + } + + try + { + foreach (KeyValuePair entry in _powerModuleMap) + { + entry.Value.Shutdown(); + } + } + catch (Exception) + { + } + + _state = State.Uninitialized; + } + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// PowerSupplySystemSim factory constructor + /// + /// + /// + /// + public PowerSupplySystemSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + try + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string powerSupplySystemDefPath = _configuration.GetConfigurationValue(deviceName, PowerSupply.ConfigXml.POWER_SUPPLY_SYSTEM_DEF_FILEPATH.ToString()); + + if (!Path.IsPathRooted(powerSupplySystemDefPath)) + powerSupplySystemDefPath = Path.GetFullPath(Path.Combine(assemblyFolder, powerSupplySystemDefPath)); + + IConfigurationFile config = new ConfigurationFile(powerSupplySystemDefPath); + + _powerModuleInitialVoltageSetpoint = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + + _moduleNumbersThatHaveBeenAdded = new List(); + + _powerModuleMap = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + + string moduleDef = config.ReadValue(deviceName, PowerSupply.ConfigIni.MODULE_DEFINITION.ToString()); + List powerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList(); + + double overCurrentProtection; + double overVoltageProtection; + double voltageSetpoint; + double maxVoltageSetpoint; + double minVoltageSetpoint; + double slewRateVoltsPerSecond; + double inRushDelaySecs; + int moduleNumber = -1; + for (int i = 0; i < powerModules.Count(); i++) + { + string moduleName = powerModules[i]; + + int.TryParse(config.ReadValue($"{deviceName}.{moduleName}", PowerSupply.ConfigIni.INDEX.ToString()), out moduleNumber); + Double.TryParse(config.ReadValue($"{deviceName}.{moduleName}", PowerSupply.ConfigIni.OCP.ToString()), out overCurrentProtection); + Double.TryParse(config.ReadValue($"{deviceName}.{moduleName}", PowerSupply.ConfigIni.OVP.ToString()), out overVoltageProtection); + Double.TryParse(config.ReadValue($"{deviceName}.{moduleName}", PowerSupply.ConfigIni.VOLTAGE_SETPOINT.ToString()), out voltageSetpoint); + Double.TryParse(config.ReadValue($"{deviceName}.{moduleName}", PowerSupply.ConfigIni.MIN_VOLTAGE.ToString()), out minVoltageSetpoint); + Double.TryParse(config.ReadValue($"{deviceName}.{moduleName}", PowerSupply.ConfigIni.MAX_VOLTAGE.ToString()), out maxVoltageSetpoint); + + try + { + if (!Double.TryParse(config.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.VOLTAGE_SLEW_RATE.ToString()), out slewRateVoltsPerSecond)) + slewRateVoltsPerSecond = -1.0; + } + catch + { + slewRateVoltsPerSecond = -1.0; + } + + try + { + if (!Double.TryParse(config.ReadValue($"{Name}.{moduleName}", PowerSupply.ConfigIni.IN_RUSH_DELAY_SECS.ToString()), out inRushDelaySecs)) + inRushDelaySecs = -1.0; + } + catch + { + inRushDelaySecs = -1.0; + } + + _powerModuleInfoDict[moduleName] = new PowerSupplyModuleInfo(moduleNumber, overCurrentProtection, overVoltageProtection, voltageSetpoint, slewRateVoltsPerSecond, minVoltageSetpoint, maxVoltageSetpoint); + + // create and initialize the power module + IDCPwr powerSupply = new PowerSupplySim(moduleName, overCurrentProtection, overVoltageProtection, voltageSetpoint, maxVoltageSetpoint, minVoltageSetpoint, inRushDelaySecs, moduleNumber); + + // remember that we have added this module + _moduleNumbersThatHaveBeenAdded.Add(moduleNumber); + + // remember the module name + _powerModuleMap.Add(moduleName.ToUpper(), powerSupply); + + // remember the initial voltage setpoint + _powerModuleInitialVoltageSetpoint.Add(moduleName.ToUpper(), voltageSetpoint); + } + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// Couple modules together + /// + /// + public void CoupleChannels(List moduleNameList) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Power Supply System Sim called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set { ; } + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Get the error code. + /// + /// The error code. + /// The error description. + public string GetErrorCode(out int errorCode) + { + lock (_syncObj) + { + errorCode = 0; + return ""; + } + } + + /// + /// Get the names of the modules in this system + /// + /// + public List GetModuleNames() + { + lock (_syncObj) + { + List moduleNames = new List(); + + foreach (KeyValuePair modules in _powerModuleMap) + { + moduleNames.Add(modules.Key); + } + + return moduleNames; + } + } + + /// + /// Get the dictionary that contains configuration information for each module + /// + /// + public Dictionary GetPowerSupplyModuleInfoDict(string powerSystem) + { + lock (_syncObj) + { + return _powerModuleInfoDict; + } + } + + /// + /// Get the overcurrent protection setting. + /// + /// The module to get the overcurrent protection setting. + /// The current (Amps). + public double GetOverCurrentSetting(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::GetOverCurrentSetting() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].CurrentLimit.Amps; + } + } + + /// + /// Get the overvoltage protection setting. + /// + /// The module to get the overvoltage protection setting. + /// The voltage (Volts). + public double GetOverVoltageSetting(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::GetOverVoltageSetting() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].OverVoltageProtection.Volts; + } + } + + /// + /// + /// + /// + public double GetSlewRate(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::GetSlewRate() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + throw new NotImplementedException(); + + //return _powerModuleMap[name.ToUpper()].GetSlewRate(); + } + } + + /// + /// Get the voltage setpoint. + /// + /// The module to get the voltage setpoint setting. + /// the voltage setpoint (Volts). + public double GetVoltageSetting(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::GetVoltageSetting() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].OutputVoltage.Volts; + } + } + + /// + /// Group Modules Together + /// + /// + public void GroupModules(List moduleNameList) + { + lock (_syncObj) + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + PerformSelfTest(); + + // initialize each module + foreach (KeyValuePair powerModPair in _powerModuleMap) + { + powerModPair.Value.Initialize(); + } + + _state = State.Ready; + } + else + { + throw new Exception("PowerSupplySystemSim::Initialize() - expected the System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// Send a command and return the response + /// + /// + /// + public string IOQuery(string commandString) + { + Thread.Sleep(500); + + // return something + return "1.11"; + } + + /// + /// Send a command + /// + /// + public void IOWrite(string commandString) + { + Thread.Sleep(50); + } + + /// + /// Query the output state. + /// + /// The module to query. + /// The output state. True = On, False = Off. + public bool IsOutputOn(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::IsOutputOn() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].Enabled; + } + } + + /// + /// Control the power supply internal mechanical relay state + /// + /// The module to act on + /// True to connect, false to disconnect + public void MechanicalRelayOutputControl(string name, bool shallWeConnect) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::MechanicalRelayOutputControl() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + } + } + + /// + /// Read the current. + /// + /// The name of the module. + /// The current (Amps). + public double MeasureCurrent(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::MeasureCurrent() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].MeasureCurrent().Amps; + } + } + + /// + /// Read the voltage. + /// + /// The name of the module. + /// The voltage (Volts). + public double MeasureVoltage(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::MeasureVoltage() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].MeasureVoltage().Volts; + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// Turn the output off. + /// + /// The name of the module. + public void Off(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::Off() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + _powerModuleMap[name.ToUpper()].Enabled = false; + } + } + + /// + /// Turn the output on. + /// + /// The name of the module. + public void On(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::On() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + _powerModuleMap[name.ToUpper()].Enabled = true; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Pass; + + return _selfTestResult; + } + + /// + /// Read the overvoltage and overcurrent protection status. + /// + /// The name of the module. + /// The binary sum of all bits (decimal value) set in the Questionable Status Enable register. + public int ReadProtectionStatus(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::ReadProtectionStatus() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + return _powerModuleMap[name.ToUpper()].ReadProtectionStatus(); + } + } + + /// + /// + /// + /// + /// + public PowerData ReadPowerData(string name) + { + lock (_syncObj) + { + // voltage, voltage setpoint, current, output status + double voltage = MeasureVoltage(name); + double voltageSetpoint = GetVoltageSetting(name); + double current = MeasureCurrent(name); + bool outputStatus = IsOutputOn(name); + int faultStatus = ReadProtectionStatus(name); + double overVoltageProtection = GetOverVoltageSetting(name); + double overCurrentProtection = GetOverCurrentSetting(name); + + return new PowerData(voltage, voltageSetpoint, overVoltageProtection, current, overCurrentProtection, outputStatus, faultStatus); + } + } + + /// + /// + /// + public void Reset() + { + lock (_syncObj) + { + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + /// + public void SetInitialVoltage(string name) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::SetInitialVoltage() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + double initializeVoltage = _powerModuleInitialVoltageSetpoint[name.ToUpper()]; + + SetVoltageSetpoint(name.ToUpper(), initializeVoltage); + } + } + + /// + /// Set the slew rate + /// + /// slew in volts per second + public void SetSlewRate(string name, double commandedSlew) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::SetSlewRate() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + throw new NotImplementedException(); + + //_powerModuleMap[name.ToUpper()].SetSlewRate(commandedSlew); + } + } + + /// + /// + /// + /// + /// + public void SetOverCurrentProtection(string moduleName, double ocpValue) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::SetOverCurrentProtection() - could not find supply: " + moduleName.ToUpper() + " In System " + _name); + } + + _powerModuleMap[moduleName.ToUpper()].CurrentLimit = Current.FromAmps(ocpValue); + } + } + + /// + /// + /// + /// + /// + public void SetOverVoltageProtection(string moduleName, double ovpValue) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::SetOverVoltageProtection() - could not find supply: " + moduleName.ToUpper() + " In System " + _name); + } + + _powerModuleMap[moduleName.ToUpper()].OverVoltageProtection = Voltage.FromVolts(ovpValue); + } + } + + /// + /// Set the voltage setpoint. + /// + /// The name of the module. + /// The desired voltage. + public void SetVoltageSetpoint(string name, double volts) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == false) + { + throw new Exception("PowerSupplySystemSim::SetVoltageSetpoint() - could not find supply: " + name.ToUpper() + " In System " + _name); + } + + _powerModuleMap[name.ToUpper()].OutputVoltage = Voltage.FromVolts(volts); + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + string errorMsg = ""; + + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + try + { + foreach (KeyValuePair entry in _powerModuleMap) + { + entry.Value.Shutdown(); + } + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + try + { + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + + if (errorMsg != "") + { + throw new Exception("PowerSupplySystemSim::ShutdDown() - System " + _name + " had an error: " + errorMsg); + } + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// Turn off the watchdog capability. + /// + public void WatchdogDisable() + { + lock (_syncObj) + { + } + } + + /// + /// Turn on the watchdog capability. + /// + /// The watchdog time in seconds. + public void WatchdogEnable(uint time) + { + lock (_syncObj) + { + } + } + + /// + /// Adds another power supply to the Power Supply System + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void AddPowerSupply(string name, double overCurrentProtection, double overVoltageProtection, double voltageSetpoint, double maxVoltageSetpoint, double minVoltageSetpoint, int moduleNumber = -1) + { + lock (_syncObj) + { + if (_powerModuleMap.ContainsKey(name.ToUpper()) == true) + { + throw new Exception("PowerSupplySystemSim::AddPowerSupply() - system already contains a supply named: " + name.ToUpper() + " In System " + _name); + } + + // check to see if this index has already been added + // would like to ask the IDCPwr object, but that functionality is not exposed in the interface + if (_moduleNumbersThatHaveBeenAdded.Contains(moduleNumber) == true) + { + throw new Exception("PowerSupplySystemSim::AddPowerSupply() - module number has already been added: " + moduleNumber + " In System " + _name); + } + + // confirm we are already initialized + if (_state != State.Uninitialized) + { + throw new Exception("PowerSupplySystemSim::AddPowerSupply() - System " + _name + " must be Uninitialized when adding power supplies. Current state is: " + _state.ToString()); + } + + // create and initialize the power module + IDCPwr powerSupply = new PowerSupplySim(name, overCurrentProtection, overVoltageProtection, voltageSetpoint, maxVoltageSetpoint, minVoltageSetpoint, moduleNumber); + + _moduleNumbersThatHaveBeenAdded.Add(moduleNumber); + + _powerModuleMap.Add(name.ToUpper(), powerSupply); + + _powerModuleInitialVoltageSetpoint.Add(name.ToUpper(), voltageSetpoint); + } + } + + /// + /// returns system name + /// + /// + public string GetSystemName() => Name; + + /// + /// reads power data + /// + /// + /// + /// + /// + /// + /// + public void ReadPowerData(string moduleName, out double voltage, out double voltageSetpoint, out double current, out bool outputStatus, out int faultStatus) + { + lock (_syncObj) + { + // voltage, voltage setpoint, current, output status + voltage = MeasureVoltage(moduleName); + voltageSetpoint = GetVoltageSetting(moduleName); + current = MeasureCurrent(moduleName); + outputStatus = IsOutputOn(moduleName); + faultStatus = ReadProtectionStatus(moduleName); + } + + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSim.csproj b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSim.csproj new file mode 100644 index 0000000..91d5ef8 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSim.csproj @@ -0,0 +1,23 @@ + + + + + net472 + Raytheon.Instruments.PowerSupplySystemSim + Power Supply System Sim implementation + Power Supply System Sim implementation + Library + + + + 1.1.0 + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSimFactory.cs b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSimFactory.cs new file mode 100644 index 0000000..740d3ee --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/PowerSupply/PowerSupplySystemSim/PowerSupplySystemSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// PowerSupplySystemSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "PowerSupplySystemSimFactory")] + public class PowerSupplySystemSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public PowerSupplySystemSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public PowerSupplySystemSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IPowerSupplySystem)); + } + + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new PowerSupplySystemSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + return new PowerSupplySystemSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpi.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpi.cs new file mode 100644 index 0000000..ce11503 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpi.cs @@ -0,0 +1,913 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Net.Sockets; +using System.Text; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// A class for controlling a scope via scpi commands + /// + public class ScopeKeysightScpi : IOscilloScope + { + #region PublicMembers + #endregion + + #region PrivateMembers + /*private enum SourceType + { + CHANNEL, + FUNCTION + }*/ + + // if other commands are needed http://www.keysight.com/upload/cmc_upload/All/Infiniium_prog_guide.pdf pg 770 + private const string m_SUBTRACTFUNC = ":SUBT "; + private const string m_MEASFALLCMD = ":MEAS:FALL? "; + private const string m_MEASRISCMD = ":MEAS:RISetime? "; + private const string m_MEASVTIMCMD = ":MEAS:VTIM? "; + + private const string _READ_ERROR_CODE_CMD = "SYST:ERR?"; + private const string m_MEASFREQCMD = ":MEAS:FREQ? "; + private const string m_SINGLECMD = ":SINGle"; + private const string m_STOPCMD = ":STOP"; + private const string m_RUNCMD = ":RUN"; + private const string m_RESETCMD = "*RST"; + //private const string m_ISOPCCMD = "*OPC? "; + private const string m_ISITCOMPLETEDCMD = ":TER? "; + private const string m_SELFTESTCMD = "*TST? "; + private const string m_COLON = ":"; + private const string m_COMMA = ","; + private const string m_QUESTMARK = "?"; + private const string m_SPACE = " "; + private const string m_SLASH = "\\"; + private const string m_DOUBLESLASH = "\\\\"; + private const string m_DOUBLEQUOTES = "\""; + + // Turn Headers Off when Returning Values to Numeric Variables + private const string m_SYSHEADEROFFCMD = ":SYST:HEAD OFF"; + private const string m_ANALAEDGCMD = ":ANALyze:AEDGes "; + private const string m_ANALASIGTYPECMD = ":ANALyze:SIGNal:TYPE"; + private const string m_ANALASIGTYPE_OPTION = "PAM4"; + private const string m_CHANCMD = "CHAN"; + private const string m_FUNCCMD = "FUNC"; + private const string m_CHANDISPCMD = ":DISP "; + private const string m_CHANINPUTCMD = ":INP "; + private const string m_INPUTIMPEDANCECMD = "DC"; + private const string m_TIMESCALECMD = ":TIM:SCAL "; + private const string m_TIMEOFFSETCMD = ":TIM:POS "; + private const string m_TRIGSRCCMD = ":TRIG:EDGE:SOUR "; + private const string m_TRIGLEVCMD = ":TRIG:LEV "; + private const string m_RISETRIGEDGESELCMD = ":TRIG:EDGE:SLOP POS"; + private const string m_FALLTRIGEDGESELCMD = ":TRIG:EDGE:SLOP NEG"; + private const string m_VOLTPERDIVCMD = ":SCAL "; + private const string m_VOLTOFFSETCMD = ":OFFS "; + + // The :MEASure:CLEar command clears the measurement results from the screen + // and disables all previously enabled measurements. + private const string m_MEASCLEARCMD = ":MEAS:CLE"; + private const string m_MEASDELTCMD = ":MEAS:DELT"; + private const string m_MEASDELTDEFCMD = ":MEAS:DELT:DEF"; + private const string m_MEASSOURCMD = ":MEAS:SOUR"; + + // These threshold settings in voltages are used for rise/fall measurements. + private const string m_MEASTHRRFALABSCMD = ":MEAS:THR:RFAL:ABS"; + private const string m_MEASTHRGENABSCMD = ":MEAS:THR:GEN:ABS"; + private const string m_MEASTHRGENMETHCMD = ":MEAS:THR:GEN:METH"; + private const string m_MEASTHRGENTOPBABSCMD = ":MEAS:THR:GEN:TOPB:ABS"; + private const string m_MEASTHRGENTOPBABS_OPTION = "5.0,1.0"; + private const string m_MEASTHRGENTOPBMETHCMD = ":MEAS:THR:GEN:TOPB:METH"; + + // The :MEASure:PWIDth command measures the width of the first positive pulse on the screen + // using the mid-threshold levels of the waveform(50% levels with standard measurements selected). + private const string m_MEASPWIDCMD = ":MEAS:PWID? "; + + private const string m_MEASTHRMETH_OPTION = "ABS"; + + // Trigger sweep + private const string m_ISTRIGGEREDCMD = ":TRIG:SWE? "; + private const string m_TRIGGERCMD = ":TRIG:SWE "; + private const string m_TRIGGER_OPTION = "TRIG"; + + // ON or OFF + private const string m_OPTION_ON = "ON"; + private const string m_OPTION_OFF = "OFF"; + + private const string m_IMAGE_DEST = @"\Users\Public\Documents"; + private const string m_DESIRED_FOLDER = @"\Scope_Measurements"; + private const string m_IMAGE_FORMAT = "GIF"; + private const string m_IMAGE_SOURCE = "SCR"; + private const string m_SAVEIMAGECMD = ":DISK:SAVE:IMAGe "; + + // Maximum number of channels provided by scope. + private const int m_MAXNUMOFCHANN = 4; + private const int m_READ_TIMEOUT = 5000; + + private readonly string _address; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~ScopeKeysightScpi() + { + Dispose(false); + } + + /// + /// Convert scpi data to string + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _tcpStream.Close(); + + _tcpStream.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get the error code. + /// + /// The error code. + /// The error description. + private string GetErrorCode(out int errorCode) + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string command = _READ_ERROR_CODE_CMD + "\n"; + + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert to a string + string rspStr = ConvertToString(ref _readBuffer); + + // parse the response + string[] tokens = rspStr.Split(','); + + errorCode = Util.ConvertStringToInt32(tokens[0]); + + // it should always be 2 + if (tokens.Length >= 2) + { + return tokens[1]; + } + else + { + return ""; + } + } + + /// + /// + /// + /// + /// + /// + private bool IsOperationCompleted(string statusString, string expectedResult = "1") + { + bool completed = false; + + // If Scope returns '+x' instead of 'x', where 'x' is any character, trim it. + if (statusString.IndexOf('+') == 0) + { + statusString = statusString.TrimStart('+'); + } + + if (statusString.Equals(expectedResult) == true) + { + completed = true; + } + + return completed; + } + + #endregion + + #region PublicFunctions + /// + /// ScopeKeysightScpi factory constructor + /// + /// + /// + public ScopeKeysightScpi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("ScopeKeysightScpi", "Address", ""); + int port = _configuration.GetConfigurationValue("ScopeKeysightScpi", "Port", 0); + + const int READ_BUFFER_SIZE = 512; + _readBuffer = new byte[READ_BUFFER_SIZE]; + + TcpClient scopeSocketConn = new TcpClient(_address, port); + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + public ScopeKeysightScpi(string name, string address, int port) + { + const int READ_BUFFER_SIZE = 512; + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _address = address; + _readBuffer = new byte[READ_BUFFER_SIZE]; + TcpClient scopeSocketConn = new TcpClient(_address, port); + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void ConfigureChannel(int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance) + { + // make sure it is stopped first + string command = m_STOPCMD + "\n"; + IOWrite(command); + + /*command = m_ISOPCCMD + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + // check to see if STOP was completed. + if (IsOperationCompleted(tokens[0]) == false) + { + throw new Exception("STOP was not completed."); + }*/ + + // clear the measurement + command = m_MEASCLEARCMD + "\n"; + IOWrite(command); + + //1. time per division + command = m_TIMESCALECMD + timePerDivison.ToString() + "\n"; + IOWrite(command); + + //2. time offset + command = m_TIMEOFFSETCMD + timeOffset.ToString() + "\n"; + IOWrite(command); + + //3. Volt per division + command = m_COLON + m_CHANCMD + channelNumber.ToString() + m_VOLTPERDIVCMD + voltageScale.ToString() + "\n"; + IOWrite(command); + + //4. Volt offset + command = m_COLON + m_CHANCMD + channelNumber.ToString() + m_VOLTOFFSETCMD + voltageOffset.ToString() + "\n"; + IOWrite(command); + + // It sets input impedance to 1M ohmns. + // The value of inputImpedance is expected to be "DC", equivalent to 1M ohmn; otherwise, it outputs error. + if (inputImpedance.ToUpper().Trim() != m_INPUTIMPEDANCECMD.ToUpper()) + { + throw new Exception("ScopeSetupChannel() expected inputImpedance to be DC."); + } + + command = m_COLON + m_CHANCMD + channelNumber.ToString() + m_CHANINPUTCMD + inputImpedance + "\n"; + IOWrite(command); + + // It turns on the specified channel. + command = m_COLON + m_CHANCMD + channelNumber.ToString() + m_CHANDISPCMD + m_OPTION_ON + "\n"; + IOWrite(command); + + // start it back up + command = m_RUNCMD + "\n"; + IOWrite(command); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Scpi Scope"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public bool HasItTriggered() + { + // Check the Trigger Event register to see if the event has properly triggered + + string command = m_ISITCOMPLETEDCMD + "\n"; + //string command = m_ISTRIGGEREDCMD + "\n"; + string rspStr = IOQuery(command); + bool isTriggered = false; + + string[] tokens = rspStr.Split('\n'); + + // check to see if it is triggered. + if (IsOperationCompleted(tokens[0]) == true) + { + isTriggered = true; + } + + return isTriggered; + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + + /// + /// + /// + /// + /// + public string IOQuery(string command) + { + // send the command + IOWrite(command, false); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // check for errors + int err = 0; + string errorMessage = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("ScopeKeysightScpi:IOQuery() - Scope " + _name + " returned error code: " + err.ToString() + "," + errorMessage); + } + + return rspStr; + } + + /// + /// + /// + /// + public void IOWrite(string command, bool shallWeCheckForError = true) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // check for errors + if (shallWeCheckForError == true) + { + int err = 0; + string errorMessage = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("ScopeKeysightScpi:IOWrite() - Scope " + _name + " returned error code: " + err.ToString() + "," + errorMessage); + } + } + } + + /// + /// + /// + /// + public double MeasureFallTime(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + public double MeasureFrequency(int channelNumber) + { + // turn off system header + string command = m_SYSHEADEROFFCMD + "\n"; + IOWrite(command); + + // send the command to read the data + command = m_MEASFREQCMD + m_CHANCMD + channelNumber.ToString() + "\n"; + + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + double freq = Util.ConvertStringToDouble(tokens[0]); + + return freq; + } + + /// + /// + /// + /// + public double MeasureMaxVoltage(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public double MeasureMinVoltage(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public double MeasurePulseWidth(int channelNumber) + { + // turn off system header + string command = m_SYSHEADEROFFCMD + "\n"; + IOWrite(command); + + // send the command to read the data + command = m_MEASPWIDCMD + m_CHANCMD + channelNumber.ToString() + "\n"; + + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + double pulseWidth = Util.ConvertStringToDouble(tokens[0]); + + return pulseWidth; + } + + /// + /// + /// + /// + public double MeasureRiseTime(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public double MeasureVoltageLevel(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + // change the timeout to account for the long self test + _tcpStream.ReadTimeout = 90000; + + // send the command and get the response + string command = m_SELFTESTCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + //Check if self test is completed; returns status of "0". + if (IsOperationCompleted(tokens[0], "0") == false) + { + _selfTestResult = SelfTestResult.Fail; + string errorMsg = "System " + _name + " returned an error: " + tokens[0]; + throw new Exception(errorMsg); + } + else + { + _selfTestResult = SelfTestResult.Pass; + } + + return _selfTestResult; + } + catch (Exception) + { + throw; + } + finally + { + // restore the timeout + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + } + } + + /// + /// + /// + public void Reset() + { + // Resets the oscilloscope + string command = m_RESETCMD + "\n"; + IOWrite(command); + + // just a swag + Thread.Sleep(3000); + + /*command = m_ISOPCCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + if (IsOperationCompleted(tokens[0]) == false) + { + throw new Exception("Reset was not completed."); + }*/ + } + + /// + /// + /// + public void SaveImage(string fileName) + { + try + { + string timeStamp_date = DateTime.Now.ToString("yyyyMMdd"); + string timeStamp_sec = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"); + string folderTimeStamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm"); + + string srcPath = $"{m_DOUBLESLASH}{_address}{m_IMAGE_DEST}{m_DESIRED_FOLDER}{m_SLASH}{timeStamp_date}{m_SLASH}{folderTimeStamp}{m_SLASH}"; + + bool exists = System.IO.Directory.Exists(srcPath); + + if (!exists) + { + try + { + System.IO.Directory.CreateDirectory(srcPath); + //m_SrcDirectory = $"{m_DOUBLESLASH}{_address}{m_IMAGE_DEST}{m_DESIRED_FOLDER}{m_SLASH}{testUnit}"; + // m_TimeStampeDate = timeStamp_date; + } + catch (Exception) + { + Reset(); + throw; + } + } + + string m_scopeFileName = $"{timeStamp_date}{m_SLASH}{folderTimeStamp}{m_SLASH}{fileName}_{timeStamp_sec}.{m_IMAGE_FORMAT}"; + + string filename = $"{srcPath}{fileName}_{timeStamp_sec}"; + + string command = m_SAVEIMAGECMD + m_DOUBLEQUOTES + filename + m_DOUBLEQUOTES + m_COMMA + m_IMAGE_FORMAT + m_COMMA + m_IMAGE_SOURCE + m_COMMA + m_OPTION_ON + "\n"; + IOWrite(command); + } + catch (Exception) + { + Reset(); + throw; + } + } + + /// + /// + /// + public void SetupTrigger(bool useRisingEdge, int channelNumber, double triggerLevel) + { + try + { + string command = m_STOPCMD + "\n"; + IOWrite(command); + + /*command = m_ISOPCCMD + "\n"; + string rspStr = IOQuery(command); + string[] tokens = rspStr.Split('\n'); + + // check to see if STOP was completed + if (IsOperationCompleted(tokens[0]) == false) + { + throw new Exception("STOP was not completed."); + }*/ + + command = m_MEASCLEARCMD + "\n"; + IOWrite(command); + + //5. Trigger level + //*** Trigger edge source + command = m_TRIGSRCCMD + m_CHANCMD + channelNumber.ToString() + "\n"; + IOWrite(command); + + //*** select edge type + if (useRisingEdge) + { + command = m_RISETRIGEDGESELCMD + "\n"; + } + else + { + command = m_FALLTRIGEDGESELCMD + "\n"; + } + IOWrite(command); + + //*** select trigger level + command = m_TRIGLEVCMD + m_CHANCMD + channelNumber.ToString() + ", " + triggerLevel.ToString() + "\n"; + IOWrite(command); + + /*command = m_ISOPCCMD + "\n"; + rspStr = IOQuery(command); + + tokens = rspStr.Split('\n'); + + // check to see if trigger level command was completed + if (IsOperationCompleted(tokens[0]) == false) + { + throw new Exception("Trigger level was not completed."); + }*/ + + // start it back up + command = m_RUNCMD + "\n"; + IOWrite(command); + } + catch (Exception) + { + Reset(); + throw; + } + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here + try + { + if (_tcpStream != null) + { + _tcpStream.Dispose(); + _tcpStream = null; + } + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + if (errorMsg != "") + { + throw new Exception("System " + _name + " Had an error: " + errorMsg); + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpi.csproj b/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpi.csproj new file mode 100644 index 0000000..7fb5142 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpi.csproj @@ -0,0 +1,33 @@ + + + + net472 + Raytheon.Instruments.ScopeKeysightScpi + Scope Keysight Scpi implementation + Scope Keysight Scpi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpiFactory.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpiFactory.cs new file mode 100644 index 0000000..c179867 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeKeysightScpi/ScopeKeysightScpiFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// ScopeKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ScopeKeysightScpiFactory")] + public class ScopeKeysightScpiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ScopeKeysightScpiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ScopeKeysightScpiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IOscilloScope)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ScopeKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new ScopeSim(name, _configurationManager, _logger); + else + return new ScopeKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSim.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSim.cs new file mode 100644 index 0000000..c4fbb9e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSim.cs @@ -0,0 +1,294 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// + /// + public class ScopeSim : IOscilloScope + { + #region PrivateMembers + private State _state; + private string _name; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + /// + /// ScopeSim factory constructor + /// + /// + /// + public ScopeSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public ScopeSim(string name) + { + _name = name; + + _logger = LogManager.GetCurrentClassLogger(); + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + } + + /// + /// + /// + /// + public void ConfigureChannel(int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance) + { + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Scope Sim called " + _name; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public bool HasItTriggered() + { + return true; + } + + public void Initialize() + { + if (_state == State.Uninitialized) + { + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + public string IOQuery(string command) + { + // nothing to do in sim + return ""; + } + + public void IOWrite(string command, bool shallWeCheckForError = true) + { + // nothing to do in sim + } + + public double MeasureFallTime(int channelNumber) + { + throw new NotImplementedException(); + } + + public double MeasureFrequency(int channel) + { + double max = 10000; + + double min = 100; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + return dataToReturn; + } + + public double MeasureMaxVoltage(int channelNumber) + { + throw new NotImplementedException(); + } + + public double MeasureMinVoltage(int channelNumber) + { + throw new NotImplementedException(); + } + + public double MeasurePulseWidth(int channelNumber) + { + double max = 10000; + + double min = 100; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + return dataToReturn; + } + + public double MeasureRiseTime(int channelNumber) + { + throw new NotImplementedException(); + } + + public double MeasureVoltageLevel(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + _selfTestResult = SelfTestResult.Pass; + return _selfTestResult; + } + + public void Reset() + { + } + + public void SaveImage(string fileName) + { + } + + public void SetupTrigger(bool useRisingEdge, int channelNumber, double triggerLevel) + { + + } + + public void Shutdown() + { + if (_state == State.Ready) + { + _state = State.Uninitialized; + } + } + + } + +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSim.csproj b/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSim.csproj new file mode 100644 index 0000000..1589b00 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSim.csproj @@ -0,0 +1,21 @@ + + + + net472 + Raytheon.Instruments.ScopeSim + Scope Sim implementation + Scope Analyzer Sim implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSimFactory.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSimFactory.cs new file mode 100644 index 0000000..e221693 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeSim/ScopeSimFactory.cs @@ -0,0 +1,137 @@ +// ********************************************************************************************************** +// ScopeSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ScopeSimFactory")] + public class ScopeSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ScopeSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ScopeSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IOscilloScope)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ScopeSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new ScopeSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBind.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBind.cs new file mode 100644 index 0000000..51adfb7 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBind.cs @@ -0,0 +1,558 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using System; +using System.Threading; +using System.Text; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A class for controlling a scope via ZBind Teradyne Library + /// + public class ScopeZBind : IOscilloScope + { + #region PublicMembers + #endregion + + #region PrivateMembers + + // Maximum number of channels provided by scope. + private readonly string _address; + private IntPtr _handle; + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~ScopeZBind() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + ScopeZBindNativeMethods.zbind_remove(_handle); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFunctions + /// + /// ScopeZBind factory constructor + /// + /// + /// + /// + public ScopeZBind(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("ScopeZBind", "Address", ""); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + public ScopeZBind(string name, string address) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _address = address; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// Horizontal + /// + /// + /// Verticle Voltage Scale + /// + public void ConfigureChannel(int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance) + { + const int SWEEP_POINTS = 2000; + + Reset(); + IOWrite("INP1 ON"); + IOWrite("INP2 ON"); + IOWrite("SENSe:SWEep:POINts " + SWEEP_POINTS.ToString()); // Options defined in zScopeM + IOWrite("SENSe:SWEep:TIME " + timePerDivison.ToString()); // SWEEP_TIME.ToString()); // In seconds + IOWrite("SWE:OFFS:TIME 0.0"); + IOWrite("AVER:STAT 0"); + IOWrite("INIT:CONT 0"); + IOWrite("SWE:MODE NORM"); + IOWrite("VOLT1:RANG:OFFS " + voltageOffset.ToString()); + IOWrite("VOLT1:RANG:PTP " + voltageScale.ToString()); // 10 division on screen so V/Div will be 1/10th of input + IOWrite("INP1:FILT 0"); + + // start wave form collection + IOWrite("INIT"); + Thread.Sleep(1000); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Teradyne ZBind Scope"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public bool HasItTriggered() + { + // Did not find support for this in the API, just return true + return true; + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + int ZT_LAN = 0x0004; + int err = ScopeZBindNativeMethods.zbind_add(_address, ZT_LAN, out _handle); + + // check for errors + if (err != 0) + { + throw new Exception("ScopeZBind:Initialize() - Scope " + _name + " returned error code: " + err.ToString()); + } + + // reset the scope + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public string IOQuery(string command) + { + // send the command + IOWrite(command, false); + + // read from the response + StringBuilder rspStr = new StringBuilder(512); + + int err = ScopeZBindNativeMethods.zbind_receive(_handle, 0, "%[ -~]", rspStr); + + // check for errors + if (err != 0) + { + throw new Exception("ScopeZBind:IOQuery() - Scope " + _name + " returned error code: " + err.ToString()); + } + + return rspStr.ToString(); + } + + /// + /// + /// + /// + public void IOWrite(string command, bool shallWeCheckForError = true) + { + int err = ScopeZBindNativeMethods.zbind_send(_handle, 0, command); + + // check for errors + if (shallWeCheckForError == true) + { + if (err != 0) + { + throw new Exception("ScopeZBind:IOWrite() - Scope " + _name + " returned error code: " + err.ToString()); + } + } + + // wait a bit for processing + Thread.Sleep(50); + } + + /// + /// + /// + /// + public double MeasureFallTime(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + public double MeasureFrequency(int channelNumber) + { + IOWrite("INIT"); + + IOWrite("SENSe:SWEep:MODE NORM"); + + string enableCommand = "SENSe:INPut" + channelNumber.ToString() + ":STATe 1"; + IOWrite(enableCommand); + + // stop the waveform + IOWrite("ABORt"); + + // wait a bit for the wave form to settle + Thread.Sleep(1000); + + // The scope will respond with a string like "60.6575321, 0" + string response = IOQuery("MEASure:VOLTage:FREQuency? INPut" + channelNumber.ToString()); + + double result = Double.Parse(response.Split(Convert.ToChar(","))[0], System.Globalization.NumberStyles.Float); + + return result; + } + + /// + /// + /// + /// + public double MeasureMaxVoltage(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public double MeasureMinVoltage(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public double MeasurePulseWidth(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public double MeasureRiseTime(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public double MeasureVoltageLevel(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void Reset() + { + // Resets the oscilloscope + string command = "*RST"; + IOWrite(command); + + // just a swag + Thread.Sleep(3000); + } + + /// + /// + /// + public void SaveImage(string fileName) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void SetupTrigger(bool useRisingEdge, int channelNumber, double triggerLevel) + { + IOWrite("TRIG:TYPE EDGE"); + IOWrite("TRIG:SOUR INP1"); + IOWrite("TRIG:INP1:LEV " + triggerLevel.ToString()); + + if (useRisingEdge == true) + { + IOWrite("TRIG:SLOP POS"); + } + else + { + IOWrite("TRIG:SLOP NEG"); + } + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here + try + { + int err = ScopeZBindNativeMethods.zbind_remove(_handle); + + // check for errors + if (err != 0) + { + throw new Exception("ScopeZBind:Shutdown() - Scope " + _name + " returned error code: " + err.ToString()); + } + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + if (errorMsg != "") + { + throw new Exception("System " + _name + " Had an error: " + errorMsg); + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBind.csproj b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBind.csproj new file mode 100644 index 0000000..5f1f239 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBind.csproj @@ -0,0 +1,33 @@ + + + + net472 + Raytheon.Instruments.ScopeZBind + Scope ZBind implementation + Scope Analyzer ZBind implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBindFactory.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBindFactory.cs new file mode 100644 index 0000000..6e2aaff --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBindFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// ScopeKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ScopeZBindFactory")] + public class ScopeZBindFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ScopeZBindFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ScopeZBindFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IOscilloScope)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ScopeZBind(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new ScopeSim(name, _configurationManager, _logger); + else + return new ScopeZBind(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBindNativeMethods.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBindNativeMethods.cs new file mode 100644 index 0000000..b60a5c4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZBind/ScopeZBindNativeMethods.cs @@ -0,0 +1,46 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System.Runtime.InteropServices; +using System.Text; +using ZT_HANDLE = System.IntPtr; + +namespace Raytheon.Instruments +{ + /// + /// InterOp interface to ZtScope Instrument Driver + /// + public class ScopeZBindNativeMethods + { + const string DLL_LOCATION = @"C:\Program Files (x86)\ZTEC Instruments\MClass\bin\ZBind.dll"; + + /*****************************************************************************/ + /*= Non-SCPI Function Prototypes ============================================*/ + /*****************************************************************************/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.StdCall)] + public static extern int zbind_add(string address, int lan, out ZT_HANDLE handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.StdCall)] + public static extern int zbind_remove(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.StdCall)] + public static extern int zbind_send(ZT_HANDLE instr_handle, int lockCmd, string scpi); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.StdCall)] + public static extern int zbind_receive(ZT_HANDLE instr_handle, int lockCmd, string formatter, StringBuilder rcvString); + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtMNativeMethods.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtMNativeMethods.cs new file mode 100644 index 0000000..d7d567f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtMNativeMethods.cs @@ -0,0 +1,2235 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System.Runtime.InteropServices; +using s32 = System.Int32; +using s16 = System.Int16; +using s8 = System.Byte; +using u32 = System.UInt32; +using u16 = System.UInt16; +using f64 = System.Double; +using ZT_ERROR = System.Int32; +using ZT_RSRC_NAME = System.String; +using ZT_HANDLE = System.IntPtr; + +namespace Raytheon.Instruments +{ + /// + /// InterOp interface to ZtScope Instrument Driver + /// + public class ScopeZtMNativeMethods + { + const string DLL_LOCATION = @"C:\Program Files (x86)\ZTEC Instruments\MClass\bin\ZtScopeM.dll"; + + /*****************************************************************************/ + /*= Non-SCPI Function Prototypes ============================================*/ + /*****************************************************************************/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_num_of_chan(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 input_channels, + [MarshalAs(UnmanagedType.I4)]out s32 calc_channels, + [MarshalAs(UnmanagedType.I4)]out s32 ref_channels); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_chassis_type(ZT_HANDLE instr_handle, + s8[] chassis_type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_card(ZT_RSRC_NAME resource_name, + [MarshalAs(UnmanagedType.U2)]out u16 comm_bus, + u32 count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_initialize(ZT_RSRC_NAME resource_name, + s32 id_query, + s32 reset, + [MarshalAs(UnmanagedType.SysInt)]out ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_initialize_dual(ZT_RSRC_NAME primary_resource_name, + ZT_RSRC_NAME secondary_resource_name, + [MarshalAs(UnmanagedType.SysInt)]out ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_init(ZT_RSRC_NAME resource_name, + s32 id_query, + s32 reset, + u16 comm_bus, + [MarshalAs(UnmanagedType.U4)]out u32 model_number, + [MarshalAs(UnmanagedType.SysInt)]out ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_close(ZT_HANDLE instr_handle); + + /*****************************************************************************/ + /*= SCPI Function Prototypes ================================================*/ + /*****************************************************************************/ + /***************************************************************/ + /* Lone & Group Function Prototypes */ + /***************************************************************/ + /*** Configure ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_auto_setup(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_memory_clear(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_channel_enable(ZT_HANDLE instr_handle, + s32 channel, + s32 state); + + /** Horizontal **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal(ZT_HANDLE instr_handle, + u32 sample_points, + f64 sample_time, + f64 offset_time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal_offset_reference(ZT_HANDLE instr_handle, + f64 offset_reference); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal_range_increment(ZT_HANDLE instr_handle, + s32 steps, + u32 nom_points, + [MarshalAs(UnmanagedType.U4)]out u32 actual_nom_points, + [MarshalAs(UnmanagedType.I4)]out s32 interpolating); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal_next_sample_rate(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 sample_rate, + s32 inc_type, + [MarshalAs(UnmanagedType.R8)]out f64 next_rate); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_delay(ZT_HANDLE instr_handle, + s32 channel, + f64 delay); + + /* Sample Clock */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_clock_divider(ZT_HANDLE instr_handle, + u32 divider); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_clock_source(ZT_HANDLE instr_handle, + s32 source); + + /** Vertical **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_vertical(ZT_HANDLE instr_handle, + s32 channel, + f64 range, + f64 offset, + s32 coupling, + f64 impedance, + s32 lowpass_filter, + f64 attenuation); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_range_increment(ZT_HANDLE instr_handle, + s32 channel, + s32 steps); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_position(ZT_HANDLE instr_handle, + s32 channel, + f64 position); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_protection_state(ZT_HANDLE instr_handle, + s32 channel, + s32 prot_state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_center_tap_state(ZT_HANDLE instr_handle, + s32 channel, + s32 state); + + /** Acquisition **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_acquisition(ZT_HANDLE instr_handle, + s32 acquire_type, + s32 acquire_count, + s32 initiate_continuously, + s32 trigger_mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_average_view(ZT_HANDLE instr_handle, + s32 view); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_envelope_view(ZT_HANDLE instr_handle, + s32 view); + + /** Trigger **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_arm(ZT_HANDLE instr_handle, + s32 arm_source, + s32 arm_polarity, + f64 level); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger(ZT_HANDLE instr_handle, + s32 trigger_source, + f64 level, + s32 slope); + + /* Advanced Trigger */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_soft_trigger_a(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_holdoff(ZT_HANDLE instr_handle, + f64 holdoff, + s32 event_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_pulse_width(ZT_HANDLE instr_handle, + s32 source, + f64 level, + s32 type, + f64 lower_limit, + f64 upper_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_pattern(ZT_HANDLE instr_handle, + s32 pattern_mask, + s32 pattern_truth); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_video(ZT_HANDLE instr_handle, + s32 source, + f64 level, + s32 standard, + s32 field, + s32 line, + s32 level_mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_glitch_limit(ZT_HANDLE instr_handle, + f64 limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_b(ZT_HANDLE instr_handle, + s32 state, + s32 trigger_source, + f64 level, + s32 slope); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_b_holdoff(ZT_HANDLE instr_handle, + f64 holdoff); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_b_event_count(ZT_HANDLE instr_handle, + s32 event_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_noise_rejection_state(ZT_HANDLE instr_handle, + s32 trigger_source, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_external(ZT_HANDLE instr_handle, + f64 level, + f64 impedance); + + /** Fiducial **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_fiducial_state(ZT_HANDLE instr_handle, + s32 channel, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_fiducial_source(ZT_HANDLE instr_handle, + s32 source); + + /** Output **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_external(ZT_HANDLE instr_handle, + s32 state, + s32 source, + s32 polarity, + s32 pulse_mode, + f64 pulse_period); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_trigger(ZT_HANDLE instr_handle, + s32 trigger_output, + s32 state, + s32 source, + s32 polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_trigger_mode(ZT_HANDLE instr_handle, + s32 trigger_output, + s32 mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_event_time(ZT_HANDLE instr_handle, + f64 seconds); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_reference_oscillator(ZT_HANDLE instr_handle, + s32 state, + s32 reference_source); + + /** Segment **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_segment_view(ZT_HANDLE instr_handle, + s32 segment_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_segment_mode(ZT_HANDLE instr_handle, + s32 memory_mode); + + /*** Calculate ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_immediate(ZT_HANDLE instr_handle, + s32 calc_channel); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calc_channel_enable(ZT_HANDLE instr_handle, + s32 calc_channel, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calc_channel_format(ZT_HANDLE instr_handle, + s32 calc_channel, + s32 format); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_function(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 operation, + s32 source1, + s32 source2, + s32 range_offset_mode, + f64 range, + f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_position(ZT_HANDLE instr_handle, + s32 calculation_channel, + f64 position); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_fft(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source, + s32 window); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_time_transform(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source, + s32 points); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_limit_test(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source, + s32 measurement, + f64 lower_limit, + f64 upper_limit, + u32 count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source, + s32 lower_reference, + s32 upper_reference, + u32 count); + + /** Advanced Limit Test **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_limit_test_clear(ZT_HANDLE instr_handle, + s32 calculation_channel); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_limit_test_event(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 limit_event_state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_limit_test_fail(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 fail_state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_limit_test_report(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.U4)]out u32 count, + [MarshalAs(UnmanagedType.U4)]out u32 fail, + [MarshalAs(UnmanagedType.R8)]out f64 min, + [MarshalAs(UnmanagedType.R8)]out f64 max, + [MarshalAs(UnmanagedType.R8)]out f64 average, + [MarshalAs(UnmanagedType.R8)]out f64 std_dev, + [MarshalAs(UnmanagedType.R8)]out f64 last); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_method(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 method); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_gate(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 gate_type, + f64 start, + f64 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_vertical_offset(ZT_HANDLE instr_handle, + f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_horizontal_offset(ZT_HANDLE instr_handle, + f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_generate_masks(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 result); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_measurement(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source, + s32 type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_measure_clear(ZT_HANDLE instr_handle, + s32 calculation_channel); + + /*** Reference ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_enable(ZT_HANDLE instr_handle, + s32 reference_channel, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_range(ZT_HANDLE instr_handle, + s32 reference_channel, + f64 range); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_position(ZT_HANDLE instr_handle, + s32 reference_channel, + f64 position); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_offset(ZT_HANDLE instr_handle, + s32 reference_channel, + f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_format(ZT_HANDLE instr_handle, + s32 reference_channel, + s32 format); + + /*** Measurement ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_status(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_immediate(ZT_HANDLE instr_handle, + s32 measurement, + s32 source, + [MarshalAs(UnmanagedType.R8)]out f64 result); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_immediate_status(ZT_HANDLE instr_handle, + s32 measurement, + s32 source, + [MarshalAs(UnmanagedType.R8)]out f64 result, + [MarshalAs(UnmanagedType.U2)]out u16 status); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_nth_maximum(ZT_HANDLE instr_handle, + s32 number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_method(ZT_HANDLE instr_handle, + s32 method, + s32 gate_type, + f64 gate_start, + f64 gate_stop, + s32 edge_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_reference(ZT_HANDLE instr_handle, + s32 reference_method, + f64 low_reference, + f64 mid_reference, + f64 high_reference); + + /** Measurement Lists **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_enable(ZT_HANDLE instr_handle, + s32 list_number, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_report(ZT_HANDLE instr_handle, + s32 list_number, + [MarshalAs(UnmanagedType.R8)]out f64 result); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_report_status(ZT_HANDLE instr_handle, + s32 list_number, + [MarshalAs(UnmanagedType.R8)]out f64 result, + [MarshalAs(UnmanagedType.U2)]out u16 status); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_measurement(ZT_HANDLE instr_handle, + s32 list_number, + s32 meas_number, + s32 source, + s32 measurement); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_clear(ZT_HANDLE instr_handle, + s32 list_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_measurement_clear(ZT_HANDLE instr_handle, + s32 list_number, + s32 measurement_number); + + /** Cursors **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_cursors_source(ZT_HANDLE instr_handle, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_cursors(ZT_HANDLE instr_handle, + f64 cursor1_time, + f64 cursor1_magnitude, + f64 cursor2_time, + f64 cursor2_magnitude); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_cursors_snap(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_cursors(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 cursor1_time, + [MarshalAs(UnmanagedType.R8)]out f64 cursor1_magnitude, + [MarshalAs(UnmanagedType.R8)]out f64 cursor2_time, + [MarshalAs(UnmanagedType.R8)]out f64 cursor2_magnitude, + [MarshalAs(UnmanagedType.R8)]out f64 delta_time, + [MarshalAs(UnmanagedType.R8)]out f64 delta_magnitude); + + /*** Operate ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_abort(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_capture_waveform(ZT_HANDLE instr_handle, + s32 timeout); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_initiate(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_soft_arm(ZT_HANDLE instr_handle, + s32 arm_state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_soft_trigger(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_timestamp(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 time_stamp); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_arm_state_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_capture_complete_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_event_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_auto_synch(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_auto_zoom(ZT_HANDLE instr_handle, + f64 start, + f64 stop); + + /*** Waveform ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_read_waveform(ZT_HANDLE instr_handle, + s32 source, + f64[] waveform, + f64[] time_array, + s32 transfer_type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_download_record(ZT_HANDLE instr_handle, + s32 source, + u32 points, + f64 start_time, + f64 stop_time, + out s16[] waveform, + //void* waveform, + s32 transfer_type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_read_waveform_preamble(ZT_HANDLE instr_handle, + s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 type, + [MarshalAs(UnmanagedType.U4)]out u32 points, + [MarshalAs(UnmanagedType.I4)]out s32 acquisition_count, + [MarshalAs(UnmanagedType.R8)]out f64 time_interval, + [MarshalAs(UnmanagedType.R8)]out f64 time_offset, + [MarshalAs(UnmanagedType.R8)]out f64 voltage_interval, + [MarshalAs(UnmanagedType.R8)]out f64 voltage_offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_store_reference_waveform(ZT_HANDLE instr_handle, + s32 reference_channel, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_load_waveform(ZT_HANDLE instr_handle, + s32 ref_channel, + f64[] waveform, + s32 type, + u32 points, + s32 count, + s32 transfer_type, + f64 time_interval, + f64 time_offset, + f64 voltage_interval, + f64 voltage_offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_upload_record(ZT_HANDLE instr_handle, + s32 ref_channel, + f64[] waveform, //void* waveform, + s32 type, + u32 points, + s32 count, + s32 transfer_type, + f64 time_interval, + f64 time_offset, + f64 voltage_interval, + f64 voltage_offset); + + /** Advanced Waveform **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_format_data(ZT_HANDLE instr_handle, + s32 format_type, + s32 length); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_format_precision(ZT_HANDLE instr_handle, + u16 mantissa, + u16 exponent); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_interpolation(ZT_HANDLE instr_handle, + s32 format); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_interleaving(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 interleaving); + + /*** Utilities ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_device_clear(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_errors(ZT_HANDLE instr_handle, + out s32 number_of_errors, + s32[] errors); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_error_count(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 number_of_errors); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_error_next(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 error_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_error_report(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I1)]out s8 report); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern void ztscopeM_error_description(s32 code, s8[] description); + //s8 description[]); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_operation_complete(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_wait_operation_complete(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_enable_operation_complete(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reset(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_save_recall_state(ZT_HANDLE instr_handle, + s32 state, + s32 state_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_undo(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_self_test(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 self_test_status); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_self_test_dual(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 primary_self_test_status, + [MarshalAs(UnmanagedType.I4)]out s32 secondary_self_test_status); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_test_count(ZT_HANDLE instr_handle, + s32 test_log, + [MarshalAs(UnmanagedType.I4)]out s32 number_of_reports); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_test_report(ZT_HANDLE instr_handle, + s32 test_log, + [MarshalAs(UnmanagedType.I1)]out s8 report); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_initiate_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 initiated); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_temperature(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 temperature); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_temperature_dual(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 primary_temperature, + [MarshalAs(UnmanagedType.R8)]out f64 secondary_temperature); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_versions(ZT_HANDLE instr_handle, + s8[] id, + s8[] driver_rev, + s32[] configuration); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_accessory_id(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I1)]out s8 id_string); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_clear_status(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_status_preset(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_status(ZT_HANDLE instr_handle, + s32 register_type, + [MarshalAs(UnmanagedType.I4)]out s32 status_register, + [MarshalAs(UnmanagedType.I4)]out s32 frequency_register, + [MarshalAs(UnmanagedType.I4)]out s32 test_register, + [MarshalAs(UnmanagedType.I4)]out s32 operation_register, + [MarshalAs(UnmanagedType.I4)]out s32 standard_register, + [MarshalAs(UnmanagedType.I4)]out s32 questionable_register, + [MarshalAs(UnmanagedType.I4)]out s32 voltage_register, + [MarshalAs(UnmanagedType.I4)]out s32 calibration_register, + [MarshalAs(UnmanagedType.I4)]out s32 dig1_register, + [MarshalAs(UnmanagedType.I4)]out s32 dig2_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_event_status_enable(ZT_HANDLE instr_handle, + s32 status_register, + s32 frequency_register, + s32 test_register, + s32 operation_register, + s32 standard_register, + s32 questionable_register, + s32 voltage_register, + s32 calibration_register, + s32 dig1_register, + s32 dig2_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_system_restore(ZT_HANDLE instr_handle, + u16 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_memory(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 bytes); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_oscillator_frequency(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 frequency); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_identification_led(ZT_HANDLE instr_handle, + s32 state); + + /** Calibrate **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 result); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_automatic(ZT_HANDLE instr_handle, + s32 type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_date(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U2)]out u16 month, + [MarshalAs(UnmanagedType.U2)]out u16 day, + [MarshalAs(UnmanagedType.U2)]out u16 year); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_save(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_restore(ZT_HANDLE instr_handle); + + /* Defaults*/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_default(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_external_default(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_reference_oscillator_default(ZT_HANDLE instr_handle); + + /* Set*/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_adc_set_code(ZT_HANDLE instr_handle, + s32 input_channel, + u16 gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_delay_code(ZT_HANDLE instr_handle, + s32 input_channel, + s16 del_code); + + /* Adjust*/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_gain_adjust(ZT_HANDLE instr_handle, + s32 input_channel, + f64 range, + f64 impedance, + s32 filter, + f64 frac_error); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_external_adjust(ZT_HANDLE instr_handle, + f64 frac_error); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_reference_oscillator_adjust(ZT_HANDLE instr_handle, + s32 clk_error); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_impedance_adjust(ZT_HANDLE instr_handle, + s32 input_channel, + f64 frac_error); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_input_adjust(ZT_HANDLE instr_handle, + s32 input_channel, + f64 frac_error); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_range_adjust(ZT_HANDLE instr_handle, + s32 input_channel, + f64 frac_error); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_trigger_gain_adjust(ZT_HANDLE instr_handle, + s32 input_channel, + f64 frac_error); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_trigger_zero_adjust(ZT_HANDLE instr_handle, + s32 input_channel, + f64 zero_error); + + /* Query */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_automatic_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 result); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_adc_data_query(ZT_HANDLE instr_handle, + s32 interleave, + [MarshalAs(UnmanagedType.U2)]out u16 i_zero_code, + [MarshalAs(UnmanagedType.U2)]out u16 i_gain_code, + [MarshalAs(UnmanagedType.U2)]out u16 q_zero_code, + [MarshalAs(UnmanagedType.U2)]out u16 q_gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_adc_table_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + s32 table_index, + [MarshalAs(UnmanagedType.U2)]out u16 scale_factor, + [MarshalAs(UnmanagedType.U2)]out u16 adc_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_gain_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + f64 range, + f64 impedance, + s32 filter, + [MarshalAs(UnmanagedType.U2)]out u16 gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_offset_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + f64 range, + f64 impedance, + s32 filter, + [MarshalAs(UnmanagedType.U2)]out u16 zero_code, + [MarshalAs(UnmanagedType.U2)]out u16 gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_poffset_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + [MarshalAs(UnmanagedType.U2)]out u16 zero_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_trigger_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + [MarshalAs(UnmanagedType.U2)]out u16 zero_code, + [MarshalAs(UnmanagedType.U2)]out u16 gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_external_data_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U2)]out u16 zero_code, + [MarshalAs(UnmanagedType.U2)]out u16 gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_reference_oscillator_data_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U2)]out u16 vcxo_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_reference_frequency_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U4)]out u32 ref_frequency); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_impedance_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + [MarshalAs(UnmanagedType.U2)]out u16 gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_input_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + [MarshalAs(UnmanagedType.U2)]out u16 path_offset_code, + [MarshalAs(UnmanagedType.U2)]out u16 path_gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_range_data_query(ZT_HANDLE instr_handle, + s32 input_channel, + [MarshalAs(UnmanagedType.U2)]out u16 zero_code, + [MarshalAs(UnmanagedType.U2)]out u16 gain_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_delay_code_query(ZT_HANDLE instr_handle, + s32 input_channel, + [MarshalAs(UnmanagedType.I2)]out s16 del_code); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calibrate_skew_query(ZT_HANDLE instr_handle, + s16[] align_score); + + /**************************************/ + /********** Read back ****************/ + + /*** Configure ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_channel_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + /** Horizontal **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U4)]out u32 sample_points, + [MarshalAs(UnmanagedType.R8)]out f64 sample_time, + [MarshalAs(UnmanagedType.R8)]out f64 offset_time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal_offset_reference_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 offset_reference); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal_sample_rate_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 sample_rate); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_horizontal_interval_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 interval); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_delay_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.R8)]out f64 delay); + + /* Sample Clock */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_clock_divider_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U4)]out u32 divider); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_clock_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 source); + + /** Vertical **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_vertical_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.R8)]out f64 range, + [MarshalAs(UnmanagedType.R8)]out f64 offset, + [MarshalAs(UnmanagedType.I4)]out s32 coupling, + [MarshalAs(UnmanagedType.R8)]out f64 impedance, + [MarshalAs(UnmanagedType.I4)]out s32 lowpass_filter, + [MarshalAs(UnmanagedType.R8)]out f64 attenuation); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_position_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.R8)]out f64 position); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_protection_state_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 prot_state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_center_tap_state_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + /** Acquisition **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_acquisition_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 acquire_type, + [MarshalAs(UnmanagedType.I4)]out s32 acquire_count, + [MarshalAs(UnmanagedType.I4)]out s32 initiate_continuously, + [MarshalAs(UnmanagedType.I4)]out s32 trigger_mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_average_view_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 view); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_envelope_view_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 view); + + /** Trigger **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_arm_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 arm_source, + [MarshalAs(UnmanagedType.I4)]out s32 arm_polarity, + [MarshalAs(UnmanagedType.R8)]out f64 level); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 trigger_source, + [MarshalAs(UnmanagedType.R8)]out f64 level, + [MarshalAs(UnmanagedType.I4)]out s32 slope, + [MarshalAs(UnmanagedType.I4)]out s32 type); + + /* Advanced Trigger */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_holdoff_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 holdoff, + [MarshalAs(UnmanagedType.I4)]out s32 event_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_analog_location_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 trigger_location); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_pulse_width_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.R8)]out f64 level, + [MarshalAs(UnmanagedType.I4)]out s32 type, + [MarshalAs(UnmanagedType.R8)]out f64 lower_limit, + [MarshalAs(UnmanagedType.R8)]out f64 upper_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_pattern_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 pattern_mask, + [MarshalAs(UnmanagedType.I4)]out s32 pattern_truth, + [MarshalAs(UnmanagedType.I4)]out s32 type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_video_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.R8)]out f64 level, + [MarshalAs(UnmanagedType.I4)]out s32 standard, + [MarshalAs(UnmanagedType.I4)]out s32 field, + [MarshalAs(UnmanagedType.I4)]out s32 line, + [MarshalAs(UnmanagedType.I4)]out s32 type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_glitch_limit_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_b_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state, + [MarshalAs(UnmanagedType.I4)]out s32 trigger_source, + [MarshalAs(UnmanagedType.R8)]out f64 level, + [MarshalAs(UnmanagedType.I4)]out s32 slope); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_b_holdoff_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 holdoff); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_b_event_count_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 event_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_trigger_noise_rejection_state_query(ZT_HANDLE instr_handle, + s32 trigger_source, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_external_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 level, + [MarshalAs(UnmanagedType.R8)]out f64 impedance); + + /** Fiducial **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_fiducial_state_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_fiducial_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 source); + + /** Output **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_external_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 polarity, + [MarshalAs(UnmanagedType.I4)]out s32 pulse_mode, + [MarshalAs(UnmanagedType.R8)]out f64 pulse_period); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_event_time_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 seconds); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_trigger_query(ZT_HANDLE instr_handle, + s32 trigger_output, + [MarshalAs(UnmanagedType.I4)]out s32 state, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_trigger_mode_query(ZT_HANDLE instr_handle, + s32 trigger_output, + [MarshalAs(UnmanagedType.I4)]out s32 mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_input_trigger_query(ZT_HANDLE instr_handle, + s32 trigger_output, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_output_reference_oscillator_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state, + [MarshalAs(UnmanagedType.I4)]out s32 reference_source); + + /** Segment **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_segment_view_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 segment_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_segment_mode_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 memory_mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_segment_count_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 segments); + + /*** Calculate ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calc_channel_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calc_channel_format_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 format); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_function_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 operation, + [MarshalAs(UnmanagedType.I4)]out s32 source1, + [MarshalAs(UnmanagedType.I4)]out s32 source2, + [MarshalAs(UnmanagedType.R8)]out f64 range, + [MarshalAs(UnmanagedType.R8)]out f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_position_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.R8)]out f64 position); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_fft_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 window); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_time_transform_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 points); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_limit_test_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 measurement, + [MarshalAs(UnmanagedType.R8)]out f64 lower_limit, + [MarshalAs(UnmanagedType.R8)]out f64 upper_limit, + [MarshalAs(UnmanagedType.U4)]out u32 count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 lower_reference, + [MarshalAs(UnmanagedType.I4)]out s32 upper_reference, + [MarshalAs(UnmanagedType.U4)]out u32 count); + + /* Advanced Limit Test */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_method_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 method); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_gate_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 gate_type, + [MarshalAs(UnmanagedType.R8)]out f64 start, + [MarshalAs(UnmanagedType.R8)]out f64 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_vertical_offset_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_mask_test_horizontal_offset_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_calculate_measurement_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 type); + + /*** Reference ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_query(ZT_HANDLE instr_handle, + s32 reference_channel, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_range_query(ZT_HANDLE instr_handle, + s32 reference_channel, + [MarshalAs(UnmanagedType.R8)]out f64 range); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_position_query(ZT_HANDLE instr_handle, + s32 reference_channel, + [MarshalAs(UnmanagedType.R8)]out f64 position); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_offset_query(ZT_HANDLE instr_handle, + s32 reference_channel, + [MarshalAs(UnmanagedType.R8)]out f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_reference_format_query(ZT_HANDLE instr_handle, + s32 reference_channel, + [MarshalAs(UnmanagedType.I4)]out s32 format); + + /*** Measurement ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_status_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measurement_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 method, + [MarshalAs(UnmanagedType.R8)]out f64 gate_start_time, + [MarshalAs(UnmanagedType.R8)]out f64 gate_stop_time, + [MarshalAs(UnmanagedType.U4)]out u32 gate_start_points, + [MarshalAs(UnmanagedType.U4)]out u32 gate_stop_points, + [MarshalAs(UnmanagedType.R8)]out f64 gate_start_freq, + [MarshalAs(UnmanagedType.R8)]out f64 gate_stop_freq, + [MarshalAs(UnmanagedType.I4)]out s32 edge_number, + [MarshalAs(UnmanagedType.I4)]out s32 reference_method, + [MarshalAs(UnmanagedType.R8)]out f64 low_reference, + [MarshalAs(UnmanagedType.R8)]out f64 mid_reference, + [MarshalAs(UnmanagedType.R8)]out f64 high_reference); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_nth_maximum_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 number); + + /** Measurement Lists **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_query(ZT_HANDLE instr_handle, + s32 list_number, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_measure_list_measurement_query(ZT_HANDLE instr_handle, + s32 list_number, + s32 meas_number, + [MarshalAs(UnmanagedType.I4)]out s32 source, + [MarshalAs(UnmanagedType.I4)]out s32 measurement); + + /** Cursors **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_cursors_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_cursors_snap_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + /*** Operate ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_auto_zoom_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 start, + [MarshalAs(UnmanagedType.R8)]out f64 stop); + + /*** Waveform ***/ + + /** Advanced Waveform **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_format_data_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 format_type, + [MarshalAs(UnmanagedType.I4)]out s32 length); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_format_precision_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U2)]out u16 mantissa, + [MarshalAs(UnmanagedType.U2)]out u16 exponent); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_interpolation_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 format); + + /*** Utilities ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_event_status_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 status_register, + [MarshalAs(UnmanagedType.I4)]out s32 frequency_register, + [MarshalAs(UnmanagedType.I4)]out s32 test_register, + [MarshalAs(UnmanagedType.I4)]out s32 operation_register, + [MarshalAs(UnmanagedType.I4)]out s32 standard_register, + [MarshalAs(UnmanagedType.I4)]out s32 questionable_register, + [MarshalAs(UnmanagedType.I4)]out s32 voltage_register, + [MarshalAs(UnmanagedType.I4)]out s32 calibration_register, + [MarshalAs(UnmanagedType.I4)]out s32 dig1_register, + [MarshalAs(UnmanagedType.I4)]out s32 dig2_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_system_restore_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U2)]out u16 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_identification_led_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + /***************************************************************/ + /* Single Function Prototypes */ + /***************************************************************/ + + /*** Configure ***/ + /** Horizontal **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_horizontal_points(ZT_HANDLE instr_handle, + u32 sample_points); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_horizontal_time(ZT_HANDLE instr_handle, + f64 time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_horizontal_offset_time(ZT_HANDLE instr_handle, + f64 offset_time); + + /** Vertical **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_range(ZT_HANDLE instr_handle, + s32 channel, + f64 range); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_offset(ZT_HANDLE instr_handle, + s32 channel, + f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_coupling(ZT_HANDLE instr_handle, + s32 channel, + s32 coupling); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_impedance(ZT_HANDLE instr_handle, + s32 channel, + f64 impedance); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_filter(ZT_HANDLE instr_handle, + s32 channel, + s32 lowpass_filter); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_attenuation(ZT_HANDLE instr_handle, + s32 channel, + f64 attenuation); + + /** Acquisition **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_type(ZT_HANDLE instr_handle, + s32 acquire_type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_count(ZT_HANDLE instr_handle, + s32 acquire_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_continuous(ZT_HANDLE instr_handle, + s32 initiate_continuously); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_mode(ZT_HANDLE instr_handle, + s32 trigger_mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_average(ZT_HANDLE instr_handle, + s32 state); + + /** Trigger **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_arm_source(ZT_HANDLE instr_handle, + s32 arm_source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_arm_polarity(ZT_HANDLE instr_handle, + s32 arm_polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_source(ZT_HANDLE instr_handle, + s32 trigger_source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_level(ZT_HANDLE instr_handle, + s32 trigger_source, + f64 level); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_slope(ZT_HANDLE instr_handle, + s32 slope); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_holdoff(ZT_HANDLE instr_handle, + f64 holdoff); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_event_count(ZT_HANDLE instr_handle, + s32 event_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_type(ZT_HANDLE instr_handle, + s32 trigger_type); + + /* Advanced Trigger */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_impedance(ZT_HANDLE instr_handle, + f64 impedance); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pulse_width_lower_limit(ZT_HANDLE instr_handle, + f64 lower_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pulse_width_upper_limit(ZT_HANDLE instr_handle, + f64 upper_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pattern_mask(ZT_HANDLE instr_handle, + s32 pattern_mask); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pattern_truth(ZT_HANDLE instr_handle, + s32 pattern_truth); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_video_standard(ZT_HANDLE instr_handle, + s32 standard); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_video_field(ZT_HANDLE instr_handle, + s32 field); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_video_line(ZT_HANDLE instr_handle, + s32 line); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_b_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_b_source(ZT_HANDLE instr_handle, + s32 trigger_source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_b_slope(ZT_HANDLE instr_handle, + s32 slope); + + /** Output **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_source(ZT_HANDLE instr_handle, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_polarity(ZT_HANDLE instr_handle, + s32 polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_pulse_mode(ZT_HANDLE instr_handle, + s32 mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_pulse_period(ZT_HANDLE instr_handle, + f64 pulse_period); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_trigger_enable(ZT_HANDLE instr_handle, + s32 trigger_output, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_trigger_source(ZT_HANDLE instr_handle, + s32 trigger_output, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_trigger_polarity(ZT_HANDLE instr_handle, + s32 trigger_output, + s32 polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_reference_oscillator_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_reference_oscillator_source(ZT_HANDLE instr_handle, + s32 reference_source); + + /*** Calculate ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_function(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 operation, + s32 source1, + s32 source2); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_range(ZT_HANDLE instr_handle, + s32 calculation_channel, + f64 range); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_offset(ZT_HANDLE instr_handle, + s32 calculation_channel, + f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_fft(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_fft_window(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 window); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_time_transform(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_time_transform_points(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 points); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_test(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_test_measurement(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 measurement); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_test_lower_limit(ZT_HANDLE instr_handle, + s32 calculation_channel, + f64 lower_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_test_upper_limit(ZT_HANDLE instr_handle, + s32 calculation_channel, + f64 upper_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_lower_reference(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 lower_reference); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_upper_reference(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 upper_reference); + + /** Advanced Limit Test **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_gate_cursors(ZT_HANDLE instr_handle, + s32 calculation_channel); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_gate_time(ZT_HANDLE instr_handle, + s32 calculation_channel, + f64 start, + f64 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_gate_points(ZT_HANDLE instr_handle, + s32 calculation_channel, + u32 start, + u32 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_gate_frequency(ZT_HANDLE instr_handle, + s32 calculation_channel, + f64 start, + f64 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_number(ZT_HANDLE instr_handle, + u32 count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_measure_source(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_measure_type(ZT_HANDLE instr_handle, + s32 calculation_channel, + s32 type); + + /*** Measurement ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_method(ZT_HANDLE instr_handle, + s32 method); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_gate_time(ZT_HANDLE instr_handle, + f64 gate_start, + f64 gate_stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_gate_points(ZT_HANDLE instr_handle, + u32 gate_start, + u32 gate_stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_gate_frequency(ZT_HANDLE instr_handle, + f64 gate_start, + f64 gate_stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_gate_cursors(ZT_HANDLE instr_handle); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_edge_number(ZT_HANDLE instr_handle, + s32 edge_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_reference_method(ZT_HANDLE instr_handle, + s32 reference_method); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_reference(ZT_HANDLE instr_handle, + f64 low_reference, + f64 mid_reference, + f64 high_reference); + + /** Cursors **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_cursor_time(ZT_HANDLE instr_handle, + s32 cursor, + f64 time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_cursor_magnitude(ZT_HANDLE instr_handle, + s32 cursor, + f64 magnitude); + + /*** Operate ***/ + /*** Waveform ***/ + + /*** Utilities ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_save_state(ZT_HANDLE instr_handle, + s32 state_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_recall_state(ZT_HANDLE instr_handle, + s32 state_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + public static extern ZT_ERROR ztscopeM_idn(ZT_HANDLE instr_handle, s8[] id); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_idn_dual(ZT_HANDLE instr_handle, + s8[] primary_id, + s8[] secondary_id); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_driver_rev(ZT_HANDLE instr_handle, s8[] driver_rev); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_config(ZT_HANDLE instr_handle, + s32[] configuration); + + /** Register Enable **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_status_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_standard_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_frequency_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_test_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_operation_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_questionable_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_voltage_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calibration_register_enable(ZT_HANDLE instr_handle, + s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_digitizer_register_enable(ZT_HANDLE instr_handle, + s32 digitizer, + s32 state); + + /** Register Query **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_status_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 status_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_standard_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 standard_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_frequency_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 frequency_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_test_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 test_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_operation_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 operation_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_questionable_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 questionable_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_voltage_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 voltage_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calibration_register_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 calibration_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_digitizer_register_query(ZT_HANDLE instr_handle, + s32 digitizer, + [MarshalAs(UnmanagedType.I4)]out s32 digitizer_register); + + /** Register Condition Query **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_frequency_register_condition_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 frequency_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_test_register_condition_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 test_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_operation_register_condition_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 operation_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_questionable_register_condition_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 questionable_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_voltage_register_condition_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 voltage_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calibration_register_condition_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 calibration_register); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_digitizer_register_condition_query(ZT_HANDLE instr_handle, + s32 digitizer, + [MarshalAs(UnmanagedType.I4)]out s32 digitizer_register); + + /******* Read back ********/ + /*** Configure ***/ + /** Horizontal **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_horizontal_points_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U4)]out u32 sample_points); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_horizontal_time_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_horizontal_offset_time_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 offset_time); + + /** Vertical **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_range_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.R8)]out f64 range); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_offset_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.R8)]out f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_coupling_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 coupling); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_impedance_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.R8)]out f64 impedance); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_filter_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.I4)]out s32 lowpass_filter); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_input_attenuation_query(ZT_HANDLE instr_handle, + s32 channel, + [MarshalAs(UnmanagedType.R8)]out f64 attenuation); + + /** Acquisition **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_type_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 acquire_type); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_count_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 acquire_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_continuous_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 initiate_continuously); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_mode_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 trigger_mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_acquisition_average_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 aver_state); + + /** Trigger **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_arm_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 arm_source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_arm_polarity_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 arm_polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 trigger_source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_level_query(ZT_HANDLE instr_handle, + s32 source, + [MarshalAs(UnmanagedType.R8)]out f64 level); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_slope_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 slope); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_type_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 type); + + /* Advanced Trigger */ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_holdoff_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 holdoff); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_event_count_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 event_count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_impedance_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 impedance); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pulse_width_lower_limit_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 lower_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pulse_width_upper_limit_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 upper_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pattern_mask_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 pattern_mask); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_pattern_truth_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 pattern_truth); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_video_standard_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 standard); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_video_field_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 field); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_video_line_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 line); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_b_state_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_b_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 trigger_source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_trigger_b_slope_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 slope); + + /** Output **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_state_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_polarity_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_pulse_mode_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 mode); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_external_pulse_period_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 pulse_period); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_trigger_state_query(ZT_HANDLE instr_handle, + s32 trigger_output, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_trigger_source_query(ZT_HANDLE instr_handle, + s32 trigger_output, + [MarshalAs(UnmanagedType.I4)]out s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_trigger_polarity_query(ZT_HANDLE instr_handle, + s32 trigger_output, + [MarshalAs(UnmanagedType.I4)]out s32 polarity); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_output_reference_oscillator_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_reference_oscillator_source_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 reference_source); + + /*** Calculate ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_function_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 operation, + [MarshalAs(UnmanagedType.I4)]out s32 source1, + [MarshalAs(UnmanagedType.I4)]out s32 source2); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_range_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.R8)]out f64 range); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_offset_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.R8)]out f64 offset); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_fft_window_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 window); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_time_transform_points_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 points); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_test_measurement_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 measurement); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_test_lower_limit_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.R8)]out f64 lower_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_test_upper_limit_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.R8)]out f64 upper_limit); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_lower_reference_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 lower_reference); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_upper_reference_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 upper_reference); + + /** Advanced Limit Test **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_gate_time_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.R8)]out f64 start, + [MarshalAs(UnmanagedType.R8)]out f64 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_gate_points_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.U4)]out u32 start, + [MarshalAs(UnmanagedType.U4)]out u32 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_mask_test_gate_frequency_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.R8)]out f64 start, + [MarshalAs(UnmanagedType.R8)]out f64 stop); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_limit_number_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U4)]out u32 count); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_measure_source_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 source); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calculate_measure_type_query(ZT_HANDLE instr_handle, + s32 calculation_channel, + [MarshalAs(UnmanagedType.I4)]out s32 type); + + /*** Measurement ***/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_method_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 method); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_gate_time_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 gate_start_time, + [MarshalAs(UnmanagedType.R8)]out f64 gate_stop_time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_gate_points_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.U4)]out u32 gate_start_points, + [MarshalAs(UnmanagedType.U4)]out u32 gate_stop_points); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_gate_frequency_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 gate_start_freq, + [MarshalAs(UnmanagedType.R8)]out f64 gate_stop_freq); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_edge_number_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 edge_number); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_reference_method_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 reference_method); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_measure_reference_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 low_reference, + [MarshalAs(UnmanagedType.R8)]out f64 mid_reference, + [MarshalAs(UnmanagedType.R8)]out f64 high_reference); + + /** Cursors **/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_cursor_time_query(ZT_HANDLE instr_handle, + s32 cursor, + [MarshalAs(UnmanagedType.R8)]out f64 time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_cursor_magnitude_query(ZT_HANDLE instr_handle, + s32 cursor, + [MarshalAs(UnmanagedType.R8)]out f64 magnitude); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_cursor_time_delta(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 delta_time); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_cursor_magnitude_delta(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.R8)]out f64 delta_magnitude); + + /**Utilities**/ + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_status_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_standard_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_frequency_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_test_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_operation_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_questionable_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_voltage_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_calibration_register_enable_query(ZT_HANDLE instr_handle, + [MarshalAs(UnmanagedType.I4)]out s32 state); + + [DllImport(DLL_LOCATION, CallingConvention = CallingConvention.Cdecl)] + public static extern ZT_ERROR ztscopeM_single_digitizer_register_enable_query(ZT_HANDLE instr_handle, + s32 digitizer, + [MarshalAs(UnmanagedType.I4)]out s32 state); + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtec.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtec.cs new file mode 100644 index 0000000..8e95e69 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtec.cs @@ -0,0 +1,963 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// CDTS HAL Oscilloscope Driver for ZTEC ZT4442 + /// + public class ScopeZtec : IOscilloScope + { + #region PublicMembers + #endregion + + #region PrivateMembers + private enum enSCOPEInput { DC_50, DC_1M, AC_1M }; + + private IntPtr _handle; + private string _resourceString; + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// The Finalizer which will release resources if required + /// + ~ScopeZtec() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + int ret = ScopeZtMNativeMethods.ztscopeM_close(_handle); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Check instrument error status. If there is a failure, get its error message and generate an exception. + /// + /// if set to true if error occurred + /// The error code. + /// The error message. + /// + private void CheckError(out bool bErrorOccurred, out int nErrorCode, out string strErrorMsg) + { + bErrorOccurred = false; + nErrorCode = 0; + strErrorMsg = ""; + int numberOfErrors = 0; + int ztError = ScopeZtMNativeMethods.ztscopeM_error_count(_handle, out numberOfErrors); + if (numberOfErrors == 0) + { + bErrorOccurred = false; + } + else + { + bErrorOccurred = true; + int[] errors = new int[numberOfErrors]; + byte[] errMsg = new byte[256]; + ztError = ScopeZtMNativeMethods.ztscopeM_errors(_handle, out numberOfErrors, errors); + //this also clear the error buffer + nErrorCode = errors[numberOfErrors - 1]; //take last error + ScopeZtMNativeMethods.ztscopeM_error_description(nErrorCode, errMsg); + strErrorMsg = System.Text.Encoding.Default.GetString(errMsg); + } + } + + /// + /// Discards any queued errors, clears the instrument status, + /// and resets the status and event registers. + /// + /// + private void ClearError() + { + int numberOfErrors = 0; + ScopeZtMNativeMethods.ztscopeM_error_count(_handle, out numberOfErrors); + if (numberOfErrors > 0) + { + int[] errors = new int[numberOfErrors]; + //this retrieve and clear the error buffer + ScopeZtMNativeMethods.ztscopeM_errors(_handle, out numberOfErrors, errors); + } + } + + /// + /// + /// + /// + private void ClearMeasurement(int channel) + { + //@@@ not sure if this is the correct command + if (0 != ScopeZtMNativeMethods.ztscopeM_calculate_measure_clear(_handle, channel)) + { + RaiseExceptionAtError(); + } + } + + /// + /// + /// + /// + public void Disable(int channel) + { + int ret = ScopeZtMNativeMethods.ztscopeM_channel_enable(_handle, channel, 0x00000000); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + + /// + /// + /// + /// + public void Enable(int channel) + { + int ret = ScopeZtMNativeMethods.ztscopeM_channel_enable(_handle, channel, 0x00000001); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + + /// + /// Gets or sets Configure input termination for channel: DC_50=0, DC_1M=1, AC_1M =2 + /// Use one of the three subcommands to enable the appropriate signal input termination. + /// The subcommands correspond to DC coupling with 50 ohm termination resistance, + /// DC coupling with 1 Mohm termination resistance, + /// and AC coupling with 1 Mohm termination resistance, respectively. + /// + /// + /// Configure input termination for channel: DC_50=0, DC_1M=1, AC_1M =2 + /// + private void InputImpedance(enSCOPEInput input, int channel) + { + //only valid for input channels + if (channel >= 4) + { + throw new Exception("invalid channel number input: " + channel.ToString()); + } + + + int V_coupling = 0; + double V_impedance = 0.0; + switch (input) + { + //#define ZTSCOPEM_COUP_AC 0x00000000 + //#define ZTSCOPEM_COUP_DC 0x00000001 + //#define ZTSCOPEM_COUP_ACLFR 0x00000002 + //#define ZTSCOPEM_COUP_GND 0x00000003 + //#define ZTSCOPEM_IMP_50 50.0 + //#define ZTSCOPEM_IMP_1M 1000000.0 + case enSCOPEInput.DC_50: + V_coupling = 0x00000001; //ZTSCOPEM_COUP_DC + V_impedance = 50.0; //50 Ohm - ZTSCOPEM_IMP_50 + break; + case enSCOPEInput.DC_1M: + V_coupling = 0x00000001; //ZTSCOPEM_COUP_DC + V_impedance = 1000000.0; //ZTSCOPEM_IMP_1M + break; + case enSCOPEInput.AC_1M: + V_coupling = 0x00000000; //ZTSCOPEM_COUP_AC + V_impedance = 1000000.0; //ZTSCOPEM_IMP_1M + break; + default: //unknown, default to DC_1M + V_coupling = 0x00000001; //ZTSCOPEM_COUP_DC + V_impedance = 1000000.0; //ZTSCOPEM_IMP_1M + break; + } + + int ret = ScopeZtMNativeMethods.ztscopeM_single_input_coupling(_handle, channel, V_coupling); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + ret = ScopeZtMNativeMethods.ztscopeM_single_input_impedance(_handle, channel, V_impedance); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + + /// + /// If there is error, throw an exception with error query information. + /// + private void RaiseExceptionAtError() + { + bool bErrorOccurred = false; + int nErrorCode = 0; + string strErrorMsg = ""; + CheckError(out bErrorOccurred, out nErrorCode, out strErrorMsg); + if (bErrorOccurred) + { + throw new Exception(strErrorMsg); + } + } + + /// + /// + /// + private void Run() + { + int ret = ScopeZtMNativeMethods.ztscopeM_initiate(_handle); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + + /// + /// Causes the Scope to stop acquiring data. + /// + /// + private void Stop() + { + int ret = ScopeZtMNativeMethods.ztscopeM_abort(_handle); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + + /// + /// Gets or sets the display timescale in seconds per division. This actually set Sweep time to be 10x time scale. + /// + /// + /// The display timescale in seconds per division + /// + private double TimeScale + { + get + { + throw new NotImplementedException(); + + /*double sweepTime; + ZTScopeM.ztscopeM_single_horizontal_time_query(m_Handle, out sweepTime); + return sweepTime / 10.0;*/ + } + set + { + int ret = ScopeZtMNativeMethods.ztscopeM_single_horizontal_time(_handle, value * 10); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + } + + /// + /// Gets or sets The display voltage scale in Volts per division + /// + /// + /// The display voltage scale in Volts per division + /// + private void VoltScale(int channel, double range) + { + //only valid for input channels + if (channel >= 4) + { + throw new Exception("invalid channel number input: " + channel.ToString()); + } + + double V_range = 400.0; + //need range check + if (range > 40) + { + V_range = 400.0; //set to the maximum range + } + else + { + V_range = range * 10; + } + + int ret = ScopeZtMNativeMethods.ztscopeM_single_input_range(_handle, channel, V_range); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + + /// + /// Gets or sets The display offset voltage in Volts + /// A positive voltage offset shifts the displayed signal (as well as ground and trigger level indicators) downward; + /// in other words, the center of the vertical scale is set to dOffset. + /// + /// + /// The display offset voltage in Volts + /// + private void VoltOffset(int channel, double offset) + { + //only valid for input channels + if (channel >= 4) + { + throw new Exception("invalid channel number input: " + channel.ToString()); + } + + int ret = ScopeZtMNativeMethods.ztscopeM_single_input_offset(_handle, channel, offset); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + #endregion + + #region PublicFunctions + + /// + /// ScopeZtec factory constructor + /// + /// + /// + /// + public ScopeZtec(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _resourceString = _configuration.GetConfigurationValue("ScopeZtec", "ResourceString", ""); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public ScopeZtec(string name, string resourceString) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _resourceString = resourceString; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + ClearError(); + + return true; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void ConfigureChannel(int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance) + { + // make sure it is stopped first + Stop(); + + // clear the measurement + ClearMeasurement(channelNumber); + + //1. time per division + TimeScale = timePerDivison; + + //2. time offset + int ret = ScopeZtMNativeMethods.ztscopeM_single_horizontal_offset_time(_handle, timeOffset); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + //3. Volt per division + VoltScale(channelNumber, voltageScale); + + //4. Volt offset + VoltOffset(channelNumber, voltageOffset); + + // set input impedance to 1M ohmns. + enSCOPEInput imped = enSCOPEInput.DC_1M; + + // The value of inputImpedance is expected to be "DC", equivalent to 1M ohmn; otherwise, it outputs error. + if (inputImpedance.ToUpper().Trim() != "DC".ToUpper()) + { + throw new Exception("ScopeSetupChannel() expected Input Impedance to be DC. If others are needed, need to update sw"); + } + + InputImpedance(imped, channelNumber); + + // It turns on the specified channel. + Enable(channelNumber); + + // start it back up + Run(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a CDTS ZTec Scope"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + /// + public bool HasItTriggered() + { + int state = 0; + int ret = ScopeZtMNativeMethods.ztscopeM_trigger_event_query(_handle, out state); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + if (state == 1) + { + return true; + } + else + { + return false; + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + int ret = ScopeZtMNativeMethods.ztscopeM_initialize(_resourceString, + 0, // id_query + 1, // reset + out _handle); + + if (ret != 0) + { + throw new Exception("call to ztscopeM_initialize returned " + ret); + } + + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public string IOQuery(string command) + { + throw new NotImplementedException(); + + // send the command + /*IOWrite(command, false); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // check for errors + int err = 0; + string errorMessage = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("ScopeZtec:IOQuery() - Scope " + _name + " returned error code: " + err.ToString() + "," + errorMessage); + } + + return rspStr;*/ + } + + /// + /// + /// + /// + public void IOWrite(string command, bool shallWeCheckForError = true) + { + throw new NotImplementedException(); + + // convert to a byte array + /*byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // check for errors + if (shallWeCheckForError == true) + { + int err = 0; + string errorMessage = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("ScopeZtec:IOWrite() - Scope " + _name + " returned error code: " + err.ToString() + "," + errorMessage); + } + }*/ + } + + /// + /// + /// + /// + public double MeasureFallTime(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + /// + public double MeasureFrequency(int channelNumber) + { + double freq = -1.0; + + int ret = ScopeZtMNativeMethods.ztscopeM_measure_immediate(_handle, 0x0000000D, channelNumber, out freq); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + return freq; + } + + /// + /// + /// + /// + public double MeasureMaxVoltage(int channelNumber) + { + double max = -1.0; + + int ret = ScopeZtMNativeMethods.ztscopeM_measure_immediate(_handle, 0x00000012, channelNumber, out max); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + return max; + } + + /// + /// + /// + /// + public double MeasureMinVoltage(int channelNumber) + { + double min = 999.99; + + int ret = ScopeZtMNativeMethods.ztscopeM_measure_immediate(_handle, 0x00000013, channelNumber, out min); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + return min; + } + + /// + /// + /// + /// + public double MeasurePulseWidth(int channelNumber) + { + double pw = -1.0; + + int ret = ScopeZtMNativeMethods.ztscopeM_measure_immediate(_handle, 0x0000001B, channelNumber, out pw); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + return pw; + } + + /// + /// + /// + /// + public double MeasureRiseTime(int channelNumber) + { + double rt = -1.0; + + int ret = ScopeZtMNativeMethods.ztscopeM_measure_immediate(_handle, 0x00000020, channelNumber, out rt); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + return rt; + } + + /// + /// + /// + /// + public double MeasureVoltageLevel(int channelNumber) + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + int selfTestStatus = -1; + //Returns the test status register. + //Bit 0- Baseboard Register Test Failed Bit + //Bit 1- Unused Bit 2- Baseboard ROM Test Failed Bit + //Bit 3- Unused + //Bit 4- Reference Oscillator Test Failed Bit + //Bit 5- DRAM Test Failed Bit + //Bit 6- FlashMemory Test Failed Bit + //Bit 7- Unused Bit + //Bit 8- Digitizer 1Register Test Failed Bit + //Bit 9- Digitizer 2Register Test Failed Bit + //Bit 10-15- Unused Bits + int ret = ScopeZtMNativeMethods.ztscopeM_self_test(_handle, out selfTestStatus); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + if (selfTestStatus == 0) + { + _selfTestResult = SelfTestResult.Pass; + } + else + { + _selfTestResult = SelfTestResult.Fail; + throw new Exception("Self Test Failed with an Error Code: " + selfTestStatus.ToString()); + } + + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + int ret = ScopeZtMNativeMethods.ztscopeM_reset(_handle); + if (0 != ret) + { + RaiseExceptionAtError(); + } + } + + /// + /// + /// + public void SaveImage(string fileName) + { + throw new NotImplementedException(); + /*try + { + string timeStamp_date = DateTime.Now.ToString("yyyyMMdd"); + string timeStamp_sec = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"); + string folderTimeStamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm"); + + string srcPath = $"{m_DOUBLESLASH}{_address}{m_IMAGE_DEST}{m_DESIRED_FOLDER}{m_SLASH}{timeStamp_date}{m_SLASH}{folderTimeStamp}{m_SLASH}"; + + bool exists = System.IO.Directory.Exists(srcPath); + + if (!exists) + { + try + { + System.IO.Directory.CreateDirectory(srcPath); + //m_SrcDirectory = $"{m_DOUBLESLASH}{_address}{m_IMAGE_DEST}{m_DESIRED_FOLDER}{m_SLASH}{testUnit}"; + // m_TimeStampeDate = timeStamp_date; + } + catch (Exception) + { + Reset(); + throw; + } + } + + string m_scopeFileName = $"{timeStamp_date}{m_SLASH}{folderTimeStamp}{m_SLASH}{fileName}_{timeStamp_sec}.{m_IMAGE_FORMAT}"; + + string filename = $"{srcPath}{fileName}_{timeStamp_sec}"; + + string command = m_SAVEIMAGECMD + m_DOUBLEQUOTES + filename + m_DOUBLEQUOTES + m_COMMA + m_IMAGE_FORMAT + m_COMMA + m_IMAGE_SOURCE + m_COMMA + m_OPTION_ON + "\n"; + IOWrite(command); + } + catch (Exception) + { + Reset(); + throw; + }*/ + } + + /// + /// + /// + public void SetupTrigger(bool useRisingEdge, int channelNumber, double triggerLevel) + { + const int RISING_TRIGGER = 0x00000000; + const int FALLING_TRIGGER = 0x00000001; + + try + { + Stop(); + + int ret = ScopeZtMNativeMethods.ztscopeM_single_trigger_type(_handle, 0x00000000); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + int trigSource = channelNumber + 0x0000000A; + int triggerEdge = FALLING_TRIGGER; + + if (useRisingEdge == true) + { + triggerEdge = RISING_TRIGGER; + } + + ret = ScopeZtMNativeMethods.ztscopeM_trigger(_handle, trigSource, triggerLevel, triggerEdge); + if (0 != ret) + { + RaiseExceptionAtError(); + } + + //ret = ScopeZtMNativeMethods.ztscopeM_trigger_holdoff(_handle, dHoldoffDuration, 1); + + Run(); + } + catch (Exception) + { + Reset(); + throw; + } + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here + try + { + int ret = ScopeZtMNativeMethods.ztscopeM_close(_handle); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + if (errorMsg != "") + { + throw new Exception("System " + _name + " Had an error: " + errorMsg); + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtec.csproj b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtec.csproj new file mode 100644 index 0000000..ad327f5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtec.csproj @@ -0,0 +1,33 @@ + + + + net472 + Raytheon.Instruments.ScopeZtec + Scope Ztec implementation + Scope Ztec implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtecFactory.cs b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtecFactory.cs new file mode 100644 index 0000000..6e34c91 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Scope/ScopeZtec/ScopeZtecFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// ScopeKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "ScopeZtecFactory")] + public class ScopeZtecFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public ScopeZtecFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public ScopeZtecFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IOscilloScope)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new ScopeZtec(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new ScopeSim(name, _configurationManager, _logger); + else + return new ScopeZtec(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpi.cs b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpi.cs new file mode 100644 index 0000000..ae73f3a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpi.cs @@ -0,0 +1,590 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using NLog; +using Raytheon.Common; +using Raytheon.Framework; +using System; +using System.Net.Sockets; +using System.Text; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// + public class SigGenKeysightScpi : ISignalGenerator + { + #region PublicMembers + #endregion + + #region PrivateMembers + private const string _READ_ERROR_CODE_CMD = "SYST:ERR?"; + private const string _SELFTESTCMD = "*TST? "; + private const string _RESETCMD = "*RST"; + private const string _ISOPCCMD = "*STB? "; + private const string _FREQCMD = ":FREQ:FIX"; + private const string _PWRLEVELMD = "POW:LEV"; + private const string _OUTPUTON = ":OUTPut ON"; + private const string _OUTPUTOFF = ":OUTPut OFF"; + + private int m_PORT = 5025; + private const int m_READ_TIMEOUT = 5000; + + private readonly string _address; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~SigGenKeysightScpi() + { + Dispose(false); + } + + /// + /// Convert scpi data to string + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _tcpStream.Close(); + + _tcpStream.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get the error code. + /// + /// The error code. + /// The error description. + private string GetErrorCode(out int errorCode) + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string command = _READ_ERROR_CODE_CMD + "\n"; + + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert to a string + string rspStr = ConvertToString(ref _readBuffer); + + // parse the response + string[] tokens = rspStr.Split(','); + + errorCode = Util.ConvertStringToInt32(tokens[0]); + + // it should always be 2 + if (tokens.Length >= 2) + { + return tokens[1]; + } + else + { + return ""; + } + } + + /// + /// + /// + /// + /// + /// + private bool IsOperationCompleted(string statusString, string expectedResult = "1") + { + bool completed = false; + + // If Scope returns '+x' instead of 'x', where 'x' is any character, trim it. + if (statusString.IndexOf('+') == 0) + { + statusString = statusString.TrimStart('+'); + } + + if (statusString.Equals(expectedResult) == true) + { + completed = true; + } + + return completed; + } + + #endregion + + /// + /// SigGenKeysightScpi factory constructor + /// + /// + /// + public SigGenKeysightScpi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + const int READ_BUFFER_SIZE = 512; + + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("SigGenKeysightScpi", "Address", "127.0.0.1"); + m_PORT = _configuration.GetConfigurationValue("SigGenKeysightScpi", "Port", 5025); + + _readBuffer = new byte[READ_BUFFER_SIZE]; + TcpClient scopeSocketConn = new TcpClient(_address, m_PORT); + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + public SigGenKeysightScpi(string name, string address) + { + const int READ_BUFFER_SIZE = 512; + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _address = address; + _readBuffer = new byte[READ_BUFFER_SIZE]; + TcpClient scopeSocketConn = new TcpClient(_address, m_PORT); + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Scpi Signal Generator"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + public void Enable(bool enable) + { + if (enable == true) + { + string command = _OUTPUTON + "\n"; + IOWrite(command); + } + else + { + string command = _OUTPUTOFF + "\n"; + IOWrite(command); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public string IOQuery(string command) + { + // send the command + IOWrite(command, false); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // check for errors + int err = 0; + string message = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("SigGenKeysightScpi:IOQuery() - Sig Gen " + _name + " returned error code: " + err.ToString() + ", " + message); + } + + return rspStr; + } + + /// + /// + /// + /// + public void IOWrite(string command, bool shallWeCheckForError = true) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // check for errors + if (shallWeCheckForError == true) + { + int err = 0; + string errorMessage = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("SigGenKeysightScpi:IOWrite() - Device " + _name + " returned error code: " + err.ToString() + "," + errorMessage); + } + } + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + // change the timeout to account for the long self test + _tcpStream.ReadTimeout = 120000; + + // send the command and get the rsponse + string command = _SELFTESTCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + //Check if self test is completed; returns status of "0". + if (IsOperationCompleted(tokens[0], "0") == false) + { + string errorMsg = "System " + _name + " returned an error: " + tokens[0]; + throw new Exception(errorMsg); + } + + _selfTestResult = SelfTestResult.Pass; + + return SelfTestResult.Pass; + } + catch (Exception) + { + throw; + } + finally + { + // restore the timeout + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + } + } + + /// + /// + /// + public void Reset() + { + // Resets the sig gen + string command = _RESETCMD + "\n"; + IOWrite(command); + + Thread.Sleep(3000); + + /*command = _ISOPCCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + if (IsOperationCompleted(tokens[0]) == false) + { + throw new Exception("Reset was not completed."); + }*/ + } + + /// + /// + /// + /// + /// + /// + public void SetFrequency(UnitizedValue frequency) + { + int freq = Convert.ToInt32(frequency.Value); + + string command = _FREQCMD + " " + freq.ToString() + "\n"; + IOWrite(command); + } + + /// + /// + /// + /// + public void SetPowerLevel(UnitizedValue powerLevel) + { + int power = Convert.ToInt32(powerLevel.Value); + + string command = _PWRLEVELMD + " " + power.ToString() + "dBm\n"; + IOWrite(command); + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here + try + { + if (_tcpStream != null) + { + _tcpStream.Dispose(); + _tcpStream = null; + } + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + if (errorMsg != "") + { + throw new Exception("System " + _name + " Had an error: " + errorMsg); + } + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpi.csproj b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpi.csproj new file mode 100644 index 0000000..b887efa --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpi.csproj @@ -0,0 +1,33 @@ + + + + net472 + Raytheon.Instruments.SigGenKeysightScpi + SigGen Keysight Scpi implementation + Signal Generator Keysight Scpi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpiFactory.cs b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpiFactory.cs new file mode 100644 index 0000000..19a4444 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenKeysightScpi/SigGenKeysightScpiFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// SigGenKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SigGenKeysightScpiFactory")] + public class SigGenKeysightScpiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SigGenKeysightScpiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SigGenKeysightScpiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISignalGenerator)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SigGenKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SigGenSim(name, _configurationManager, _logger); + else + return new SigGenKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSim.cs b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSim.cs new file mode 100644 index 0000000..3149bbc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSim.cs @@ -0,0 +1,366 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using NLog; +using Raytheon.Common; +using Raytheon.Framework; +using System; + +namespace Raytheon.Instruments +{ + /// + /// + public class SigGenSim : ISignalGenerator + { + #region PublicMembers + #endregion + + #region PrivateMembers + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~SigGenSim() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + /// + /// PowerMeterKeysightScpi factory constructor + /// + /// + /// + public SigGenSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public SigGenSim(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Scpi Sig Gen"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + public void Enable(bool enable) + { + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public string IOQuery(string command) + { + return "Junk Sim Data"; + } + + /// + /// + /// + /// + public void IOWrite(string command, bool shallWeCheckForError = true) + { + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set + { + _name = value; + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + _selfTestResult = SelfTestResult.Pass; + + return SelfTestResult.Pass; + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + public void Reset() + { + } + + /// + /// + /// + /// + /// + /// + public void SetFrequency(UnitizedValue frequency) + { + } + + /// + /// + /// + /// + public void SetPowerLevel(UnitizedValue powerLevel) + { + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSim.csproj b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSim.csproj new file mode 100644 index 0000000..fc8e40a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSim.csproj @@ -0,0 +1,21 @@ + + + + net472 + Raytheon.Instruments.SigGenSim + Sig Gen Sim implementation + Signal Generator Sim implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSimFactory.cs b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSimFactory.cs new file mode 100644 index 0000000..ffd9fdc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SignalGenerator/SigGenSim/SigGenSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// SigGenSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SigGenSimFactory")] + public class SigGenSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SigGenSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SigGenSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISignalGenerator)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SigGenSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new SigGenSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpi.cs b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpi.cs new file mode 100644 index 0000000..30361cb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpi.cs @@ -0,0 +1,764 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Net.Sockets; +using System.Text; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// + public class SpecAnKeysightScpi : ISpecAnalyzer + { + #region PublicMembers + #endregion + + #region PrivateMembers + private const string _READ_ERROR_CODE_CMD = "SYST:ERR?"; + private const string _SELFTESTCMD = "*TST? "; + private const string _RESETCMD = "*RST"; + /*private const string _ISOPCCMD = "*STB? "; + private const string _FREQCMD = ":FREQ:FIX"; + private const string _PWRLEVELMD = "POW:REF"; + private const string _OUTPUTON = ":OUTPut ON"; + private const string _OUTPUTOFF = ":OUTPut OFF";*/ + + + private const string _INIT_IMMEDIATE = "INIT:IMM"; + private const string _MARKER_SET_MAX = "CALC:MARK:MAX"; + private const string _MARKER_QUERY_MAX_X = "CALC:MARK:X?"; + private const string _MARKER_QUERY_MAX_Y = "CALC:MARK:Y?"; + private const string _AVG_OFF = "AVER OFF"; + private const string _AVG_ON = "AVER ON"; + private const string _AVG_LOG = "AVER:TYPE LOG"; + private const string _AVG_RMS = "AVER:TYPE RMS"; + //private const string _AVG_SCAL = "AVER:TYPE SCAL"; + private const string _AVG_COUNT = "AVER:COUN"; + private const string _ATTENUATION_AUTO_ON = "POWer:ATTenuation:AUTO ON"; + private const string _ATTENUATION_AUTO_OFF = "POWer:ATTenuation:AUTO OFF"; + private const string _ATTENUATION_SET = "POWer:ATTenuation"; + + //private const string _POWER_LEVEL = "POWer:LEVel"; + //private const string _POWER_LEVEL_AUTO_ON = "POWer:LEVel:AUTO ON"; + //private const string _POWER_LEVEL_AUTO_OFF = "POWer:LEVel:AUTO OFF"; + + private const string _FREQ_CENTER = "SENS:FREQ:CENT"; + private const string _FREQ_SPAN = "SENS:FREQ:SPAN"; + + private const string _RBW_SET = "BWID"; + private const string _RBW_AUTO_ON = "BWID:AUTO On"; + private const string _RBW_AUTO_OFF = "BWID:AUTO Off"; + private const string _VBW_SET = "BWID:VID"; + private const string _VBW_AUTO_ON = "BWID:VID:AUTO On"; + private const string _VBW_AUTO_OFF = "BWID:VID:AUTO Off"; + + + private int m_PORT = 5025; + private const int m_READ_TIMEOUT = 10000; + + private readonly string _address; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~SpecAnKeysightScpi() + { + Dispose(false); + } + + /// + /// Convert scpi data to string + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _tcpStream.Close(); + + _tcpStream.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get the error code. + /// + /// The error code. + /// The error description. + private string GetErrorCode(out int errorCode) + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + + string command = _READ_ERROR_CODE_CMD + "\n"; + + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert to a string + string rspStr = ConvertToString(ref _readBuffer); + + // parse the response + string[] tokens = rspStr.Split(','); + + errorCode = Util.ConvertStringToInt32(tokens[0]); + + // it should always be 2 + if (tokens.Length >= 2) + { + return tokens[1]; + } + else + { + return ""; + } + } + + /// + /// + /// + /// + /// + /// + private bool IsOperationCompleted(string statusString, string expectedResult = "1") + { + bool completed = false; + + // If Scope returns '+x' instead of 'x', where 'x' is any character, trim it. + if (statusString.IndexOf('+') == 0) + { + statusString = statusString.TrimStart('+'); + } + + if (statusString.Equals(expectedResult) == true) + { + completed = true; + } + + return completed; + } + + #endregion + + /// + /// SpecAnKeysightScpi factory constructor + /// + /// + /// + public SpecAnKeysightScpi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + const int READ_BUFFER_SIZE = 512; + + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("SpecAnKeysightScpi", "Address", "127.0.0.1"); + m_PORT = _configuration.GetConfigurationValue("SpecAnKeysightScpi", "Port", 5025); + + _readBuffer = new byte[READ_BUFFER_SIZE]; + TcpClient scopeSocketConn = new TcpClient(_address, m_PORT); + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + public SpecAnKeysightScpi(string name, string address) + { + const int READ_BUFFER_SIZE = 512; + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _address = address; + _readBuffer = new byte[READ_BUFFER_SIZE]; + TcpClient scopeSocketConn = new TcpClient(_address, m_PORT); + _tcpStream = scopeSocketConn.GetStream(); + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + + /// + /// + /// + /// + /// + public void ConfigureAveraging(SpecAnAveragingType type, int numOfAverages) + { + if (type == SpecAnAveragingType.NONE) + { + string command = _AVG_OFF + "\n"; + IOWrite(command); + } + else + { + string onCommand = _AVG_ON + "\n"; + IOWrite(onCommand); + + string countCommand = _AVG_COUNT + " " + numOfAverages.ToString() + "\n"; + IOWrite(onCommand); + + if (type == SpecAnAveragingType.LOG) + { + string logCommand = _AVG_LOG + "\n"; + IOWrite(logCommand); + } + else if (type == SpecAnAveragingType.RMS) + { + string rmsCommand = _AVG_RMS + "\n"; + IOWrite(rmsCommand); + } + /*else if (type == SpecAnAveragingType.SCAL) + { + //@@@ resulting in error -224 + string scalCommand = _AVG_SCAL + "\n"; + IOWrite(scalCommand); + }*/ + else + { + throw new Exception("unsupported averaging type: " + type.ToString()); + } + } + } + + /// + /// + /// + /// + /// + public void ConfigureBandwidth(int rbw, int vbw) + { + if (rbw == -99) + { + string command = _RBW_AUTO_ON + "\n"; + IOWrite(command); + } + else + { + string command = _RBW_AUTO_OFF + "\n"; + IOWrite(command); + + command = _RBW_SET + " " + rbw.ToString() + "\n"; + IOWrite(command); + } + + if (vbw == -99) + { + string command = _VBW_AUTO_ON + "\n"; + IOWrite(command); + } + else + { + string command = _VBW_AUTO_OFF + "\n"; + IOWrite(command); + + command = _VBW_SET + " " + vbw.ToString() + "\n"; + IOWrite(command); + } + } + + /// + /// + /// + /// + /// + public void ConfigureFrequency(int centerFreq, int span) + { + string command = _FREQ_CENTER + " " + centerFreq.ToString() + "\n"; + IOWrite(command); + + command = _FREQ_SPAN + " " + span.ToString() + "\n"; + IOWrite(command); + } + + /// + /// + /// + /// + /// + public void ConfigurePowerLevel(/*int referanceLevel, */int attenuation) + { + /*if (referanceLevel == -99) + { + string command = _POWER_LEVEL_AUTO_ON + " " + referanceLevel.ToString() + "\n"; + IOWrite(command); + } + else + { + string command = _POWER_LEVEL_AUTO_OFF + " " + referanceLevel.ToString() + "\n"; + IOWrite(command); + + command = _POWER_LEVEL + " " + referanceLevel.ToString() + "\n"; + IOWrite(command); + }*/ + + if (attenuation == -99) + { + string command = _ATTENUATION_AUTO_ON + "\n"; + IOWrite(command); + } + else + { + string command = _ATTENUATION_AUTO_OFF + "\n"; + IOWrite(command); + + command = _ATTENUATION_SET + " " + attenuation.ToString() + "\n"; + IOWrite(command); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Scpi Spec An"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public string IOQuery(string command, int timeout = 10000) + { + _tcpStream.ReadTimeout = timeout; + + // send the command + IOWrite(command, false); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // check for errors + int err = 0; + string message = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("SpecAnKeysightScpi:IOQuery() - Spec An " + _name + " returned error code: " + err.ToString() + ", " + message); + } + + return rspStr; + } + + /// + /// + /// + /// + public void IOWrite(string command, bool shallWeCheckForError = true) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // check for errors + if (shallWeCheckForError == true) + { + int err = 0; + string errorMessage = GetErrorCode(out err); + if (err != 0) + { + throw new Exception("SpecAnKeysightScpi:IOWrite() - Device " + _name + " returned error code: " + err.ToString() + "," + errorMessage); + } + } + } + + /// + /// + /// + /// + public double MeasurePeakAmplitude() + { + //Initiate a single sweep + string command = _INIT_IMMEDIATE + "\n"; + IOWrite(command); + + //@@@ probably need to wait until sweep is completed + //although examples dont show that..have to try it out with a real signal + + // Set the marker to the maximum peak + command = _MARKER_SET_MAX + "\n"; + IOWrite(command); + + //Query and read the marker frequency + command = _MARKER_QUERY_MAX_Y + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + double amp = Util.ConvertStringToDouble(tokens[0]); + + return amp; + } + + /// + /// + /// + /// + public double MeasurePeakFrequency() + { + //Initiate a single sweep + string command = _INIT_IMMEDIATE + "\n"; + IOWrite(command); + + //@@@ probably need to wait until sweep is completed + //although examples dont show that..have to try it out with a real signal + + // Set the marker to the maximum peak + command = _MARKER_SET_MAX + "\n"; + IOWrite(command); + + //Query and read the marker frequency + command = _MARKER_QUERY_MAX_X + "\n"; + string rspStr = IOQuery(command); + + string[] tokens = rspStr.Split('\n'); + + double freq = Util.ConvertStringToDouble(tokens[0]); + + return freq; + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set + { + _name = value; + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + // change the timeout to account for the long self test + _tcpStream.ReadTimeout = 120000; + + // send the command and get the rsponse + string command = _SELFTESTCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + //Check if self test is completed; returns status of "0". + if (IsOperationCompleted(tokens[0], "0") == false) + { + string errorMsg = "System " + _name + " returned an error: " + tokens[0]; + throw new Exception(errorMsg); + } + + _selfTestResult = SelfTestResult.Pass; + + return SelfTestResult.Pass; + } + catch (Exception) + { + throw; + } + finally + { + // restore the timeout + _tcpStream.ReadTimeout = m_READ_TIMEOUT; + } + } + + /// + /// + /// + public void Reset() + { + // Resets the instrument + string command = _RESETCMD + "\n"; + IOWrite(command); + + Thread.Sleep(3000); + + /*command = _ISOPCCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + if (IsOperationCompleted(tokens[0]) == false) + { + throw new Exception("Reset was not completed."); + }*/ + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + + // the stream was created in the constructor, dispose of it here + try + { + if (_tcpStream != null) + { + _tcpStream.Dispose(); + _tcpStream = null; + } + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + if (errorMsg != "") + { + throw new Exception("System " + _name + " Had an error: " + errorMsg); + } + } + + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpi.csproj b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpi.csproj new file mode 100644 index 0000000..6b54d68 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpi.csproj @@ -0,0 +1,34 @@ + + + + net472 + Raytheon.Instruments.SpecAnKeysightScpi + SpecAn Keysight Scpi implementation + Spec Analyzer Keysight Scpi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpiFactory.cs b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpiFactory.cs new file mode 100644 index 0000000..4b8b79d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnKeysightScpi/SpecAnKeysightScpiFactory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// SpecAnKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SpecAnKeysightScpiFactory")] + public class SpecAnKeysightScpiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SpecAnKeysightScpiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SpecAnKeysightScpiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISpecAnalyzer)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SpecAnKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SpecAnSim(name, _configurationManager, _logger); + else + return new SpecAnKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSim.cs b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSim.cs new file mode 100644 index 0000000..208a901 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSim.cs @@ -0,0 +1,396 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using System; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// + public class SpecAnSim : ISpecAnalyzer + { + #region PublicMembers + #endregion + + #region PrivateMembers + + private State _state; + private SelfTestResult _selfTestResult; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer which will release resources if required + /// + ~SpecAnSim() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + /// + /// SpecAnSim factory constructor + /// + /// + /// + public SpecAnSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public SpecAnSim(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + public void ConfigureAveraging(SpecAnAveragingType type, int numOfAverages) + { + + } + + /// + /// + /// + /// + /// + public void ConfigureBandwidth(int rbw, int vbw) + { + + } + + /// + /// + /// + /// + /// + public void ConfigureFrequency(int centerFreq, int span) + { + + } + + /// + /// + /// + /// + /// + public void ConfigurePowerLevel(/*int referanceLevel, */int attenuation) + { + + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Scpi Spec An "; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + // if we have not yet been initialized, go ahead and create the socket + if (_state == State.Uninitialized) + { + Reset(); + + // we already connected to the instrument in the constructor + _state = State.Ready; + } + else + { + throw new Exception("expected the state of System " + _name + " to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + /// + /// + public string IOQuery(string command, int timeout = 10000) + { + return "100"; + } + + /// + /// + /// + /// + public void IOWrite(string command, bool shallWeCheckForError = true) + { + } + + /// + /// + /// + /// + public double MeasurePeakAmplitude() + { + return 0.0; + } + + /// + /// + /// + /// + public double MeasurePeakFrequency() + { + return 0.0; + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + set + { + _name = value; + } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + try + { + _selfTestResult = SelfTestResult.Pass; + + return SelfTestResult.Pass; + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + public void Reset() + { + } + + /// + /// + /// + public void Shutdown() + { + string errorMsg = ""; + + if (_state == State.Ready) + { + try + { + //Reset System + Reset(); + } + catch (Exception err) + { + errorMsg += err.Message + " "; + } + + _state = State.Uninitialized; + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSim.csproj b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSim.csproj new file mode 100644 index 0000000..27f101b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSim.csproj @@ -0,0 +1,21 @@ + + + + net472 + Raytheon.Instruments.SpecAnSim + SpecAn Sim implementation + Spec Analyzer Sim implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSimFactory.cs b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSimFactory.cs new file mode 100644 index 0000000..de6c2a5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/SpecAnalyzer/SpecAnSim/SpecAnSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// SpecAnSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SpecAnSimFactory")] + public class SpecAnSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SpecAnSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SpecAnSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISpecAnalyzer)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SpecAnSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new SpecAnSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpi.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpi.cs new file mode 100644 index 0000000..0db132f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpi.cs @@ -0,0 +1,483 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Net.Sockets; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// This is a class for controlling a VTI EX1200-3001, 5002, 4264 switch card. + /// It only supports individual relay mode at this time. + /// + public class SwitchKeysightScpi : ISwitch + { + #region PrivateMemberVariables + private const string READ_ERROR_STATUS_CMD = "SYST:ERR?"; + private const string _SELFTESTCMD = "*TST?"; + private const string _RESETCMD = "*RST"; + //@@@ add scpi commands here + + private int _PORT = 5025; + private const int _READ_TIMEOUT = 5000; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + private string _name; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing && _tcpStream != null) + { + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Convert scpi data to string + /// + /// + /// + private string ConvertToString(ref byte[] data) + { + string rsp = System.Text.Encoding.ASCII.GetString(data); + return rsp; + } + + /// + /// Get the error code. + /// + /// The error code (number). + private int GetErrorCode() + { + // not calling IOQuery() here so IOQuery() can call GetErrorCode() after each query + string command = READ_ERROR_STATUS_CMD + "\n"; + + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(command); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert to a string + string rspStr = ConvertToString(ref _readBuffer); + + // parse the response + string[] tokens = rspStr.Split(','); + + int ret = Util.ConvertStringToInt32(tokens[0]); + + return ret; + } + + + /// + /// Send a command to the DMM and get the response + /// + /// The command to send + /// The DMM response + private string IOQuery(string commandString) + { + // send the command + IOWrite(commandString); + + // clear our buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + // read from the response + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + // convert response to a string + string rspStr = ConvertToString(ref _readBuffer); + + // check for errors + int err = GetErrorCode(); + if (err != 0) + { + throw new Exception("SwitchKeysightScpi:IOQuery() - returned error code: " + err.ToString()); + } + + return rspStr; + } + + /// + /// Sends a SCPI Command to the instrument. + /// + /// The SCPI Command to be sent to the instrument. + private void IOWrite(string commandString) + { + // convert to a byte array + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + // send the data out + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + // check for errors + int err = GetErrorCode(); + if (err != 0) + { + throw new Exception("SwitchKeysightScpi:IOQuery() - returned error code: " + err.ToString()); + } + } + + /// + /// Perform self-test. + /// + private void SelfTest() + { + try + { + // change the timeout to account for the long self test + _tcpStream.ReadTimeout = 30000; + + // send the command and get the response + string command = _SELFTESTCMD + "\n"; + string rspStr = IOQuery(command); + + // parse the response + string[] tokens = rspStr.Split('\n'); + + int rsp = Util.ConvertStringToInt32(tokens[0]); + + if (rsp != 0) + { + string errorMsg = "returned an error: " + rsp.ToString() + "," + rspStr; + throw new Exception(errorMsg); + } + } + catch (Exception) + { + throw; + } + finally + { + // restore the timeout + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + } + #endregion + + #region PublicFunctions + + /// + /// SwitchKeysightScpi factory constructor + /// + /// + /// + public SwitchKeysightScpi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + var address = _configuration.GetConfigurationValue("SwitchKeysightScpi", "Address", "127.0.0.1"); + _PORT = _configuration.GetConfigurationValue("SwitchKeysightScpi", "Port", 5025); + + const int READ_BUFFER_SIZE = 512; + + _readBuffer = new byte[READ_BUFFER_SIZE]; + + TcpClient dmmSocketConn = new TcpClient(address, _PORT); + _tcpStream = dmmSocketConn.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + + SelfTest(); + } + + /// + /// Constructor for RelaySwitch card. + /// + /// The address of the RelaySwitch. + /// The options used for setting up the instrument. + public SwitchKeysightScpi(string name, string address) + { + const int READ_BUFFER_SIZE = 512; + + _name = name; + + _logger = LogManager.GetCurrentClassLogger(); + + _readBuffer = new byte[READ_BUFFER_SIZE]; + + TcpClient dmmSocketConn = new TcpClient(address, _PORT); + _tcpStream = dmmSocketConn.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + + SelfTest(); + } + + /// + /// Finalizer. + /// + ~SwitchKeysightScpi() + { + Dispose(false); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// Close a single relay. + /// + /// The relay to close. + public void Connect(string path) + { + // send the command + + //IOWrite(command); + + //read back to verify state of relay? + + + //"ROUT:CLOS (@3923)" + } + + /// + /// Open a single relay. + /// + /// The relay to open. + public void Disconnect(string path) + { + // send the command + + //IOWrite(command); + + //read back to verify state of relay? + //"ROUT:OPEN (@3923)") + } + + /// + /// + /// + public void DisconnectAll() + { + } + + /// + /// Dispose of resources. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Keysight 34980A switch"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotSupportedException(); + } + + set + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotSupportedException(); + } + + set + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public void Initialize() + { + throw new NotSupportedException(); + } + + /// + /// + /// + public bool IsDebounced + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public State Status + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotSupportedException(); + } + + /// + /// + /// + public void Reset() + { + IOWrite(_RESETCMD + "\n"); + } + + /// + /// + /// + public void Shutdown() + { + if (_tcpStream != null) + { + Reset(); + _tcpStream.Dispose(); + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpi.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpi.csproj new file mode 100644 index 0000000..63184e2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpi.csproj @@ -0,0 +1,35 @@ + + + + + net472 + Raytheon.Instruments.SwitchKeysightScpi + Switch Keysight Scpi implementation + Switch Keysight Scpi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpiFactory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpiFactory.cs new file mode 100644 index 0000000..de74bb1 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchKeysightScpi/SwitchKeysightScpiFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// SwitchKeysightScpiFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchKeysightScpiFactory")] + public class SwitchKeysightScpiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchKeysightScpiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchKeysightScpiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SwitchSim(name, _configurationManager, _logger); + else + return new SwitchKeysightScpi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxi.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxi.cs new file mode 100644 index 0000000..a5c7241 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxi.cs @@ -0,0 +1,360 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using NationalInstruments.ModularInstruments.NISwitch; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A simulated implementation of the ISwitch interface. + /// + public class SwitchNiPxi : ISwitch, IDisposable + { + #region PrivateMemberVariables + + private NISwitch _niSwitch; + private string _name; + private readonly string _address; + private readonly string _topology; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer + /// + ~SwitchNiPxi() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _niSwitch.Utility.Reset(); + + _niSwitch.Close(); + + _niSwitch.Dispose(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFunctions + + /// + /// SwitchNiPxi factory constructor + /// + /// + /// + public SwitchNiPxi(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("SwitchNiPxi", "Address", ""); + _topology = _configuration.GetConfigurationValue("SwitchNiPxi", "Topology", ""); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + public SwitchNiPxi(string name, string address, string topology = "") + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _address = address; + _topology = topology; + + // set in Initialize() + _niSwitch = null; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Connect(string path) + { + _niSwitch.RelayOperations.RelayControl(path, SwitchRelayAction.CloseRelay); + } + + /// + /// + /// + /// + public void Disconnect(string path) + { + _niSwitch.RelayOperations.RelayControl(path, SwitchRelayAction.OpenRelay); + } + + /// + /// + /// + public void DisconnectAll() + { + _niSwitch.Path.DisconnectAll(); + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a NI Switch"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool IsDebounced + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _niSwitch = new NISwitch(_address, _topology, false, true); + + //_niSwitch.ModuleCharacteristics.PowerDownLatchingRelaysAfterDebounce + + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + Ivi.Driver.SelfTestResult res = _niSwitch.Utility.SelfTest(); + + if (res.Code != 0) + { + _selfTestResult = Raytheon.Instruments.SelfTestResult.Fail; + throw new Exception("self test returned: " + res.Code + "," + res.Message + " on card " + _name); + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + _niSwitch.Utility.Reset(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + _niSwitch.Utility.Reset(); + + _niSwitch.Close(); + + _niSwitch.Dispose(); + + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxi.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxi.csproj new file mode 100644 index 0000000..518f472 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxi.csproj @@ -0,0 +1,43 @@ + + + + net472 + Raytheon.Instruments.SwitchNiPxi + Switch Ni Pxi implementation + Switch Ni Pxi implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\IviFoundationSharedComponents_1.4.1\Ivi.Driver.dll + + + ..\..\Common\COTS\NI\NationalInstruments.ModularInstruments.NISwitch.Fx45.dll + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxiFactory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxiFactory.cs new file mode 100644 index 0000000..a02482d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNiPxi/SwitchNiPxiFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// ScopeSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchNiPxiFactory")] + public class SwitchNiPxiFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchNiPxiFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchNiPxiFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchNiPxi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SwitchSim(name, _configurationManager, _logger); + else + return new SwitchNiPxi(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/NiseNativeMethods.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/NiseNativeMethods.cs new file mode 100644 index 0000000..f7ac8dd --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/NiseNativeMethods.cs @@ -0,0 +1,44 @@ +using System.Runtime.InteropServices; +using System; + +namespace Raytheon.Instruments +{ + public static class NiseNativeMethods + { + public enum MulticonnectMode + { + MulticonnectRoutes, + NoMulticonnect, + UseDefault + } + + // NISEStatus niSE_ClearError(Val NISESession hSession) + [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)] + internal static extern Int32 niSE_ClearError(Int32 hSession); + + // NISEStatus niSE_CloseSession(Val NISESession hSession) + [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)] + internal static extern Int32 niSE_CloseSession(Int32 hSession); + + // NISEStatus niSE_Connect(Val NISESession hSession, Val string connectSpec, Val __MIDL___MIDL_itf_Nise_0115_0003 multiconnectMode, NISEBoolean waitForDebounce); + [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)] + internal static extern Int32 niSE_Connect(Int32 hSession, string route, MulticonnectMode multiconnectMode, bool waitForDebounce); + + // NISEStatus niSE_Disconnect(Val NISESession hSession, Val string disconnectSpec); + [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)] + internal static extern Int32 niSE_Disconnect(Int32 hSession, string disconnectSpec); + + // NISEStatus niSE_DisconnectAll(Val NISESession hSession); + [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)] + internal static extern Int32 niSE_DisconnectAll(Int32 hSession); + + // NISEStatus niSE_IsDebounced(Val NISESession hSession, Var NISEBoolean isDebounced); + [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)] + internal static extern Int32 niSE_IsDebounced(Int32 hSession, out bool isDebounced); + + // NISEStatus niSE_OpenSession(Val string virtualDeviceName, Val string option, Var NISESession hSession) + [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)] + internal static extern Int32 niSE_OpenSession(string virtualDeviceName, string options, out Int32 hSession); + } +} + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNise.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNise.cs new file mode 100644 index 0000000..ad2d697 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNise.cs @@ -0,0 +1,264 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + public class SwitchNise : ISwitch + { + private int _hSession = 0; + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + /// + /// SwitchNise factory constructor + /// + /// + /// + public SwitchNise(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + var virtualDeviceName = _configuration.GetConfigurationValue("SwitchNise", "VirtualDeviceName", ""); + string options = _configuration.GetConfigurationValue("SwitchNise", "Options", ""); + + try + { + int status = NiseNativeMethods.niSE_OpenSession(virtualDeviceName, options, out _hSession); + if (status != 0) + { + throw new InstrumentException(string.Format("Could not open NISE session '{0}', error # {1}", virtualDeviceName, status)); + } + } + catch (BadImageFormatException ex) + { + throw new InstrumentException("Possible 32/64-bit issue with NI Switch Executive, see inner exception.", ex); + } + + DetailedStatus = ""; + DisplayEnabled = false; + FrontPanelEnabled = false; + Info = new InstrumentMetadata + { + ModelNumber = "NISE" + }; + Name = virtualDeviceName; + SelfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + Status = State.Ready; + } + + public SwitchNise(string virtualDeviceName) + { + string options = ""; + var status = -123; + + _logger = LogManager.GetCurrentClassLogger(); + + try + { + status = NiseNativeMethods.niSE_OpenSession(virtualDeviceName, options, out _hSession); + + if (status != 0) + { + throw new InstrumentException(string.Format("Could not open NISE session '{0}', error # {1}", virtualDeviceName, status)); + } + } + catch (BadImageFormatException ex) + { + throw new InstrumentException("Possible 32/64-bit issue with NI Switch Executive, see inner exception.", ex); + } + + DetailedStatus = ""; + DisplayEnabled = false; + FrontPanelEnabled = false; + Info = new InstrumentMetadata(); + Info.ModelNumber = "NISE"; + Name = virtualDeviceName; + SelfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + Status = State.Ready; + } + + public bool ClearErrors() + { + int status = NiseNativeMethods.niSE_ClearError(_hSession); + + if (status != 0) + { + Status = State.HardwareFailure; + DetailedStatus = "ClearError failed"; + + throw new InstrumentException("" + string.Format("Could not clear errors, error # {0}", status)); + } + + Status = State.Ready; + + return true; + } + + public void Connect(string path) + { + int status = NiseNativeMethods.niSE_Connect(_hSession, path, NiseNativeMethods.MulticonnectMode.NoMulticonnect, true); + + if (status != 0) + { + Status = State.HardwareFailure; + DetailedStatus = "Connect failed"; + + throw new InstrumentException("" + string.Format("Could not connect '{0}', NISE error # {1}", path, status)); + } + } + + public string DetailedStatus + { + get; + private set; + } + + public void Disconnect(string path) + { + int status = NiseNativeMethods.niSE_Disconnect(_hSession, path); + + if (status != 0) + { + throw new InstrumentException(string.Format("" + "Could not disconnect '{0}', NISE error # {1}", path, status)); + } + } + + public void DisconnectAll() + { + int status = NiseNativeMethods.niSE_DisconnectAll(_hSession); + + if (status != 0) + { + Status = State.HardwareFailure; + DetailedStatus = "DisconnectAll failed"; + + throw new InstrumentException(string.Format("" + "Could not disconnect all, NISE error # {0}", status)); + } + } + + //*** consider implementing 'set' to change back to some default value + // not available + public bool DisplayEnabled + { + get; + set; + } + + //*** consider implementing 'set' to change back to some default value + // not available + public bool FrontPanelEnabled + { + get; + set; + } + + public InstrumentMetadata Info + { + get; + private set; + } + + public void Initialize() + { + // do not want to allow user to open another session since they must close each one + // they open. already opened in constructor + + ClearErrors(); + } + + public bool IsDebounced + { + get + { + bool isDebounced; + int status = NiseNativeMethods.niSE_IsDebounced(_hSession, out isDebounced); + + if (status != 0) + { + Status = State.HardwareFailure; + DetailedStatus = "IsDebounced failed"; + + throw new InstrumentException("" + string.Format("Could not check debounce, error # {0}", status)); + } + + return isDebounced; + } + } + + public string Name + { + get; + private set; + } + + public SelfTestResult PerformSelfTest() + { + return SelfTestResult.Pass; + } + + public void Reset() + { + ClearErrors(); + DisconnectAll(); + + Status = State.Ready; + DetailedStatus = ""; + } + + // not available + public SelfTestResult SelfTestResult + { + get; + private set; + } + + public void Shutdown() + { + Int32 status = NiseNativeMethods.niSE_CloseSession(_hSession); + + if (status != 0) + { + Status = State.HardwareFailure; + DetailedStatus = "Close failed"; + + throw new InstrumentException("" + string.Format("Could not close NISE session, error # {0}", status)); + } + } + + public State Status + { + get; + private set; + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNise.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNise.csproj new file mode 100644 index 0000000..2e66690 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNise.csproj @@ -0,0 +1,34 @@ + + + + net472 + Raytheon.Instruments.SwitchNise + Switch Nise implementation + Switch Nise implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNiseFactory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNiseFactory.cs new file mode 100644 index 0000000..f5f1f30 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchNise/SwitchNiseFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// SwitchNiseFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchNiseFactory")] + public class SwitchNiseFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchNiseFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchNiseFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchNise(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SwitchSim(name, _configurationManager, _logger); + else + return new SwitchNise(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Pickering40LxiSoap.wsdl b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Pickering40LxiSoap.wsdl new file mode 100644 index 0000000..f1d0c0d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Pickering40LxiSoap.wsdl @@ -0,0 +1,2675 @@ + + + + + + + + represents status of cards. + + + + + + + + + + + + + + + + + + + + + + + + represents type of standard Pickering cards. + + + + + + + + + + + + + + + + + + represents attributes which help in getting information from the card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + represents important attributes for a OpSwitch function + + + + + + + + + + + + represents action for OpSwitch function. + + + + + + + + + + all PSU capability flags. + + + + + + + + + + + + indicating which store to access. + + + + + + + + + indicating how the given resistance value is to be applied. Only one mode is currently supported. + + + + + + + + contains set of capability flags. + + + + + + + + + + + + represents all of the battery simulator sub-units on the card. + + + + + + + + represents all of the voltage sources sub-units on the card. + + + + + + + + represents array data type + + + + + + + + represents unsigned int array data type + + + + + + + + represents array data type + + + + + + + + data type which represents SOAP header for sending data about a bus and a slot of a card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + obtains the identification string of the specified card. + + + + + obtains the bus and slot position of specific card Id. + + + + + obtains the maximum number of switches that may be activated simultaneously in the specified sub-unit. + + + + + returns count of switched relays from operation system start. + + + + + obtains the number of installed cards that are operable by the Pilpxi driver but are not currently opened by it. + + + + + obtains the diagnostic string of the specified card, giving expanded information on any fault conditons. + + + + + obtains the numbers of input and output sub-units implemented on the specified card. + + + + + obtains the logical bus and slot locations of installed cards that are operable by the Pilpxi driver and are currently unopened. + + + + + obtains a sub-unit's settling time (the period taken for its switches to stabilise). + + + + + obtains the current status flags for the specified card. + + + + + obtains the value of a sub-unit attribute. + + + + + obtains a description of a sub-unit, as numeric values. + + + + + obtains the current status flags for the specified output sub-unit. + + + + + obtains a description of a sub-unit, as a text string. + + + + + obtains the driver version code. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of every open Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of the specified Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of a sub-unit. + + + + + operate a single output channel or bit. + + + + + obtains the state of an individual output. + + + + + obtains the state of all outputs of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + sets all outputs of a sub-unit to the supplied bit-pattern. The number of least significant bits corresponding to the size of the sub-unit are written. + + + + + obtains the state of an individual input. + + + + + obtains the current state of all inputs of a sub-unit. + + + + + clears a sub-unit's switch mask, enabling operation of all outputs by the OpBit, OpCrosspoint and WriteSub functions. + + + + + Service definition of function ns__MaskBit + + + + + mask or unmask a single matrix crosspoint. + + + + + operate a single matrix crosspoint. + + + + + this function obtains, and optionally sets, the state of a switch. + + + + + obtains the state of an individual matrix crosspoint. + + + + + obtains the switch mask of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + obtains the state of an individual output's mask. + + + + + obtains the state of an individual matrix crosspoint's mask. + + + + + sets a sub-unit's switch mask to the supplied bit-pattern. + + + + + enables or disables a power supply's output. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains a description of a power supply sub-unit, as numeric values. + + + + + obtains a description of a power supply sub-unit, as text string. + + + + + obtains the current attenuation setting. + + + + + obtains a description of an RF attenuator sub-unit, as numeric values. + + + + + obtains the attenuation value of a numbered pad. + + + + + sets the attenuation to the specified value. + + + + + obtains a description of an attenuator sub-unit, as a text string. + + + + + reads a 16-bit calibration value from on-card EEPROM. + + + + + reads a sub-unit's calibration date and interval from on-card EEPROM. + + + + + reads one or more floating-point calibration values from on-card EEPROM. + + + + + sets a sub-unit to a state corresponding to one of its defined calibration points. + + + + + writes a 16-bit calibration value to on-card EEPROM. + + + + + writes a sub-unit's calibration date and interval into on-card EEPROM. Date information is obtained from the current system date. + + + + + writes one or more floating-point calibration values into on-card EEPROM. + + + + + obtains the current resistance setting of the specified programmable resistor. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + sets a programmable resistor to the closest available setting to the value specified. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + obtains detailed information on a programmable resistor sub-unit. + + + + + sets the output of a battery simulator sub-unit(s). + + + + + obtains the voltage setting of a battery simulator sub-unit. + + + + + sets the output sink of a battery simulator sub-unit(s). + + + + + obtains the current sink setting of a battery simulator sub-unit. + + + + + sets the output enable pattern of a battery simulator sub-unit(s). + + + + + optains the output enable pattern of a battery simulator sub-unit. + + + + + obtains the present state of a hardware interlock associated with battery simulator sub-unit(s). + + + + + sets output voltage range of voltage source sub-unit. + + + + + obtains the output voltage settings of range of voltage source sub-unit. + + + + + sets the output voltage of voltage source sub-unit. + + + + + obtains the output voltage setting of a voltage source sub-unit. + + + + + sets the output enable pattern of a voltage source sub-unit(s). + + + + + optains the output enable pattern of a voltage source sub-unit. + + + + + return eeror message of the error code. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Web service for basic Pickering's cards like switches, resistor cards and digital I/O. + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Properties/Settings.Designer.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4e843db --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Properties/Settings.Designer.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// 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 Raytheon.Instruments.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.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; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] + [global::System.Configuration.DefaultSettingValueAttribute("http://lxidevice/bin/picards")] + public string SwitchMeasurementInstruments_Pickering40LxiSoap_PiCards { + get { + return ((string)(this["SwitchMeasurementInstruments_Pickering40LxiSoap_PiCards"])); + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Properties/Settings.settings b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Properties/Settings.settings new file mode 100644 index 0000000..c1a0e4c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Properties/Settings.settings @@ -0,0 +1,9 @@ + + + + + + http://lxidevice/bin/picards + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_Soap.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_Soap.cs new file mode 100644 index 0000000..6059233 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_Soap.cs @@ -0,0 +1,409 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using NLog; +using Raytheon.Common; +using SwitchMeasurementInstrumentsLib.Pickering40LxiSoap; + +namespace Raytheon.Instruments +{ + /// + /// A Pickering implementation of the IRelaySwitch interface + /// + public class SwitchPickeringLxi40_531_Soap : ISwitch, IDisposable + { + #region PrivateMemberVariables + + private string _name; + private PiCards _card; + private readonly int _subUnit; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer + /// + ~SwitchPickeringLxi40_531_Soap() + { + Dispose(false); + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _card.ClearAll(); + _card.Dispose(); + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Close a single relay + /// The relay string should be the string form of an integer that represents the bit to close + /// + /// The relay to close + private void RelayClose(string relay) + { + int ret = _card.OpBit(_subUnit, Convert.ToInt32(relay), true); + + if (ret != 0) + { + throw new Exception("OpBit failed with a ret of: " + ret); + } + } + + /// + /// Opens a single relay + /// The relay strings should be the string form of an integer that represents the bit to close + /// + /// The relay to open + private void RelayOpen(string relay) + { + int ret = _card.OpBit(_subUnit, Convert.ToInt32(relay), false); + + if (ret != 0) + { + throw new Exception("OpBit failed with a ret of: " + ret); + } + } + + /// + /// Opens all relays on the card + /// + private void RelayOpenAll() + { + int ret = _card.ClearCard(); + + if (ret != 0) + { + throw new Exception("OpBit failed with a ret of: " + ret); + } + } + + #endregion + + #region PublicFunctions + + /// + /// SwitchPickeringLxi40_531_Soap factory constructor + /// + /// + /// + public SwitchPickeringLxi40_531_Soap(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + var address = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "Address", "127.0.0.1"); + var deviceNumber = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "DeviceNumber", 0); + var busNumber = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "BusNumber", 0); + + _subUnit = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "SubUnit", 0); + + _card = new PiCards + { + Url = $"http://{address}/bin/picards" + }; + + LocationHeader lh = new LocationHeader + { + Slot = deviceNumber, + Bus = busNumber + }; + + _card.CardLocation = lh; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public SwitchPickeringLxi40_531_Soap(string name, string address, int deviceNumber, int busNumber, int subUnit) + { + _name = name; + + _logger = LogManager.GetCurrentClassLogger(); + + _subUnit = subUnit; + + _card = new PiCards(); + + string tempAddress = "http://" + address + "/bin/picards"; + _card.Url = tempAddress; + + LocationHeader lh = new LocationHeader(); + lh.Slot = deviceNumber; + lh.Bus = busNumber; + + _card.CardLocation = lh; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Connect(string path) + { + RelayClose(path); + } + + /// + /// + /// + /// + public void Disconnect(string path) + { + RelayOpen(path); + } + + /// + /// + /// + public void DisconnectAll() + { + RelayOpenAll(); + } + + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Pickering Switch"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + // nothing to initialize here + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public bool IsDebounced + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void Reset() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + _card.ClearAll(); + _card.Dispose(); + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_Soap.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_Soap.csproj new file mode 100644 index 0000000..1fff40d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_Soap.csproj @@ -0,0 +1,59 @@ + + + + net472 + Raytheon.Instruments.SwitchPickeringLxi40_531_Soap + Switch Pickering Lxi40 531 Soap implementation + Switch Pickering Lxi40 531 Soap implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + + + + + True + True + Settings.settings + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_SoapFactory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_SoapFactory.cs new file mode 100644 index 0000000..4a60ab2 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/SwitchPickeringLxi40_531_SoapFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// SwitchPickeringLxi40_531_SoapFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchPickeringLxi40_531_SoapFactory")] + public class SwitchPickeringLxi40_531_SoapFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchPickeringLxi40_531_SoapFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchPickeringLxi40_531_SoapFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchPickeringLxi40_531_Soap(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SwitchSim(name, _configurationManager, _logger); + else + return new SwitchPickeringLxi40_531_Soap(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/PiCards.wsdl b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/PiCards.wsdl new file mode 100644 index 0000000..440478e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/PiCards.wsdl @@ -0,0 +1,2675 @@ + + + + + + + + represents status of cards. + + + + + + + + + + + + + + + + + + + + + + + + represents type of standard Pickering cards. + + + + + + + + + + + + + + + + + + represents attributes which help in getting information from the card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + represents important attributes for a OpSwitch function + + + + + + + + + + + + represents action for OpSwitch function. + + + + + + + + + + all PSU capability flags. + + + + + + + + + + + + indicating which store to access. + + + + + + + + + indicating how the given resistance value is to be applied. Only one mode is currently supported. + + + + + + + + contains set of capability flags. + + + + + + + + + + + + represents all of the battery simulator sub-units on the card. + + + + + + + + represents all of the voltage sources sub-units on the card. + + + + + + + + represents array data type + + + + + + + + represents unsigned int array data type + + + + + + + + represents array data type + + + + + + + + data type which represents SOAP header for sending data about a bus and a slot of a card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + obtains the identification string of the specified card. + + + + + obtains the bus and slot position of specific card Id. + + + + + obtains the maximum number of switches that may be activated simultaneously in the specified sub-unit. + + + + + returns count of switched relays from operation system start. + + + + + obtains the number of installed cards that are operable by the Pilpxi driver but are not currently opened by it. + + + + + obtains the diagnostic string of the specified card, giving expanded information on any fault conditons. + + + + + obtains the numbers of input and output sub-units implemented on the specified card. + + + + + obtains the logical bus and slot locations of installed cards that are operable by the Pilpxi driver and are currently unopened. + + + + + obtains a sub-unit's settling time (the period taken for its switches to stabilise). + + + + + obtains the current status flags for the specified card. + + + + + obtains the value of a sub-unit attribute. + + + + + obtains a description of a sub-unit, as numeric values. + + + + + obtains the current status flags for the specified output sub-unit. + + + + + obtains a description of a sub-unit, as a text string. + + + + + obtains the driver version code. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of every open Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of the specified Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of a sub-unit. + + + + + operate a single output channel or bit. + + + + + obtains the state of an individual output. + + + + + obtains the state of all outputs of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + sets all outputs of a sub-unit to the supplied bit-pattern. The number of least significant bits corresponding to the size of the sub-unit are written. + + + + + obtains the state of an individual input. + + + + + obtains the current state of all inputs of a sub-unit. + + + + + clears a sub-unit's switch mask, enabling operation of all outputs by the OpBit, OpCrosspoint and WriteSub functions. + + + + + Service definition of function ns__MaskBit + + + + + mask or unmask a single matrix crosspoint. + + + + + operate a single matrix crosspoint. + + + + + this function obtains, and optionally sets, the state of a switch. + + + + + obtains the state of an individual matrix crosspoint. + + + + + obtains the switch mask of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + obtains the state of an individual output's mask. + + + + + obtains the state of an individual matrix crosspoint's mask. + + + + + sets a sub-unit's switch mask to the supplied bit-pattern. + + + + + enables or disables a power supply's output. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains a description of a power supply sub-unit, as numeric values. + + + + + obtains a description of a power supply sub-unit, as text string. + + + + + obtains the current attenuation setting. + + + + + obtains a description of an RF attenuator sub-unit, as numeric values. + + + + + obtains the attenuation value of a numbered pad. + + + + + sets the attenuation to the specified value. + + + + + obtains a description of an attenuator sub-unit, as a text string. + + + + + reads a 16-bit calibration value from on-card EEPROM. + + + + + reads a sub-unit's calibration date and interval from on-card EEPROM. + + + + + reads one or more floating-point calibration values from on-card EEPROM. + + + + + sets a sub-unit to a state corresponding to one of its defined calibration points. + + + + + writes a 16-bit calibration value to on-card EEPROM. + + + + + writes a sub-unit's calibration date and interval into on-card EEPROM. Date information is obtained from the current system date. + + + + + writes one or more floating-point calibration values into on-card EEPROM. + + + + + obtains the current resistance setting of the specified programmable resistor. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + sets a programmable resistor to the closest available setting to the value specified. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + obtains detailed information on a programmable resistor sub-unit. + + + + + sets the output of a battery simulator sub-unit(s). + + + + + obtains the voltage setting of a battery simulator sub-unit. + + + + + sets the output sink of a battery simulator sub-unit(s). + + + + + obtains the current sink setting of a battery simulator sub-unit. + + + + + sets the output enable pattern of a battery simulator sub-unit(s). + + + + + optains the output enable pattern of a battery simulator sub-unit. + + + + + obtains the present state of a hardware interlock associated with battery simulator sub-unit(s). + + + + + sets output voltage range of voltage source sub-unit. + + + + + obtains the output voltage settings of range of voltage source sub-unit. + + + + + sets the output voltage of voltage source sub-unit. + + + + + obtains the output voltage setting of a voltage source sub-unit. + + + + + sets the output enable pattern of a voltage source sub-unit(s). + + + + + optains the output enable pattern of a voltage source sub-unit. + + + + + return eeror message of the error code. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Web service for basic Pickering's cards like switches, resistor cards and digital I/O. + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/Reference.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/Reference.cs new file mode 100644 index 0000000..f9e6078 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/Reference.cs @@ -0,0 +1,5228 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +// +// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.42000. +// +#pragma warning disable 1591 + +namespace SwitchMeasurementInstrumentsLib.Pickering40LxiSoap { + using System; + using System.Web.Services; + using System.Diagnostics; + using System.Web.Services.Protocols; + using System.Xml.Serialization; + using System.ComponentModel; + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="PiCards", Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public partial class PiCards : System.Web.Services.Protocols.SoapHttpClientProtocol { + + private LocationHeader cardLocationField; + + private System.Threading.SendOrPostCallback CardIdOperationCompleted; + + private System.Threading.SendOrPostCallback CardLocOperationCompleted; + + private System.Threading.SendOrPostCallback ClosureLimitOperationCompleted; + + private System.Threading.SendOrPostCallback CardOpsCountOperationCompleted; + + private System.Threading.SendOrPostCallback CountFreeCardsOperationCompleted; + + private System.Threading.SendOrPostCallback DiagnosticOperationCompleted; + + private System.Threading.SendOrPostCallback EnumerateSubsOperationCompleted; + + private System.Threading.SendOrPostCallback FindFreeCardsOperationCompleted; + + private System.Threading.SendOrPostCallback SettleTimeOperationCompleted; + + private System.Threading.SendOrPostCallback StatusOperationCompleted; + + private System.Threading.SendOrPostCallback SubAttributeOperationCompleted; + + private System.Threading.SendOrPostCallback SubInfoOperationCompleted; + + private System.Threading.SendOrPostCallback SubStatusOperationCompleted; + + private System.Threading.SendOrPostCallback SubTypeOperationCompleted; + + private System.Threading.SendOrPostCallback VersionOperationCompleted; + + private System.Threading.SendOrPostCallback ClearAllOperationCompleted; + + private System.Threading.SendOrPostCallback ClearCardOperationCompleted; + + private System.Threading.SendOrPostCallback ClearSubOperationCompleted; + + private System.Threading.SendOrPostCallback OpBitOperationCompleted; + + private System.Threading.SendOrPostCallback ViewBitOperationCompleted; + + private System.Threading.SendOrPostCallback ViewSubOperationCompleted; + + private System.Threading.SendOrPostCallback WriteSubOperationCompleted; + + private System.Threading.SendOrPostCallback ReadBitOperationCompleted; + + private System.Threading.SendOrPostCallback ReadSubOperationCompleted; + + private System.Threading.SendOrPostCallback ClearMaskOperationCompleted; + + private System.Threading.SendOrPostCallback MaskBitOperationCompleted; + + private System.Threading.SendOrPostCallback MaskCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback OpCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback OpSwitchOperationCompleted; + + private System.Threading.SendOrPostCallback ViewCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback ViewMaskOperationCompleted; + + private System.Threading.SendOrPostCallback ViewMaskBitOperationCompleted; + + private System.Threading.SendOrPostCallback ViewMaskCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback WriteMaskOperationCompleted; + + private System.Threading.SendOrPostCallback PsuEnableOperationCompleted; + + private System.Threading.SendOrPostCallback PsuGetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback PsuSetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback PsuInfoOperationCompleted; + + private System.Threading.SendOrPostCallback PsuTypeOperationCompleted; + + private System.Threading.SendOrPostCallback AttenGetAttenuationOperationCompleted; + + private System.Threading.SendOrPostCallback AttenInfoOperationCompleted; + + private System.Threading.SendOrPostCallback AttenPadValueOperationCompleted; + + private System.Threading.SendOrPostCallback AttenSetAttenuationOperationCompleted; + + private System.Threading.SendOrPostCallback AttenTypeOperationCompleted; + + private System.Threading.SendOrPostCallback ReadCalOperationCompleted; + + private System.Threading.SendOrPostCallback ReadCalDateOperationCompleted; + + private System.Threading.SendOrPostCallback ReadCalFPOperationCompleted; + + private System.Threading.SendOrPostCallback SetCalPointOperationCompleted; + + private System.Threading.SendOrPostCallback WriteCalOperationCompleted; + + private System.Threading.SendOrPostCallback WriteCalDateOperationCompleted; + + private System.Threading.SendOrPostCallback WriteCalFPOperationCompleted; + + private System.Threading.SendOrPostCallback ResGetResistanceOperationCompleted; + + private System.Threading.SendOrPostCallback ResSetResistanceOperationCompleted; + + private System.Threading.SendOrPostCallback ResInfoOperationCompleted; + + private System.Threading.SendOrPostCallback BattSetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback BattGetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback BattSetCurrentOperationCompleted; + + private System.Threading.SendOrPostCallback BattGetCurrentOperationCompleted; + + private System.Threading.SendOrPostCallback BattSetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback BattGetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback BattReadInterlockStateOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceSetRangeOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceGetRangeOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceSetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceGetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceSetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceGetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback ErrorCodeToMessageOperationCompleted; + + private bool useDefaultCredentialsSetExplicitly; + + /// + public PiCards() { + this.Url = global::Raytheon.Instruments.Properties.Settings.Default.SwitchMeasurementInstruments_Pickering40LxiSoap_PiCards; + if ((this.IsLocalFileSystemWebService(this.Url) == true)) { + this.UseDefaultCredentials = true; + this.useDefaultCredentialsSetExplicitly = false; + } + else { + this.useDefaultCredentialsSetExplicitly = true; + } + } + + public LocationHeader CardLocation { + get { + return this.cardLocationField; + } + set { + this.cardLocationField = value; + } + } + + public new string Url { + get { + return base.Url; + } + set { + if ((((this.IsLocalFileSystemWebService(base.Url) == true) + && (this.useDefaultCredentialsSetExplicitly == false)) + && (this.IsLocalFileSystemWebService(value) == false))) { + base.UseDefaultCredentials = false; + } + base.Url = value; + } + } + + public new bool UseDefaultCredentials { + get { + return base.UseDefaultCredentials; + } + set { + base.UseDefaultCredentials = value; + this.useDefaultCredentialsSetExplicitly = true; + } + } + + /// + public event CardIdCompletedEventHandler CardIdCompleted; + + /// + public event CardLocCompletedEventHandler CardLocCompleted; + + /// + public event ClosureLimitCompletedEventHandler ClosureLimitCompleted; + + /// + public event CardOpsCountCompletedEventHandler CardOpsCountCompleted; + + /// + public event CountFreeCardsCompletedEventHandler CountFreeCardsCompleted; + + /// + public event DiagnosticCompletedEventHandler DiagnosticCompleted; + + /// + public event EnumerateSubsCompletedEventHandler EnumerateSubsCompleted; + + /// + public event FindFreeCardsCompletedEventHandler FindFreeCardsCompleted; + + /// + public event SettleTimeCompletedEventHandler SettleTimeCompleted; + + /// + public event StatusCompletedEventHandler StatusCompleted; + + /// + public event SubAttributeCompletedEventHandler SubAttributeCompleted; + + /// + public event SubInfoCompletedEventHandler SubInfoCompleted; + + /// + public event SubStatusCompletedEventHandler SubStatusCompleted; + + /// + public event SubTypeCompletedEventHandler SubTypeCompleted; + + /// + public event VersionCompletedEventHandler VersionCompleted; + + /// + public event ClearAllCompletedEventHandler ClearAllCompleted; + + /// + public event ClearCardCompletedEventHandler ClearCardCompleted; + + /// + public event ClearSubCompletedEventHandler ClearSubCompleted; + + /// + public event OpBitCompletedEventHandler OpBitCompleted; + + /// + public event ViewBitCompletedEventHandler ViewBitCompleted; + + /// + public event ViewSubCompletedEventHandler ViewSubCompleted; + + /// + public event WriteSubCompletedEventHandler WriteSubCompleted; + + /// + public event ReadBitCompletedEventHandler ReadBitCompleted; + + /// + public event ReadSubCompletedEventHandler ReadSubCompleted; + + /// + public event ClearMaskCompletedEventHandler ClearMaskCompleted; + + /// + public event MaskBitCompletedEventHandler MaskBitCompleted; + + /// + public event MaskCrosspointCompletedEventHandler MaskCrosspointCompleted; + + /// + public event OpCrosspointCompletedEventHandler OpCrosspointCompleted; + + /// + public event OpSwitchCompletedEventHandler OpSwitchCompleted; + + /// + public event ViewCrosspointCompletedEventHandler ViewCrosspointCompleted; + + /// + public event ViewMaskCompletedEventHandler ViewMaskCompleted; + + /// + public event ViewMaskBitCompletedEventHandler ViewMaskBitCompleted; + + /// + public event ViewMaskCrosspointCompletedEventHandler ViewMaskCrosspointCompleted; + + /// + public event WriteMaskCompletedEventHandler WriteMaskCompleted; + + /// + public event PsuEnableCompletedEventHandler PsuEnableCompleted; + + /// + public event PsuGetVoltageCompletedEventHandler PsuGetVoltageCompleted; + + /// + public event PsuSetVoltageCompletedEventHandler PsuSetVoltageCompleted; + + /// + public event PsuInfoCompletedEventHandler PsuInfoCompleted; + + /// + public event PsuTypeCompletedEventHandler PsuTypeCompleted; + + /// + public event AttenGetAttenuationCompletedEventHandler AttenGetAttenuationCompleted; + + /// + public event AttenInfoCompletedEventHandler AttenInfoCompleted; + + /// + public event AttenPadValueCompletedEventHandler AttenPadValueCompleted; + + /// + public event AttenSetAttenuationCompletedEventHandler AttenSetAttenuationCompleted; + + /// + public event AttenTypeCompletedEventHandler AttenTypeCompleted; + + /// + public event ReadCalCompletedEventHandler ReadCalCompleted; + + /// + public event ReadCalDateCompletedEventHandler ReadCalDateCompleted; + + /// + public event ReadCalFPCompletedEventHandler ReadCalFPCompleted; + + /// + public event SetCalPointCompletedEventHandler SetCalPointCompleted; + + /// + public event WriteCalCompletedEventHandler WriteCalCompleted; + + /// + public event WriteCalDateCompletedEventHandler WriteCalDateCompleted; + + /// + public event WriteCalFPCompletedEventHandler WriteCalFPCompleted; + + /// + public event ResGetResistanceCompletedEventHandler ResGetResistanceCompleted; + + /// + public event ResSetResistanceCompletedEventHandler ResSetResistanceCompleted; + + /// + public event ResInfoCompletedEventHandler ResInfoCompleted; + + /// + public event BattSetVoltageCompletedEventHandler BattSetVoltageCompleted; + + /// + public event BattGetVoltageCompletedEventHandler BattGetVoltageCompleted; + + /// + public event BattSetCurrentCompletedEventHandler BattSetCurrentCompleted; + + /// + public event BattGetCurrentCompletedEventHandler BattGetCurrentCompleted; + + /// + public event BattSetEnableCompletedEventHandler BattSetEnableCompleted; + + /// + public event BattGetEnableCompletedEventHandler BattGetEnableCompleted; + + /// + public event BattReadInterlockStateCompletedEventHandler BattReadInterlockStateCompleted; + + /// + public event VsourceSetRangeCompletedEventHandler VsourceSetRangeCompleted; + + /// + public event VsourceGetRangeCompletedEventHandler VsourceGetRangeCompleted; + + /// + public event VsourceSetVoltageCompletedEventHandler VsourceSetVoltageCompleted; + + /// + public event VsourceGetVoltageCompletedEventHandler VsourceGetVoltageCompleted; + + /// + public event VsourceSetEnableCompletedEventHandler VsourceSetEnableCompleted; + + /// + public event VsourceGetEnableCompletedEventHandler VsourceGetEnableCompleted; + + /// + public event ErrorCodeToMessageCompletedEventHandler ErrorCodeToMessageCompleted; + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int CardId([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("CardId", new object[0]); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void CardIdAsync() { + this.CardIdAsync(null); + } + + /// + public void CardIdAsync(object userState) { + if ((this.CardIdOperationCompleted == null)) { + this.CardIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCardIdOperationCompleted); + } + this.InvokeAsync("CardId", new object[0], this.CardIdOperationCompleted, userState); + } + + private void OnCardIdOperationCompleted(object arg) { + if ((this.CardIdCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CardIdCompleted(this, new CardIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int CardLoc(out int bus, out int slot) { + object[] results = this.Invoke("CardLoc", new object[0]); + bus = ((int)(results[1])); + slot = ((int)(results[2])); + return ((int)(results[0])); + } + + /// + public void CardLocAsync() { + this.CardLocAsync(null); + } + + /// + public void CardLocAsync(object userState) { + if ((this.CardLocOperationCompleted == null)) { + this.CardLocOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCardLocOperationCompleted); + } + this.InvokeAsync("CardLoc", new object[0], this.CardLocOperationCompleted, userState); + } + + private void OnCardLocOperationCompleted(object arg) { + if ((this.CardLocCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CardLocCompleted(this, new CardLocCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClosureLimit(int outSub, out int limit) { + object[] results = this.Invoke("ClosureLimit", new object[] { + outSub}); + limit = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void ClosureLimitAsync(int outSub) { + this.ClosureLimitAsync(outSub, null); + } + + /// + public void ClosureLimitAsync(int outSub, object userState) { + if ((this.ClosureLimitOperationCompleted == null)) { + this.ClosureLimitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClosureLimitOperationCompleted); + } + this.InvokeAsync("ClosureLimit", new object[] { + outSub}, this.ClosureLimitOperationCompleted, userState); + } + + private void OnClosureLimitOperationCompleted(object arg) { + if ((this.ClosureLimitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClosureLimitCompleted(this, new ClosureLimitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int CardOpsCount(out int count) { + object[] results = this.Invoke("CardOpsCount", new object[0]); + count = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void CardOpsCountAsync() { + this.CardOpsCountAsync(null); + } + + /// + public void CardOpsCountAsync(object userState) { + if ((this.CardOpsCountOperationCompleted == null)) { + this.CardOpsCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCardOpsCountOperationCompleted); + } + this.InvokeAsync("CardOpsCount", new object[0], this.CardOpsCountOperationCompleted, userState); + } + + private void OnCardOpsCountOperationCompleted(object arg) { + if ((this.CardOpsCountCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CardOpsCountCompleted(this, new CardOpsCountCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int CountFreeCards(out int numCards) { + object[] results = this.Invoke("CountFreeCards", new object[0]); + numCards = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void CountFreeCardsAsync() { + this.CountFreeCardsAsync(null); + } + + /// + public void CountFreeCardsAsync(object userState) { + if ((this.CountFreeCardsOperationCompleted == null)) { + this.CountFreeCardsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCountFreeCardsOperationCompleted); + } + this.InvokeAsync("CountFreeCards", new object[0], this.CountFreeCardsOperationCompleted, userState); + } + + private void OnCountFreeCardsOperationCompleted(object arg) { + if ((this.CountFreeCardsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CountFreeCardsCompleted(this, new CountFreeCardsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int Diagnostic([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("Diagnostic", new object[0]); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void DiagnosticAsync() { + this.DiagnosticAsync(null); + } + + /// + public void DiagnosticAsync(object userState) { + if ((this.DiagnosticOperationCompleted == null)) { + this.DiagnosticOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDiagnosticOperationCompleted); + } + this.InvokeAsync("Diagnostic", new object[0], this.DiagnosticOperationCompleted, userState); + } + + private void OnDiagnosticOperationCompleted(object arg) { + if ((this.DiagnosticCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.DiagnosticCompleted(this, new DiagnosticCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int EnumerateSubs(out int inSubs, out int outSubs) { + object[] results = this.Invoke("EnumerateSubs", new object[0]); + inSubs = ((int)(results[1])); + outSubs = ((int)(results[2])); + return ((int)(results[0])); + } + + /// + public void EnumerateSubsAsync() { + this.EnumerateSubsAsync(null); + } + + /// + public void EnumerateSubsAsync(object userState) { + if ((this.EnumerateSubsOperationCompleted == null)) { + this.EnumerateSubsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnumerateSubsOperationCompleted); + } + this.InvokeAsync("EnumerateSubs", new object[0], this.EnumerateSubsOperationCompleted, userState); + } + + private void OnEnumerateSubsOperationCompleted(object arg) { + if ((this.EnumerateSubsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.EnumerateSubsCompleted(this, new EnumerateSubsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int FindFreeCards([System.Xml.Serialization.XmlElementAttribute("busList")] out int[] busList, [System.Xml.Serialization.XmlElementAttribute("slotList")] out int[] slotList) { + object[] results = this.Invoke("FindFreeCards", new object[0]); + busList = ((int[])(results[1])); + slotList = ((int[])(results[2])); + return ((int)(results[0])); + } + + /// + public void FindFreeCardsAsync() { + this.FindFreeCardsAsync(null); + } + + /// + public void FindFreeCardsAsync(object userState) { + if ((this.FindFreeCardsOperationCompleted == null)) { + this.FindFreeCardsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnFindFreeCardsOperationCompleted); + } + this.InvokeAsync("FindFreeCards", new object[0], this.FindFreeCardsOperationCompleted, userState); + } + + private void OnFindFreeCardsOperationCompleted(object arg) { + if ((this.FindFreeCardsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.FindFreeCardsCompleted(this, new FindFreeCardsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SettleTime(int outSub, out int time) { + object[] results = this.Invoke("SettleTime", new object[] { + outSub}); + time = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void SettleTimeAsync(int outSub) { + this.SettleTimeAsync(outSub, null); + } + + /// + public void SettleTimeAsync(int outSub, object userState) { + if ((this.SettleTimeOperationCompleted == null)) { + this.SettleTimeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSettleTimeOperationCompleted); + } + this.InvokeAsync("SettleTime", new object[] { + outSub}, this.SettleTimeOperationCompleted, userState); + } + + private void OnSettleTimeOperationCompleted(object arg) { + if ((this.SettleTimeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SettleTimeCompleted(this, new SettleTimeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int Status([System.Xml.Serialization.XmlElementAttribute("status")] out StatusEnum status1) { + object[] results = this.Invoke("Status", new object[0]); + status1 = ((StatusEnum)(results[1])); + return ((int)(results[0])); + } + + /// + public void StatusAsync() { + this.StatusAsync(null); + } + + /// + public void StatusAsync(object userState) { + if ((this.StatusOperationCompleted == null)) { + this.StatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStatusOperationCompleted); + } + this.InvokeAsync("Status", new object[0], this.StatusOperationCompleted, userState); + } + + private void OnStatusOperationCompleted(object arg) { + if ((this.StatusCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.StatusCompleted(this, new StatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubAttribute(int subNum, bool output, AttrCodeEnum attrCode, out int attrValue) { + object[] results = this.Invoke("SubAttribute", new object[] { + subNum, + output, + attrCode}); + attrValue = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void SubAttributeAsync(int subNum, bool output, AttrCodeEnum attrCode) { + this.SubAttributeAsync(subNum, output, attrCode, null); + } + + /// + public void SubAttributeAsync(int subNum, bool output, AttrCodeEnum attrCode, object userState) { + if ((this.SubAttributeOperationCompleted == null)) { + this.SubAttributeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubAttributeOperationCompleted); + } + this.InvokeAsync("SubAttribute", new object[] { + subNum, + output, + attrCode}, this.SubAttributeOperationCompleted, userState); + } + + private void OnSubAttributeOperationCompleted(object arg) { + if ((this.SubAttributeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubAttributeCompleted(this, new SubAttributeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubInfo(int subNum, bool output, out TypeNumberEnum typeNum, out int rows, out int cols) { + object[] results = this.Invoke("SubInfo", new object[] { + subNum, + output}); + typeNum = ((TypeNumberEnum)(results[1])); + rows = ((int)(results[2])); + cols = ((int)(results[3])); + return ((int)(results[0])); + } + + /// + public void SubInfoAsync(int subNum, bool output) { + this.SubInfoAsync(subNum, output, null); + } + + /// + public void SubInfoAsync(int subNum, bool output, object userState) { + if ((this.SubInfoOperationCompleted == null)) { + this.SubInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubInfoOperationCompleted); + } + this.InvokeAsync("SubInfo", new object[] { + subNum, + output}, this.SubInfoOperationCompleted, userState); + } + + private void OnSubInfoOperationCompleted(object arg) { + if ((this.SubInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubInfoCompleted(this, new SubInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubStatus(int subNum, out StatusEnum status) { + object[] results = this.Invoke("SubStatus", new object[] { + subNum}); + status = ((StatusEnum)(results[1])); + return ((int)(results[0])); + } + + /// + public void SubStatusAsync(int subNum) { + this.SubStatusAsync(subNum, null); + } + + /// + public void SubStatusAsync(int subNum, object userState) { + if ((this.SubStatusOperationCompleted == null)) { + this.SubStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubStatusOperationCompleted); + } + this.InvokeAsync("SubStatus", new object[] { + subNum}, this.SubStatusOperationCompleted, userState); + } + + private void OnSubStatusOperationCompleted(object arg) { + if ((this.SubStatusCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubStatusCompleted(this, new SubStatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubType(int subNum, bool output, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("SubType", new object[] { + subNum, + output}); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void SubTypeAsync(int subNum, bool output) { + this.SubTypeAsync(subNum, output, null); + } + + /// + public void SubTypeAsync(int subNum, bool output, object userState) { + if ((this.SubTypeOperationCompleted == null)) { + this.SubTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubTypeOperationCompleted); + } + this.InvokeAsync("SubType", new object[] { + subNum, + output}, this.SubTypeOperationCompleted, userState); + } + + private void OnSubTypeOperationCompleted(object arg) { + if ((this.SubTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubTypeCompleted(this, new SubTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int Version([System.Xml.Serialization.XmlElementAttribute("version")] out int version1) { + object[] results = this.Invoke("Version", new object[0]); + version1 = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void VersionAsync() { + this.VersionAsync(null); + } + + /// + public void VersionAsync(object userState) { + if ((this.VersionOperationCompleted == null)) { + this.VersionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVersionOperationCompleted); + } + this.InvokeAsync("Version", new object[0], this.VersionOperationCompleted, userState); + } + + private void OnVersionOperationCompleted(object arg) { + if ((this.VersionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VersionCompleted(this, new VersionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearAll() { + object[] results = this.Invoke("ClearAll", new object[0]); + return ((int)(results[0])); + } + + /// + public void ClearAllAsync() { + this.ClearAllAsync(null); + } + + /// + public void ClearAllAsync(object userState) { + if ((this.ClearAllOperationCompleted == null)) { + this.ClearAllOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearAllOperationCompleted); + } + this.InvokeAsync("ClearAll", new object[0], this.ClearAllOperationCompleted, userState); + } + + private void OnClearAllOperationCompleted(object arg) { + if ((this.ClearAllCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearAllCompleted(this, new ClearAllCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearCard() { + object[] results = this.Invoke("ClearCard", new object[0]); + return ((int)(results[0])); + } + + /// + public void ClearCardAsync() { + this.ClearCardAsync(null); + } + + /// + public void ClearCardAsync(object userState) { + if ((this.ClearCardOperationCompleted == null)) { + this.ClearCardOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearCardOperationCompleted); + } + this.InvokeAsync("ClearCard", new object[0], this.ClearCardOperationCompleted, userState); + } + + private void OnClearCardOperationCompleted(object arg) { + if ((this.ClearCardCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearCardCompleted(this, new ClearCardCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearSub(int outSub) { + object[] results = this.Invoke("ClearSub", new object[] { + outSub}); + return ((int)(results[0])); + } + + /// + public void ClearSubAsync(int outSub) { + this.ClearSubAsync(outSub, null); + } + + /// + public void ClearSubAsync(int outSub, object userState) { + if ((this.ClearSubOperationCompleted == null)) { + this.ClearSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearSubOperationCompleted); + } + this.InvokeAsync("ClearSub", new object[] { + outSub}, this.ClearSubOperationCompleted, userState); + } + + private void OnClearSubOperationCompleted(object arg) { + if ((this.ClearSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearSubCompleted(this, new ClearSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int OpBit(int outSub, int bitNum, bool action) { + object[] results = this.Invoke("OpBit", new object[] { + outSub, + bitNum, + action}); + return ((int)(results[0])); + } + + /// + public void OpBitAsync(int outSub, int bitNum, bool action) { + this.OpBitAsync(outSub, bitNum, action, null); + } + + /// + public void OpBitAsync(int outSub, int bitNum, bool action, object userState) { + if ((this.OpBitOperationCompleted == null)) { + this.OpBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOpBitOperationCompleted); + } + this.InvokeAsync("OpBit", new object[] { + outSub, + bitNum, + action}, this.OpBitOperationCompleted, userState); + } + + private void OnOpBitOperationCompleted(object arg) { + if ((this.OpBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OpBitCompleted(this, new OpBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewBit(int outSub, int bitNum, out bool state) { + object[] results = this.Invoke("ViewBit", new object[] { + outSub, + bitNum}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewBitAsync(int outSub, int bitNum) { + this.ViewBitAsync(outSub, bitNum, null); + } + + /// + public void ViewBitAsync(int outSub, int bitNum, object userState) { + if ((this.ViewBitOperationCompleted == null)) { + this.ViewBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewBitOperationCompleted); + } + this.InvokeAsync("ViewBit", new object[] { + outSub, + bitNum}, this.ViewBitOperationCompleted, userState); + } + + private void OnViewBitOperationCompleted(object arg) { + if ((this.ViewBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewBitCompleted(this, new ViewBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewSub(int outSub, [System.Xml.Serialization.XmlElementAttribute("data")] out uint[] data) { + object[] results = this.Invoke("ViewSub", new object[] { + outSub}); + data = ((uint[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewSubAsync(int outSub) { + this.ViewSubAsync(outSub, null); + } + + /// + public void ViewSubAsync(int outSub, object userState) { + if ((this.ViewSubOperationCompleted == null)) { + this.ViewSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewSubOperationCompleted); + } + this.InvokeAsync("ViewSub", new object[] { + outSub}, this.ViewSubOperationCompleted, userState); + } + + private void OnViewSubOperationCompleted(object arg) { + if ((this.ViewSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewSubCompleted(this, new ViewSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteSub(int outSub, [System.Xml.Serialization.XmlArrayItemAttribute("item", IsNullable=false)] uint[] data) { + object[] results = this.Invoke("WriteSub", new object[] { + outSub, + data}); + return ((int)(results[0])); + } + + /// + public void WriteSubAsync(int outSub, uint[] data) { + this.WriteSubAsync(outSub, data, null); + } + + /// + public void WriteSubAsync(int outSub, uint[] data, object userState) { + if ((this.WriteSubOperationCompleted == null)) { + this.WriteSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteSubOperationCompleted); + } + this.InvokeAsync("WriteSub", new object[] { + outSub, + data}, this.WriteSubOperationCompleted, userState); + } + + private void OnWriteSubOperationCompleted(object arg) { + if ((this.WriteSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteSubCompleted(this, new WriteSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadBit(int inSub, int bitNum, out bool state) { + object[] results = this.Invoke("ReadBit", new object[] { + inSub, + bitNum}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadBitAsync(int inSub, int bitNum) { + this.ReadBitAsync(inSub, bitNum, null); + } + + /// + public void ReadBitAsync(int inSub, int bitNum, object userState) { + if ((this.ReadBitOperationCompleted == null)) { + this.ReadBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadBitOperationCompleted); + } + this.InvokeAsync("ReadBit", new object[] { + inSub, + bitNum}, this.ReadBitOperationCompleted, userState); + } + + private void OnReadBitOperationCompleted(object arg) { + if ((this.ReadBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadBitCompleted(this, new ReadBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadSub(int inSub, [System.Xml.Serialization.XmlElementAttribute("data")] out int[] data) { + object[] results = this.Invoke("ReadSub", new object[] { + inSub}); + data = ((int[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadSubAsync(int inSub) { + this.ReadSubAsync(inSub, null); + } + + /// + public void ReadSubAsync(int inSub, object userState) { + if ((this.ReadSubOperationCompleted == null)) { + this.ReadSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadSubOperationCompleted); + } + this.InvokeAsync("ReadSub", new object[] { + inSub}, this.ReadSubOperationCompleted, userState); + } + + private void OnReadSubOperationCompleted(object arg) { + if ((this.ReadSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadSubCompleted(this, new ReadSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearMask(int outSub) { + object[] results = this.Invoke("ClearMask", new object[] { + outSub}); + return ((int)(results[0])); + } + + /// + public void ClearMaskAsync(int outSub) { + this.ClearMaskAsync(outSub, null); + } + + /// + public void ClearMaskAsync(int outSub, object userState) { + if ((this.ClearMaskOperationCompleted == null)) { + this.ClearMaskOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearMaskOperationCompleted); + } + this.InvokeAsync("ClearMask", new object[] { + outSub}, this.ClearMaskOperationCompleted, userState); + } + + private void OnClearMaskOperationCompleted(object arg) { + if ((this.ClearMaskCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearMaskCompleted(this, new ClearMaskCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int MaskBit(int outSub, int bitNum, bool action) { + object[] results = this.Invoke("MaskBit", new object[] { + outSub, + bitNum, + action}); + return ((int)(results[0])); + } + + /// + public void MaskBitAsync(int outSub, int bitNum, bool action) { + this.MaskBitAsync(outSub, bitNum, action, null); + } + + /// + public void MaskBitAsync(int outSub, int bitNum, bool action, object userState) { + if ((this.MaskBitOperationCompleted == null)) { + this.MaskBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMaskBitOperationCompleted); + } + this.InvokeAsync("MaskBit", new object[] { + outSub, + bitNum, + action}, this.MaskBitOperationCompleted, userState); + } + + private void OnMaskBitOperationCompleted(object arg) { + if ((this.MaskBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.MaskBitCompleted(this, new MaskBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int MaskCrosspoint(int outSub, int row, int col, bool action) { + object[] results = this.Invoke("MaskCrosspoint", new object[] { + outSub, + row, + col, + action}); + return ((int)(results[0])); + } + + /// + public void MaskCrosspointAsync(int outSub, int row, int col, bool action) { + this.MaskCrosspointAsync(outSub, row, col, action, null); + } + + /// + public void MaskCrosspointAsync(int outSub, int row, int col, bool action, object userState) { + if ((this.MaskCrosspointOperationCompleted == null)) { + this.MaskCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMaskCrosspointOperationCompleted); + } + this.InvokeAsync("MaskCrosspoint", new object[] { + outSub, + row, + col, + action}, this.MaskCrosspointOperationCompleted, userState); + } + + private void OnMaskCrosspointOperationCompleted(object arg) { + if ((this.MaskCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.MaskCrosspointCompleted(this, new MaskCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int OpCrosspoint(int outSub, int row, int col, bool action) { + object[] results = this.Invoke("OpCrosspoint", new object[] { + outSub, + row, + col, + action}); + return ((int)(results[0])); + } + + /// + public void OpCrosspointAsync(int outSub, int row, int col, bool action) { + this.OpCrosspointAsync(outSub, row, col, action, null); + } + + /// + public void OpCrosspointAsync(int outSub, int row, int col, bool action, object userState) { + if ((this.OpCrosspointOperationCompleted == null)) { + this.OpCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOpCrosspointOperationCompleted); + } + this.InvokeAsync("OpCrosspoint", new object[] { + outSub, + row, + col, + action}, this.OpCrosspointOperationCompleted, userState); + } + + private void OnOpCrosspointOperationCompleted(object arg) { + if ((this.OpCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OpCrosspointCompleted(this, new OpCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int OpSwitch(int outSub, SwFuncEnum switchFunc, int segNum, int switchNum, int subSwitch, SwActEnum switchAction, out bool state) { + object[] results = this.Invoke("OpSwitch", new object[] { + outSub, + switchFunc, + segNum, + switchNum, + subSwitch, + switchAction}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void OpSwitchAsync(int outSub, SwFuncEnum switchFunc, int segNum, int switchNum, int subSwitch, SwActEnum switchAction) { + this.OpSwitchAsync(outSub, switchFunc, segNum, switchNum, subSwitch, switchAction, null); + } + + /// + public void OpSwitchAsync(int outSub, SwFuncEnum switchFunc, int segNum, int switchNum, int subSwitch, SwActEnum switchAction, object userState) { + if ((this.OpSwitchOperationCompleted == null)) { + this.OpSwitchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOpSwitchOperationCompleted); + } + this.InvokeAsync("OpSwitch", new object[] { + outSub, + switchFunc, + segNum, + switchNum, + subSwitch, + switchAction}, this.OpSwitchOperationCompleted, userState); + } + + private void OnOpSwitchOperationCompleted(object arg) { + if ((this.OpSwitchCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OpSwitchCompleted(this, new OpSwitchCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewCrosspoint(int outSub, int row, int col, out bool state) { + object[] results = this.Invoke("ViewCrosspoint", new object[] { + outSub, + row, + col}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewCrosspointAsync(int outSub, int row, int col) { + this.ViewCrosspointAsync(outSub, row, col, null); + } + + /// + public void ViewCrosspointAsync(int outSub, int row, int col, object userState) { + if ((this.ViewCrosspointOperationCompleted == null)) { + this.ViewCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewCrosspointOperationCompleted); + } + this.InvokeAsync("ViewCrosspoint", new object[] { + outSub, + row, + col}, this.ViewCrosspointOperationCompleted, userState); + } + + private void OnViewCrosspointOperationCompleted(object arg) { + if ((this.ViewCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewCrosspointCompleted(this, new ViewCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewMask(int outSub, [System.Xml.Serialization.XmlElementAttribute("data")] out int[] data) { + object[] results = this.Invoke("ViewMask", new object[] { + outSub}); + data = ((int[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewMaskAsync(int outSub) { + this.ViewMaskAsync(outSub, null); + } + + /// + public void ViewMaskAsync(int outSub, object userState) { + if ((this.ViewMaskOperationCompleted == null)) { + this.ViewMaskOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewMaskOperationCompleted); + } + this.InvokeAsync("ViewMask", new object[] { + outSub}, this.ViewMaskOperationCompleted, userState); + } + + private void OnViewMaskOperationCompleted(object arg) { + if ((this.ViewMaskCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewMaskCompleted(this, new ViewMaskCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewMaskBit(int outSub, int bitNum, out bool state) { + object[] results = this.Invoke("ViewMaskBit", new object[] { + outSub, + bitNum}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewMaskBitAsync(int outSub, int bitNum) { + this.ViewMaskBitAsync(outSub, bitNum, null); + } + + /// + public void ViewMaskBitAsync(int outSub, int bitNum, object userState) { + if ((this.ViewMaskBitOperationCompleted == null)) { + this.ViewMaskBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewMaskBitOperationCompleted); + } + this.InvokeAsync("ViewMaskBit", new object[] { + outSub, + bitNum}, this.ViewMaskBitOperationCompleted, userState); + } + + private void OnViewMaskBitOperationCompleted(object arg) { + if ((this.ViewMaskBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewMaskBitCompleted(this, new ViewMaskBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewMaskCrosspoint(int outSub, int row, int col, out bool state) { + object[] results = this.Invoke("ViewMaskCrosspoint", new object[] { + outSub, + row, + col}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewMaskCrosspointAsync(int outSub, int row, int col) { + this.ViewMaskCrosspointAsync(outSub, row, col, null); + } + + /// + public void ViewMaskCrosspointAsync(int outSub, int row, int col, object userState) { + if ((this.ViewMaskCrosspointOperationCompleted == null)) { + this.ViewMaskCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewMaskCrosspointOperationCompleted); + } + this.InvokeAsync("ViewMaskCrosspoint", new object[] { + outSub, + row, + col}, this.ViewMaskCrosspointOperationCompleted, userState); + } + + private void OnViewMaskCrosspointOperationCompleted(object arg) { + if ((this.ViewMaskCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewMaskCrosspointCompleted(this, new ViewMaskCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteMask(int outSub, [System.Xml.Serialization.XmlArrayItemAttribute("item", IsNullable=false)] int[] data) { + object[] results = this.Invoke("WriteMask", new object[] { + outSub, + data}); + return ((int)(results[0])); + } + + /// + public void WriteMaskAsync(int outSub, int[] data) { + this.WriteMaskAsync(outSub, data, null); + } + + /// + public void WriteMaskAsync(int outSub, int[] data, object userState) { + if ((this.WriteMaskOperationCompleted == null)) { + this.WriteMaskOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteMaskOperationCompleted); + } + this.InvokeAsync("WriteMask", new object[] { + outSub, + data}, this.WriteMaskOperationCompleted, userState); + } + + private void OnWriteMaskOperationCompleted(object arg) { + if ((this.WriteMaskCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteMaskCompleted(this, new WriteMaskCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuEnable(int subNum, bool state) { + object[] results = this.Invoke("PsuEnable", new object[] { + subNum, + state}); + return ((int)(results[0])); + } + + /// + public void PsuEnableAsync(int subNum, bool state) { + this.PsuEnableAsync(subNum, state, null); + } + + /// + public void PsuEnableAsync(int subNum, bool state, object userState) { + if ((this.PsuEnableOperationCompleted == null)) { + this.PsuEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuEnableOperationCompleted); + } + this.InvokeAsync("PsuEnable", new object[] { + subNum, + state}, this.PsuEnableOperationCompleted, userState); + } + + private void OnPsuEnableOperationCompleted(object arg) { + if ((this.PsuEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuEnableCompleted(this, new PsuEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuGetVoltage(int subNum, out double voltage) { + object[] results = this.Invoke("PsuGetVoltage", new object[] { + subNum}); + voltage = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void PsuGetVoltageAsync(int subNum) { + this.PsuGetVoltageAsync(subNum, null); + } + + /// + public void PsuGetVoltageAsync(int subNum, object userState) { + if ((this.PsuGetVoltageOperationCompleted == null)) { + this.PsuGetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuGetVoltageOperationCompleted); + } + this.InvokeAsync("PsuGetVoltage", new object[] { + subNum}, this.PsuGetVoltageOperationCompleted, userState); + } + + private void OnPsuGetVoltageOperationCompleted(object arg) { + if ((this.PsuGetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuGetVoltageCompleted(this, new PsuGetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuSetVoltage(int subNum, double voltage) { + object[] results = this.Invoke("PsuSetVoltage", new object[] { + subNum, + voltage}); + return ((int)(results[0])); + } + + /// + public void PsuSetVoltageAsync(int subNum, double voltage) { + this.PsuSetVoltageAsync(subNum, voltage, null); + } + + /// + public void PsuSetVoltageAsync(int subNum, double voltage, object userState) { + if ((this.PsuSetVoltageOperationCompleted == null)) { + this.PsuSetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuSetVoltageOperationCompleted); + } + this.InvokeAsync("PsuSetVoltage", new object[] { + subNum, + voltage}, this.PsuSetVoltageOperationCompleted, userState); + } + + private void OnPsuSetVoltageOperationCompleted(object arg) { + if ((this.PsuSetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuSetVoltageCompleted(this, new PsuSetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuInfo(int subNum, out int typeNum, out double voltage, out double current, out int precis, out int capabilities) { + object[] results = this.Invoke("PsuInfo", new object[] { + subNum}); + typeNum = ((int)(results[1])); + voltage = ((double)(results[2])); + current = ((double)(results[3])); + precis = ((int)(results[4])); + capabilities = ((int)(results[5])); + return ((int)(results[0])); + } + + /// + public void PsuInfoAsync(int subNum) { + this.PsuInfoAsync(subNum, null); + } + + /// + public void PsuInfoAsync(int subNum, object userState) { + if ((this.PsuInfoOperationCompleted == null)) { + this.PsuInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuInfoOperationCompleted); + } + this.InvokeAsync("PsuInfo", new object[] { + subNum}, this.PsuInfoOperationCompleted, userState); + } + + private void OnPsuInfoOperationCompleted(object arg) { + if ((this.PsuInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuInfoCompleted(this, new PsuInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuType(int subNum, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("PsuType", new object[] { + subNum}); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void PsuTypeAsync(int subNum) { + this.PsuTypeAsync(subNum, null); + } + + /// + public void PsuTypeAsync(int subNum, object userState) { + if ((this.PsuTypeOperationCompleted == null)) { + this.PsuTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuTypeOperationCompleted); + } + this.InvokeAsync("PsuType", new object[] { + subNum}, this.PsuTypeOperationCompleted, userState); + } + + private void OnPsuTypeOperationCompleted(object arg) { + if ((this.PsuTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuTypeCompleted(this, new PsuTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenGetAttenuation(int subNum, out float atten) { + object[] results = this.Invoke("AttenGetAttenuation", new object[] { + subNum}); + atten = ((float)(results[1])); + return ((int)(results[0])); + } + + /// + public void AttenGetAttenuationAsync(int subNum) { + this.AttenGetAttenuationAsync(subNum, null); + } + + /// + public void AttenGetAttenuationAsync(int subNum, object userState) { + if ((this.AttenGetAttenuationOperationCompleted == null)) { + this.AttenGetAttenuationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenGetAttenuationOperationCompleted); + } + this.InvokeAsync("AttenGetAttenuation", new object[] { + subNum}, this.AttenGetAttenuationOperationCompleted, userState); + } + + private void OnAttenGetAttenuationOperationCompleted(object arg) { + if ((this.AttenGetAttenuationCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenGetAttenuationCompleted(this, new AttenGetAttenuationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenInfo(int subNum, out int typeNum, out int numSteps, out float stepSize) { + object[] results = this.Invoke("AttenInfo", new object[] { + subNum}); + typeNum = ((int)(results[1])); + numSteps = ((int)(results[2])); + stepSize = ((float)(results[3])); + return ((int)(results[0])); + } + + /// + public void AttenInfoAsync(int subNum) { + this.AttenInfoAsync(subNum, null); + } + + /// + public void AttenInfoAsync(int subNum, object userState) { + if ((this.AttenInfoOperationCompleted == null)) { + this.AttenInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenInfoOperationCompleted); + } + this.InvokeAsync("AttenInfo", new object[] { + subNum}, this.AttenInfoOperationCompleted, userState); + } + + private void OnAttenInfoOperationCompleted(object arg) { + if ((this.AttenInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenInfoCompleted(this, new AttenInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenPadValue(int subNum, int padNum, out float atten) { + object[] results = this.Invoke("AttenPadValue", new object[] { + subNum, + padNum}); + atten = ((float)(results[1])); + return ((int)(results[0])); + } + + /// + public void AttenPadValueAsync(int subNum, int padNum) { + this.AttenPadValueAsync(subNum, padNum, null); + } + + /// + public void AttenPadValueAsync(int subNum, int padNum, object userState) { + if ((this.AttenPadValueOperationCompleted == null)) { + this.AttenPadValueOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenPadValueOperationCompleted); + } + this.InvokeAsync("AttenPadValue", new object[] { + subNum, + padNum}, this.AttenPadValueOperationCompleted, userState); + } + + private void OnAttenPadValueOperationCompleted(object arg) { + if ((this.AttenPadValueCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenPadValueCompleted(this, new AttenPadValueCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenSetAttenuation(int subNum, float atten) { + object[] results = this.Invoke("AttenSetAttenuation", new object[] { + subNum, + atten}); + return ((int)(results[0])); + } + + /// + public void AttenSetAttenuationAsync(int subNum, float atten) { + this.AttenSetAttenuationAsync(subNum, atten, null); + } + + /// + public void AttenSetAttenuationAsync(int subNum, float atten, object userState) { + if ((this.AttenSetAttenuationOperationCompleted == null)) { + this.AttenSetAttenuationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenSetAttenuationOperationCompleted); + } + this.InvokeAsync("AttenSetAttenuation", new object[] { + subNum, + atten}, this.AttenSetAttenuationOperationCompleted, userState); + } + + private void OnAttenSetAttenuationOperationCompleted(object arg) { + if ((this.AttenSetAttenuationCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenSetAttenuationCompleted(this, new AttenSetAttenuationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenType(int subNum, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("AttenType", new object[] { + subNum}); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void AttenTypeAsync(int subNum) { + this.AttenTypeAsync(subNum, null); + } + + /// + public void AttenTypeAsync(int subNum, object userState) { + if ((this.AttenTypeOperationCompleted == null)) { + this.AttenTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenTypeOperationCompleted); + } + this.InvokeAsync("AttenType", new object[] { + subNum}, this.AttenTypeOperationCompleted, userState); + } + + private void OnAttenTypeOperationCompleted(object arg) { + if ((this.AttenTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenTypeCompleted(this, new AttenTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadCal(int outSub, int idx, out int data) { + object[] results = this.Invoke("ReadCal", new object[] { + outSub, + idx}); + data = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadCalAsync(int outSub, int idx) { + this.ReadCalAsync(outSub, idx, null); + } + + /// + public void ReadCalAsync(int outSub, int idx, object userState) { + if ((this.ReadCalOperationCompleted == null)) { + this.ReadCalOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadCalOperationCompleted); + } + this.InvokeAsync("ReadCal", new object[] { + outSub, + idx}, this.ReadCalOperationCompleted, userState); + } + + private void OnReadCalOperationCompleted(object arg) { + if ((this.ReadCalCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadCalCompleted(this, new ReadCalCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadCalDate(int outSub, StoreTypeEnum store, out int year, out int day, out int interval) { + object[] results = this.Invoke("ReadCalDate", new object[] { + outSub, + store}); + year = ((int)(results[1])); + day = ((int)(results[2])); + interval = ((int)(results[3])); + return ((int)(results[0])); + } + + /// + public void ReadCalDateAsync(int outSub, StoreTypeEnum store) { + this.ReadCalDateAsync(outSub, store, null); + } + + /// + public void ReadCalDateAsync(int outSub, StoreTypeEnum store, object userState) { + if ((this.ReadCalDateOperationCompleted == null)) { + this.ReadCalDateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadCalDateOperationCompleted); + } + this.InvokeAsync("ReadCalDate", new object[] { + outSub, + store}, this.ReadCalDateOperationCompleted, userState); + } + + private void OnReadCalDateOperationCompleted(object arg) { + if ((this.ReadCalDateCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadCalDateCompleted(this, new ReadCalDateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadCalFP(int outSub, StoreTypeEnum store, int offset, int numValues, [System.Xml.Serialization.XmlElementAttribute("data")] out double[] data) { + object[] results = this.Invoke("ReadCalFP", new object[] { + outSub, + store, + offset, + numValues}); + data = ((double[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues) { + this.ReadCalFPAsync(outSub, store, offset, numValues, null); + } + + /// + public void ReadCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues, object userState) { + if ((this.ReadCalFPOperationCompleted == null)) { + this.ReadCalFPOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadCalFPOperationCompleted); + } + this.InvokeAsync("ReadCalFP", new object[] { + outSub, + store, + offset, + numValues}, this.ReadCalFPOperationCompleted, userState); + } + + private void OnReadCalFPOperationCompleted(object arg) { + if ((this.ReadCalFPCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadCalFPCompleted(this, new ReadCalFPCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SetCalPoint(int outSub, int index) { + object[] results = this.Invoke("SetCalPoint", new object[] { + outSub, + index}); + return ((int)(results[0])); + } + + /// + public void SetCalPointAsync(int outSub, int index) { + this.SetCalPointAsync(outSub, index, null); + } + + /// + public void SetCalPointAsync(int outSub, int index, object userState) { + if ((this.SetCalPointOperationCompleted == null)) { + this.SetCalPointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetCalPointOperationCompleted); + } + this.InvokeAsync("SetCalPoint", new object[] { + outSub, + index}, this.SetCalPointOperationCompleted, userState); + } + + private void OnSetCalPointOperationCompleted(object arg) { + if ((this.SetCalPointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetCalPointCompleted(this, new SetCalPointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteCal(int outSub, int idx, int data) { + object[] results = this.Invoke("WriteCal", new object[] { + outSub, + idx, + data}); + return ((int)(results[0])); + } + + /// + public void WriteCalAsync(int outSub, int idx, int data) { + this.WriteCalAsync(outSub, idx, data, null); + } + + /// + public void WriteCalAsync(int outSub, int idx, int data, object userState) { + if ((this.WriteCalOperationCompleted == null)) { + this.WriteCalOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteCalOperationCompleted); + } + this.InvokeAsync("WriteCal", new object[] { + outSub, + idx, + data}, this.WriteCalOperationCompleted, userState); + } + + private void OnWriteCalOperationCompleted(object arg) { + if ((this.WriteCalCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteCalCompleted(this, new WriteCalCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteCalDate(int outSub, StoreTypeEnum store, int interval) { + object[] results = this.Invoke("WriteCalDate", new object[] { + outSub, + store, + interval}); + return ((int)(results[0])); + } + + /// + public void WriteCalDateAsync(int outSub, StoreTypeEnum store, int interval) { + this.WriteCalDateAsync(outSub, store, interval, null); + } + + /// + public void WriteCalDateAsync(int outSub, StoreTypeEnum store, int interval, object userState) { + if ((this.WriteCalDateOperationCompleted == null)) { + this.WriteCalDateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteCalDateOperationCompleted); + } + this.InvokeAsync("WriteCalDate", new object[] { + outSub, + store, + interval}, this.WriteCalDateOperationCompleted, userState); + } + + private void OnWriteCalDateOperationCompleted(object arg) { + if ((this.WriteCalDateCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteCalDateCompleted(this, new WriteCalDateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteCalFP(int outSub, StoreTypeEnum store, int offset, int numValues, [System.Xml.Serialization.XmlArrayItemAttribute("item", IsNullable=false)] double[] data) { + object[] results = this.Invoke("WriteCalFP", new object[] { + outSub, + store, + offset, + numValues, + data}); + return ((int)(results[0])); + } + + /// + public void WriteCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues, double[] data) { + this.WriteCalFPAsync(outSub, store, offset, numValues, data, null); + } + + /// + public void WriteCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues, double[] data, object userState) { + if ((this.WriteCalFPOperationCompleted == null)) { + this.WriteCalFPOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteCalFPOperationCompleted); + } + this.InvokeAsync("WriteCalFP", new object[] { + outSub, + store, + offset, + numValues, + data}, this.WriteCalFPOperationCompleted, userState); + } + + private void OnWriteCalFPOperationCompleted(object arg) { + if ((this.WriteCalFPCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteCalFPCompleted(this, new WriteCalFPCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ResGetResistance(int outSub, out double resistance) { + object[] results = this.Invoke("ResGetResistance", new object[] { + outSub}); + resistance = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void ResGetResistanceAsync(int outSub) { + this.ResGetResistanceAsync(outSub, null); + } + + /// + public void ResGetResistanceAsync(int outSub, object userState) { + if ((this.ResGetResistanceOperationCompleted == null)) { + this.ResGetResistanceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResGetResistanceOperationCompleted); + } + this.InvokeAsync("ResGetResistance", new object[] { + outSub}, this.ResGetResistanceOperationCompleted, userState); + } + + private void OnResGetResistanceOperationCompleted(object arg) { + if ((this.ResGetResistanceCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ResGetResistanceCompleted(this, new ResGetResistanceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ResSetResistance(int outSub, ModeTypeEnum mode, double resistance) { + object[] results = this.Invoke("ResSetResistance", new object[] { + outSub, + mode, + resistance}); + return ((int)(results[0])); + } + + /// + public void ResSetResistanceAsync(int outSub, ModeTypeEnum mode, double resistance) { + this.ResSetResistanceAsync(outSub, mode, resistance, null); + } + + /// + public void ResSetResistanceAsync(int outSub, ModeTypeEnum mode, double resistance, object userState) { + if ((this.ResSetResistanceOperationCompleted == null)) { + this.ResSetResistanceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResSetResistanceOperationCompleted); + } + this.InvokeAsync("ResSetResistance", new object[] { + outSub, + mode, + resistance}, this.ResSetResistanceOperationCompleted, userState); + } + + private void OnResSetResistanceOperationCompleted(object arg) { + if ((this.ResSetResistanceCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ResSetResistanceCompleted(this, new ResSetResistanceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ResInfo(int outSub, out double minRes, out double maxRes, out double refRes, out double precPC, out double precDelta, out double int1, out double intDelta, out int capabilities) { + object[] results = this.Invoke("ResInfo", new object[] { + outSub}); + minRes = ((double)(results[1])); + maxRes = ((double)(results[2])); + refRes = ((double)(results[3])); + precPC = ((double)(results[4])); + precDelta = ((double)(results[5])); + int1 = ((double)(results[6])); + intDelta = ((double)(results[7])); + capabilities = ((int)(results[8])); + return ((int)(results[0])); + } + + /// + public void ResInfoAsync(int outSub) { + this.ResInfoAsync(outSub, null); + } + + /// + public void ResInfoAsync(int outSub, object userState) { + if ((this.ResInfoOperationCompleted == null)) { + this.ResInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResInfoOperationCompleted); + } + this.InvokeAsync("ResInfo", new object[] { + outSub}, this.ResInfoOperationCompleted, userState); + } + + private void OnResInfoOperationCompleted(object arg) { + if ((this.ResInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ResInfoCompleted(this, new ResInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattSetVoltage(int outSub, double voltage) { + object[] results = this.Invoke("BattSetVoltage", new object[] { + outSub, + voltage}); + return ((int)(results[0])); + } + + /// + public void BattSetVoltageAsync(int outSub, double voltage) { + this.BattSetVoltageAsync(outSub, voltage, null); + } + + /// + public void BattSetVoltageAsync(int outSub, double voltage, object userState) { + if ((this.BattSetVoltageOperationCompleted == null)) { + this.BattSetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattSetVoltageOperationCompleted); + } + this.InvokeAsync("BattSetVoltage", new object[] { + outSub, + voltage}, this.BattSetVoltageOperationCompleted, userState); + } + + private void OnBattSetVoltageOperationCompleted(object arg) { + if ((this.BattSetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattSetVoltageCompleted(this, new BattSetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattGetVoltage(int outSub, out double voltage) { + object[] results = this.Invoke("BattGetVoltage", new object[] { + outSub}); + voltage = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattGetVoltageAsync(int outSub) { + this.BattGetVoltageAsync(outSub, null); + } + + /// + public void BattGetVoltageAsync(int outSub, object userState) { + if ((this.BattGetVoltageOperationCompleted == null)) { + this.BattGetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattGetVoltageOperationCompleted); + } + this.InvokeAsync("BattGetVoltage", new object[] { + outSub}, this.BattGetVoltageOperationCompleted, userState); + } + + private void OnBattGetVoltageOperationCompleted(object arg) { + if ((this.BattGetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattGetVoltageCompleted(this, new BattGetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattSetCurrent(int outSub, double current) { + object[] results = this.Invoke("BattSetCurrent", new object[] { + outSub, + current}); + return ((int)(results[0])); + } + + /// + public void BattSetCurrentAsync(int outSub, double current) { + this.BattSetCurrentAsync(outSub, current, null); + } + + /// + public void BattSetCurrentAsync(int outSub, double current, object userState) { + if ((this.BattSetCurrentOperationCompleted == null)) { + this.BattSetCurrentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattSetCurrentOperationCompleted); + } + this.InvokeAsync("BattSetCurrent", new object[] { + outSub, + current}, this.BattSetCurrentOperationCompleted, userState); + } + + private void OnBattSetCurrentOperationCompleted(object arg) { + if ((this.BattSetCurrentCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattSetCurrentCompleted(this, new BattSetCurrentCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattGetCurrent(int outSub, out double current) { + object[] results = this.Invoke("BattGetCurrent", new object[] { + outSub}); + current = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattGetCurrentAsync(int outSub) { + this.BattGetCurrentAsync(outSub, null); + } + + /// + public void BattGetCurrentAsync(int outSub, object userState) { + if ((this.BattGetCurrentOperationCompleted == null)) { + this.BattGetCurrentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattGetCurrentOperationCompleted); + } + this.InvokeAsync("BattGetCurrent", new object[] { + outSub}, this.BattGetCurrentOperationCompleted, userState); + } + + private void OnBattGetCurrentOperationCompleted(object arg) { + if ((this.BattGetCurrentCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattGetCurrentCompleted(this, new BattGetCurrentCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattSetEnable(int outSub, int pattern) { + object[] results = this.Invoke("BattSetEnable", new object[] { + outSub, + pattern}); + return ((int)(results[0])); + } + + /// + public void BattSetEnableAsync(int outSub, int pattern) { + this.BattSetEnableAsync(outSub, pattern, null); + } + + /// + public void BattSetEnableAsync(int outSub, int pattern, object userState) { + if ((this.BattSetEnableOperationCompleted == null)) { + this.BattSetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattSetEnableOperationCompleted); + } + this.InvokeAsync("BattSetEnable", new object[] { + outSub, + pattern}, this.BattSetEnableOperationCompleted, userState); + } + + private void OnBattSetEnableOperationCompleted(object arg) { + if ((this.BattSetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattSetEnableCompleted(this, new BattSetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattGetEnable(int outSub, out int pattern) { + object[] results = this.Invoke("BattGetEnable", new object[] { + outSub}); + pattern = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattGetEnableAsync(int outSub) { + this.BattGetEnableAsync(outSub, null); + } + + /// + public void BattGetEnableAsync(int outSub, object userState) { + if ((this.BattGetEnableOperationCompleted == null)) { + this.BattGetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattGetEnableOperationCompleted); + } + this.InvokeAsync("BattGetEnable", new object[] { + outSub}, this.BattGetEnableOperationCompleted, userState); + } + + private void OnBattGetEnableOperationCompleted(object arg) { + if ((this.BattGetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattGetEnableCompleted(this, new BattGetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattReadInterlockState(int outSub, out bool interlock) { + object[] results = this.Invoke("BattReadInterlockState", new object[] { + outSub}); + interlock = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattReadInterlockStateAsync(int outSub) { + this.BattReadInterlockStateAsync(outSub, null); + } + + /// + public void BattReadInterlockStateAsync(int outSub, object userState) { + if ((this.BattReadInterlockStateOperationCompleted == null)) { + this.BattReadInterlockStateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattReadInterlockStateOperationCompleted); + } + this.InvokeAsync("BattReadInterlockState", new object[] { + outSub}, this.BattReadInterlockStateOperationCompleted, userState); + } + + private void OnBattReadInterlockStateOperationCompleted(object arg) { + if ((this.BattReadInterlockStateCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattReadInterlockStateCompleted(this, new BattReadInterlockStateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceSetRange(int outSub, double range) { + object[] results = this.Invoke("VsourceSetRange", new object[] { + outSub, + range}); + return ((int)(results[0])); + } + + /// + public void VsourceSetRangeAsync(int outSub, double range) { + this.VsourceSetRangeAsync(outSub, range, null); + } + + /// + public void VsourceSetRangeAsync(int outSub, double range, object userState) { + if ((this.VsourceSetRangeOperationCompleted == null)) { + this.VsourceSetRangeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceSetRangeOperationCompleted); + } + this.InvokeAsync("VsourceSetRange", new object[] { + outSub, + range}, this.VsourceSetRangeOperationCompleted, userState); + } + + private void OnVsourceSetRangeOperationCompleted(object arg) { + if ((this.VsourceSetRangeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceSetRangeCompleted(this, new VsourceSetRangeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceGetRange(int outSub, out double range) { + object[] results = this.Invoke("VsourceGetRange", new object[] { + outSub}); + range = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void VsourceGetRangeAsync(int outSub) { + this.VsourceGetRangeAsync(outSub, null); + } + + /// + public void VsourceGetRangeAsync(int outSub, object userState) { + if ((this.VsourceGetRangeOperationCompleted == null)) { + this.VsourceGetRangeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceGetRangeOperationCompleted); + } + this.InvokeAsync("VsourceGetRange", new object[] { + outSub}, this.VsourceGetRangeOperationCompleted, userState); + } + + private void OnVsourceGetRangeOperationCompleted(object arg) { + if ((this.VsourceGetRangeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceGetRangeCompleted(this, new VsourceGetRangeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceSetVoltage(int outSub, double voltage) { + object[] results = this.Invoke("VsourceSetVoltage", new object[] { + outSub, + voltage}); + return ((int)(results[0])); + } + + /// + public void VsourceSetVoltageAsync(int outSub, double voltage) { + this.VsourceSetVoltageAsync(outSub, voltage, null); + } + + /// + public void VsourceSetVoltageAsync(int outSub, double voltage, object userState) { + if ((this.VsourceSetVoltageOperationCompleted == null)) { + this.VsourceSetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceSetVoltageOperationCompleted); + } + this.InvokeAsync("VsourceSetVoltage", new object[] { + outSub, + voltage}, this.VsourceSetVoltageOperationCompleted, userState); + } + + private void OnVsourceSetVoltageOperationCompleted(object arg) { + if ((this.VsourceSetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceSetVoltageCompleted(this, new VsourceSetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceGetVoltage(int outSub, out double voltage) { + object[] results = this.Invoke("VsourceGetVoltage", new object[] { + outSub}); + voltage = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void VsourceGetVoltageAsync(int outSub) { + this.VsourceGetVoltageAsync(outSub, null); + } + + /// + public void VsourceGetVoltageAsync(int outSub, object userState) { + if ((this.VsourceGetVoltageOperationCompleted == null)) { + this.VsourceGetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceGetVoltageOperationCompleted); + } + this.InvokeAsync("VsourceGetVoltage", new object[] { + outSub}, this.VsourceGetVoltageOperationCompleted, userState); + } + + private void OnVsourceGetVoltageOperationCompleted(object arg) { + if ((this.VsourceGetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceGetVoltageCompleted(this, new VsourceGetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceSetEnable(int outSub, int pattern) { + object[] results = this.Invoke("VsourceSetEnable", new object[] { + outSub, + pattern}); + return ((int)(results[0])); + } + + /// + public void VsourceSetEnableAsync(int outSub, int pattern) { + this.VsourceSetEnableAsync(outSub, pattern, null); + } + + /// + public void VsourceSetEnableAsync(int outSub, int pattern, object userState) { + if ((this.VsourceSetEnableOperationCompleted == null)) { + this.VsourceSetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceSetEnableOperationCompleted); + } + this.InvokeAsync("VsourceSetEnable", new object[] { + outSub, + pattern}, this.VsourceSetEnableOperationCompleted, userState); + } + + private void OnVsourceSetEnableOperationCompleted(object arg) { + if ((this.VsourceSetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceSetEnableCompleted(this, new VsourceSetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceGetEnable(int outSub, out int pattern) { + object[] results = this.Invoke("VsourceGetEnable", new object[] { + outSub}); + pattern = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void VsourceGetEnableAsync(int outSub) { + this.VsourceGetEnableAsync(outSub, null); + } + + /// + public void VsourceGetEnableAsync(int outSub, object userState) { + if ((this.VsourceGetEnableOperationCompleted == null)) { + this.VsourceGetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceGetEnableOperationCompleted); + } + this.InvokeAsync("VsourceGetEnable", new object[] { + outSub}, this.VsourceGetEnableOperationCompleted, userState); + } + + private void OnVsourceGetEnableOperationCompleted(object arg) { + if ((this.VsourceGetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceGetEnableCompleted(this, new VsourceGetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("message", IsNullable=true)] + public string ErrorCodeToMessage(int errorCode) { + object[] results = this.Invoke("ErrorCodeToMessage", new object[] { + errorCode}); + return ((string)(results[0])); + } + + /// + public void ErrorCodeToMessageAsync(int errorCode) { + this.ErrorCodeToMessageAsync(errorCode, null); + } + + /// + public void ErrorCodeToMessageAsync(int errorCode, object userState) { + if ((this.ErrorCodeToMessageOperationCompleted == null)) { + this.ErrorCodeToMessageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnErrorCodeToMessageOperationCompleted); + } + this.InvokeAsync("ErrorCodeToMessage", new object[] { + errorCode}, this.ErrorCodeToMessageOperationCompleted, userState); + } + + private void OnErrorCodeToMessageOperationCompleted(object arg) { + if ((this.ErrorCodeToMessageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ErrorCodeToMessageCompleted(this, new ErrorCodeToMessageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } + + private bool IsLocalFileSystemWebService(string url) { + if (((url == null) + || (url == string.Empty))) { + return false; + } + System.Uri wsUri = new System.Uri(url); + if (((wsUri.Port >= 1024) + && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) { + return true; + } + return false; + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + [System.Xml.Serialization.XmlRootAttribute("CardLocation", Namespace="http://pickeringswitch.com/lxi/ws/picards", IsNullable=false)] + public partial class LocationHeader : System.Web.Services.Protocols.SoapHeader { + + private long busField; + + private long slotField; + + /// + public long Bus { + get { + return this.busField; + } + set { + this.busField = value; + } + } + + /// + public long Slot { + get { + return this.slotField; + } + set { + this.slotField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum StatusEnum { + + /// + StatNoCard, + + /// + StatWrongDriver, + + /// + StatEepromErr, + + /// + StatDisabled, + + /// + SubStatNoSub, + + /// + StatBusy, + + /// + StatHwFault, + + /// + StatParityError, + + /// + StatPsuInhibited, + + /// + StatPsuShutdown, + + /// + StatPsuCurrentLimit, + + /// + StatCorrupted, + + /// + StatCardInaccessible, + + /// + StatUncalibrated, + + /// + StatCalibrationDue, + + /// + StatBirstEnabled, + + /// + StatOk, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum AttrCodeEnum { + + /// + AttrChannelSubSwitches, + + /// + AttrXIsoSubSwitches, + + /// + AttrYIsoSubSwitches, + + /// + AttrXLoopthruSubSwitches, + + /// + AttrYLoopthruSubSwitches, + + /// + AttrNumXSegments, + + /// + AttrXSegment01Size, + + /// + AttrXSegment02Size, + + /// + AttrXSegment03Size, + + /// + AttrXSegment04Size, + + /// + AttrXSegment05Size, + + /// + AttrXSegment06Size, + + /// + AttrXSegment07Size, + + /// + AttrXSegment08Size, + + /// + AttrXSegment09Size, + + /// + AttrXSegment10Size, + + /// + AttrXSegment11Size, + + /// + AttrXSegment12Size, + + /// + AttrNumYSegments, + + /// + AttrYSegment01Size, + + /// + AttrYSegment02Size, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum TypeNumberEnum { + + /// + TypeSw, + + /// + TypeMux, + + /// + TypeMuxm, + + /// + TypeMat, + + /// + TypeMatr, + + /// + TypeDig, + + /// + TypeRes, + + /// + TypeAtten, + + /// + TypePsudc, + + /// + TypeBatt, + + /// + TypeVsource, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum SwFuncEnum { + + /// + SwFuncChannel, + + /// + SwFuncXIso, + + /// + SwFuncYIso, + + /// + SwFuncXLoopthru, + + /// + SwFuncYLoopthru, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum SwActEnum { + + /// + SwActNone, + + /// + SwActActOpen, + + /// + SwActClose, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum StoreTypeEnum { + + /// + CalStoreUser, + + /// + CalStoreFactory, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum ModeTypeEnum { + + /// + ResModeSet, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void CardIdCompletedEventHandler(object sender, CardIdCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CardIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CardIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void CardLocCompletedEventHandler(object sender, CardLocCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CardLocCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CardLocCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int bus { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public int slot { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClosureLimitCompletedEventHandler(object sender, ClosureLimitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClosureLimitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClosureLimitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int limit { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void CardOpsCountCompletedEventHandler(object sender, CardOpsCountCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CardOpsCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CardOpsCountCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int count { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void CountFreeCardsCompletedEventHandler(object sender, CountFreeCardsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CountFreeCardsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CountFreeCardsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int numCards { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void DiagnosticCompletedEventHandler(object sender, DiagnosticCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class DiagnosticCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal DiagnosticCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void EnumerateSubsCompletedEventHandler(object sender, EnumerateSubsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class EnumerateSubsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal EnumerateSubsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int inSubs { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public int outSubs { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void FindFreeCardsCompletedEventHandler(object sender, FindFreeCardsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class FindFreeCardsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal FindFreeCardsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int[] busList { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[1])); + } + } + + /// + public int[] slotList { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[2])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SettleTimeCompletedEventHandler(object sender, SettleTimeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SettleTimeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SettleTimeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int time { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void StatusCompletedEventHandler(object sender, StatusCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class StatusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal StatusCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public StatusEnum status1 { + get { + this.RaiseExceptionIfNecessary(); + return ((StatusEnum)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubAttributeCompletedEventHandler(object sender, SubAttributeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubAttributeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubAttributeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int attrValue { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubInfoCompletedEventHandler(object sender, SubInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public TypeNumberEnum typeNum { + get { + this.RaiseExceptionIfNecessary(); + return ((TypeNumberEnum)(this.results[1])); + } + } + + /// + public int rows { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + + /// + public int cols { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[3])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubStatusCompletedEventHandler(object sender, SubStatusCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubStatusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubStatusCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public StatusEnum status { + get { + this.RaiseExceptionIfNecessary(); + return ((StatusEnum)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubTypeCompletedEventHandler(object sender, SubTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VersionCompletedEventHandler(object sender, VersionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VersionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int version1 { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearAllCompletedEventHandler(object sender, ClearAllCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearAllCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearAllCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearCardCompletedEventHandler(object sender, ClearCardCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearCardCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearCardCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearSubCompletedEventHandler(object sender, ClearSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void OpBitCompletedEventHandler(object sender, OpBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class OpBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OpBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewBitCompletedEventHandler(object sender, ViewBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewSubCompletedEventHandler(object sender, ViewSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public uint[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((uint[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteSubCompletedEventHandler(object sender, WriteSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadBitCompletedEventHandler(object sender, ReadBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadSubCompletedEventHandler(object sender, ReadSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearMaskCompletedEventHandler(object sender, ClearMaskCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearMaskCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearMaskCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void MaskBitCompletedEventHandler(object sender, MaskBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class MaskBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal MaskBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void MaskCrosspointCompletedEventHandler(object sender, MaskCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class MaskCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal MaskCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void OpCrosspointCompletedEventHandler(object sender, OpCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class OpCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OpCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void OpSwitchCompletedEventHandler(object sender, OpSwitchCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class OpSwitchCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OpSwitchCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewCrosspointCompletedEventHandler(object sender, ViewCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewMaskCompletedEventHandler(object sender, ViewMaskCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewMaskCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewMaskCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewMaskBitCompletedEventHandler(object sender, ViewMaskBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewMaskBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewMaskBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewMaskCrosspointCompletedEventHandler(object sender, ViewMaskCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewMaskCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewMaskCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteMaskCompletedEventHandler(object sender, WriteMaskCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteMaskCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteMaskCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuEnableCompletedEventHandler(object sender, PsuEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuGetVoltageCompletedEventHandler(object sender, PsuGetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuGetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuGetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuSetVoltageCompletedEventHandler(object sender, PsuSetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuSetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuSetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuInfoCompletedEventHandler(object sender, PsuInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int typeNum { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[2])); + } + } + + /// + public double current { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[3])); + } + } + + /// + public int precis { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[4])); + } + } + + /// + public int capabilities { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[5])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuTypeCompletedEventHandler(object sender, PsuTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenGetAttenuationCompletedEventHandler(object sender, AttenGetAttenuationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenGetAttenuationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenGetAttenuationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public float atten { + get { + this.RaiseExceptionIfNecessary(); + return ((float)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenInfoCompletedEventHandler(object sender, AttenInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int typeNum { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public int numSteps { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + + /// + public float stepSize { + get { + this.RaiseExceptionIfNecessary(); + return ((float)(this.results[3])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenPadValueCompletedEventHandler(object sender, AttenPadValueCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenPadValueCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenPadValueCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public float atten { + get { + this.RaiseExceptionIfNecessary(); + return ((float)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenSetAttenuationCompletedEventHandler(object sender, AttenSetAttenuationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenSetAttenuationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenSetAttenuationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenTypeCompletedEventHandler(object sender, AttenTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadCalCompletedEventHandler(object sender, ReadCalCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadCalCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadCalCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int data { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadCalDateCompletedEventHandler(object sender, ReadCalDateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadCalDateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadCalDateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int year { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public int day { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + + /// + public int interval { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[3])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadCalFPCompletedEventHandler(object sender, ReadCalFPCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadCalFPCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadCalFPCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((double[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SetCalPointCompletedEventHandler(object sender, SetCalPointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetCalPointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetCalPointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteCalCompletedEventHandler(object sender, WriteCalCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteCalCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteCalCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteCalDateCompletedEventHandler(object sender, WriteCalDateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteCalDateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteCalDateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteCalFPCompletedEventHandler(object sender, WriteCalFPCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteCalFPCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteCalFPCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ResGetResistanceCompletedEventHandler(object sender, ResGetResistanceCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ResGetResistanceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ResGetResistanceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double resistance { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ResSetResistanceCompletedEventHandler(object sender, ResSetResistanceCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ResSetResistanceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ResSetResistanceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ResInfoCompletedEventHandler(object sender, ResInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ResInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ResInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double minRes { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + + /// + public double maxRes { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[2])); + } + } + + /// + public double refRes { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[3])); + } + } + + /// + public double precPC { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[4])); + } + } + + /// + public double precDelta { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[5])); + } + } + + /// + public double int1 { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[6])); + } + } + + /// + public double intDelta { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[7])); + } + } + + /// + public int capabilities { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[8])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattSetVoltageCompletedEventHandler(object sender, BattSetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattSetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattSetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattGetVoltageCompletedEventHandler(object sender, BattGetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattGetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattGetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattSetCurrentCompletedEventHandler(object sender, BattSetCurrentCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattSetCurrentCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattSetCurrentCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattGetCurrentCompletedEventHandler(object sender, BattGetCurrentCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattGetCurrentCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattGetCurrentCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double current { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattSetEnableCompletedEventHandler(object sender, BattSetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattSetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattSetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattGetEnableCompletedEventHandler(object sender, BattGetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattGetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattGetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int pattern { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattReadInterlockStateCompletedEventHandler(object sender, BattReadInterlockStateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattReadInterlockStateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattReadInterlockStateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool interlock { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceSetRangeCompletedEventHandler(object sender, VsourceSetRangeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceSetRangeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceSetRangeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceGetRangeCompletedEventHandler(object sender, VsourceGetRangeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceGetRangeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceGetRangeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double range { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceSetVoltageCompletedEventHandler(object sender, VsourceSetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceSetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceSetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceGetVoltageCompletedEventHandler(object sender, VsourceGetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceGetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceGetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceSetEnableCompletedEventHandler(object sender, VsourceSetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceSetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceSetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceGetEnableCompletedEventHandler(object sender, VsourceGetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceGetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceGetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int pattern { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ErrorCodeToMessageCompletedEventHandler(object sender, ErrorCodeToMessageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ErrorCodeToMessageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ErrorCodeToMessageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } +} + +#pragma warning restore 1591 \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/Reference.map b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/Reference.map new file mode 100644 index 0000000..9b256dd --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/Reference.map @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/StatusEnum.datasource b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/StatusEnum.datasource new file mode 100644 index 0000000..e8ca972 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/StatusEnum.datasource @@ -0,0 +1,10 @@ + + + + SwitchMeasurementInstrumentsLib.Pickering40LxiSoap.StatusEnum, Web References.Pickering40LxiSoap.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/TypeNumberEnum.datasource b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/TypeNumberEnum.datasource new file mode 100644 index 0000000..0ceba76 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi40_531_Soap/Web References/Pickering40LxiSoap/TypeNumberEnum.datasource @@ -0,0 +1,10 @@ + + + + SwitchMeasurementInstrumentsLib.Pickering40LxiSoap.TypeNumberEnum, Web References.Pickering40LxiSoap.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/App.config b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/App.config new file mode 100644 index 0000000..68918ce --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/App.config @@ -0,0 +1,16 @@ + + + + +
+ + + + + + http://lxidevice/bin/PiCards + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Pickering60LxiSoap.wsdl b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Pickering60LxiSoap.wsdl new file mode 100644 index 0000000..d3ce4c0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Pickering60LxiSoap.wsdl @@ -0,0 +1,2632 @@ + + + + + + + + represents status of cards. + + + + + + + + + + + + + + + + + + + + + + + + represents type of standard Pickering cards. + + + + + + + + + + + + + + + + + + represents attributes which help in getting information from the card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + represents important attributes for a OpSwitch function + + + + + + + + + + + + represents action for OpSwitch function. + + + + + + + + + + all PSU capability flags. + + + + + + + + + + + + indicating which store to access. + + + + + + + + + indicating how the given resistance value is to be applied. Only one mode is currently supported. + + + + + + + + contains set of capability flags. + + + + + + + + + + + + represents all of the battery simulator sub-units on the card. + + + + + + + + represents all of the voltage sources sub-units on the card. + + + + + + + + represents array data type + + + + + + + + represents array data type + + + + + + + + data type which represents SOAP header for sending data about a bus and a slot of a card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + obtains the identification string of the specified card. + + + + + obtains the maximum number of switches that may be activated simultaneously in the specified sub-unit. + + + + + returns count of switched relays from operation system start. + + + + + obtains the number of installed cards that are operable by the Pilpxi driver but are not currently opened by it. + + + + + obtains the diagnostic string of the specified card, giving expanded information on any fault conditons. + + + + + obtains the numbers of input and output sub-units implemented on the specified card. + + + + + obtains the logical bus and slot locations of installed cards that are operable by the Pilpxi driver and are currently unopened. + + + + + obtains a sub-unit's settling time (the period taken for its switches to stabilise). + + + + + obtains the current status flags for the specified card. + + + + + obtains the value of a sub-unit attribute. + + + + + obtains a description of a sub-unit, as numeric values. + + + + + obtains the current status flags for the specified output sub-unit. + + + + + obtains a description of a sub-unit, as a text string. + + + + + obtains the driver version code. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of every open Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of the specified Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of a sub-unit. + + + + + operate a single output channel or bit. + + + + + obtains the state of an individual output. + + + + + obtains the state of all outputs of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + sets all outputs of a sub-unit to the supplied bit-pattern. The number of least significant bits corresponding to the size of the sub-unit are written. + + + + + obtains the state of an individual input. + + + + + obtains the current state of all inputs of a sub-unit. + + + + + clears a sub-unit's switch mask, enabling operation of all outputs by the OpBit, OpCrosspoint and WriteSub functions. + + + + + Service definition of function ns__MaskBit + + + + + mask or unmask a single matrix crosspoint. + + + + + operate a single matrix crosspoint. + + + + + this function obtains, and optionally sets, the state of a switch. + + + + + obtains the state of an individual matrix crosspoint. + + + + + obtains the switch mask of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + obtains the state of an individual output's mask. + + + + + obtains the state of an individual matrix crosspoint's mask. + + + + + sets a sub-unit's switch mask to the supplied bit-pattern. + + + + + enables or disables a power supply's output. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains a description of a power supply sub-unit, as numeric values. + + + + + obtains a description of a power supply sub-unit, as text string. + + + + + obtains the current attenuation setting. + + + + + obtains a description of an RF attenuator sub-unit, as numeric values. + + + + + obtains the attenuation value of a numbered pad. + + + + + sets the attenuation to the specified value. + + + + + obtains a description of an attenuator sub-unit, as a text string. + + + + + reads a 16-bit calibration value from on-card EEPROM. + + + + + reads a sub-unit's calibration date and interval from on-card EEPROM. + + + + + reads one or more floating-point calibration values from on-card EEPROM. + + + + + sets a sub-unit to a state corresponding to one of its defined calibration points. + + + + + writes a 16-bit calibration value to on-card EEPROM. + + + + + writes a sub-unit's calibration date and interval into on-card EEPROM. Date information is obtained from the current system date. + + + + + writes one or more floating-point calibration values into on-card EEPROM. + + + + + obtains the current resistance setting of the specified programmable resistor. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + sets a programmable resistor to the closest available setting to the value specified. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + obtains detailed information on a programmable resistor sub-unit. + + + + + sets the output of a battery simulator sub-unit(s). + + + + + obtains the voltage setting of a battery simulator sub-unit. + + + + + sets the output sink of a battery simulator sub-unit(s). + + + + + obtains the current sink setting of a battery simulator sub-unit. + + + + + sets the output enable pattern of a battery simulator sub-unit(s). + + + + + optains the output enable pattern of a battery simulator sub-unit. + + + + + obtains the present state of a hardware interlock associated with battery simulator sub-unit(s). + + + + + sets output voltage range of voltage source sub-unit. + + + + + obtains the output voltage settings of range of voltage source sub-unit. + + + + + sets the output voltage of voltage source sub-unit. + + + + + obtains the output voltage setting of a voltage source sub-unit. + + + + + sets the output enable pattern of a voltage source sub-unit(s). + + + + + optains the output enable pattern of a voltage source sub-unit. + + + + + return eeror message of the error code. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Web service for basic Pickering's cards like switches, resistor cards and digital I/O. + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Properties/Settings.Designer.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c6c2dcc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Properties/Settings.Designer.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// 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 Raytheon.Instruments.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.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; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] + [global::System.Configuration.DefaultSettingValueAttribute("http://lxidevice/bin/PiCards")] + public string SwitchMeasurementInstruments_Pickering60LxiSoap_PiCards { + get { + return ((string)(this["SwitchMeasurementInstruments_Pickering60LxiSoap_PiCards"])); + } + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Properties/Settings.settings b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Properties/Settings.settings new file mode 100644 index 0000000..d2ec45a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Properties/Settings.settings @@ -0,0 +1,9 @@ + + + + + + http://lxidevice/bin/PiCards + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_Soap.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_Soap.cs new file mode 100644 index 0000000..afc9cd6 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_Soap.cs @@ -0,0 +1,409 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using NLog; +using Raytheon.Common; +using SwitchMeasurementInstrumentsLib.Pickering60LxiSoap; + +namespace Raytheon.Instruments +{ + /// + /// A Pickering implementation of the IRelaySwitch interface + /// + public class SwitchPickeringLxi60_522_Soap : ISwitch, IDisposable + { + #region PrivateMemberVariables + + private string _name; + private PiCards _card; + private readonly int _subUnit; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer + /// + ~SwitchPickeringLxi60_522_Soap() + { + Dispose(false); + } + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _card.ClearAll(); + _card.Dispose(); + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Close a single relay + /// The relay string should be the string form of an integer that represents the bit to close + /// + /// The relay to close + private void RelayClose(string relay) + { + int ret = _card.OpBit(_subUnit, Convert.ToInt32(relay), true); + + if (ret != 0) + { + throw new Exception("OpBit failed with a ret of: " + ret); + } + } + + /// + /// Opens a single relay + /// The relay strings should be the string form of an integer that represents the bit to close + /// + /// The relay to open + private void RelayOpen(string relay) + { + int ret = _card.OpBit(_subUnit, Convert.ToInt32(relay), false); + + if (ret != 0) + { + throw new Exception("OpBit failed with a ret of: " + ret); + } + } + + /// + /// Opens all relays on the card + /// + private void RelayOpenAll() + { + int ret = _card.ClearCard(); + + if (ret != 0) + { + throw new Exception("OpBit failed with a ret of: " + ret); + } + } + + #endregion + + #region PublicFunctions + + /// + /// SwitchPickeringLxi60_522_Soap factory constructor + /// + /// + /// + public SwitchPickeringLxi60_522_Soap(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + var address = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "Address", "127.0.0.1"); + var deviceNumber = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "DeviceNumber", 0); + var busNumber = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "BusNumber", 0); + + _subUnit = _configuration.GetConfigurationValue("SwitchPickeringLxi60_522_Soap", "SubUnit", 0); + + _card = new PiCards + { + Url = $"http://{address}/bin/picards" + }; + + LocationHeader lh = new LocationHeader + { + Slot = deviceNumber, + Bus = busNumber + }; + + _card.CardLocation = lh; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public SwitchPickeringLxi60_522_Soap(string name, string address, int deviceNumber, int busNumber, int subUnit) + { + _name = name; + + _logger = LogManager.GetCurrentClassLogger(); + + _subUnit = subUnit; + + _card = new PiCards(); + + string tempAddress = "http://" + address + "/bin/picards"; + _card.Url = tempAddress; + + LocationHeader lh = new LocationHeader(); + lh.Slot = deviceNumber; + lh.Bus = busNumber; + + _card.CardLocation = lh; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Connect(string path) + { + RelayClose(path); + } + + /// + /// + /// + /// + public void Disconnect(string path) + { + RelayOpen(path); + } + + /// + /// + /// + public void DisconnectAll() + { + RelayOpenAll(); + } + + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Pickering Switch"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + // nothing to initialize here + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public bool IsDebounced + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void Reset() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + _card.ClearAll(); + _card.Dispose(); + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_Soap.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_Soap.csproj new file mode 100644 index 0000000..c4f88e4 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_Soap.csproj @@ -0,0 +1,55 @@ + + + + net472 + Raytheon.Instruments.SwitchPickeringLxi60_522_Soap + Switch Pickering Lxi60 522 Soap implementation + Switch Pickering Lxi60 522 Soap implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + + + True + True + Settings.settings + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_SoapFactory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_SoapFactory.cs new file mode 100644 index 0000000..b1198d7 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/SwitchPickeringLxi60_522_SoapFactory.cs @@ -0,0 +1,141 @@ +// ********************************************************************************************************** +// SwitchPickeringLxi60_522_SoapFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using SwitchMeasurementInstrumentsLib; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchPickeringLxi60_522_SoapFactory")] + public class SwitchPickeringLxi60_522_SoapFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchPickeringLxi60_522_SoapFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchPickeringLxi60_522_SoapFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchPickeringLxi60_522_Soap(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SwitchSim(name, _configurationManager, _logger); + else + return new SwitchPickeringLxi60_522_Soap(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/PiCards.wsdl b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/PiCards.wsdl new file mode 100644 index 0000000..6ebb3b5 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/PiCards.wsdl @@ -0,0 +1,2632 @@ + + + + + + + + represents status of cards. + + + + + + + + + + + + + + + + + + + + + + + + represents type of standard Pickering cards. + + + + + + + + + + + + + + + + + + represents attributes which help in getting information from the card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + represents important attributes for a OpSwitch function + + + + + + + + + + + + represents action for OpSwitch function. + + + + + + + + + + all PSU capability flags. + + + + + + + + + + + + indicating which store to access. + + + + + + + + + indicating how the given resistance value is to be applied. Only one mode is currently supported. + + + + + + + + contains set of capability flags. + + + + + + + + + + + + represents all of the battery simulator sub-units on the card. + + + + + + + + represents all of the voltage sources sub-units on the card. + + + + + + + + represents array data type + + + + + + + + represents array data type + + + + + + + + data type which represents SOAP header for sending data about a bus and a slot of a card. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + obtains the identification string of the specified card. + + + + + obtains the maximum number of switches that may be activated simultaneously in the specified sub-unit. + + + + + returns count of switched relays from operation system start. + + + + + obtains the number of installed cards that are operable by the Pilpxi driver but are not currently opened by it. + + + + + obtains the diagnostic string of the specified card, giving expanded information on any fault conditons. + + + + + obtains the numbers of input and output sub-units implemented on the specified card. + + + + + obtains the logical bus and slot locations of installed cards that are operable by the Pilpxi driver and are currently unopened. + + + + + obtains a sub-unit's settling time (the period taken for its switches to stabilise). + + + + + obtains the current status flags for the specified card. + + + + + obtains the value of a sub-unit attribute. + + + + + obtains a description of a sub-unit, as numeric values. + + + + + obtains the current status flags for the specified output sub-unit. + + + + + obtains a description of a sub-unit, as a text string. + + + + + obtains the driver version code. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of every open Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of all sub-units of the specified Pickering card. + + + + + clears (de-energises or sets to logic '0') all outputs of a sub-unit. + + + + + operate a single output channel or bit. + + + + + obtains the state of an individual output. + + + + + obtains the state of all outputs of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + sets all outputs of a sub-unit to the supplied bit-pattern. The number of least significant bits corresponding to the size of the sub-unit are written. + + + + + obtains the state of an individual input. + + + + + obtains the current state of all inputs of a sub-unit. + + + + + clears a sub-unit's switch mask, enabling operation of all outputs by the OpBit, OpCrosspoint and WriteSub functions. + + + + + Service definition of function ns__MaskBit + + + + + mask or unmask a single matrix crosspoint. + + + + + operate a single matrix crosspoint. + + + + + this function obtains, and optionally sets, the state of a switch. + + + + + obtains the state of an individual matrix crosspoint. + + + + + obtains the switch mask of a sub-unit. The result fills the number of least significant bits corresponding to the size of the sub-unit. + + + + + obtains the state of an individual output's mask. + + + + + obtains the state of an individual matrix crosspoint's mask. + + + + + sets a sub-unit's switch mask to the supplied bit-pattern. + + + + + enables or disables a power supply's output. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains the voltage setting of a power supply sub-unit. + + + + + obtains a description of a power supply sub-unit, as numeric values. + + + + + obtains a description of a power supply sub-unit, as text string. + + + + + obtains the current attenuation setting. + + + + + obtains a description of an RF attenuator sub-unit, as numeric values. + + + + + obtains the attenuation value of a numbered pad. + + + + + sets the attenuation to the specified value. + + + + + obtains a description of an attenuator sub-unit, as a text string. + + + + + reads a 16-bit calibration value from on-card EEPROM. + + + + + reads a sub-unit's calibration date and interval from on-card EEPROM. + + + + + reads one or more floating-point calibration values from on-card EEPROM. + + + + + sets a sub-unit to a state corresponding to one of its defined calibration points. + + + + + writes a 16-bit calibration value to on-card EEPROM. + + + + + writes a sub-unit's calibration date and interval into on-card EEPROM. Date information is obtained from the current system date. + + + + + writes one or more floating-point calibration values into on-card EEPROM. + + + + + obtains the current resistance setting of the specified programmable resistor. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + sets a programmable resistor to the closest available setting to the value specified. This function is only usable with programmable resistor models that support it, such as 40-260-001. + + + + + obtains detailed information on a programmable resistor sub-unit. + + + + + sets the output of a battery simulator sub-unit(s). + + + + + obtains the voltage setting of a battery simulator sub-unit. + + + + + sets the output sink of a battery simulator sub-unit(s). + + + + + obtains the current sink setting of a battery simulator sub-unit. + + + + + sets the output enable pattern of a battery simulator sub-unit(s). + + + + + optains the output enable pattern of a battery simulator sub-unit. + + + + + obtains the present state of a hardware interlock associated with battery simulator sub-unit(s). + + + + + sets output voltage range of voltage source sub-unit. + + + + + obtains the output voltage settings of range of voltage source sub-unit. + + + + + sets the output voltage of voltage source sub-unit. + + + + + obtains the output voltage setting of a voltage source sub-unit. + + + + + sets the output enable pattern of a voltage source sub-unit(s). + + + + + optains the output enable pattern of a voltage source sub-unit. + + + + + return eeror message of the error code. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Web service for basic Pickering's cards like switches, resistor cards and digital I/O. + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/Reference.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/Reference.cs new file mode 100644 index 0000000..712ebf8 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/Reference.cs @@ -0,0 +1,5150 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +// +// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.42000. +// +#pragma warning disable 1591 + +namespace SwitchMeasurementInstrumentsLib.Pickering60LxiSoap { + using System; + using System.Web.Services; + using System.Diagnostics; + using System.Web.Services.Protocols; + using System.Xml.Serialization; + using System.ComponentModel; + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="PiCards", Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public partial class PiCards : System.Web.Services.Protocols.SoapHttpClientProtocol { + + private LocationHeader cardLocationField; + + private System.Threading.SendOrPostCallback CardIdOperationCompleted; + + private System.Threading.SendOrPostCallback ClosureLimitOperationCompleted; + + private System.Threading.SendOrPostCallback CardOpsCountOperationCompleted; + + private System.Threading.SendOrPostCallback CountFreeCardsOperationCompleted; + + private System.Threading.SendOrPostCallback DiagnosticOperationCompleted; + + private System.Threading.SendOrPostCallback EnumerateSubsOperationCompleted; + + private System.Threading.SendOrPostCallback FindFreeCardsOperationCompleted; + + private System.Threading.SendOrPostCallback SettleTimeOperationCompleted; + + private System.Threading.SendOrPostCallback StatusOperationCompleted; + + private System.Threading.SendOrPostCallback SubAttributeOperationCompleted; + + private System.Threading.SendOrPostCallback SubInfoOperationCompleted; + + private System.Threading.SendOrPostCallback SubStatusOperationCompleted; + + private System.Threading.SendOrPostCallback SubTypeOperationCompleted; + + private System.Threading.SendOrPostCallback VersionOperationCompleted; + + private System.Threading.SendOrPostCallback ClearAllOperationCompleted; + + private System.Threading.SendOrPostCallback ClearCardOperationCompleted; + + private System.Threading.SendOrPostCallback ClearSubOperationCompleted; + + private System.Threading.SendOrPostCallback OpBitOperationCompleted; + + private System.Threading.SendOrPostCallback ViewBitOperationCompleted; + + private System.Threading.SendOrPostCallback ViewSubOperationCompleted; + + private System.Threading.SendOrPostCallback WriteSubOperationCompleted; + + private System.Threading.SendOrPostCallback ReadBitOperationCompleted; + + private System.Threading.SendOrPostCallback ReadSubOperationCompleted; + + private System.Threading.SendOrPostCallback ClearMaskOperationCompleted; + + private System.Threading.SendOrPostCallback MaskBitOperationCompleted; + + private System.Threading.SendOrPostCallback MaskCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback OpCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback OpSwitchOperationCompleted; + + private System.Threading.SendOrPostCallback ViewCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback ViewMaskOperationCompleted; + + private System.Threading.SendOrPostCallback ViewMaskBitOperationCompleted; + + private System.Threading.SendOrPostCallback ViewMaskCrosspointOperationCompleted; + + private System.Threading.SendOrPostCallback WriteMaskOperationCompleted; + + private System.Threading.SendOrPostCallback PsuEnableOperationCompleted; + + private System.Threading.SendOrPostCallback PsuGetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback PsuSetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback PsuInfoOperationCompleted; + + private System.Threading.SendOrPostCallback PsuTypeOperationCompleted; + + private System.Threading.SendOrPostCallback AttenGetAttenuationOperationCompleted; + + private System.Threading.SendOrPostCallback AttenInfoOperationCompleted; + + private System.Threading.SendOrPostCallback AttenPadValueOperationCompleted; + + private System.Threading.SendOrPostCallback AttenSetAttenuationOperationCompleted; + + private System.Threading.SendOrPostCallback AttenTypeOperationCompleted; + + private System.Threading.SendOrPostCallback ReadCalOperationCompleted; + + private System.Threading.SendOrPostCallback ReadCalDateOperationCompleted; + + private System.Threading.SendOrPostCallback ReadCalFPOperationCompleted; + + private System.Threading.SendOrPostCallback SetCalPointOperationCompleted; + + private System.Threading.SendOrPostCallback WriteCalOperationCompleted; + + private System.Threading.SendOrPostCallback WriteCalDateOperationCompleted; + + private System.Threading.SendOrPostCallback WriteCalFPOperationCompleted; + + private System.Threading.SendOrPostCallback ResGetResistanceOperationCompleted; + + private System.Threading.SendOrPostCallback ResSetResistanceOperationCompleted; + + private System.Threading.SendOrPostCallback ResInfoOperationCompleted; + + private System.Threading.SendOrPostCallback BattSetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback BattGetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback BattSetCurrentOperationCompleted; + + private System.Threading.SendOrPostCallback BattGetCurrentOperationCompleted; + + private System.Threading.SendOrPostCallback BattSetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback BattGetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback BattReadInterlockStateOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceSetRangeOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceGetRangeOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceSetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceGetVoltageOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceSetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback VsourceGetEnableOperationCompleted; + + private System.Threading.SendOrPostCallback ErrorCodeToMessageOperationCompleted; + + private bool useDefaultCredentialsSetExplicitly; + + /// + public PiCards() { + this.Url = global::Raytheon.Instruments.Properties.Settings.Default.SwitchMeasurementInstruments_Pickering60LxiSoap_PiCards; + if ((this.IsLocalFileSystemWebService(this.Url) == true)) { + this.UseDefaultCredentials = true; + this.useDefaultCredentialsSetExplicitly = false; + } + else { + this.useDefaultCredentialsSetExplicitly = true; + } + } + + public LocationHeader CardLocation { + get { + return this.cardLocationField; + } + set { + this.cardLocationField = value; + } + } + + public new string Url { + get { + return base.Url; + } + set { + if ((((this.IsLocalFileSystemWebService(base.Url) == true) + && (this.useDefaultCredentialsSetExplicitly == false)) + && (this.IsLocalFileSystemWebService(value) == false))) { + base.UseDefaultCredentials = false; + } + base.Url = value; + } + } + + public new bool UseDefaultCredentials { + get { + return base.UseDefaultCredentials; + } + set { + base.UseDefaultCredentials = value; + this.useDefaultCredentialsSetExplicitly = true; + } + } + + /// + public event CardIdCompletedEventHandler CardIdCompleted; + + /// + public event ClosureLimitCompletedEventHandler ClosureLimitCompleted; + + /// + public event CardOpsCountCompletedEventHandler CardOpsCountCompleted; + + /// + public event CountFreeCardsCompletedEventHandler CountFreeCardsCompleted; + + /// + public event DiagnosticCompletedEventHandler DiagnosticCompleted; + + /// + public event EnumerateSubsCompletedEventHandler EnumerateSubsCompleted; + + /// + public event FindFreeCardsCompletedEventHandler FindFreeCardsCompleted; + + /// + public event SettleTimeCompletedEventHandler SettleTimeCompleted; + + /// + public event StatusCompletedEventHandler StatusCompleted; + + /// + public event SubAttributeCompletedEventHandler SubAttributeCompleted; + + /// + public event SubInfoCompletedEventHandler SubInfoCompleted; + + /// + public event SubStatusCompletedEventHandler SubStatusCompleted; + + /// + public event SubTypeCompletedEventHandler SubTypeCompleted; + + /// + public event VersionCompletedEventHandler VersionCompleted; + + /// + public event ClearAllCompletedEventHandler ClearAllCompleted; + + /// + public event ClearCardCompletedEventHandler ClearCardCompleted; + + /// + public event ClearSubCompletedEventHandler ClearSubCompleted; + + /// + public event OpBitCompletedEventHandler OpBitCompleted; + + /// + public event ViewBitCompletedEventHandler ViewBitCompleted; + + /// + public event ViewSubCompletedEventHandler ViewSubCompleted; + + /// + public event WriteSubCompletedEventHandler WriteSubCompleted; + + /// + public event ReadBitCompletedEventHandler ReadBitCompleted; + + /// + public event ReadSubCompletedEventHandler ReadSubCompleted; + + /// + public event ClearMaskCompletedEventHandler ClearMaskCompleted; + + /// + public event MaskBitCompletedEventHandler MaskBitCompleted; + + /// + public event MaskCrosspointCompletedEventHandler MaskCrosspointCompleted; + + /// + public event OpCrosspointCompletedEventHandler OpCrosspointCompleted; + + /// + public event OpSwitchCompletedEventHandler OpSwitchCompleted; + + /// + public event ViewCrosspointCompletedEventHandler ViewCrosspointCompleted; + + /// + public event ViewMaskCompletedEventHandler ViewMaskCompleted; + + /// + public event ViewMaskBitCompletedEventHandler ViewMaskBitCompleted; + + /// + public event ViewMaskCrosspointCompletedEventHandler ViewMaskCrosspointCompleted; + + /// + public event WriteMaskCompletedEventHandler WriteMaskCompleted; + + /// + public event PsuEnableCompletedEventHandler PsuEnableCompleted; + + /// + public event PsuGetVoltageCompletedEventHandler PsuGetVoltageCompleted; + + /// + public event PsuSetVoltageCompletedEventHandler PsuSetVoltageCompleted; + + /// + public event PsuInfoCompletedEventHandler PsuInfoCompleted; + + /// + public event PsuTypeCompletedEventHandler PsuTypeCompleted; + + /// + public event AttenGetAttenuationCompletedEventHandler AttenGetAttenuationCompleted; + + /// + public event AttenInfoCompletedEventHandler AttenInfoCompleted; + + /// + public event AttenPadValueCompletedEventHandler AttenPadValueCompleted; + + /// + public event AttenSetAttenuationCompletedEventHandler AttenSetAttenuationCompleted; + + /// + public event AttenTypeCompletedEventHandler AttenTypeCompleted; + + /// + public event ReadCalCompletedEventHandler ReadCalCompleted; + + /// + public event ReadCalDateCompletedEventHandler ReadCalDateCompleted; + + /// + public event ReadCalFPCompletedEventHandler ReadCalFPCompleted; + + /// + public event SetCalPointCompletedEventHandler SetCalPointCompleted; + + /// + public event WriteCalCompletedEventHandler WriteCalCompleted; + + /// + public event WriteCalDateCompletedEventHandler WriteCalDateCompleted; + + /// + public event WriteCalFPCompletedEventHandler WriteCalFPCompleted; + + /// + public event ResGetResistanceCompletedEventHandler ResGetResistanceCompleted; + + /// + public event ResSetResistanceCompletedEventHandler ResSetResistanceCompleted; + + /// + public event ResInfoCompletedEventHandler ResInfoCompleted; + + /// + public event BattSetVoltageCompletedEventHandler BattSetVoltageCompleted; + + /// + public event BattGetVoltageCompletedEventHandler BattGetVoltageCompleted; + + /// + public event BattSetCurrentCompletedEventHandler BattSetCurrentCompleted; + + /// + public event BattGetCurrentCompletedEventHandler BattGetCurrentCompleted; + + /// + public event BattSetEnableCompletedEventHandler BattSetEnableCompleted; + + /// + public event BattGetEnableCompletedEventHandler BattGetEnableCompleted; + + /// + public event BattReadInterlockStateCompletedEventHandler BattReadInterlockStateCompleted; + + /// + public event VsourceSetRangeCompletedEventHandler VsourceSetRangeCompleted; + + /// + public event VsourceGetRangeCompletedEventHandler VsourceGetRangeCompleted; + + /// + public event VsourceSetVoltageCompletedEventHandler VsourceSetVoltageCompleted; + + /// + public event VsourceGetVoltageCompletedEventHandler VsourceGetVoltageCompleted; + + /// + public event VsourceSetEnableCompletedEventHandler VsourceSetEnableCompleted; + + /// + public event VsourceGetEnableCompletedEventHandler VsourceGetEnableCompleted; + + /// + public event ErrorCodeToMessageCompletedEventHandler ErrorCodeToMessageCompleted; + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int CardId([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("CardId", new object[0]); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void CardIdAsync() { + this.CardIdAsync(null); + } + + /// + public void CardIdAsync(object userState) { + if ((this.CardIdOperationCompleted == null)) { + this.CardIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCardIdOperationCompleted); + } + this.InvokeAsync("CardId", new object[0], this.CardIdOperationCompleted, userState); + } + + private void OnCardIdOperationCompleted(object arg) { + if ((this.CardIdCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CardIdCompleted(this, new CardIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClosureLimit(int outSub, out int limit) { + object[] results = this.Invoke("ClosureLimit", new object[] { + outSub}); + limit = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void ClosureLimitAsync(int outSub) { + this.ClosureLimitAsync(outSub, null); + } + + /// + public void ClosureLimitAsync(int outSub, object userState) { + if ((this.ClosureLimitOperationCompleted == null)) { + this.ClosureLimitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClosureLimitOperationCompleted); + } + this.InvokeAsync("ClosureLimit", new object[] { + outSub}, this.ClosureLimitOperationCompleted, userState); + } + + private void OnClosureLimitOperationCompleted(object arg) { + if ((this.ClosureLimitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClosureLimitCompleted(this, new ClosureLimitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int CardOpsCount(out int count) { + object[] results = this.Invoke("CardOpsCount", new object[0]); + count = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void CardOpsCountAsync() { + this.CardOpsCountAsync(null); + } + + /// + public void CardOpsCountAsync(object userState) { + if ((this.CardOpsCountOperationCompleted == null)) { + this.CardOpsCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCardOpsCountOperationCompleted); + } + this.InvokeAsync("CardOpsCount", new object[0], this.CardOpsCountOperationCompleted, userState); + } + + private void OnCardOpsCountOperationCompleted(object arg) { + if ((this.CardOpsCountCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CardOpsCountCompleted(this, new CardOpsCountCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int CountFreeCards(out int numCards) { + object[] results = this.Invoke("CountFreeCards", new object[0]); + numCards = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void CountFreeCardsAsync() { + this.CountFreeCardsAsync(null); + } + + /// + public void CountFreeCardsAsync(object userState) { + if ((this.CountFreeCardsOperationCompleted == null)) { + this.CountFreeCardsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCountFreeCardsOperationCompleted); + } + this.InvokeAsync("CountFreeCards", new object[0], this.CountFreeCardsOperationCompleted, userState); + } + + private void OnCountFreeCardsOperationCompleted(object arg) { + if ((this.CountFreeCardsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CountFreeCardsCompleted(this, new CountFreeCardsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int Diagnostic([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("Diagnostic", new object[0]); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void DiagnosticAsync() { + this.DiagnosticAsync(null); + } + + /// + public void DiagnosticAsync(object userState) { + if ((this.DiagnosticOperationCompleted == null)) { + this.DiagnosticOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDiagnosticOperationCompleted); + } + this.InvokeAsync("Diagnostic", new object[0], this.DiagnosticOperationCompleted, userState); + } + + private void OnDiagnosticOperationCompleted(object arg) { + if ((this.DiagnosticCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.DiagnosticCompleted(this, new DiagnosticCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int EnumerateSubs(out int inSubs, out int outSubs) { + object[] results = this.Invoke("EnumerateSubs", new object[0]); + inSubs = ((int)(results[1])); + outSubs = ((int)(results[2])); + return ((int)(results[0])); + } + + /// + public void EnumerateSubsAsync() { + this.EnumerateSubsAsync(null); + } + + /// + public void EnumerateSubsAsync(object userState) { + if ((this.EnumerateSubsOperationCompleted == null)) { + this.EnumerateSubsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnumerateSubsOperationCompleted); + } + this.InvokeAsync("EnumerateSubs", new object[0], this.EnumerateSubsOperationCompleted, userState); + } + + private void OnEnumerateSubsOperationCompleted(object arg) { + if ((this.EnumerateSubsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.EnumerateSubsCompleted(this, new EnumerateSubsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int FindFreeCards([System.Xml.Serialization.XmlElementAttribute("busList")] out int[] busList, [System.Xml.Serialization.XmlElementAttribute("slotList")] out int[] slotList) { + object[] results = this.Invoke("FindFreeCards", new object[0]); + busList = ((int[])(results[1])); + slotList = ((int[])(results[2])); + return ((int)(results[0])); + } + + /// + public void FindFreeCardsAsync() { + this.FindFreeCardsAsync(null); + } + + /// + public void FindFreeCardsAsync(object userState) { + if ((this.FindFreeCardsOperationCompleted == null)) { + this.FindFreeCardsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnFindFreeCardsOperationCompleted); + } + this.InvokeAsync("FindFreeCards", new object[0], this.FindFreeCardsOperationCompleted, userState); + } + + private void OnFindFreeCardsOperationCompleted(object arg) { + if ((this.FindFreeCardsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.FindFreeCardsCompleted(this, new FindFreeCardsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SettleTime(int outSub, out int time) { + object[] results = this.Invoke("SettleTime", new object[] { + outSub}); + time = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void SettleTimeAsync(int outSub) { + this.SettleTimeAsync(outSub, null); + } + + /// + public void SettleTimeAsync(int outSub, object userState) { + if ((this.SettleTimeOperationCompleted == null)) { + this.SettleTimeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSettleTimeOperationCompleted); + } + this.InvokeAsync("SettleTime", new object[] { + outSub}, this.SettleTimeOperationCompleted, userState); + } + + private void OnSettleTimeOperationCompleted(object arg) { + if ((this.SettleTimeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SettleTimeCompleted(this, new SettleTimeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int Status([System.Xml.Serialization.XmlElementAttribute("status")] out StatusEnum status1) { + object[] results = this.Invoke("Status", new object[0]); + status1 = ((StatusEnum)(results[1])); + return ((int)(results[0])); + } + + /// + public void StatusAsync() { + this.StatusAsync(null); + } + + /// + public void StatusAsync(object userState) { + if ((this.StatusOperationCompleted == null)) { + this.StatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStatusOperationCompleted); + } + this.InvokeAsync("Status", new object[0], this.StatusOperationCompleted, userState); + } + + private void OnStatusOperationCompleted(object arg) { + if ((this.StatusCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.StatusCompleted(this, new StatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubAttribute(int subNum, bool output, AttrCodeEnum attrCode, out int attrValue) { + object[] results = this.Invoke("SubAttribute", new object[] { + subNum, + output, + attrCode}); + attrValue = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void SubAttributeAsync(int subNum, bool output, AttrCodeEnum attrCode) { + this.SubAttributeAsync(subNum, output, attrCode, null); + } + + /// + public void SubAttributeAsync(int subNum, bool output, AttrCodeEnum attrCode, object userState) { + if ((this.SubAttributeOperationCompleted == null)) { + this.SubAttributeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubAttributeOperationCompleted); + } + this.InvokeAsync("SubAttribute", new object[] { + subNum, + output, + attrCode}, this.SubAttributeOperationCompleted, userState); + } + + private void OnSubAttributeOperationCompleted(object arg) { + if ((this.SubAttributeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubAttributeCompleted(this, new SubAttributeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubInfo(int subNum, bool output, out TypeNumberEnum typeNum, out int rows, out int cols) { + object[] results = this.Invoke("SubInfo", new object[] { + subNum, + output}); + typeNum = ((TypeNumberEnum)(results[1])); + rows = ((int)(results[2])); + cols = ((int)(results[3])); + return ((int)(results[0])); + } + + /// + public void SubInfoAsync(int subNum, bool output) { + this.SubInfoAsync(subNum, output, null); + } + + /// + public void SubInfoAsync(int subNum, bool output, object userState) { + if ((this.SubInfoOperationCompleted == null)) { + this.SubInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubInfoOperationCompleted); + } + this.InvokeAsync("SubInfo", new object[] { + subNum, + output}, this.SubInfoOperationCompleted, userState); + } + + private void OnSubInfoOperationCompleted(object arg) { + if ((this.SubInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubInfoCompleted(this, new SubInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubStatus(int subNum, out StatusEnum status) { + object[] results = this.Invoke("SubStatus", new object[] { + subNum}); + status = ((StatusEnum)(results[1])); + return ((int)(results[0])); + } + + /// + public void SubStatusAsync(int subNum) { + this.SubStatusAsync(subNum, null); + } + + /// + public void SubStatusAsync(int subNum, object userState) { + if ((this.SubStatusOperationCompleted == null)) { + this.SubStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubStatusOperationCompleted); + } + this.InvokeAsync("SubStatus", new object[] { + subNum}, this.SubStatusOperationCompleted, userState); + } + + private void OnSubStatusOperationCompleted(object arg) { + if ((this.SubStatusCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubStatusCompleted(this, new SubStatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SubType(int subNum, bool output, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("SubType", new object[] { + subNum, + output}); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void SubTypeAsync(int subNum, bool output) { + this.SubTypeAsync(subNum, output, null); + } + + /// + public void SubTypeAsync(int subNum, bool output, object userState) { + if ((this.SubTypeOperationCompleted == null)) { + this.SubTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubTypeOperationCompleted); + } + this.InvokeAsync("SubType", new object[] { + subNum, + output}, this.SubTypeOperationCompleted, userState); + } + + private void OnSubTypeOperationCompleted(object arg) { + if ((this.SubTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SubTypeCompleted(this, new SubTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int Version([System.Xml.Serialization.XmlElementAttribute("version")] out int version1) { + object[] results = this.Invoke("Version", new object[0]); + version1 = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void VersionAsync() { + this.VersionAsync(null); + } + + /// + public void VersionAsync(object userState) { + if ((this.VersionOperationCompleted == null)) { + this.VersionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVersionOperationCompleted); + } + this.InvokeAsync("Version", new object[0], this.VersionOperationCompleted, userState); + } + + private void OnVersionOperationCompleted(object arg) { + if ((this.VersionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VersionCompleted(this, new VersionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearAll() { + object[] results = this.Invoke("ClearAll", new object[0]); + return ((int)(results[0])); + } + + /// + public void ClearAllAsync() { + this.ClearAllAsync(null); + } + + /// + public void ClearAllAsync(object userState) { + if ((this.ClearAllOperationCompleted == null)) { + this.ClearAllOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearAllOperationCompleted); + } + this.InvokeAsync("ClearAll", new object[0], this.ClearAllOperationCompleted, userState); + } + + private void OnClearAllOperationCompleted(object arg) { + if ((this.ClearAllCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearAllCompleted(this, new ClearAllCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearCard() { + object[] results = this.Invoke("ClearCard", new object[0]); + return ((int)(results[0])); + } + + /// + public void ClearCardAsync() { + this.ClearCardAsync(null); + } + + /// + public void ClearCardAsync(object userState) { + if ((this.ClearCardOperationCompleted == null)) { + this.ClearCardOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearCardOperationCompleted); + } + this.InvokeAsync("ClearCard", new object[0], this.ClearCardOperationCompleted, userState); + } + + private void OnClearCardOperationCompleted(object arg) { + if ((this.ClearCardCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearCardCompleted(this, new ClearCardCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearSub(int outSub) { + object[] results = this.Invoke("ClearSub", new object[] { + outSub}); + return ((int)(results[0])); + } + + /// + public void ClearSubAsync(int outSub) { + this.ClearSubAsync(outSub, null); + } + + /// + public void ClearSubAsync(int outSub, object userState) { + if ((this.ClearSubOperationCompleted == null)) { + this.ClearSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearSubOperationCompleted); + } + this.InvokeAsync("ClearSub", new object[] { + outSub}, this.ClearSubOperationCompleted, userState); + } + + private void OnClearSubOperationCompleted(object arg) { + if ((this.ClearSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearSubCompleted(this, new ClearSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int OpBit(int outSub, int bitNum, bool action) { + object[] results = this.Invoke("OpBit", new object[] { + outSub, + bitNum, + action}); + return ((int)(results[0])); + } + + /// + public void OpBitAsync(int outSub, int bitNum, bool action) { + this.OpBitAsync(outSub, bitNum, action, null); + } + + /// + public void OpBitAsync(int outSub, int bitNum, bool action, object userState) { + if ((this.OpBitOperationCompleted == null)) { + this.OpBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOpBitOperationCompleted); + } + this.InvokeAsync("OpBit", new object[] { + outSub, + bitNum, + action}, this.OpBitOperationCompleted, userState); + } + + private void OnOpBitOperationCompleted(object arg) { + if ((this.OpBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OpBitCompleted(this, new OpBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewBit(int outSub, int bitNum, out bool state) { + object[] results = this.Invoke("ViewBit", new object[] { + outSub, + bitNum}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewBitAsync(int outSub, int bitNum) { + this.ViewBitAsync(outSub, bitNum, null); + } + + /// + public void ViewBitAsync(int outSub, int bitNum, object userState) { + if ((this.ViewBitOperationCompleted == null)) { + this.ViewBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewBitOperationCompleted); + } + this.InvokeAsync("ViewBit", new object[] { + outSub, + bitNum}, this.ViewBitOperationCompleted, userState); + } + + private void OnViewBitOperationCompleted(object arg) { + if ((this.ViewBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewBitCompleted(this, new ViewBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewSub(int outSub, [System.Xml.Serialization.XmlElementAttribute("data")] out int[] data) { + object[] results = this.Invoke("ViewSub", new object[] { + outSub}); + data = ((int[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewSubAsync(int outSub) { + this.ViewSubAsync(outSub, null); + } + + /// + public void ViewSubAsync(int outSub, object userState) { + if ((this.ViewSubOperationCompleted == null)) { + this.ViewSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewSubOperationCompleted); + } + this.InvokeAsync("ViewSub", new object[] { + outSub}, this.ViewSubOperationCompleted, userState); + } + + private void OnViewSubOperationCompleted(object arg) { + if ((this.ViewSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewSubCompleted(this, new ViewSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteSub(int outSub, [System.Xml.Serialization.XmlArrayItemAttribute("item", IsNullable=false)] int[] data) { + object[] results = this.Invoke("WriteSub", new object[] { + outSub, + data}); + return ((int)(results[0])); + } + + /// + public void WriteSubAsync(int outSub, int[] data) { + this.WriteSubAsync(outSub, data, null); + } + + /// + public void WriteSubAsync(int outSub, int[] data, object userState) { + if ((this.WriteSubOperationCompleted == null)) { + this.WriteSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteSubOperationCompleted); + } + this.InvokeAsync("WriteSub", new object[] { + outSub, + data}, this.WriteSubOperationCompleted, userState); + } + + private void OnWriteSubOperationCompleted(object arg) { + if ((this.WriteSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteSubCompleted(this, new WriteSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadBit(int inSub, int bitNum, out bool state) { + object[] results = this.Invoke("ReadBit", new object[] { + inSub, + bitNum}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadBitAsync(int inSub, int bitNum) { + this.ReadBitAsync(inSub, bitNum, null); + } + + /// + public void ReadBitAsync(int inSub, int bitNum, object userState) { + if ((this.ReadBitOperationCompleted == null)) { + this.ReadBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadBitOperationCompleted); + } + this.InvokeAsync("ReadBit", new object[] { + inSub, + bitNum}, this.ReadBitOperationCompleted, userState); + } + + private void OnReadBitOperationCompleted(object arg) { + if ((this.ReadBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadBitCompleted(this, new ReadBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadSub(int inSub, [System.Xml.Serialization.XmlElementAttribute("data")] out int[] data) { + object[] results = this.Invoke("ReadSub", new object[] { + inSub}); + data = ((int[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadSubAsync(int inSub) { + this.ReadSubAsync(inSub, null); + } + + /// + public void ReadSubAsync(int inSub, object userState) { + if ((this.ReadSubOperationCompleted == null)) { + this.ReadSubOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadSubOperationCompleted); + } + this.InvokeAsync("ReadSub", new object[] { + inSub}, this.ReadSubOperationCompleted, userState); + } + + private void OnReadSubOperationCompleted(object arg) { + if ((this.ReadSubCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadSubCompleted(this, new ReadSubCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ClearMask(int outSub) { + object[] results = this.Invoke("ClearMask", new object[] { + outSub}); + return ((int)(results[0])); + } + + /// + public void ClearMaskAsync(int outSub) { + this.ClearMaskAsync(outSub, null); + } + + /// + public void ClearMaskAsync(int outSub, object userState) { + if ((this.ClearMaskOperationCompleted == null)) { + this.ClearMaskOperationCompleted = new System.Threading.SendOrPostCallback(this.OnClearMaskOperationCompleted); + } + this.InvokeAsync("ClearMask", new object[] { + outSub}, this.ClearMaskOperationCompleted, userState); + } + + private void OnClearMaskOperationCompleted(object arg) { + if ((this.ClearMaskCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ClearMaskCompleted(this, new ClearMaskCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int MaskBit(int outSub, int bitNum, bool action) { + object[] results = this.Invoke("MaskBit", new object[] { + outSub, + bitNum, + action}); + return ((int)(results[0])); + } + + /// + public void MaskBitAsync(int outSub, int bitNum, bool action) { + this.MaskBitAsync(outSub, bitNum, action, null); + } + + /// + public void MaskBitAsync(int outSub, int bitNum, bool action, object userState) { + if ((this.MaskBitOperationCompleted == null)) { + this.MaskBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMaskBitOperationCompleted); + } + this.InvokeAsync("MaskBit", new object[] { + outSub, + bitNum, + action}, this.MaskBitOperationCompleted, userState); + } + + private void OnMaskBitOperationCompleted(object arg) { + if ((this.MaskBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.MaskBitCompleted(this, new MaskBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int MaskCrosspoint(int outSub, int row, int col, bool action) { + object[] results = this.Invoke("MaskCrosspoint", new object[] { + outSub, + row, + col, + action}); + return ((int)(results[0])); + } + + /// + public void MaskCrosspointAsync(int outSub, int row, int col, bool action) { + this.MaskCrosspointAsync(outSub, row, col, action, null); + } + + /// + public void MaskCrosspointAsync(int outSub, int row, int col, bool action, object userState) { + if ((this.MaskCrosspointOperationCompleted == null)) { + this.MaskCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMaskCrosspointOperationCompleted); + } + this.InvokeAsync("MaskCrosspoint", new object[] { + outSub, + row, + col, + action}, this.MaskCrosspointOperationCompleted, userState); + } + + private void OnMaskCrosspointOperationCompleted(object arg) { + if ((this.MaskCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.MaskCrosspointCompleted(this, new MaskCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int OpCrosspoint(int outSub, int row, int col, bool action) { + object[] results = this.Invoke("OpCrosspoint", new object[] { + outSub, + row, + col, + action}); + return ((int)(results[0])); + } + + /// + public void OpCrosspointAsync(int outSub, int row, int col, bool action) { + this.OpCrosspointAsync(outSub, row, col, action, null); + } + + /// + public void OpCrosspointAsync(int outSub, int row, int col, bool action, object userState) { + if ((this.OpCrosspointOperationCompleted == null)) { + this.OpCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOpCrosspointOperationCompleted); + } + this.InvokeAsync("OpCrosspoint", new object[] { + outSub, + row, + col, + action}, this.OpCrosspointOperationCompleted, userState); + } + + private void OnOpCrosspointOperationCompleted(object arg) { + if ((this.OpCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OpCrosspointCompleted(this, new OpCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int OpSwitch(int outSub, SwFuncEnum switchFunc, int segNum, int switchNum, int subSwitch, SwActEnum switchAction, out bool state) { + object[] results = this.Invoke("OpSwitch", new object[] { + outSub, + switchFunc, + segNum, + switchNum, + subSwitch, + switchAction}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void OpSwitchAsync(int outSub, SwFuncEnum switchFunc, int segNum, int switchNum, int subSwitch, SwActEnum switchAction) { + this.OpSwitchAsync(outSub, switchFunc, segNum, switchNum, subSwitch, switchAction, null); + } + + /// + public void OpSwitchAsync(int outSub, SwFuncEnum switchFunc, int segNum, int switchNum, int subSwitch, SwActEnum switchAction, object userState) { + if ((this.OpSwitchOperationCompleted == null)) { + this.OpSwitchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOpSwitchOperationCompleted); + } + this.InvokeAsync("OpSwitch", new object[] { + outSub, + switchFunc, + segNum, + switchNum, + subSwitch, + switchAction}, this.OpSwitchOperationCompleted, userState); + } + + private void OnOpSwitchOperationCompleted(object arg) { + if ((this.OpSwitchCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OpSwitchCompleted(this, new OpSwitchCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewCrosspoint(int outSub, int row, int col, out bool state) { + object[] results = this.Invoke("ViewCrosspoint", new object[] { + outSub, + row, + col}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewCrosspointAsync(int outSub, int row, int col) { + this.ViewCrosspointAsync(outSub, row, col, null); + } + + /// + public void ViewCrosspointAsync(int outSub, int row, int col, object userState) { + if ((this.ViewCrosspointOperationCompleted == null)) { + this.ViewCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewCrosspointOperationCompleted); + } + this.InvokeAsync("ViewCrosspoint", new object[] { + outSub, + row, + col}, this.ViewCrosspointOperationCompleted, userState); + } + + private void OnViewCrosspointOperationCompleted(object arg) { + if ((this.ViewCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewCrosspointCompleted(this, new ViewCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewMask(int outSub, [System.Xml.Serialization.XmlElementAttribute("data")] out int[] data) { + object[] results = this.Invoke("ViewMask", new object[] { + outSub}); + data = ((int[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewMaskAsync(int outSub) { + this.ViewMaskAsync(outSub, null); + } + + /// + public void ViewMaskAsync(int outSub, object userState) { + if ((this.ViewMaskOperationCompleted == null)) { + this.ViewMaskOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewMaskOperationCompleted); + } + this.InvokeAsync("ViewMask", new object[] { + outSub}, this.ViewMaskOperationCompleted, userState); + } + + private void OnViewMaskOperationCompleted(object arg) { + if ((this.ViewMaskCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewMaskCompleted(this, new ViewMaskCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewMaskBit(int outSub, int bitNum, out bool state) { + object[] results = this.Invoke("ViewMaskBit", new object[] { + outSub, + bitNum}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewMaskBitAsync(int outSub, int bitNum) { + this.ViewMaskBitAsync(outSub, bitNum, null); + } + + /// + public void ViewMaskBitAsync(int outSub, int bitNum, object userState) { + if ((this.ViewMaskBitOperationCompleted == null)) { + this.ViewMaskBitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewMaskBitOperationCompleted); + } + this.InvokeAsync("ViewMaskBit", new object[] { + outSub, + bitNum}, this.ViewMaskBitOperationCompleted, userState); + } + + private void OnViewMaskBitOperationCompleted(object arg) { + if ((this.ViewMaskBitCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewMaskBitCompleted(this, new ViewMaskBitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ViewMaskCrosspoint(int outSub, int row, int col, out bool state) { + object[] results = this.Invoke("ViewMaskCrosspoint", new object[] { + outSub, + row, + col}); + state = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void ViewMaskCrosspointAsync(int outSub, int row, int col) { + this.ViewMaskCrosspointAsync(outSub, row, col, null); + } + + /// + public void ViewMaskCrosspointAsync(int outSub, int row, int col, object userState) { + if ((this.ViewMaskCrosspointOperationCompleted == null)) { + this.ViewMaskCrosspointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnViewMaskCrosspointOperationCompleted); + } + this.InvokeAsync("ViewMaskCrosspoint", new object[] { + outSub, + row, + col}, this.ViewMaskCrosspointOperationCompleted, userState); + } + + private void OnViewMaskCrosspointOperationCompleted(object arg) { + if ((this.ViewMaskCrosspointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ViewMaskCrosspointCompleted(this, new ViewMaskCrosspointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteMask(int outSub, [System.Xml.Serialization.XmlArrayItemAttribute("item", IsNullable=false)] int[] data) { + object[] results = this.Invoke("WriteMask", new object[] { + outSub, + data}); + return ((int)(results[0])); + } + + /// + public void WriteMaskAsync(int outSub, int[] data) { + this.WriteMaskAsync(outSub, data, null); + } + + /// + public void WriteMaskAsync(int outSub, int[] data, object userState) { + if ((this.WriteMaskOperationCompleted == null)) { + this.WriteMaskOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteMaskOperationCompleted); + } + this.InvokeAsync("WriteMask", new object[] { + outSub, + data}, this.WriteMaskOperationCompleted, userState); + } + + private void OnWriteMaskOperationCompleted(object arg) { + if ((this.WriteMaskCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteMaskCompleted(this, new WriteMaskCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuEnable(int subNum, bool state) { + object[] results = this.Invoke("PsuEnable", new object[] { + subNum, + state}); + return ((int)(results[0])); + } + + /// + public void PsuEnableAsync(int subNum, bool state) { + this.PsuEnableAsync(subNum, state, null); + } + + /// + public void PsuEnableAsync(int subNum, bool state, object userState) { + if ((this.PsuEnableOperationCompleted == null)) { + this.PsuEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuEnableOperationCompleted); + } + this.InvokeAsync("PsuEnable", new object[] { + subNum, + state}, this.PsuEnableOperationCompleted, userState); + } + + private void OnPsuEnableOperationCompleted(object arg) { + if ((this.PsuEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuEnableCompleted(this, new PsuEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuGetVoltage(int subNum, out double voltage) { + object[] results = this.Invoke("PsuGetVoltage", new object[] { + subNum}); + voltage = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void PsuGetVoltageAsync(int subNum) { + this.PsuGetVoltageAsync(subNum, null); + } + + /// + public void PsuGetVoltageAsync(int subNum, object userState) { + if ((this.PsuGetVoltageOperationCompleted == null)) { + this.PsuGetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuGetVoltageOperationCompleted); + } + this.InvokeAsync("PsuGetVoltage", new object[] { + subNum}, this.PsuGetVoltageOperationCompleted, userState); + } + + private void OnPsuGetVoltageOperationCompleted(object arg) { + if ((this.PsuGetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuGetVoltageCompleted(this, new PsuGetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuSetVoltage(int subNum, double voltage) { + object[] results = this.Invoke("PsuSetVoltage", new object[] { + subNum, + voltage}); + return ((int)(results[0])); + } + + /// + public void PsuSetVoltageAsync(int subNum, double voltage) { + this.PsuSetVoltageAsync(subNum, voltage, null); + } + + /// + public void PsuSetVoltageAsync(int subNum, double voltage, object userState) { + if ((this.PsuSetVoltageOperationCompleted == null)) { + this.PsuSetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuSetVoltageOperationCompleted); + } + this.InvokeAsync("PsuSetVoltage", new object[] { + subNum, + voltage}, this.PsuSetVoltageOperationCompleted, userState); + } + + private void OnPsuSetVoltageOperationCompleted(object arg) { + if ((this.PsuSetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuSetVoltageCompleted(this, new PsuSetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuInfo(int subNum, out int typeNum, out double voltage, out double current, out int precis, out int capabilities) { + object[] results = this.Invoke("PsuInfo", new object[] { + subNum}); + typeNum = ((int)(results[1])); + voltage = ((double)(results[2])); + current = ((double)(results[3])); + precis = ((int)(results[4])); + capabilities = ((int)(results[5])); + return ((int)(results[0])); + } + + /// + public void PsuInfoAsync(int subNum) { + this.PsuInfoAsync(subNum, null); + } + + /// + public void PsuInfoAsync(int subNum, object userState) { + if ((this.PsuInfoOperationCompleted == null)) { + this.PsuInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuInfoOperationCompleted); + } + this.InvokeAsync("PsuInfo", new object[] { + subNum}, this.PsuInfoOperationCompleted, userState); + } + + private void OnPsuInfoOperationCompleted(object arg) { + if ((this.PsuInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuInfoCompleted(this, new PsuInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int PsuType(int subNum, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("PsuType", new object[] { + subNum}); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void PsuTypeAsync(int subNum) { + this.PsuTypeAsync(subNum, null); + } + + /// + public void PsuTypeAsync(int subNum, object userState) { + if ((this.PsuTypeOperationCompleted == null)) { + this.PsuTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPsuTypeOperationCompleted); + } + this.InvokeAsync("PsuType", new object[] { + subNum}, this.PsuTypeOperationCompleted, userState); + } + + private void OnPsuTypeOperationCompleted(object arg) { + if ((this.PsuTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.PsuTypeCompleted(this, new PsuTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenGetAttenuation(int subNum, out float atten) { + object[] results = this.Invoke("AttenGetAttenuation", new object[] { + subNum}); + atten = ((float)(results[1])); + return ((int)(results[0])); + } + + /// + public void AttenGetAttenuationAsync(int subNum) { + this.AttenGetAttenuationAsync(subNum, null); + } + + /// + public void AttenGetAttenuationAsync(int subNum, object userState) { + if ((this.AttenGetAttenuationOperationCompleted == null)) { + this.AttenGetAttenuationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenGetAttenuationOperationCompleted); + } + this.InvokeAsync("AttenGetAttenuation", new object[] { + subNum}, this.AttenGetAttenuationOperationCompleted, userState); + } + + private void OnAttenGetAttenuationOperationCompleted(object arg) { + if ((this.AttenGetAttenuationCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenGetAttenuationCompleted(this, new AttenGetAttenuationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenInfo(int subNum, out int typeNum, out int numSteps, out float stepSize) { + object[] results = this.Invoke("AttenInfo", new object[] { + subNum}); + typeNum = ((int)(results[1])); + numSteps = ((int)(results[2])); + stepSize = ((float)(results[3])); + return ((int)(results[0])); + } + + /// + public void AttenInfoAsync(int subNum) { + this.AttenInfoAsync(subNum, null); + } + + /// + public void AttenInfoAsync(int subNum, object userState) { + if ((this.AttenInfoOperationCompleted == null)) { + this.AttenInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenInfoOperationCompleted); + } + this.InvokeAsync("AttenInfo", new object[] { + subNum}, this.AttenInfoOperationCompleted, userState); + } + + private void OnAttenInfoOperationCompleted(object arg) { + if ((this.AttenInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenInfoCompleted(this, new AttenInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenPadValue(int subNum, int padNum, out float atten) { + object[] results = this.Invoke("AttenPadValue", new object[] { + subNum, + padNum}); + atten = ((float)(results[1])); + return ((int)(results[0])); + } + + /// + public void AttenPadValueAsync(int subNum, int padNum) { + this.AttenPadValueAsync(subNum, padNum, null); + } + + /// + public void AttenPadValueAsync(int subNum, int padNum, object userState) { + if ((this.AttenPadValueOperationCompleted == null)) { + this.AttenPadValueOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenPadValueOperationCompleted); + } + this.InvokeAsync("AttenPadValue", new object[] { + subNum, + padNum}, this.AttenPadValueOperationCompleted, userState); + } + + private void OnAttenPadValueOperationCompleted(object arg) { + if ((this.AttenPadValueCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenPadValueCompleted(this, new AttenPadValueCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenSetAttenuation(int subNum, float atten) { + object[] results = this.Invoke("AttenSetAttenuation", new object[] { + subNum, + atten}); + return ((int)(results[0])); + } + + /// + public void AttenSetAttenuationAsync(int subNum, float atten) { + this.AttenSetAttenuationAsync(subNum, atten, null); + } + + /// + public void AttenSetAttenuationAsync(int subNum, float atten, object userState) { + if ((this.AttenSetAttenuationOperationCompleted == null)) { + this.AttenSetAttenuationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenSetAttenuationOperationCompleted); + } + this.InvokeAsync("AttenSetAttenuation", new object[] { + subNum, + atten}, this.AttenSetAttenuationOperationCompleted, userState); + } + + private void OnAttenSetAttenuationOperationCompleted(object arg) { + if ((this.AttenSetAttenuationCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenSetAttenuationCompleted(this, new AttenSetAttenuationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int AttenType(int subNum, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] out string str) { + object[] results = this.Invoke("AttenType", new object[] { + subNum}); + str = ((string)(results[1])); + return ((int)(results[0])); + } + + /// + public void AttenTypeAsync(int subNum) { + this.AttenTypeAsync(subNum, null); + } + + /// + public void AttenTypeAsync(int subNum, object userState) { + if ((this.AttenTypeOperationCompleted == null)) { + this.AttenTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAttenTypeOperationCompleted); + } + this.InvokeAsync("AttenType", new object[] { + subNum}, this.AttenTypeOperationCompleted, userState); + } + + private void OnAttenTypeOperationCompleted(object arg) { + if ((this.AttenTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AttenTypeCompleted(this, new AttenTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadCal(int outSub, int idx, out int data) { + object[] results = this.Invoke("ReadCal", new object[] { + outSub, + idx}); + data = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadCalAsync(int outSub, int idx) { + this.ReadCalAsync(outSub, idx, null); + } + + /// + public void ReadCalAsync(int outSub, int idx, object userState) { + if ((this.ReadCalOperationCompleted == null)) { + this.ReadCalOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadCalOperationCompleted); + } + this.InvokeAsync("ReadCal", new object[] { + outSub, + idx}, this.ReadCalOperationCompleted, userState); + } + + private void OnReadCalOperationCompleted(object arg) { + if ((this.ReadCalCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadCalCompleted(this, new ReadCalCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadCalDate(int outSub, StoreTypeEnum store, out int year, out int day, out int interval) { + object[] results = this.Invoke("ReadCalDate", new object[] { + outSub, + store}); + year = ((int)(results[1])); + day = ((int)(results[2])); + interval = ((int)(results[3])); + return ((int)(results[0])); + } + + /// + public void ReadCalDateAsync(int outSub, StoreTypeEnum store) { + this.ReadCalDateAsync(outSub, store, null); + } + + /// + public void ReadCalDateAsync(int outSub, StoreTypeEnum store, object userState) { + if ((this.ReadCalDateOperationCompleted == null)) { + this.ReadCalDateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadCalDateOperationCompleted); + } + this.InvokeAsync("ReadCalDate", new object[] { + outSub, + store}, this.ReadCalDateOperationCompleted, userState); + } + + private void OnReadCalDateOperationCompleted(object arg) { + if ((this.ReadCalDateCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadCalDateCompleted(this, new ReadCalDateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ReadCalFP(int outSub, StoreTypeEnum store, int offset, int numValues, [System.Xml.Serialization.XmlElementAttribute("data")] out double[] data) { + object[] results = this.Invoke("ReadCalFP", new object[] { + outSub, + store, + offset, + numValues}); + data = ((double[])(results[1])); + return ((int)(results[0])); + } + + /// + public void ReadCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues) { + this.ReadCalFPAsync(outSub, store, offset, numValues, null); + } + + /// + public void ReadCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues, object userState) { + if ((this.ReadCalFPOperationCompleted == null)) { + this.ReadCalFPOperationCompleted = new System.Threading.SendOrPostCallback(this.OnReadCalFPOperationCompleted); + } + this.InvokeAsync("ReadCalFP", new object[] { + outSub, + store, + offset, + numValues}, this.ReadCalFPOperationCompleted, userState); + } + + private void OnReadCalFPOperationCompleted(object arg) { + if ((this.ReadCalFPCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ReadCalFPCompleted(this, new ReadCalFPCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int SetCalPoint(int outSub, int index) { + object[] results = this.Invoke("SetCalPoint", new object[] { + outSub, + index}); + return ((int)(results[0])); + } + + /// + public void SetCalPointAsync(int outSub, int index) { + this.SetCalPointAsync(outSub, index, null); + } + + /// + public void SetCalPointAsync(int outSub, int index, object userState) { + if ((this.SetCalPointOperationCompleted == null)) { + this.SetCalPointOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetCalPointOperationCompleted); + } + this.InvokeAsync("SetCalPoint", new object[] { + outSub, + index}, this.SetCalPointOperationCompleted, userState); + } + + private void OnSetCalPointOperationCompleted(object arg) { + if ((this.SetCalPointCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetCalPointCompleted(this, new SetCalPointCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteCal(int outSub, int idx, int data) { + object[] results = this.Invoke("WriteCal", new object[] { + outSub, + idx, + data}); + return ((int)(results[0])); + } + + /// + public void WriteCalAsync(int outSub, int idx, int data) { + this.WriteCalAsync(outSub, idx, data, null); + } + + /// + public void WriteCalAsync(int outSub, int idx, int data, object userState) { + if ((this.WriteCalOperationCompleted == null)) { + this.WriteCalOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteCalOperationCompleted); + } + this.InvokeAsync("WriteCal", new object[] { + outSub, + idx, + data}, this.WriteCalOperationCompleted, userState); + } + + private void OnWriteCalOperationCompleted(object arg) { + if ((this.WriteCalCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteCalCompleted(this, new WriteCalCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteCalDate(int outSub, StoreTypeEnum store, int interval) { + object[] results = this.Invoke("WriteCalDate", new object[] { + outSub, + store, + interval}); + return ((int)(results[0])); + } + + /// + public void WriteCalDateAsync(int outSub, StoreTypeEnum store, int interval) { + this.WriteCalDateAsync(outSub, store, interval, null); + } + + /// + public void WriteCalDateAsync(int outSub, StoreTypeEnum store, int interval, object userState) { + if ((this.WriteCalDateOperationCompleted == null)) { + this.WriteCalDateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteCalDateOperationCompleted); + } + this.InvokeAsync("WriteCalDate", new object[] { + outSub, + store, + interval}, this.WriteCalDateOperationCompleted, userState); + } + + private void OnWriteCalDateOperationCompleted(object arg) { + if ((this.WriteCalDateCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteCalDateCompleted(this, new WriteCalDateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int WriteCalFP(int outSub, StoreTypeEnum store, int offset, int numValues, [System.Xml.Serialization.XmlArrayItemAttribute("item", IsNullable=false)] double[] data) { + object[] results = this.Invoke("WriteCalFP", new object[] { + outSub, + store, + offset, + numValues, + data}); + return ((int)(results[0])); + } + + /// + public void WriteCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues, double[] data) { + this.WriteCalFPAsync(outSub, store, offset, numValues, data, null); + } + + /// + public void WriteCalFPAsync(int outSub, StoreTypeEnum store, int offset, int numValues, double[] data, object userState) { + if ((this.WriteCalFPOperationCompleted == null)) { + this.WriteCalFPOperationCompleted = new System.Threading.SendOrPostCallback(this.OnWriteCalFPOperationCompleted); + } + this.InvokeAsync("WriteCalFP", new object[] { + outSub, + store, + offset, + numValues, + data}, this.WriteCalFPOperationCompleted, userState); + } + + private void OnWriteCalFPOperationCompleted(object arg) { + if ((this.WriteCalFPCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.WriteCalFPCompleted(this, new WriteCalFPCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ResGetResistance(int outSub, out double resistance) { + object[] results = this.Invoke("ResGetResistance", new object[] { + outSub}); + resistance = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void ResGetResistanceAsync(int outSub) { + this.ResGetResistanceAsync(outSub, null); + } + + /// + public void ResGetResistanceAsync(int outSub, object userState) { + if ((this.ResGetResistanceOperationCompleted == null)) { + this.ResGetResistanceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResGetResistanceOperationCompleted); + } + this.InvokeAsync("ResGetResistance", new object[] { + outSub}, this.ResGetResistanceOperationCompleted, userState); + } + + private void OnResGetResistanceOperationCompleted(object arg) { + if ((this.ResGetResistanceCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ResGetResistanceCompleted(this, new ResGetResistanceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ResSetResistance(int outSub, ModeTypeEnum mode, double resistance) { + object[] results = this.Invoke("ResSetResistance", new object[] { + outSub, + mode, + resistance}); + return ((int)(results[0])); + } + + /// + public void ResSetResistanceAsync(int outSub, ModeTypeEnum mode, double resistance) { + this.ResSetResistanceAsync(outSub, mode, resistance, null); + } + + /// + public void ResSetResistanceAsync(int outSub, ModeTypeEnum mode, double resistance, object userState) { + if ((this.ResSetResistanceOperationCompleted == null)) { + this.ResSetResistanceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResSetResistanceOperationCompleted); + } + this.InvokeAsync("ResSetResistance", new object[] { + outSub, + mode, + resistance}, this.ResSetResistanceOperationCompleted, userState); + } + + private void OnResSetResistanceOperationCompleted(object arg) { + if ((this.ResSetResistanceCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ResSetResistanceCompleted(this, new ResSetResistanceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int ResInfo(int outSub, out double minRes, out double maxRes, out double refRes, out double precPC, out double precDelta, out double int1, out double intDelta, out int capabilities) { + object[] results = this.Invoke("ResInfo", new object[] { + outSub}); + minRes = ((double)(results[1])); + maxRes = ((double)(results[2])); + refRes = ((double)(results[3])); + precPC = ((double)(results[4])); + precDelta = ((double)(results[5])); + int1 = ((double)(results[6])); + intDelta = ((double)(results[7])); + capabilities = ((int)(results[8])); + return ((int)(results[0])); + } + + /// + public void ResInfoAsync(int outSub) { + this.ResInfoAsync(outSub, null); + } + + /// + public void ResInfoAsync(int outSub, object userState) { + if ((this.ResInfoOperationCompleted == null)) { + this.ResInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResInfoOperationCompleted); + } + this.InvokeAsync("ResInfo", new object[] { + outSub}, this.ResInfoOperationCompleted, userState); + } + + private void OnResInfoOperationCompleted(object arg) { + if ((this.ResInfoCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ResInfoCompleted(this, new ResInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattSetVoltage(int outSub, double voltage) { + object[] results = this.Invoke("BattSetVoltage", new object[] { + outSub, + voltage}); + return ((int)(results[0])); + } + + /// + public void BattSetVoltageAsync(int outSub, double voltage) { + this.BattSetVoltageAsync(outSub, voltage, null); + } + + /// + public void BattSetVoltageAsync(int outSub, double voltage, object userState) { + if ((this.BattSetVoltageOperationCompleted == null)) { + this.BattSetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattSetVoltageOperationCompleted); + } + this.InvokeAsync("BattSetVoltage", new object[] { + outSub, + voltage}, this.BattSetVoltageOperationCompleted, userState); + } + + private void OnBattSetVoltageOperationCompleted(object arg) { + if ((this.BattSetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattSetVoltageCompleted(this, new BattSetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattGetVoltage(int outSub, out double voltage) { + object[] results = this.Invoke("BattGetVoltage", new object[] { + outSub}); + voltage = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattGetVoltageAsync(int outSub) { + this.BattGetVoltageAsync(outSub, null); + } + + /// + public void BattGetVoltageAsync(int outSub, object userState) { + if ((this.BattGetVoltageOperationCompleted == null)) { + this.BattGetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattGetVoltageOperationCompleted); + } + this.InvokeAsync("BattGetVoltage", new object[] { + outSub}, this.BattGetVoltageOperationCompleted, userState); + } + + private void OnBattGetVoltageOperationCompleted(object arg) { + if ((this.BattGetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattGetVoltageCompleted(this, new BattGetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattSetCurrent(int outSub, double current) { + object[] results = this.Invoke("BattSetCurrent", new object[] { + outSub, + current}); + return ((int)(results[0])); + } + + /// + public void BattSetCurrentAsync(int outSub, double current) { + this.BattSetCurrentAsync(outSub, current, null); + } + + /// + public void BattSetCurrentAsync(int outSub, double current, object userState) { + if ((this.BattSetCurrentOperationCompleted == null)) { + this.BattSetCurrentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattSetCurrentOperationCompleted); + } + this.InvokeAsync("BattSetCurrent", new object[] { + outSub, + current}, this.BattSetCurrentOperationCompleted, userState); + } + + private void OnBattSetCurrentOperationCompleted(object arg) { + if ((this.BattSetCurrentCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattSetCurrentCompleted(this, new BattSetCurrentCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattGetCurrent(int outSub, out double current) { + object[] results = this.Invoke("BattGetCurrent", new object[] { + outSub}); + current = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattGetCurrentAsync(int outSub) { + this.BattGetCurrentAsync(outSub, null); + } + + /// + public void BattGetCurrentAsync(int outSub, object userState) { + if ((this.BattGetCurrentOperationCompleted == null)) { + this.BattGetCurrentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattGetCurrentOperationCompleted); + } + this.InvokeAsync("BattGetCurrent", new object[] { + outSub}, this.BattGetCurrentOperationCompleted, userState); + } + + private void OnBattGetCurrentOperationCompleted(object arg) { + if ((this.BattGetCurrentCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattGetCurrentCompleted(this, new BattGetCurrentCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattSetEnable(int outSub, int pattern) { + object[] results = this.Invoke("BattSetEnable", new object[] { + outSub, + pattern}); + return ((int)(results[0])); + } + + /// + public void BattSetEnableAsync(int outSub, int pattern) { + this.BattSetEnableAsync(outSub, pattern, null); + } + + /// + public void BattSetEnableAsync(int outSub, int pattern, object userState) { + if ((this.BattSetEnableOperationCompleted == null)) { + this.BattSetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattSetEnableOperationCompleted); + } + this.InvokeAsync("BattSetEnable", new object[] { + outSub, + pattern}, this.BattSetEnableOperationCompleted, userState); + } + + private void OnBattSetEnableOperationCompleted(object arg) { + if ((this.BattSetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattSetEnableCompleted(this, new BattSetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattGetEnable(int outSub, out int pattern) { + object[] results = this.Invoke("BattGetEnable", new object[] { + outSub}); + pattern = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattGetEnableAsync(int outSub) { + this.BattGetEnableAsync(outSub, null); + } + + /// + public void BattGetEnableAsync(int outSub, object userState) { + if ((this.BattGetEnableOperationCompleted == null)) { + this.BattGetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattGetEnableOperationCompleted); + } + this.InvokeAsync("BattGetEnable", new object[] { + outSub}, this.BattGetEnableOperationCompleted, userState); + } + + private void OnBattGetEnableOperationCompleted(object arg) { + if ((this.BattGetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattGetEnableCompleted(this, new BattGetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int BattReadInterlockState(int outSub, out bool interlock) { + object[] results = this.Invoke("BattReadInterlockState", new object[] { + outSub}); + interlock = ((bool)(results[1])); + return ((int)(results[0])); + } + + /// + public void BattReadInterlockStateAsync(int outSub) { + this.BattReadInterlockStateAsync(outSub, null); + } + + /// + public void BattReadInterlockStateAsync(int outSub, object userState) { + if ((this.BattReadInterlockStateOperationCompleted == null)) { + this.BattReadInterlockStateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBattReadInterlockStateOperationCompleted); + } + this.InvokeAsync("BattReadInterlockState", new object[] { + outSub}, this.BattReadInterlockStateOperationCompleted, userState); + } + + private void OnBattReadInterlockStateOperationCompleted(object arg) { + if ((this.BattReadInterlockStateCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.BattReadInterlockStateCompleted(this, new BattReadInterlockStateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceSetRange(int outSub, double range) { + object[] results = this.Invoke("VsourceSetRange", new object[] { + outSub, + range}); + return ((int)(results[0])); + } + + /// + public void VsourceSetRangeAsync(int outSub, double range) { + this.VsourceSetRangeAsync(outSub, range, null); + } + + /// + public void VsourceSetRangeAsync(int outSub, double range, object userState) { + if ((this.VsourceSetRangeOperationCompleted == null)) { + this.VsourceSetRangeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceSetRangeOperationCompleted); + } + this.InvokeAsync("VsourceSetRange", new object[] { + outSub, + range}, this.VsourceSetRangeOperationCompleted, userState); + } + + private void OnVsourceSetRangeOperationCompleted(object arg) { + if ((this.VsourceSetRangeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceSetRangeCompleted(this, new VsourceSetRangeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceGetRange(int outSub, out double range) { + object[] results = this.Invoke("VsourceGetRange", new object[] { + outSub}); + range = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void VsourceGetRangeAsync(int outSub) { + this.VsourceGetRangeAsync(outSub, null); + } + + /// + public void VsourceGetRangeAsync(int outSub, object userState) { + if ((this.VsourceGetRangeOperationCompleted == null)) { + this.VsourceGetRangeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceGetRangeOperationCompleted); + } + this.InvokeAsync("VsourceGetRange", new object[] { + outSub}, this.VsourceGetRangeOperationCompleted, userState); + } + + private void OnVsourceGetRangeOperationCompleted(object arg) { + if ((this.VsourceGetRangeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceGetRangeCompleted(this, new VsourceGetRangeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceSetVoltage(int outSub, double voltage) { + object[] results = this.Invoke("VsourceSetVoltage", new object[] { + outSub, + voltage}); + return ((int)(results[0])); + } + + /// + public void VsourceSetVoltageAsync(int outSub, double voltage) { + this.VsourceSetVoltageAsync(outSub, voltage, null); + } + + /// + public void VsourceSetVoltageAsync(int outSub, double voltage, object userState) { + if ((this.VsourceSetVoltageOperationCompleted == null)) { + this.VsourceSetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceSetVoltageOperationCompleted); + } + this.InvokeAsync("VsourceSetVoltage", new object[] { + outSub, + voltage}, this.VsourceSetVoltageOperationCompleted, userState); + } + + private void OnVsourceSetVoltageOperationCompleted(object arg) { + if ((this.VsourceSetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceSetVoltageCompleted(this, new VsourceSetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceGetVoltage(int outSub, out double voltage) { + object[] results = this.Invoke("VsourceGetVoltage", new object[] { + outSub}); + voltage = ((double)(results[1])); + return ((int)(results[0])); + } + + /// + public void VsourceGetVoltageAsync(int outSub) { + this.VsourceGetVoltageAsync(outSub, null); + } + + /// + public void VsourceGetVoltageAsync(int outSub, object userState) { + if ((this.VsourceGetVoltageOperationCompleted == null)) { + this.VsourceGetVoltageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceGetVoltageOperationCompleted); + } + this.InvokeAsync("VsourceGetVoltage", new object[] { + outSub}, this.VsourceGetVoltageOperationCompleted, userState); + } + + private void OnVsourceGetVoltageOperationCompleted(object arg) { + if ((this.VsourceGetVoltageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceGetVoltageCompleted(this, new VsourceGetVoltageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceSetEnable(int outSub, int pattern) { + object[] results = this.Invoke("VsourceSetEnable", new object[] { + outSub, + pattern}); + return ((int)(results[0])); + } + + /// + public void VsourceSetEnableAsync(int outSub, int pattern) { + this.VsourceSetEnableAsync(outSub, pattern, null); + } + + /// + public void VsourceSetEnableAsync(int outSub, int pattern, object userState) { + if ((this.VsourceSetEnableOperationCompleted == null)) { + this.VsourceSetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceSetEnableOperationCompleted); + } + this.InvokeAsync("VsourceSetEnable", new object[] { + outSub, + pattern}, this.VsourceSetEnableOperationCompleted, userState); + } + + private void OnVsourceSetEnableOperationCompleted(object arg) { + if ((this.VsourceSetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceSetEnableCompleted(this, new VsourceSetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("CardLocation")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("result")] + public int VsourceGetEnable(int outSub, out int pattern) { + object[] results = this.Invoke("VsourceGetEnable", new object[] { + outSub}); + pattern = ((int)(results[1])); + return ((int)(results[0])); + } + + /// + public void VsourceGetEnableAsync(int outSub) { + this.VsourceGetEnableAsync(outSub, null); + } + + /// + public void VsourceGetEnableAsync(int outSub, object userState) { + if ((this.VsourceGetEnableOperationCompleted == null)) { + this.VsourceGetEnableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVsourceGetEnableOperationCompleted); + } + this.InvokeAsync("VsourceGetEnable", new object[] { + outSub}, this.VsourceGetEnableOperationCompleted, userState); + } + + private void OnVsourceGetEnableOperationCompleted(object arg) { + if ((this.VsourceGetEnableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.VsourceGetEnableCompleted(this, new VsourceGetEnableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://pickeringswitch.com/lxi/ws/picards", ResponseNamespace="http://pickeringswitch.com/lxi/ws/picards", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("message", IsNullable=true)] + public string ErrorCodeToMessage(int errorCode) { + object[] results = this.Invoke("ErrorCodeToMessage", new object[] { + errorCode}); + return ((string)(results[0])); + } + + /// + public void ErrorCodeToMessageAsync(int errorCode) { + this.ErrorCodeToMessageAsync(errorCode, null); + } + + /// + public void ErrorCodeToMessageAsync(int errorCode, object userState) { + if ((this.ErrorCodeToMessageOperationCompleted == null)) { + this.ErrorCodeToMessageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnErrorCodeToMessageOperationCompleted); + } + this.InvokeAsync("ErrorCodeToMessage", new object[] { + errorCode}, this.ErrorCodeToMessageOperationCompleted, userState); + } + + private void OnErrorCodeToMessageOperationCompleted(object arg) { + if ((this.ErrorCodeToMessageCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ErrorCodeToMessageCompleted(this, new ErrorCodeToMessageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } + + private bool IsLocalFileSystemWebService(string url) { + if (((url == null) + || (url == string.Empty))) { + return false; + } + System.Uri wsUri = new System.Uri(url); + if (((wsUri.Port >= 1024) + && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) { + return true; + } + return false; + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + [System.Xml.Serialization.XmlRootAttribute("CardLocation", Namespace="http://pickeringswitch.com/lxi/ws/picards", IsNullable=false)] + public partial class LocationHeader : System.Web.Services.Protocols.SoapHeader { + + private long busField; + + private long slotField; + + /// + public long Bus { + get { + return this.busField; + } + set { + this.busField = value; + } + } + + /// + public long Slot { + get { + return this.slotField; + } + set { + this.slotField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum StatusEnum { + + /// + StatNoCard, + + /// + StatWrongDriver, + + /// + StatEepromErr, + + /// + StatDisabled, + + /// + SubStatNoSub, + + /// + StatBusy, + + /// + StatHwFault, + + /// + StatParityError, + + /// + StatPsuInhibited, + + /// + StatPsuShutdown, + + /// + StatPsuCurrentLimit, + + /// + StatCorrupted, + + /// + StatCardInaccessible, + + /// + StatUncalibrated, + + /// + StatCalibrationDue, + + /// + StatBirstEnabled, + + /// + StatOk, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum AttrCodeEnum { + + /// + AttrChannelSubSwitches, + + /// + AttrXIsoSubSwitches, + + /// + AttrYIsoSubSwitches, + + /// + AttrXLoopthruSubSwitches, + + /// + AttrYLoopthruSubSwitches, + + /// + AttrNumXSegments, + + /// + AttrXSegment01Size, + + /// + AttrXSegment02Size, + + /// + AttrXSegment03Size, + + /// + AttrXSegment04Size, + + /// + AttrXSegment05Size, + + /// + AttrXSegment06Size, + + /// + AttrXSegment07Size, + + /// + AttrXSegment08Size, + + /// + AttrXSegment09Size, + + /// + AttrXSegment10Size, + + /// + AttrXSegment11Size, + + /// + AttrXSegment12Size, + + /// + AttrNumYSegments, + + /// + AttrYSegment01Size, + + /// + AttrYSegment02Size, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum TypeNumberEnum { + + /// + TypeSw, + + /// + TypeMux, + + /// + TypeMuxm, + + /// + TypeMat, + + /// + TypeMatr, + + /// + TypeDig, + + /// + TypeRes, + + /// + TypeAtten, + + /// + TypePsudc, + + /// + TypeBatt, + + /// + TypeVsource, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum SwFuncEnum { + + /// + SwFuncChannel, + + /// + SwFuncXIso, + + /// + SwFuncYIso, + + /// + SwFuncXLoopthru, + + /// + SwFuncYLoopthru, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum SwActEnum { + + /// + SwActNone, + + /// + SwActActOpen, + + /// + SwActClose, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum StoreTypeEnum { + + /// + CalStoreUser, + + /// + CalStoreFactory, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://pickeringswitch.com/lxi/ws/picards")] + public enum ModeTypeEnum { + + /// + ResModeSet, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void CardIdCompletedEventHandler(object sender, CardIdCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CardIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CardIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClosureLimitCompletedEventHandler(object sender, ClosureLimitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClosureLimitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClosureLimitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int limit { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void CardOpsCountCompletedEventHandler(object sender, CardOpsCountCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CardOpsCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CardOpsCountCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int count { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void CountFreeCardsCompletedEventHandler(object sender, CountFreeCardsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CountFreeCardsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CountFreeCardsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int numCards { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void DiagnosticCompletedEventHandler(object sender, DiagnosticCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class DiagnosticCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal DiagnosticCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void EnumerateSubsCompletedEventHandler(object sender, EnumerateSubsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class EnumerateSubsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal EnumerateSubsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int inSubs { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public int outSubs { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void FindFreeCardsCompletedEventHandler(object sender, FindFreeCardsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class FindFreeCardsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal FindFreeCardsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int[] busList { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[1])); + } + } + + /// + public int[] slotList { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[2])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SettleTimeCompletedEventHandler(object sender, SettleTimeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SettleTimeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SettleTimeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int time { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void StatusCompletedEventHandler(object sender, StatusCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class StatusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal StatusCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public StatusEnum status1 { + get { + this.RaiseExceptionIfNecessary(); + return ((StatusEnum)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubAttributeCompletedEventHandler(object sender, SubAttributeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubAttributeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubAttributeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int attrValue { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubInfoCompletedEventHandler(object sender, SubInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public TypeNumberEnum typeNum { + get { + this.RaiseExceptionIfNecessary(); + return ((TypeNumberEnum)(this.results[1])); + } + } + + /// + public int rows { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + + /// + public int cols { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[3])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubStatusCompletedEventHandler(object sender, SubStatusCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubStatusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubStatusCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public StatusEnum status { + get { + this.RaiseExceptionIfNecessary(); + return ((StatusEnum)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SubTypeCompletedEventHandler(object sender, SubTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SubTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SubTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VersionCompletedEventHandler(object sender, VersionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VersionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int version1 { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearAllCompletedEventHandler(object sender, ClearAllCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearAllCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearAllCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearCardCompletedEventHandler(object sender, ClearCardCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearCardCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearCardCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearSubCompletedEventHandler(object sender, ClearSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void OpBitCompletedEventHandler(object sender, OpBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class OpBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OpBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewBitCompletedEventHandler(object sender, ViewBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewSubCompletedEventHandler(object sender, ViewSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteSubCompletedEventHandler(object sender, WriteSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadBitCompletedEventHandler(object sender, ReadBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadSubCompletedEventHandler(object sender, ReadSubCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadSubCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadSubCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ClearMaskCompletedEventHandler(object sender, ClearMaskCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ClearMaskCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ClearMaskCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void MaskBitCompletedEventHandler(object sender, MaskBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class MaskBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal MaskBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void MaskCrosspointCompletedEventHandler(object sender, MaskCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class MaskCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal MaskCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void OpCrosspointCompletedEventHandler(object sender, OpCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class OpCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OpCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void OpSwitchCompletedEventHandler(object sender, OpSwitchCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class OpSwitchCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OpSwitchCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewCrosspointCompletedEventHandler(object sender, ViewCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewMaskCompletedEventHandler(object sender, ViewMaskCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewMaskCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewMaskCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewMaskBitCompletedEventHandler(object sender, ViewMaskBitCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewMaskBitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewMaskBitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ViewMaskCrosspointCompletedEventHandler(object sender, ViewMaskCrosspointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ViewMaskCrosspointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ViewMaskCrosspointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool state { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteMaskCompletedEventHandler(object sender, WriteMaskCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteMaskCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteMaskCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuEnableCompletedEventHandler(object sender, PsuEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuGetVoltageCompletedEventHandler(object sender, PsuGetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuGetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuGetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuSetVoltageCompletedEventHandler(object sender, PsuSetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuSetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuSetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuInfoCompletedEventHandler(object sender, PsuInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int typeNum { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[2])); + } + } + + /// + public double current { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[3])); + } + } + + /// + public int precis { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[4])); + } + } + + /// + public int capabilities { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[5])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void PsuTypeCompletedEventHandler(object sender, PsuTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class PsuTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal PsuTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenGetAttenuationCompletedEventHandler(object sender, AttenGetAttenuationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenGetAttenuationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenGetAttenuationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public float atten { + get { + this.RaiseExceptionIfNecessary(); + return ((float)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenInfoCompletedEventHandler(object sender, AttenInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int typeNum { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public int numSteps { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + + /// + public float stepSize { + get { + this.RaiseExceptionIfNecessary(); + return ((float)(this.results[3])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenPadValueCompletedEventHandler(object sender, AttenPadValueCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenPadValueCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenPadValueCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public float atten { + get { + this.RaiseExceptionIfNecessary(); + return ((float)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenSetAttenuationCompletedEventHandler(object sender, AttenSetAttenuationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenSetAttenuationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenSetAttenuationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void AttenTypeCompletedEventHandler(object sender, AttenTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AttenTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AttenTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public string str { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadCalCompletedEventHandler(object sender, ReadCalCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadCalCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadCalCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int data { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadCalDateCompletedEventHandler(object sender, ReadCalDateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadCalDateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadCalDateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int year { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + + /// + public int day { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[2])); + } + } + + /// + public int interval { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[3])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ReadCalFPCompletedEventHandler(object sender, ReadCalFPCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ReadCalFPCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ReadCalFPCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double[] data { + get { + this.RaiseExceptionIfNecessary(); + return ((double[])(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void SetCalPointCompletedEventHandler(object sender, SetCalPointCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetCalPointCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetCalPointCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteCalCompletedEventHandler(object sender, WriteCalCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteCalCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteCalCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteCalDateCompletedEventHandler(object sender, WriteCalDateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteCalDateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteCalDateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void WriteCalFPCompletedEventHandler(object sender, WriteCalFPCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class WriteCalFPCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal WriteCalFPCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ResGetResistanceCompletedEventHandler(object sender, ResGetResistanceCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ResGetResistanceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ResGetResistanceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double resistance { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ResSetResistanceCompletedEventHandler(object sender, ResSetResistanceCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ResSetResistanceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ResSetResistanceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ResInfoCompletedEventHandler(object sender, ResInfoCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ResInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ResInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double minRes { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + + /// + public double maxRes { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[2])); + } + } + + /// + public double refRes { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[3])); + } + } + + /// + public double precPC { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[4])); + } + } + + /// + public double precDelta { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[5])); + } + } + + /// + public double int1 { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[6])); + } + } + + /// + public double intDelta { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[7])); + } + } + + /// + public int capabilities { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[8])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattSetVoltageCompletedEventHandler(object sender, BattSetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattSetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattSetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattGetVoltageCompletedEventHandler(object sender, BattGetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattGetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattGetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattSetCurrentCompletedEventHandler(object sender, BattSetCurrentCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattSetCurrentCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattSetCurrentCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattGetCurrentCompletedEventHandler(object sender, BattGetCurrentCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattGetCurrentCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattGetCurrentCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double current { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattSetEnableCompletedEventHandler(object sender, BattSetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattSetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattSetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattGetEnableCompletedEventHandler(object sender, BattGetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattGetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattGetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int pattern { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void BattReadInterlockStateCompletedEventHandler(object sender, BattReadInterlockStateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class BattReadInterlockStateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal BattReadInterlockStateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public bool interlock { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceSetRangeCompletedEventHandler(object sender, VsourceSetRangeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceSetRangeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceSetRangeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceGetRangeCompletedEventHandler(object sender, VsourceGetRangeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceGetRangeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceGetRangeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double range { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceSetVoltageCompletedEventHandler(object sender, VsourceSetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceSetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceSetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceGetVoltageCompletedEventHandler(object sender, VsourceGetVoltageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceGetVoltageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceGetVoltageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public double voltage { + get { + this.RaiseExceptionIfNecessary(); + return ((double)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceSetEnableCompletedEventHandler(object sender, VsourceSetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceSetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceSetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void VsourceGetEnableCompletedEventHandler(object sender, VsourceGetEnableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class VsourceGetEnableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal VsourceGetEnableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + + /// + public int pattern { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + public delegate void ErrorCodeToMessageCompletedEventHandler(object sender, ErrorCodeToMessageCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ErrorCodeToMessageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ErrorCodeToMessageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } +} + +#pragma warning restore 1591 \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/Reference.map b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/Reference.map new file mode 100644 index 0000000..57ebfee --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/Reference.map @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/StatusEnum.datasource b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/StatusEnum.datasource new file mode 100644 index 0000000..8285d6c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/StatusEnum.datasource @@ -0,0 +1,10 @@ + + + + SwitchMeasurementInstrumentsLib.Pickering60LxiSoap.StatusEnum, Web References.Pickering60LxiSoap.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/TypeNumberEnum.datasource b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/TypeNumberEnum.datasource new file mode 100644 index 0000000..eecea86 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringLxi60_522_Soap/Web References/Pickering60LxiSoap/TypeNumberEnum.datasource @@ -0,0 +1,10 @@ + + + + SwitchMeasurementInstrumentsLib.Pickering60LxiSoap.TypeNumberEnum, Web References.Pickering60LxiSoap.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40.cs new file mode 100644 index 0000000..46bf42b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40.cs @@ -0,0 +1,404 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Text; +using NLog; +using Pickering.Pipx40.Interop; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A Pickering implementation of the IRelaySwitch interface + /// + public class SwitchPickeringPipx40 : ISwitch + { + #region PrivateMemberVariables + private readonly int _handle; + private string _name; + private readonly int _subUnit; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// Dispose of the resources contained by this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + RelayOpenAll(); + Pickering.Pipx40.Interop.Pipx40Module.Reset(_handle); + Pickering.Pipx40.Interop.Pipx40Module.Close(_handle); + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Close a single relay + /// The relay string should be the string form of an integer that represents the bit to close + /// + /// The relay to close + private void RelayClose(string relay) + { + //VI_ON energizes + int ret = Pickering.Pipx40.Interop.Pipx40Module.SetChannelState(_handle, _subUnit, Convert.ToInt32(relay), 1); + //pipx40_operateSwitch + if (ret != 0) + { + throw new Exception("Pickering.Pipx40.Interop.Pipx40Module.SetChannelState() return: " + ret.ToString()); + } + } + + /// + /// Opens a single relay + /// The relay strings should be the string form of an integer that represents the bit to close + /// + /// The relay to open + private void RelayOpen(string relay) + { + //VI_OFF energizes + int ret = Pickering.Pipx40.Interop.Pipx40Module.SetChannelState(_handle, _subUnit, Convert.ToInt32(relay), 0); + //pipx40_operateSwitch + if (ret != 0) + { + throw new Exception("Pickering.Pipx40.Interop.Pipx40Module.SetChannelState() return: " + ret.ToString()); + } + } + + /// + /// Opens all relays on the card + /// + private void RelayOpenAll() + { + Pickering.Pipx40.Interop.Pipx40Module.ClearCard(_handle); + + //Pickering.Pipx40.Interop.Pipx40Module.ClearSub(_handle, _subUnit); + } + + private void SelfTest() + { + SelftestFault stFault = new SelftestFault(); + + StringBuilder message = new StringBuilder(); + + int ret = Pickering.Pipx40.Interop.Pipx40Module.SelfTest(_handle, ref stFault, message); + + if (ret != 0) + { + throw new Exception("Pickering.Pipx40.Interop.Pipx40Module.SelfTest() return: " + ret.ToString() + ", " + message.ToString()); + } + } + + #endregion + + #region PublicFunctions + + /// + /// SwitchPickeringPipx40 factory constructor + /// + /// + /// + public SwitchPickeringPipx40(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _subUnit = _configuration.GetConfigurationValue("SwitchPickeringPipx40", "SubUnit", 0); + + int ret = Pipx40Module.Init(Name, 0, 1, ref _handle); + if (ret != 0) + { + throw new Exception("Pickering.Pipx40.Interop.Pipx40Module.Init() return: " + ret.ToString()); + } + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + /// + /// + public SwitchPickeringPipx40(string name, string address, int subUnit) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _subUnit = subUnit; + + int ret = Pipx40Module.Init(name, 0, 1, ref _handle); + if (ret != 0) + { + throw new Exception("Pickering.Pipx40.Interop.Pipx40Module.Init() return: " + ret.ToString()); + } + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// The Finalizer + /// + ~SwitchPickeringPipx40() + { + Dispose(false); + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Connect(string path) + { + RelayClose(path); + } + + /// + /// + /// + /// + public void Disconnect(string path) + { + RelayOpen(path); + } + + /// + /// + /// + public void DisconnectAll() + { + RelayOpenAll(); + } + + /// + /// Dispose of the resources contained by this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Pickering Switch"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + // nothing to initialize here + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public bool IsDebounced + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void Reset() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + RelayOpenAll(); + Pickering.Pipx40.Interop.Pipx40Module.Reset(_handle); + Pickering.Pipx40.Interop.Pipx40Module.Close(_handle); + _state = State.Uninitialized; + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40.csproj new file mode 100644 index 0000000..b89c744 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40.csproj @@ -0,0 +1,40 @@ + + + + net472 + Raytheon.Instruments.SwitchPickeringPipx40 + Switch Pickering Pipx40 implementation + Switch Pickering Pipx40 implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\Pickering\Pickering.Pipx40.Interop.dll + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40Factory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40Factory.cs new file mode 100644 index 0000000..7298bbd --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchPickeringPipx40/SwitchPickeringPipx40Factory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// SwitchPickeringPipx40Factory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchPickeringPipx40Factory")] + public class SwitchPickeringPipx40Factory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchPickeringPipx40Factory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchPickeringPipx40Factory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchPickeringPipx40(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SwitchSim(name, _configurationManager, _logger); + else + return new SwitchPickeringPipx40(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSim.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSim.cs new file mode 100644 index 0000000..5d84d2d --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSim.cs @@ -0,0 +1,350 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// A simulated implementation of the ISwitch interface. + /// + public class SwitchSim : ISwitch + { + #region PrivateMemberVariables + + private Dictionary _relayStates; + private string _name; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + + /// + /// The Finalizer + /// + ~SwitchSim() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Close a relay (simulated). + /// + /// The relay to close. + private void RelayClose(string relay) + { + _relayStates[relay] = true; + } + + /// + /// Open a relay (simulated). + /// + /// The relay to open. + private void RelayOpen(string relay) + { + _relayStates[relay] = false; + } + + /// + /// + /// + private void RelayOpenAll() + { + List keys = new List(_relayStates.Keys); + + foreach (string key in keys) + { + _relayStates[key] = false; + } + } + + #endregion + + #region PublicFunctions + + /// + /// SwitchSim factory constructor + /// + /// + /// + public SwitchSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _relayStates = new Dictionary(); + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// Constructor for RelaySwitch card (simulated). + /// + public SwitchSim(string name) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _relayStates = new Dictionary(); + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// + /// + /// + public void Connect(string path) + { + RelayClose(path); + } + + /// + /// + /// + /// + public void Disconnect(string path) + { + RelayOpen(path); + } + + /// + /// + /// + public void DisconnectAll() + { + RelayOpenAll(); + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Sim Switch"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public bool IsDebounced + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void Reset() + { + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + _state = State.Uninitialized; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSim.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSim.csproj new file mode 100644 index 0000000..2ce535a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSim.csproj @@ -0,0 +1,21 @@ + + + + net472 + Raytheon.Instruments.SwitchSim + Switch Sim implementation + Switch Analyzer Sim implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSimFactory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSimFactory.cs new file mode 100644 index 0000000..4e5f071 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchSim/SwitchSimFactory.cs @@ -0,0 +1,137 @@ +// ********************************************************************************************************** +// SwitchSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchSimFactory")] + public class SwitchSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new SwitchSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTI.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTI.cs new file mode 100644 index 0000000..dacc0eb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTI.cs @@ -0,0 +1,389 @@ +//>>*************************************************************************** +// UNCLASSIFIED +// +// COPYRIGHT 2017 RAYTHEON MISSILE SYSTEMS +// ALL RIGHTS RESERVED +// This data was developed pursuant to Contract Number HQ0147-12-C-0004/1088370 +// with the US Government. The US Government's rights in and to this +// copyrighted data are as specified in DFAR 252.227-7013 +// which was made part of the above contract. +// +// Distribution Statement: D -Distribution authorized to the DoD and DoD +// contractors only based on Critical Technology Requirements, May 2001. +// Other requests shall be referred to PEO THEATER AIR DEFENSE (PMS 422). +// Warning: - This document contains technical data whose export is restricted +// by the Arms Export Control Act (Title 22, U.S.C.) or Export +// Administration Act of 1979, as amended (Title 50, U.S.C.). Violations +// of these laws are subject to severe criminal penalties. Disseminate in +// accordance with provisions of DoD 5230.25. +// Destruction Notice: - For unclassified, limited distribution information, +// destroy by any method that will prevent disclosure of contents or +// reconstruction of the document. Classified information, destroy in +// accordance with DoD-5220.22-M or OPNAVINST 5510.1h. +//>>*************************************************************************** + +using System; +using VTI.VTEXSwitch.Interop; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// This is a class for controlling a VTI EX1200-3001, 5002, 4264 switch card. + /// It only supports individual relay mode at this time. + /// + public class SwitchVTI : ISwitch + { + #region PrivateMemberVariables + private VTEXSwitch _switch; + private string _name; + private readonly string _address; + private readonly string _options; + private State _state; + private SelfTestResult _selfTestResult; + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateFunctions + /// + /// Finalizer. + /// + ~SwitchVTI() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + if (_state == State.Ready) + { + Reset(); + + _switch.Close(); + + _state = State.Uninitialized; + } + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Perform self-test. + /// + private string SelfTest() + { + int testResult = 0; + + string selfTestMessage = ""; + + _switch.Utility.SelfTest(ref testResult, ref selfTestMessage); + + if (testResult != 0) + { + throw new Exception("Self test returned an error code of: " + testResult.ToString() + ", and an error string of: " + selfTestMessage); + } + + return selfTestMessage; + } + #endregion + + #region PublicFunctions + + /// + /// SwitchVTI factory constructor + /// + /// + /// + public SwitchVTI(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _address = _configuration.GetConfigurationValue("SwitchVTI", "Address", ""); + _options = _configuration.GetConfigurationValue("SwitchVTI", "Options", ""); + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// Constructor for RelaySwitch card. + /// + /// The name. + /// The address of the RelaySwitch. + /// The options used for setting up the instrument. + public SwitchVTI(string name, string address, string options) + { + _name = name; + _logger = LogManager.GetCurrentClassLogger(); + _address = address; + _options = options; + + // created in initialized + _switch = null; + + _state = State.Uninitialized; + _selfTestResult = SelfTestResult.Unknown; + } + + /// + /// + /// + /// + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + /// + /// Close a single relay. + /// The COTS library works on string inputs: + /// - Ex Relay: "2!K1" Means card 2 relay 1. + /// + /// The relay to close. + public void Connect(string path) + { + _switch.InstrumentSpecific.CloseRelays(path); + } + + /// + /// Open a single relay. + /// The COTS library works on string inputs: + /// - Ex Relay: "2!K1" Means card 2 relay 1. + /// + /// The relay to open. + public void Disconnect(string path) + { + _switch.InstrumentSpecific.OpenRelays(path); + } + + /// + /// + /// + public void DisconnectAll() + { + string relayList = _switch.InstrumentSpecific.ListOfRelays; + + _switch.InstrumentSpecific.OpenRelays(relayList); + } + + /// + /// Dispose of resources. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a VTI Switch"; + } + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + throw new NotSupportedException(); + } + + set + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotSupportedException(); + } + + set + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public void Initialize() + { + if (_state == State.Uninitialized) + { + _switch = new VTEXSwitch(); + _switch.Initialize(_address, false, true, _options); + _state = State.Ready; + } + else + { + throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString()); + } + } + + /// + /// + /// + public bool IsDebounced + { + get + { + throw new NotSupportedException(); + } + } + + /// + /// + /// + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + int testResult = 0; + string result = ""; + _switch.Utility.SelfTest(ref testResult, ref result); + + // Set measurement input to backplane after performing self test. Default is front panel. + // _dmm.Measurement.In = VTEXDmmInputSelectEnum.VTEXDmmInputSelectInternal; + + if (testResult > 0) + { + _selfTestResult = Raytheon.Instruments.SelfTestResult.Fail; + throw new Exception("self test failed with an Error Code: " + testResult + " and Error Message: " + result); + } + + _selfTestResult = Raytheon.Instruments.SelfTestResult.Pass; + + return _selfTestResult; + } + + /// + /// + /// + public void Reset() + { + _switch.Utility.Reset(); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + if (_state == State.Ready) + { + Reset(); + + _switch.Close(); + + _state = State.Uninitialized; + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTI.csproj b/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTI.csproj new file mode 100644 index 0000000..8ac20ec --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTI.csproj @@ -0,0 +1,36 @@ + + + + net472 + x86 + Raytheon.Instruments.SwitchVTI + Switch VTI implementation + Switch VTI implementation + Library + + + + 1.0.0 + + + + + + + + + + + + + + + ..\..\Common\COTS\VTI\Ivi.Driver.Interop.dll + + + ..\..\Common\COTS\VTI\VTI.VTEXSwitch.Interop.dll + True + + + + diff --git a/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTIFactory.cs b/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTIFactory.cs new file mode 100644 index 0000000..292f45a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/Switch/SwitchVTI/SwitchVTIFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// SwitchSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "SwitchVTIFactory")] + public class SwitchVTIFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public SwitchVTIFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public SwitchVTIFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ISwitch)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new SwitchVTI(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new SwitchSim(name, _configurationManager, _logger); + else + return new SwitchVTI(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446.cs b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446.cs new file mode 100644 index 0000000..ceb3d3e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446.cs @@ -0,0 +1,309 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.IO.Ports; +using System.Net.Sockets; +using System.Text; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Temperature monitor class used to interact with the M3446 temperature sensor. + /// Parsing assumes Echo mode is turned off (front panel of instrument) + /// + public class TempMonitorOmegaM3446 : ITempMonitor + { + #region PrivateMembers + //Commands + private const string _CARRIAGE_RTN = "\r"; + private const string _TEMP = "*X03"; + private const string _VERSION = "*U03"; + + //Prevent Collisions + private static object m_sync = new object(); + + private readonly string _ipAddr; + private readonly int _port; + private const int _READ_BUFFER_SIZE = 128; + private const int _READ_TIMEOUT = 5000; + private byte[] _readBuffer; + private NetworkStream _tcpStream; + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set; } + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + #endregion + + #region PrivateFunctions + /// + /// Destructor + /// + ~TempMonitorOmegaM3446() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources + /// + /// Currently disposing + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + //Close Connection (if available) + _tcpStream?.Close(); + + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Open socket to the temperature sensor + /// + private void ConnectEthernet() + { + //Create and open a socket to temperature sensor + TcpClient tempSocket = new TcpClient(_ipAddr, _port); + _tcpStream = tempSocket.GetStream(); + _tcpStream.ReadTimeout = _READ_TIMEOUT; + } + + + /// + /// Get the current version of software loaded on temperature sensor + /// + private void GetSoftwareVersion() + { + lock (m_sync) + { + //Request the software version + string rsp = SendMessageGetResponse(_VERSION); + } + } + + /// + /// Send a command to the temperature sensor and request a response + /// + /// Command to send. + /// Response from the temperature sensor. + private string SendMessageGetResponse(string cmd) + { + lock (m_sync) + { + //Format the command before sending + string commandString = cmd + _CARRIAGE_RTN; + + //convert to byte array for sending + byte[] commandBuffer = Encoding.ASCII.GetBytes(commandString); + + //send the data + _tcpStream.Write(commandBuffer, 0, commandBuffer.Length); + + //clear the buffer + Array.Clear(_readBuffer, 0, _readBuffer.Length); + + //read from the response buffer + int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length); + + //convert response to a string + string rspStr = Encoding.ASCII.GetString(_readBuffer); + + //Check Response + if (rspStr.Contains(_CARRIAGE_RTN)) + { + char[] delimit = { '\r' }; + string[] parsed = rspStr.Split(delimit, StringSplitOptions.RemoveEmptyEntries); + + //Return parsed message + return parsed[0]; + } + else + { + throw new Exception("Command message not successful"); + } + } + } + + #endregion + + #region PublicFunctions + + /// + /// TempMonitorOmegaM3446 factory constructor + /// + /// + /// + public TempMonitorOmegaM3446(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + + _ipAddr = _configuration.GetConfigurationValue("TempMonitorOmegaM3446", "IpAddr", ""); + _port = _configuration.GetConfigurationValue("TempMonitorOmegaM3446", "Port", 0); + + _readBuffer = new byte[_READ_BUFFER_SIZE]; + + //Connect to device + ConnectEthernet(); + } + + + /// + /// Constructor for the temperature sensor + /// + /// the name + /// IP Address of the equipment + /// Port of the equipment + public TempMonitorOmegaM3446(string name, string ipAddress, int port) + { + Name = name; + _logger = LogManager.GetCurrentClassLogger(); + _ipAddr = ipAddress; + _port = port; + + //Initialize read buffer + _readBuffer = new byte[_READ_BUFFER_SIZE]; + + ConnectEthernet(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public TempMonitorOmegaM3446(string name, string comPortName, uint delayBeforeReadMs, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One) + { + throw new NotImplementedException(); + } + + + // This code added to correctly implement the disposable pattern. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + lock (m_sync) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Returns the current temperature read by temperature sensor + /// + /// The current Temperature reading + public double ReadTemperature() + { + lock (m_sync) + { + //Request current temp reading + string rsp = SendMessageGetResponse(_TEMP); + + return double.Parse(rsp); + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public void Shutdown() + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446.csproj b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446.csproj new file mode 100644 index 0000000..a710c16 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446.csproj @@ -0,0 +1,37 @@ + + + + net472 + Raytheon.Instruments.TempMonitorOmegaM3446 + Temp Monitor Omega M3446 implementation + Temp Monitor Omega M3446 implementation + Library + + + + 1.0.0 + + + + NU1603 + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446Factory.cs b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446Factory.cs new file mode 100644 index 0000000..aa9d310 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorOmegaM3446/TempMonitorOmegaM3446Factory.cs @@ -0,0 +1,139 @@ +// ********************************************************************************************************** +// TempMonitorOmegaM3446Factory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "TempMonitorOmegaM3446Factory")] + public class TempMonitorOmegaM3446Factory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public TempMonitorOmegaM3446Factory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public TempMonitorOmegaM3446Factory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ITempMonitor)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new TempMonitorOmegaM3446(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new TempMonitorSim(name, _configurationManager, _logger); + else + return new TempMonitorOmegaM3446(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSim.cs b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSim.cs new file mode 100644 index 0000000..8a4cb9c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSim.cs @@ -0,0 +1,203 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using NLog; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Temperature monitor class used to interact with the temperature sensor. + /// + public class TempMonitorSim : ITempMonitor + { + #region PrivateMembers + + private static object m_sync = new object(); + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set; } + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + + #endregion + + #region PrivateFunctions + /// + /// Destructor + /// + ~TempMonitorSim() + { + Dispose(false); + } + + /// + /// Dispose of this object's resources + /// + /// Currently disposing + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + #endregion + + #region PublicFunctions + + /// + /// TempMonitorSim factory constructor + /// + /// + /// + public TempMonitorSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + + /// + /// Constructor for the temperature sensor + /// + /// the name + /// IP Address of the equipment + /// Port of the equipment + public TempMonitorSim(string name) + { + Name = name; + _logger = LogManager.GetCurrentClassLogger(); + } + + + // This code added to correctly implement the disposable pattern. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + lock (m_sync) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception) + { + try + { + //ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Returns the current temperature read by temperature sensor + /// + /// The current Temperature reading + public double ReadTemperature() + { + lock (m_sync) + { + double max = 20.0; + + double min = 30.0; + + Random rnd = new Random(); + + double seed = rnd.NextDouble(); + + double dataToReturn = (seed * (max - min)) + min; + + Thread.Sleep(100); + + return dataToReturn; + } + } + + public bool ClearErrors() + { + throw new NotImplementedException(); + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public void Shutdown() + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSim.csproj b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSim.csproj new file mode 100644 index 0000000..d5bd488 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSim.csproj @@ -0,0 +1,21 @@ + + + + net472 + Raytheon.Instruments.TempMonitorSim + Temp Monitor SIM implementation + Temp Monitor SIM implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSimFactory.cs b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSimFactory.cs new file mode 100644 index 0000000..09e396a --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/TempMonitor/TempMonitorSim/TempMonitorSimFactory.cs @@ -0,0 +1,136 @@ +// ********************************************************************************************************** +// TempMonitorSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "TempMonitorSimFactory")] + public class TempMonitorSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public TempMonitorSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public TempMonitorSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ITempMonitor)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new TempMonitorSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new TempMonitorSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSim.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSim.cs new file mode 100644 index 0000000..4eb78bc --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSim.cs @@ -0,0 +1,296 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using System; +using System.IO; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// A simulated video recorder + /// + public class VideoRecorderSim : IVideoRecorder + { + #region PrivateClassMembers + private const string _SIM_VIDEO_FILE_NAME = "SimVideo"; + private string _lastGrabFileName; + + public string DetailedStatus { get; protected set; } + + public bool DisplayEnabled { get; set; } + public bool FrontPanelEnabled { get; set; } + + public InstrumentMetadata Info { get; set; } + + public string Name { get; protected set; } + + public SelfTestResult SelfTestResult => PerformSelfTest(); + + public State Status { get; set; } + + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + #endregion + + #region PrivateClassFunctions + /// + /// The Finalizer + /// + ~VideoRecorderSim() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + Disconnect(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicClassFunctions + /// + /// VideoRecorderSim factory constructor + /// + /// + /// + public VideoRecorderSim(string deviceName, IConfigurationManager configurationManager, ILogger logger) + { + Name = deviceName; + + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + } + /// + /// The sim constructor + /// + public VideoRecorderSim() + { + _lastGrabFileName = ""; + _logger = LogManager.GetCurrentClassLogger(); + } + + /// + /// + /// + /// + /// + public void AddNcdfAttributes(string videoFile, string attributeFile) + { + Thread.Sleep(1000); + } + + /// + /// + /// + public void Connect() + { + Thread.Sleep(1000); + } + + /// + /// + /// + public void Disconnect() + { + Thread.Sleep(1000); + } + + /// + /// Dispose of this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// This will create an empty video file in the user temp folder + /// + /// + /// + public void GrabVideoToDisk(uint numberOfFrames, VideoSaveFormat format) + { + Thread.Sleep(1000); + + // create a dummy file + string tempDirectory = Path.GetTempPath(); + + string time = Util.GetTimeString(); + + if (format == VideoSaveFormat.BIN) + { + tempDirectory += time + _SIM_VIDEO_FILE_NAME + ".bin"; + } + else if (format == VideoSaveFormat.NCDF) + { + tempDirectory += time + _SIM_VIDEO_FILE_NAME + ".ncdf"; + } + else + { + throw new Exception("UnhandledExceptionEventArgs save format" + format); + } + + string simFileName = tempDirectory; + + File.Create(simFileName); + + _lastGrabFileName = simFileName; + } + + /// + /// + /// + /// The number of free Gigabytes + /// The number of free Gigabytes + /// The number of free Gigabytes + /// The number of free Gigabytes + public void QueryHardDrive(ref float driveSpace1, ref float driveSpace2, ref float driveSpace3, ref float driveSpace4) + { + const float FREE_SPACE_IN_GB = 10.0f; + const float FULL_IN_GB = 0.0f; + + driveSpace1 = FREE_SPACE_IN_GB; + driveSpace2 = FULL_IN_GB; + driveSpace3 = FULL_IN_GB; + driveSpace4 = FULL_IN_GB; + } + + /// + /// + /// + /// + /// + /// + public void MoveFile(string fromFile, string toFile, MoveControl control) + { + File.Move(fromFile, toFile); + } + + /// + /// + /// + public void ShowLiveVideo() + { + Thread.Sleep(1000); + } + + /// + /// + /// + public void StopLiveVideo() + { + Thread.Sleep(1000); + } + + /// + /// This will return the file created by GrabVideoToDisk() + /// + /// + /// + public string WaitForGrabToComplete(int timeoutms) + { + Thread.Sleep(1000); + + // return the last file that was created, and clear the last file name for the next time + string lastFileName = _lastGrabFileName; + _lastGrabFileName = ""; + return lastFileName; + } + + public bool ClearErrors() + { + return false; + } + + public void Initialize() + { + } + + public SelfTestResult PerformSelfTest() + { + return SelfTestResult.Unknown; + } + + public void Reset() + { + Shutdown(); + Initialize(); + } + + public void Shutdown() + { + Disconnect(); + Dispose(); + } + + public byte[] GetSmallVideoFrame(string name, int nFrames, bool sensor, ref uint numBytesRead, bool deleteVideoFile) + { + return new byte[1024]; + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSim.csproj b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSim.csproj new file mode 100644 index 0000000..eb5dbbe --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSim.csproj @@ -0,0 +1,21 @@ + + + + net472 + Raytheon.Instruments.VideoRecorderSim + Video Recorder Sim implementation + Video Recorder Sim implementation + Library + + + + 1.0.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSimFactory.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSimFactory.cs new file mode 100644 index 0000000..d222f04 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderSim/VideoRecorderSimFactory.cs @@ -0,0 +1,137 @@ +// ********************************************************************************************************** +// VideoRecorderSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "VideoRecorderSimFactory")] + public class VideoRecorderSimFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public VideoRecorderSimFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public VideoRecorderSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(IVideoRecorder)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new VideoRecorderSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + return new VideoRecorderSim(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommDeviceNode.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommDeviceNode.cs new file mode 100644 index 0000000..710b041 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommDeviceNode.cs @@ -0,0 +1,371 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; + +using System; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// An interface to sending/receiving data over comm devices + /// + internal class CommDeviceNode : ICommDevice, IDisposable + { + #region PrivateClassMembers + private ICommDevice _commDevice; + private IWorkerInterface _socketReadWorker; + private Thread _socketReadThread; + private readonly string _name; + private SelfTestResult _selfTestResult; + private State _state; + + private uint _commReadWorkerBufferSize; + private uint _readWorkerRestTimeInMs; + private MsgDevice _msgHandler; + + #endregion + + #region PrivateFuctions + /// + /// The finalizer. Necessary for quitting the read thread + /// + ~CommDeviceNode() + { + Dispose(false); + } + + + /// + /// Quit the threads associated with the node + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + State initialState = _state; + + // close the socket and threads + try + { + if (initialState == State.Ready) + { + Shutdown(); + _commDevice.Shutdown(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + + // dispose of the resources + try + { + if (initialState == State.Ready) + { + _socketReadWorker.Dispose(); + _state = State.Uninitialized; + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// The constructor + /// + /// The name of this instance + /// The communication device + /// The message handler for this interface + /// The number of bytes for the buffer internal to this class. Each individual read will read upto this buffer size (or until the timeout happens) + /// Number of ms to reset between read calls on the comm interface + public CommDeviceNode(string name, ICommDevice commDevice, MsgDevice msgHandler, uint commReadWorkerBufferSize = 100000, uint readWorkerRestTimeInMs = 10) + { + _name = name; + _commDevice = commDevice; + + _commReadWorkerBufferSize = commReadWorkerBufferSize; + _readWorkerRestTimeInMs = readWorkerRestTimeInMs; + _msgHandler = msgHandler; + + Open(); + } + + /// + /// Starts communication thread + /// + public void Open() + { + _socketReadWorker = new CommReadWorker(this, _msgHandler, _commReadWorkerBufferSize, _readWorkerRestTimeInMs); + _socketReadThread = new Thread(_socketReadWorker.DoWork); + + // start the read thread + _socketReadThread.Start(); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + + /// + /// there is no error msg repository + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Comm Sim Device Node " + _name; + } + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + _commDevice.Initialize(); + _state = State.Ready; + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// Read data from the socket + /// + /// The data that was read + /// the number of bytes read + public uint Read(ref byte[] dataRead) + { + return _commDevice.Read(ref dataRead); + } + + /// + /// Resets communications + /// + public void Reset() + { + Close(); + Open(); + } + + /// + /// + /// + /// + public void SetReadTimeout(uint readTimeout) + { + _commDevice.SetReadTimeout(readTimeout); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// Close communications + /// + public void Close() + { + Shutdown(); + } + + /// + /// Close communications + /// + public void Shutdown() + { + if (_state == State.Ready) + { + const int THREAD_QUIT_TIMEOUT_MS = 3000; + + // tell the thread to quit + _socketReadWorker.QuitWork(); + + // close the socket which the thread might be blocked on + _commDevice.Shutdown(); + + if (_socketReadThread.IsAlive) + { + bool didThreadQuit = _socketReadThread.Join(THREAD_QUIT_TIMEOUT_MS); + + if (didThreadQuit == false) + { + ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread did not quit as expected, aborting it"); + _socketReadThread.Abort(); + } + else + { + ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread quit successfully after join", ErrorLogger.LogLevel.INFO); + } + } + else + { + ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread quit successfully", ErrorLogger.LogLevel.INFO); + } + } + + _state = State.Uninitialized; + } + + /// + /// Send data on the socket + /// + /// The data to send + /// The number of bytes to write from the dataToSend buffer + /// The number of bytes sent + public uint Write(byte[] dataToSend, uint numBytesToWrite) + { + return _commDevice.Write(dataToSend, numBytesToWrite); + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommReadWorker.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommReadWorker.cs new file mode 100644 index 0000000..2e8b1ef --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommReadWorker.cs @@ -0,0 +1,178 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using System.Net.Sockets; +using Raytheon.Instruments; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Takes raw data from an ICommDevice and throws it in a buffer + /// + internal class CommReadWorker : IWorkerInterface + { + #region PrivateClassMembers + private ICommDevice _commNode; + private MsgDevice _msgHandler; + private bool _threadQuitControl; + private AutoResetEvent _quitEvent; + private byte[] _dataRead; + private readonly uint _timeToRestBetweenReadsInMs; + #endregion + + #region PublicFuctions + + /// + /// Constructor + /// + /// The communication interface + /// The message handler for received data + /// The number of bytes for the buffer internal to this class. Each individual read will read upto this buffer size (or until the timeout happens) + /// Number of ms to rest after a read call + public CommReadWorker(ICommDevice commNode, MsgDevice msghandler, uint bufferSize, uint timeToRestBetweenReadsInMs) + { + _commNode = commNode; + _threadQuitControl = false; + _msgHandler = msghandler; + _quitEvent = new AutoResetEvent(false); + _dataRead = new byte[bufferSize]; + _timeToRestBetweenReadsInMs = timeToRestBetweenReadsInMs; + } + + /// + /// Finalizer + /// + ~CommReadWorker() + { + Dispose(false); + } + + /// + /// Dispose of this object. Needed for releasing thread/comm resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Reads the socket and puts data into a buffer + /// + public void DoWork() + { + try + { + while (_threadQuitControl == false) + { + try + { + uint numBytesRead = _commNode.Read(ref _dataRead); + + // add into buffer + if (numBytesRead > 0) + { + _msgHandler.AddData(_dataRead, numBytesRead); + } + + // not using timeToRestBetweenReadsInMs. Just going to wait 1 ms and get back to the read + if (_quitEvent.WaitOne(1)) + { + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - received signal to quit", ErrorLogger.LogLevel.INFO); + _threadQuitControl = true; + } + } + catch (SocketException e) + { + if (e.SocketErrorCode == SocketError.TimedOut) + { + //expected + } + else + { + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - " + e.Message, ErrorLogger.LogLevel.ERROR); + } + } + catch (Exception e) + { + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - " + e.Message, ErrorLogger.LogLevel.ERROR); + } + } + + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Commands the worker to stop + /// + public void QuitWork() + { + _quitEvent.Set(); + _threadQuitControl = true; + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _quitEvent.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommUtil.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommUtil.cs new file mode 100644 index 0000000..5f7ec60 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Lib/CommUtil.cs @@ -0,0 +1,104 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; + +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// Singleton sending out messages + /// + internal class CommUtil + { + // class variables + private static CommUtil _commUtilInstance; + + /// + /// Getter for this singleton + /// + /// + /// The instance of this class + public static CommUtil Instance() + { + if (_commUtilInstance == null) + { + _commUtilInstance = new CommUtil(); + } + return _commUtilInstance; + } + + /// + /// Sends a message and gets a response + /// + /// The communication interface + /// The message to send + /// The response that is received + /// The amount of time in ms to wait for the response + public void SendCommandGetResponse(ICommDevice commNode, AutomationMessage commandMsg, ref AutomationMessage rspMsg, int timeoutInMs = 5000) + { + // send the command + byte[] dataToSend = new byte[commandMsg.GetEntireMsgLength()]; + + // format the data + GCHandle pinnedArray = GCHandle.Alloc(dataToSend, GCHandleType.Pinned); + IntPtr pByte = pinnedArray.AddrOfPinnedObject(); + commandMsg.Format(pByte); + pinnedArray.Free(); + + uint numWritten = commNode.Write(dataToSend, (uint)dataToSend.Length); + + + if (numWritten != (uint)dataToSend.Length) + { + throw new Exception("CommUtil::SendCommandGetResponse NumBytesWritten does not match: numWritten " + numWritten + " and dataToSend.Length " + dataToSend.Length); + } + + // wait for the response + AutomationRxMsgBuffer rxBuffer = AutomationRxMsgBuffer.Instance(); + uint respMsgId = rspMsg.GetMessageId(); + bool didWeReceiveTheResponse = rxBuffer.WaitForRspMsg(respMsgId, timeoutInMs); + + if (didWeReceiveTheResponse == false) + { + throw new Exception("did not receive " + rspMsg.GetDescription()); + } + + rspMsg = rxBuffer.GetNewestMessage(respMsgId); + } + + /// + /// + /// + /// + /// + public void SendCommand(ICommDevice commNode, AutomationMessage commandMsg) + { + // send the command + byte[] dataToSend = new byte[commandMsg.GetEntireMsgLength()]; + + // format the data + GCHandle pinnedArray = GCHandle.Alloc(dataToSend, GCHandleType.Pinned); + IntPtr pByte = pinnedArray.AddrOfPinnedObject(); + commandMsg.Format(pByte); + pinnedArray.Free(); + commNode.Write(dataToSend, (uint)dataToSend.Length); + } + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/MessageHandler/VrsClientMsgHandler.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/MessageHandler/VrsClientMsgHandler.cs new file mode 100644 index 0000000..11a5eeb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/MessageHandler/VrsClientMsgHandler.cs @@ -0,0 +1,343 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + /// + /// Handles received messages from the remote VRS system + /// + internal class VrsClientMsgHandler : MsgDevice + { + #region PrivateClassMembers + private Dictionary> _messageHandlerMap; + private ICommDevice _commInterface; + #endregion + + #region PrivateClassFunctions + + /// + /// Handle the add attribute message + /// + /// the handle attribute msg data + /// + private bool HandleAddAttributesRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleAddAttributesRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrsAddAttributesRspMessage msg = new VrsAddAttributesRspMessage(false); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the VRS_CONNECT_RSP + /// + /// The data associated with VRS_CONNECT_RSP + private bool HandleConnectRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleConnectRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrsConnectRspMessage msg = new VrsConnectRspMessage(false); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the disconnect rsp msg + /// + /// + /// + private bool HandleDisconnectRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleDisconnectRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrsDisconnectRspMessage msg = new VrsDisconnectRspMessage(false); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the VRS_GRAB_VIDEO_TO_DISK_RSP + /// + /// The data associated with VRS_GRAB_VIDEO_TO_DISK_RSP + private bool HandleGrabToDiskRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleGrabToDiskRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrsGrabToDiskRspMessage msg = new VrsGrabToDiskRspMessage(false); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the VrsGrabToDiskCompleteRspMessage + /// + /// + /// + private bool HandleGrabToDiskCompleteRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleGrabToDiskCompleteRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrsGrabToDiskCompleteRspMessage msg = new VrsGrabToDiskCompleteRspMessage(false, ""); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the VrsMoveFileRspMessage + /// + /// + /// + private bool HandleMoveFileRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleMoveFileRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrsMoveFileRspMessage msg = new VrsMoveFileRspMessage(false); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the VrsQueryHardDriveRspMessage + /// + /// + /// + private bool HandleQueryDiskRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleQueryDiskRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrsQueryHardDriveRspMessage msg = new VrsQueryHardDriveRspMessage(false, 0, 0, 0, 0); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the VrStopLiveVideoRspMessage + /// + /// + /// + private bool HandleStopLiveVideoRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleStopLiveVideoRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrStopLiveVideoRspMessage msg = new VrStopLiveVideoRspMessage(false); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + + /// + /// Handler for the VrShowLiveVideoRspMessage + /// + /// + /// + private bool HandleShowLiveVideoRspMsg(IntPtr pData) + { + try + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleShowLiveVideoRspMsg() - beginning", ErrorLogger.LogLevel.INFO); + + VrShowLiveVideoRspMessage msg = new VrShowLiveVideoRspMessage(false); + msg.Parse(pData); + msg.ExecuteMsg(); + AutomationRxMsgBuffer.Instance().AddMsg(msg); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + + return true; + } + #endregion + + #region PublicFuctions + + /// + /// Constructor + /// + /// The number of bytes for the buffer that holds onto incomming data + unsafe public VrsClientMsgHandler(uint bufferSize) + : base(new VrsMsgParser(), bufferSize) + { + _commInterface = null; + + // set the callback + base.SetCompleteMessageCallback(this.OnCompleteMessage); + + // set up function mapping for received messages + _messageHandlerMap = new Dictionary>(); + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_CONNECT_RSP] = HandleConnectRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_RSP] = HandleGrabToDiskRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_RSP] = HandleShowLiveVideoRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_RSP] = HandleStopLiveVideoRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_MOVE_FILE_RSP] = HandleMoveFileRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_RSP] = HandleQueryDiskRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_RSP] = HandleAddAttributesRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_DISCONNECT_RSP] = HandleDisconnectRspMsg; + _messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP] = HandleGrabToDiskCompleteRspMsg; + } + + /// + /// Add data to the buffer + /// + /// The data to add + /// The number of bytes in the data buffer + public override void AddData(byte[] data, uint numBytes) + { + AddToBuffer(data, numBytes); + } + + /// + /// Clear all data from the buffer + /// + public void ClearData() + { + ClearBuffer(); + } + + /// + /// The callback function for when a complete message is received + /// + /// The id of the message received + /// The data for the message received + /// The number of bytes in pData + /// The error code + unsafe public void OnCompleteMessage(uint msgId, IntPtr pData, uint numBytes, uint errorCode) + { + if (_messageHandlerMap.ContainsKey(msgId) == false) + { + ErrorLogger.Instance().Write("VrsClientMsgHandler::OnCompleteMessage() - detected unknown msg id: " + msgId.ToString()); + } + else + { + //call the message handler + _messageHandlerMap[msgId](pData); + } + } + + /// + /// Stops the message handler + /// + public void QuitHandler() + { + base.QuitThread(); + } + + /// + /// If this handler needs to send out data, this is the setter for the ICommNodeInterface object + /// + /// The communication interface + public void SetCommInterface(ICommDevice commInterface) + { + _commInterface = commInterface; + } + + /// + /// Sets the log file name. Not supported for this handler. Will throw an expection if called + /// + /// The log file name + public void SetLogFileName(string fileName) + { + throw new Exception("This handler does not support this"); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/MessageHandler/VrsMsgParser.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/MessageHandler/VrsMsgParser.cs new file mode 100644 index 0000000..b0d942b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/MessageHandler/VrsMsgParser.cs @@ -0,0 +1,115 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + /// + /// Parses out messages that go between the VRSUI and the Test Controller + /// This class is meant to be used by both the test controller and the VRSUI, so it parses out messages that target either of those systems + /// + internal class VrsMsgParser : IMsgParser + { + #region PrivateClassMembers + private List _messageList; + private AutomationMessageHeader _header; + #endregion + + #region PublicClassFunctions + + /// + /// The constructor + /// + public VrsMsgParser() + { + _messageList = new List(); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_CONNECT_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_CONNECT_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_RSP); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_DISCONNECT_CMD); + _messageList.Add((uint)VrsAutomationMsgIds.VRS_DISCONNECT_RSP); + + _header = new AutomationMessageHeader(); + } + + /// + /// Search the data buffer for the next valid message + /// + /// The data buffer to search + /// The number of bytes in pData + /// The number of bytes to remove from the buffer + /// the msg id that this function finds + /// The error that this functions finds + /// + public bool Run(IntPtr pData, uint numBytesInPdata, ref uint bytesToRemove, ref uint messageId, ref uint errorCode) + { + // default error code to 0. Not used in this parser + errorCode = 0; + + // check to see if we have enough data for at least a header + if (numBytesInPdata < AutomationMessageHeader.HEADER_EXPECTED_SIZE) + { + ErrorLogger.Instance().Write("VrsMsgParser::run() - not enough data in the buffer to form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes", ErrorLogger.LogLevel.INFO); + bytesToRemove = 0; + return false; + } + + // create and parse header + _header.Parse(pData); + + uint totalMsgSize = _header.GetEntireMsgLength(); + + // do we have this message in our messageSizeMap_ dictionary? + if (_messageList.Contains(_header.GetMessageId()) == false) + { + string msg = "VrsMsgParser::run() - unknown id received: " + Convert.ToString(_header.GetMessageId()); + ErrorLogger.Instance().Write(msg, ErrorLogger.LogLevel.ERROR); + bytesToRemove = totalMsgSize; // move on to next message + return false; + } + + // do we have enough data to make the complete message + if (numBytesInPdata < totalMsgSize) + { + // need to wait for more data + bytesToRemove = 0; + return false; + } + + // everything has checked out. + bytesToRemove = totalMsgSize; + messageId = _header.GetMessageId(); + return true; + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrShowLiveVideoCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrShowLiveVideoCmdMessage.cs new file mode 100644 index 0000000..8562e58 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrShowLiveVideoCmdMessage.cs @@ -0,0 +1,114 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// The message commands the vrs to display video on its UI + /// + internal class VrShowLiveVideoCmdMessage : AutomationMessage + { + /// + /// Copy constructor + /// + /// The object to copy + public VrShowLiveVideoCmdMessage(VrShowLiveVideoCmdMessage rhs) + : base(rhs) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + public VrShowLiveVideoCmdMessage() + : base((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_CMD, "VRS_SHOW_LIVE_VIDEO_CMD", 0) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override String ToString() + { + String msg = base.ToString(); + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrShowLiveVideoCmdMessage msg = new VrShowLiveVideoCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // nothing to format + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + // nothing to parse + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrShowLiveVideoRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrShowLiveVideoRspMessage.cs new file mode 100644 index 0000000..b333647 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrShowLiveVideoRspMessage.cs @@ -0,0 +1,155 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The response message from VrShowLiveVideoCmdMessage + /// + internal class VrShowLiveVideoRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_wasCommandSuccessful; + }; + + private Data m_dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrShowLiveVideoRspMessage(VrShowLiveVideoRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrShowLiveVideoRspMessage(bool wasCommandSuccessful) + : base((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_RSP, "VRS_SHOW_LIVE_VIDEO_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + try + { + if (wasCommandSuccessful == true) + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n"; + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrShowLiveVideoRspMessage msg = new VrShowLiveVideoRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful); + Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAddAttributesCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAddAttributesCmdMessage.cs new file mode 100644 index 0000000..3e9b790 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAddAttributesCmdMessage.cs @@ -0,0 +1,146 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// The message that commands the VRS to move a file + /// + internal class VrsAddAttributesCmdMessage : AutomationMessage + { + #region PrivateClassMembers + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint _videoFileNameStrLen; + public uint m_attributeFileStrLen; + }; + + private Data _dataStruct; + + private string _videoFileName; + private string _attributeFileName; + #endregion + + #region PrivateClassFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsAddAttributesCmdMessage msg = new VrsAddAttributesCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // put the struct to the ptr + Marshal.StructureToPtr(_dataStruct, pData, true); + pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))); + + byte[] videoFileNameBytes = Encoding.ASCII.GetBytes(_videoFileName); + Marshal.Copy(videoFileNameBytes, 0, pData, _videoFileName.Length); + pData = IntPtr.Add(pData, _videoFileName.Length); + + byte[] attributeFileNameBytes = Encoding.ASCII.GetBytes(_attributeFileName); + Marshal.Copy(attributeFileNameBytes, 0, pData, attributeFileNameBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + _dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))); + + byte[] videoFileNameArray = new byte[_dataStruct._videoFileNameStrLen]; + Marshal.Copy(pData, videoFileNameArray, 0, (int)_dataStruct._videoFileNameStrLen); + _videoFileName = Encoding.ASCII.GetString(videoFileNameArray); + pData = IntPtr.Add(pData, (int)_dataStruct._videoFileNameStrLen); + + byte[] attributeFileNameArray = new byte[_dataStruct.m_attributeFileStrLen]; + Marshal.Copy(pData, attributeFileNameArray, 0, (int)_dataStruct.m_attributeFileStrLen); + _attributeFileName = Encoding.ASCII.GetString(attributeFileNameArray); + } + #endregion + + #region PublicClassFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public VrsAddAttributesCmdMessage(VrsAddAttributesCmdMessage rhs) + : base(rhs) + { + _dataStruct = rhs._dataStruct; + _videoFileName = rhs._videoFileName; + _attributeFileName = rhs._attributeFileName; + } + + /// + /// The constructor for sending + /// + public VrsAddAttributesCmdMessage(string videoFile, string attributeFile) + : base((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_CMD, "VRS_ADD_ATTRIBUTES_CMD", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))) + (uint)videoFile.Length + (uint)attributeFile.Length) + { + _dataStruct._videoFileNameStrLen = (uint)videoFile.Length; + _videoFileName = videoFile; + + _dataStruct.m_attributeFileStrLen = (uint)attributeFile.Length; + _attributeFileName = attributeFile; + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + // no action to take + } + + /// + /// Convert this object into string form + /// + /// + public override String ToString() + { + string msg = base.ToString(); + msg += " videoFileNameStrLen: " + _dataStruct._videoFileNameStrLen + "\r\n"; + msg += " videoFileName: " + _videoFileName + "\r\n"; + msg += " attributeFileStrLen: " + _dataStruct.m_attributeFileStrLen + "\r\n"; + msg += " attributeFileName: " + _attributeFileName + "\r\n\r\n"; + return msg; + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAddAttributesRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAddAttributesRspMessage.cs new file mode 100644 index 0000000..1582a20 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAddAttributesRspMessage.cs @@ -0,0 +1,142 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The response message from the VRS upon receiving a VrsMoveFileCmdMessage + /// + internal class VrsAddAttributesRspMessage : AutomationMessage + { + #region PrivateClassMembers + private const uint COMMAND_WAS_SUCCESSFUL = 1; + private const uint COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_wasCommandSuccessful; + }; + + private Data _dataStruct; + #endregion + + #region PrivateClassFunctions + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsAddAttributesRspMessage msg = new VrsAddAttributesRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + byte[] successFlagBytes = BitConverter.GetBytes(_dataStruct.m_wasCommandSuccessful); + Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + _dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + #endregion + + #region PublicClassFunctions + + /// + /// Copy constructor + /// + /// The object to copy + public VrsAddAttributesRspMessage(VrsAddAttributesRspMessage rhs) + : base(rhs) + { + _dataStruct = rhs._dataStruct; + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrsAddAttributesRspMessage(bool wasCommandSuccessful) + : base((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_RSP, "VRS_ADD_ATTRIBUTES_RSP", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + if (wasCommandSuccessful == true) + { + _dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + _dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + // no action to take + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override string ToString() + { + string msg = base.ToString(); + msg += " wasCommandSuccessful: " + _dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n"; + + return msg; + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAutomationMessageIDs.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAutomationMessageIDs.cs new file mode 100644 index 0000000..6f7cc72 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsAutomationMessageIDs.cs @@ -0,0 +1,78 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +namespace Raytheon.Instruments +{ + /// + /// The IDs for messages that go between applications + /// + public enum VrsAutomationMsgIds : uint + { + //VRS commands + VRS_CONNECT_CMD = 0x00001001, + VRS_GRAB_VIDEO_TO_DISK_CMD = 0x00001002, + VRS_SHOW_LIVE_VIDEO_CMD = 0x00001003, + VRS_STOP_LIVE_VIDEO_CMD = 0x00001004, + VRS_MOVE_FILE_CMD = 0x00001005, + VRS_QUERY_HARD_DRIVE_CMD = 0x00001006, + VRS_ADD_ATTRIBUTES_CMD = 0x00001007, + VRS_DISCONNECT_CMD = 0x00001008, + + //VRS responses + VRS_CONNECT_RSP = 0x00002001, + VRS_GRAB_VIDEO_TO_DISK_RSP = 0x00002002, + VRS_SHOW_LIVE_VIDEO_RSP = 0x00002003, + VRS_STOP_LIVE_VIDEO_RSP = 0x00002004, + VRS_MOVE_FILE_RSP = 0x00002005, + VRS_QUERY_HARD_DRIVE_RSP = 0x00002006, + VRS_ADD_ATTRIBUTES_RSP = 0x00002007, + VRS_DISCONNECT_RSP = 0x00002008, + VRS_GRAB_TO_DISK_COMPLETE_RSP = 0x00002009, + + //NWL commands + NWL_CONNECT_CMD = 0x00003001, + NWL_READ_CMD = 0x00003002, + NWL_READ_DMA_CMD = 0x00003003, + NWL_READ_REG_CMD = 0x00003004, + NWL_WRITE_CMD = 0x00003005, + NWL_WRITE_DMA_CMD = 0x00003006, + NWL_WRITE_REG_CMD = 0x00003007, + NWL_START_SENSOR_READ_THREAD_CMD = 0x00003008, + NWL_STOP_SENSOR_READ_THREAD_CMD = 0x00003009, + NWL_START_IMU_READ_THREAD_CMD = 0x0000300A, + NWL_STOP_IMU_READ_THREAD_CMD = 0x0000300B, + NWL_DISCONNECT_CMD = 0x0000300C, + NWL_START_IMU_WRITE_THREAD_CMD = 0x0000300D, + NWL_STOP_IMU_WRITE_THREAD_CMD = 0x0000300E, + + //NWL responses + NWL_CONNECT_RSP = 0x00004001, + NWL_READ_RSP = 0x00004002, + NWL_READ_DMA_RSP = 0x00004003, + NWL_READ_REG_RSP = 0x00004004, + NWL_WRITE_RSP = 0x00004005, + NWL_WRITE_DMA_RSP = 0x00004006, + NWL_WRITE_REG_RSP = 0x00004007, + NWL_START_SENSOR_READ_THREAD_RSP = 0x00004008, + NWL_STOP_SENSOR_READ_THREAD_RSP = 0x00004009, + NWL_START_IMU_READ_THREAD_RSP = 0X0000400A, + NWL_STOP_IMU_READ_THREAD_RSP = 0X0000400B, + NWL_DISCONNECT_RSP = 0x0000400C, + NWL_START_IMU_WRITE_THREAD_RSP = 0x0000400D, + NWL_STOP_IMU_WRITE_THREAD_RSP = 0x0000400E + }; +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsConnectCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsConnectCmdMessage.cs new file mode 100644 index 0000000..0cefba3 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsConnectCmdMessage.cs @@ -0,0 +1,95 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// The message that targets the VRS to make a connection + /// + internal class VrsConnectCmdMessage : AutomationMessage + { + /// + /// Copy constructor + /// + /// The object to copy + public VrsConnectCmdMessage(VrsConnectCmdMessage rhs) + : base(rhs) + { + // no action to take + } + + /// + /// The constructor for sending + /// + public VrsConnectCmdMessage() + : base((uint)VrsAutomationMsgIds.VRS_CONNECT_CMD, "VRS_CONNECT_CMD", 0) + { + // no action to take + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + // no action to take + } + + /// + /// Convert this object into string form + /// + /// + public override string ToString() + { + string msg = base.ToString(); + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsConnectCmdMessage msg = new VrsConnectCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // nothing to format + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + // nothing to parse + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsConnectRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsConnectRspMessage.cs new file mode 100644 index 0000000..4412e38 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsConnectRspMessage.cs @@ -0,0 +1,141 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.InteropServices; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// The response message from the VRS upon receiving a VrsConnectCmdMessage + /// + internal class VrsConnectRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public uint m_wasCommandSuccessful; + }; + + private Data _dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsConnectRspMessage(VrsConnectRspMessage rhs) + : base(rhs) + { + _dataStruct = rhs._dataStruct; + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrsConnectRspMessage(bool wasCommandSuccessful) + : base((uint)VrsAutomationMsgIds.VRS_CONNECT_RSP, "VRS Connect Response Message", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + if (wasCommandSuccessful == true) + { + _dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + _dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override string ToString() + { + string msg = base.ToString(); + msg += " wasCommandSuccessful: " + _dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n"; + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsConnectRspMessage msg = new VrsConnectRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + byte[] successFlagBytes = BitConverter.GetBytes(_dataStruct.m_wasCommandSuccessful); + Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + _dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsDisconnectCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsDisconnectCmdMessage.cs new file mode 100644 index 0000000..2dbfd12 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsDisconnectCmdMessage.cs @@ -0,0 +1,114 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// The message that targets the VRS to disconnect + /// + internal class VrsDisconnectCmdMessage : AutomationMessage + { + /// + /// Copy constructor + /// + /// The object to copy + public VrsDisconnectCmdMessage(VrsDisconnectCmdMessage rhs) + : base(rhs) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + public VrsDisconnectCmdMessage() + : base((uint)VrsAutomationMsgIds.VRS_DISCONNECT_CMD, "VRS_DISCONNECT_CMD", 0) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override String ToString() + { + String msg = base.ToString(); + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsDisconnectCmdMessage msg = new VrsDisconnectCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // nothing to format + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + // nothing to parse + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsDisconnectRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsDisconnectRspMessage.cs new file mode 100644 index 0000000..7da9edb --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsDisconnectRspMessage.cs @@ -0,0 +1,155 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The response message from the VRS upon receiving a VrsDisconnectCmdMessage + /// + internal class VrsDisconnectRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_wasCommandSuccessful; + }; + + private Data m_dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsDisconnectRspMessage(VrsDisconnectRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrsDisconnectRspMessage(bool wasCommandSuccessful) + : base((uint)VrsAutomationMsgIds.VRS_DISCONNECT_RSP, "VRS_DISCONNECT_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + try + { + if (wasCommandSuccessful == true) + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n"; + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsDisconnectRspMessage msg = new VrsDisconnectRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful); + Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskCmdMessage.cs new file mode 100644 index 0000000..2aa7b83 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskCmdMessage.cs @@ -0,0 +1,163 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Instruments; +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The message that targets the VRS to save video to disk + /// + internal class VrsGrabToDiskCmdMessage : AutomationMessage + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_numberOfFrames; + public UInt32 m_fileFormat; + }; + + private Data m_dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsGrabToDiskCmdMessage(VrsGrabToDiskCmdMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// The number of frames to send + /// The resulting file format + public VrsGrabToDiskCmdMessage(uint numberOfFrames, VideoSaveFormat format) + : base((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_CMD, "VRS_GRAB_VIDEO_TO_DISK_CMD", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + try + { + m_dataStruct.m_numberOfFrames = numberOfFrames; + + if (format == VideoSaveFormat.BIN) + { + m_dataStruct.m_fileFormat = 0; + } + else if (format == VideoSaveFormat.NCDF) + { + m_dataStruct.m_fileFormat = 1; + } + else + { + throw new Exception("Unsupported format: " + format.ToString()); + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// return the file format + /// + /// + public UInt32 GetFileFormat() + { + return m_dataStruct.m_fileFormat; + } + + /// + /// getter for the number of frames + /// + /// The number of frames + public UInt32 GetNumberOfFrames() + { + return m_dataStruct.m_numberOfFrames; + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + + msg += " numberOfFrames: " + m_dataStruct.m_numberOfFrames.ToString() + "\r\n"; + msg += " file format: " + m_dataStruct.m_fileFormat.ToString() + "\r\n\r\n"; + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsGrabToDiskCmdMessage msg = new VrsGrabToDiskCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // put the struct to the ptr + Marshal.StructureToPtr(m_dataStruct, pData, true); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskCompleteRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskCompleteRspMessage.cs new file mode 100644 index 0000000..a3d121b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskCompleteRspMessage.cs @@ -0,0 +1,173 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// The response message from the VRS upon receiving a completing saving video to disk + /// + internal class VrsGrabToDiskCompleteRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_wasCommandSuccessful; + public UInt32 m_fileNameLen; + }; + + private Data m_dataStruct; + + private String m_fileName; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsGrabToDiskCompleteRspMessage(VrsGrabToDiskCompleteRspMessage rhs) + : base(rhs) + { + m_dataStruct = rhs.m_dataStruct; + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrsGrabToDiskCompleteRspMessage(bool wasCommandSuccessful, String fileName) + : base((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP, "VRS Grab To Disk Complete Response Message", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))) + (uint)fileName.Length) + { + try + { + if (wasCommandSuccessful == true) + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + + m_dataStruct.m_fileNameLen = (uint)fileName.Length; + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + public String GetFileName() + { + return m_fileName; + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n"; + msg += " fileNameLen: " + m_dataStruct.m_fileNameLen.ToString() + "\r\n"; + msg += " filename: " + m_fileName + "\r\n\r\n"; + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsGrabToDiskCompleteRspMessage msg = new VrsGrabToDiskCompleteRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful); + Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length); + pData = IntPtr.Add(pData, successFlagBytes.Length); + + byte[] fileNameLenBytes = BitConverter.GetBytes(m_dataStruct.m_fileNameLen); + Marshal.Copy(successFlagBytes, 0, pData, fileNameLenBytes.Length); + pData = IntPtr.Add(pData, fileNameLenBytes.Length); + + byte[] fileNameBytes = Encoding.ASCII.GetBytes(m_fileName); + Marshal.Copy(fileNameBytes, 0, pData, m_fileName.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))); + + byte[] fileNameArray = new byte[m_dataStruct.m_fileNameLen]; + Marshal.Copy(pData, fileNameArray, 0, (int)m_dataStruct.m_fileNameLen); + m_fileName = Encoding.ASCII.GetString(fileNameArray); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskRspMessage.cs new file mode 100644 index 0000000..5aee4ec --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsGrabToDiskRspMessage.cs @@ -0,0 +1,154 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The response message from the VRS upon receiving a VrsGrabToDiskCmdMessage + /// + internal class VrsGrabToDiskRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_wasCommandSuccessful; + }; + + private Data m_dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsGrabToDiskRspMessage(VrsGrabToDiskRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrsGrabToDiskRspMessage(bool wasCommandSuccessful): + base((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_RSP, "VRS_GRAB_VIDEO_TO_DISK_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + try + { + if (wasCommandSuccessful == true) + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n"; + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsGrabToDiskRspMessage msg = new VrsGrabToDiskRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + Marshal.StructureToPtr(m_dataStruct.m_wasCommandSuccessful, pData, true); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsMoveFileCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsMoveFileCmdMessage.cs new file mode 100644 index 0000000..73be788 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsMoveFileCmdMessage.cs @@ -0,0 +1,159 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Instruments; +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Raytheon.Instruments +{ + /// + /// The message that commands the VRS to move a file + /// + internal class VrsMoveFileCmdMessage : AutomationMessage + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_fromStrLen; + public UInt32 m_toStrLen; + public UInt32 m_copyControl; + }; + + private Data m_dataStruct; + + private String m_fromFileName; + private String m_toFileName; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsMoveFileCmdMessage(VrsMoveFileCmdMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + m_fromFileName = rhs.m_fromFileName; + m_toFileName = rhs.m_toFileName; + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + /// + /// + public VrsMoveFileCmdMessage(string fromFileName, string toFileName, MoveControl control) + : base((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_CMD, "VRS_MOVE_FILE_CMD", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))) + (uint)fromFileName.Length + (uint)toFileName.Length) + { + m_dataStruct.m_fromStrLen = (uint)fromFileName.Length; + m_fromFileName = fromFileName; + + m_dataStruct.m_toStrLen = (uint)toFileName.Length; + m_toFileName = toFileName; + + m_dataStruct.m_copyControl = (uint)control; + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override String ToString() + { + String msg = base.ToString(); + msg += " fromLen: " + m_dataStruct.m_fromStrLen + "\r\n"; + msg += " from: " + m_fromFileName + "\r\n"; + msg += " toLen: " + m_dataStruct.m_toStrLen + "\r\n"; + msg += " to: " + m_toFileName + "\r\n"; + msg += " control: " + m_dataStruct.m_copyControl + "\r\n\r\n"; + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsMoveFileCmdMessage msg = new VrsMoveFileCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // put the struct to the ptr + Marshal.StructureToPtr(m_dataStruct, pData, true); + pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))); + + byte[] fromFileNameBytes = Encoding.ASCII.GetBytes(m_fromFileName); + Marshal.Copy(fromFileNameBytes, 0, pData, m_fromFileName.Length); + pData = IntPtr.Add(pData, m_fromFileName.Length); + + byte[] toFileNameBytes = Encoding.ASCII.GetBytes(m_toFileName); + Marshal.Copy(toFileNameBytes, 0, pData, toFileNameBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))); + + byte[] fromFileNameArray = new byte[m_dataStruct.m_fromStrLen]; + Marshal.Copy(pData, fromFileNameArray, 0, (int)m_dataStruct.m_fromStrLen); + m_fromFileName = Encoding.ASCII.GetString(fromFileNameArray); + pData = IntPtr.Add(pData, (int)m_dataStruct.m_fromStrLen); + + byte[] toFileNameArray = new byte[m_dataStruct.m_toStrLen]; + Marshal.Copy(pData, toFileNameArray, 0, (int)m_dataStruct.m_toStrLen); + m_toFileName = Encoding.ASCII.GetString(toFileNameArray); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsMoveFileRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsMoveFileRspMessage.cs new file mode 100644 index 0000000..c59e955 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsMoveFileRspMessage.cs @@ -0,0 +1,155 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The response message from the VRS upon receiving a VrsMoveFileCmdMessage + /// + internal class VrsMoveFileRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_wasCommandSuccessful; + }; + + private Data m_dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsMoveFileRspMessage(VrsMoveFileRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrsMoveFileRspMessage(bool wasCommandSuccessful) + : base((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_RSP, "VRS_MOVE_FILE_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + try + { + if (wasCommandSuccessful == true) + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n"; + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsMoveFileRspMessage msg = new VrsMoveFileRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful); + Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsQueryHardDriveCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsQueryHardDriveCmdMessage.cs new file mode 100644 index 0000000..8cef3aa --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsQueryHardDriveCmdMessage.cs @@ -0,0 +1,114 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// The message that commands the VRS to return the GBs free on each of its drives + /// + internal class VrsQueryHardDriveCmdMessage : AutomationMessage + { + /// + /// Copy constructor + /// + /// The object to copy + public VrsQueryHardDriveCmdMessage(VrsQueryHardDriveCmdMessage rhs) + : base(rhs) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + public VrsQueryHardDriveCmdMessage() + : base((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_CMD, "VRS_QUERY_HARD_DRIVE_CMD", 0) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override String ToString() + { + String msg = base.ToString(); + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsQueryHardDriveCmdMessage msg = new VrsQueryHardDriveCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // nothing to format + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + // nothing to parse + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsQueryHardDriveRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsQueryHardDriveRspMessage.cs new file mode 100644 index 0000000..0f2f68c --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsQueryHardDriveRspMessage.cs @@ -0,0 +1,176 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The response message from VrsQueryHardDriveCmdMessage + /// + internal class VrsQueryHardDriveRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_wasCommandSuccessful; + public float m_drive1Space; + public float m_drive2Space; + public float m_drive3Space; + public float m_drive4Space; + }; + + private Data m_dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrsQueryHardDriveRspMessage(VrsQueryHardDriveRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrsQueryHardDriveRspMessage(bool wasCommandSuccessful, float drive1Space, float drive2Space, float drive3Space, float drive4Space) + : base((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_RSP, "VRS_QUERY_HARD_DRIVE_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + try + { + if (wasCommandSuccessful == true) + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// GEtter for the freee drive space + /// + /// GBs free for drive 1 + /// GBs free for drive 2 + /// GBs free for drive 3 + /// GBs free for drive 4 + public void GetDriveSpace(ref float drive1Space, ref float drive2Space, ref float drive3Space, ref float drive4Space) + { + drive1Space = m_dataStruct.m_drive1Space; + drive2Space = m_dataStruct.m_drive2Space; + drive3Space = m_dataStruct.m_drive3Space; + drive4Space = m_dataStruct.m_drive4Space; + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n"; + msg += " drive1space: " + m_dataStruct.m_drive1Space.ToString() + "\r\n"; + msg += " drive2space: " + m_dataStruct.m_drive2Space.ToString() + "\r\n"; + msg += " drive3space: " + m_dataStruct.m_drive3Space.ToString() + "\r\n"; + msg += " drive4space: " + m_dataStruct.m_drive4Space.ToString() + "\r\n\r\n"; + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrsQueryHardDriveRspMessage msg = new VrsQueryHardDriveRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // put the struct to the ptr + Marshal.StructureToPtr(m_dataStruct, pData, true); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsStopLiveVideoCmdMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsStopLiveVideoCmdMessage.cs new file mode 100644 index 0000000..8b7939f --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsStopLiveVideoCmdMessage.cs @@ -0,0 +1,114 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace Raytheon.Instruments +{ + /// + /// The message commands the VRS to stop showing video on its UI + /// + internal class VrStopLiveVideoCmdMessage : AutomationMessage + { + /// + /// Copy constructor + /// + /// The object to copy + public VrStopLiveVideoCmdMessage(VrStopLiveVideoCmdMessage rhs) + : base(rhs) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + public VrStopLiveVideoCmdMessage() + : base((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_CMD, "VRS_STOP_LIVE_VIDEO_CMD", 0) + { + try + { + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// Convert this object into string form + /// + /// + public override String ToString() + { + String msg = base.ToString(); + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrStopLiveVideoCmdMessage msg = new VrStopLiveVideoCmdMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // nothing to format + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + // nothing to parse + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsStopLiveVideoRspMessage.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsStopLiveVideoRspMessage.cs new file mode 100644 index 0000000..e9a860e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/Messages/VrsStopLiveVideoRspMessage.cs @@ -0,0 +1,155 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; + +namespace Raytheon.Instruments +{ + /// + /// The response message from VrStopLiveVideoCmdMessage + /// + internal class VrStopLiveVideoRspMessage : AutomationMessage + { + private const UInt32 COMMAND_WAS_SUCCESSFUL = 1; + private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct Data + { + public UInt32 m_wasCommandSuccessful; + }; + + private Data m_dataStruct; + + /// + /// Copy constructor + /// + /// The object to copy + public VrStopLiveVideoRspMessage(VrStopLiveVideoRspMessage rhs) + : base(rhs) + { + try + { + m_dataStruct = rhs.m_dataStruct; + } + catch (Exception) + { + throw; + } + } + + /// + /// The constructor for sending + /// + /// flag for if the command was successful + public VrStopLiveVideoRspMessage(bool wasCommandSuccessful) + : base((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_RSP, "VRS_STOP_LIVE_VIDEO_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data)))) + { + try + { + if (wasCommandSuccessful == true) + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL; + } + else + { + m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL; + } + } + catch (Exception) + { + throw; + } + } + + /// + /// Perform the action associated with this message + /// + public override void ExecuteMsg() + { + try + { + // no action to take + } + catch (Exception) + { + throw; + } + } + + /// + /// getter + /// + /// The success flag from the execution of the command + public bool GetSuccessfulFlag() + { + if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL) + { + return true; + } + else + { + return false; + } + } + + /// + /// Convert this object into string form + /// + /// The string form of this object + public override String ToString() + { + String msg = base.ToString(); + msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n"; + + return msg; + } + + /// + /// Create a copy of this object + /// + /// A copy of this object + protected override object CloneSelf() + { + VrStopLiveVideoRspMessage msg = new VrStopLiveVideoRspMessage(this); + + return msg; + } + + /// + /// Encode the message into a byte array for sending. + /// + /// The buffer to put the message items + protected override void FormatData(IntPtr pData) + { + // copy data from our structure, info the buffer + byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful); + Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length); + } + + /// + /// Takes an array of bytes and populates the message object + /// + /// The message in byte form + protected override void ParseData(IntPtr pData) + { + m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data)); + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClient.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClient.cs new file mode 100644 index 0000000..e1460d0 --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClient.cs @@ -0,0 +1,518 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + + +// Ignore Spelling: Ncdf + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + /// + /// The interface for the test controller to automate the VRS system + /// + public class VideoRecorderVrsClient : IVideoRecorder + { + #region PrivateClassMembers + private readonly string _remoteAddress; + private readonly int _remotePort; + private readonly int _localPort; + private readonly CommDeviceNode _udpNode; + private readonly ICommDevice _commDevice; + private readonly uint _parseBufferSize; + private static readonly object _syncObj = new Object(); + /// + /// NLog logger + /// + private readonly ILogger _logger; + /// + /// Raytheon configuration + /// + private readonly IConfigurationManager _configurationManager; + private readonly IConfiguration _configuration; + + public string DetailedStatus => throw new NotImplementedException(); + + public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public InstrumentMetadata Info => throw new NotImplementedException(); + + public string Name { get; set; } + + public SelfTestResult SelfTestResult => throw new NotImplementedException(); + + public State Status => throw new NotImplementedException(); + #endregion + + #region PrivateClassFunctions + + /// + /// The Finalizer + /// + ~VideoRecorderVrsClient() + { + Dispose(false); + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + Disconnect(); + _commDevice.Shutdown(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + + try + { + if (disposing) + { + _udpNode.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicClassFunctions + + /// + /// The constructor + /// + /// The remote computer address + /// The remote computer port + /// the local computer port + /// the parse buffer size in bytes + public VideoRecorderVrsClient(string remoteAddress, int remotePort, int localPort, uint parseBufferSize) + { + _logger = LogManager.GetCurrentClassLogger(); + + // init error logger singleton + ErrorLogger.Instance().Write("beginning", ErrorLogger.LogLevel.INFO); + + _remoteAddress = remoteAddress; + + _remotePort = remotePort; + + _localPort = localPort; + + _parseBufferSize = parseBufferSize; + + List msgIds = new List(); + + foreach (uint id in Enum.GetValues(typeof(VrsAutomationMsgIds))) + { + msgIds.Add(id); + } + + AutomationRxMsgBuffer.Instance(msgIds); + + VrsClientMsgHandler msghandler = new VrsClientMsgHandler(_parseBufferSize); + + _commDevice = new CommDeviceUdp("CommDeviceUdp", _localPort, _remotePort, _remoteAddress); + + _udpNode = new CommDeviceNode("CommDeviceNode", _commDevice, msghandler); + + msghandler.SetCommInterface(_udpNode); + } + + /// + /// updated constructor + /// + /// + /// + /// + public VideoRecorderVrsClient(string name, IConfigurationManager configurationManager, ILogger logger) + { + Name = name; + _logger = logger; + + _configurationManager = configurationManager; + _configuration = _configurationManager.GetConfiguration(Name); + + _remoteAddress = _configuration.GetConfigurationValue("VideoRecorderVrsClient", "RemoteAddress", "127.0.0.1"); + _remotePort = _configuration.GetConfigurationValue("VideoRecorderVrsClient", "RemotePort", 0); + _localPort = _configuration.GetConfigurationValue("VideoRecorderVrsClient", "LocalPort", 0); + _parseBufferSize = _configuration.GetConfigurationValue("VideoRecorderVrsClient", "LocalPort", 1024); + + List msgIds = new List(); + foreach (uint id in Enum.GetValues(typeof(VrsAutomationMsgIds))) + { + msgIds.Add(id); + } + + AutomationRxMsgBuffer.Instance(msgIds); + + VrsClientMsgHandler msghandler = new VrsClientMsgHandler(_parseBufferSize); + + _commDevice = new CommDeviceUdp("CommDeviceUdp", _localPort, _remotePort, _remoteAddress); + _udpNode = new CommDeviceNode("CommDeviceNode", _commDevice, msghandler); + + msghandler.SetCommInterface(_udpNode); + } + + /// + /// Send a message to the VRS and command it to add ncdf attributes to a video file + /// + /// The video file to add attributes to + /// The attribute file + public void AddNcdfAttributes(string videoFile, string attributeFile) + { + lock (_syncObj) + { + AutomationMessage addAttributesMsg = new VrsAddAttributesCmdMessage(videoFile, attributeFile); + + AutomationMessage addAttributesRspMsg = new VrsAddAttributesRspMessage(false); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, addAttributesMsg, ref addAttributesRspMsg); + + VrsAddAttributesRspMessage tempRsp = (VrsAddAttributesRspMessage)addAttributesRspMsg; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrsAddAttributesRspMessage returned a successful flag of false"); + } + } + } + + /// + /// Connect to the VRS system + /// + public void Connect() + { + lock (_syncObj) + { + // send the vrs a message just to make sure the two apps are talking + AutomationMessage connectMsg = new VrsConnectCmdMessage(); + + AutomationMessage connectRspMsg = new VrsConnectRspMessage(false); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, connectMsg, ref connectRspMsg); + + VrsConnectRspMessage tempRsp = (VrsConnectRspMessage)connectRspMsg; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrsConnectRspMessage returned a successful flag of false"); + } + } + } + + /// + /// Disconnect from the VRS + /// + public void Disconnect() + { + lock (_syncObj) + { + // send the vrs a message just to make sure the two apps are talking + AutomationMessage disconnectMsg = new VrsDisconnectCmdMessage(); + + AutomationMessage disconnectRspMsg = new VrsDisconnectRspMessage(false); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, disconnectMsg, ref disconnectRspMsg); + + VrsDisconnectRspMessage tempRsp = (VrsDisconnectRspMessage)disconnectRspMsg; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrsDisconnectRspMessage returned a successful flag of false"); + } + } + } + + /// + /// Dispose of this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// record video to the VRS hard drive. This function returns once the grab has begun, Use WaitForGrabToComplete() to know when the grab is completed + /// + /// The number of frames to grab + /// The save file format + public void GrabVideoToDisk(uint numberOfFrames, VideoSaveFormat format) + { + const int RSP_TIMEOUT = 20000; + + lock (_syncObj) + { + //reset the event for WaitForGrabComplete + AutomationRxMsgBuffer.Instance().ResetRxEvent((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP); + + // send the vrs a message just to make sure the two apps are talking + AutomationMessage grabCmd = new VrsGrabToDiskCmdMessage(numberOfFrames, format); + + AutomationMessage grabRsp = new VrsGrabToDiskRspMessage(false); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, grabCmd, ref grabRsp, RSP_TIMEOUT); + + VrsGrabToDiskRspMessage tempRsp = (VrsGrabToDiskRspMessage)grabRsp; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrsGrabToDiskRspMessage returned a successful flag of false"); + } + } + } + + /// + /// Get the number of GB free on the VRS system. + /// + /// Drive 1 free space in GBs + /// Drive 2 free space in GBs + /// Drive 3 free space in GBs + /// Drive 4 free space in GBs + public void QueryHardDrive(ref float driveSpace1, ref float driveSpace2, ref float driveSpace3, ref float driveSpace4) + { + lock (_syncObj) + { + // send the vrs a message just to make sure the two apps are talking + AutomationMessage msg = new VrsQueryHardDriveCmdMessage(); + + AutomationMessage rsp = new VrsQueryHardDriveRspMessage(false, 0, 0, 0, 0); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, msg, ref rsp); + + VrsQueryHardDriveRspMessage tempRsp = (VrsQueryHardDriveRspMessage)rsp; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrsQueryHardDriveRspMessage returned a successful flag of false"); + } + + tempRsp.GetDriveSpace(ref driveSpace1, ref driveSpace2, ref driveSpace3, ref driveSpace4); + } + } + + /// + /// Moves a file from one location to another + /// + /// + /// + /// + public void MoveFile(string fromFile, string toFile, MoveControl control) + { + lock (_syncObj) + { + // send the vrs a message just to make sure the two apps are talking + AutomationMessage cmd = new VrsMoveFileCmdMessage(fromFile, toFile, control); + + AutomationMessage rsp = new VrsMoveFileRspMessage(false); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, cmd, ref rsp); + + VrsMoveFileRspMessage tempRsp = (VrsMoveFileRspMessage)rsp; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrsMoveFileRspMessage returned a successful flag of false"); + } + } + } + + /// + /// Start displaying live video on the VRS + /// + public void ShowLiveVideo() + { + lock (_syncObj) + { + // send the vrs a message just to make sure the two apps are talking + AutomationMessage cmd = new VrShowLiveVideoCmdMessage(); + + AutomationMessage rsp = new VrShowLiveVideoRspMessage(false); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, cmd, ref rsp); + + VrShowLiveVideoRspMessage tempRsp = (VrShowLiveVideoRspMessage)rsp; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrShowLiveVideoRspMessage returned a successful flag of false"); + } + } + } + + /// + /// Stop displaying video on the VRS + /// + public void StopLiveVideo() + { + lock (_syncObj) + { + // send the vrs a message just to make sure the two apps are talking + AutomationMessage cmd = new VrStopLiveVideoCmdMessage(); + + AutomationMessage rsp = new VrStopLiveVideoRspMessage(false); + + CommUtil.Instance().SendCommandGetResponse(_udpNode, cmd, ref rsp); + + VrStopLiveVideoRspMessage tempRsp = (VrStopLiveVideoRspMessage)rsp; + + bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag(); + + ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO); + + if (wasConnectMsgSuccessful == false) + { + throw new Exception("VrStopLiveVideoRspMessage returned a successful flag of false"); + } + } + } + + /// + /// A blocking function that waits for a video capture to complete + /// + /// + /// + public string WaitForGrabToComplete(int timeoutms) + { + lock (_syncObj) + { + bool didWeGetRsp = AutomationRxMsgBuffer.Instance().WaitForRspMsg((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP, timeoutms); + + if (didWeGetRsp == true) + { + VrsGrabToDiskCompleteRspMessage rsp = (VrsGrabToDiskCompleteRspMessage)AutomationRxMsgBuffer.Instance().GetNewestMessage((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP); + + return rsp.GetFileName(); + } + else + { + throw new Exception("Timed out waiting for response"); + } + } + } + + public bool ClearErrors() + { + return false; + } + + public void Initialize() + { + throw new NotImplementedException(); + } + + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// + /// + public void Reset() + { + Disconnect(); + + Connect(); + } + + /// + /// + /// + /// + public void Shutdown() + { + Dispose(true); + } + + public byte[] GetSmallVideoFrame(string name, int nFrames, bool sensor, ref uint numBytesRead, bool deleteVideoFile) + { + throw new NotImplementedException(); + } + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClient.csproj b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClient.csproj new file mode 100644 index 0000000..b1a240e --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClient.csproj @@ -0,0 +1,35 @@ + + + + net472 + Raytheon.Instruments.VideoRecorderVrsClient + Video Recorder Vrs Client implementation + Video Recorder Vrs Client implementation + Library + + + + 1.0.0 + true + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClientFactory.cs b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClientFactory.cs new file mode 100644 index 0000000..e3ba77b --- /dev/null +++ b/Source/TSRealLib/HAL/Implementations/VideoRecorder/VideoRecorderVrsClient/VideoRecorderVrsClientFactory.cs @@ -0,0 +1,140 @@ +// ********************************************************************************************************** +// VideoRecorderSimFactory.cs +// 2/20/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.IO; +using System.Reflection; + +namespace Raytheon.Instruments +{ + [ExportInstrumentFactory(ModelNumber = "VideoRecorderVrsClientFactory")] + public class VideoRecorderVrsClientFactory : IInstrumentFactory + { + /// + /// The supported interfaces + /// + private readonly List _supportedInterfaces = new List(); + private ILogger _logger; + private readonly IConfigurationManager _configurationManager; + private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService"; + private static string DefaultPath; + + public VideoRecorderVrsClientFactory(string defaultConfigPath = DefaultConfigPath) + : this(null, defaultConfigPath) + { + } + + /// + /// COECommDeviceInstrumentFactory injection constructor + /// + /// + /// + /// + [ImportingConstructor] + public VideoRecorderVrsClientFactory([Import(AllowDefault = false)] IConfigurationManager configManager, + [Import(AllowDefault = true)] string defaultConfigPath = null) + { + DefaultPath = defaultConfigPath; + + if (LogManager.Configuration == null) + { + var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config"); + } + + _configurationManager = configManager ?? GetConfigurationManager(); + _supportedInterfaces.Add(typeof(ICommDevice)); + } + /// + /// Gets the instrument + /// + /// + /// + public IInstrument GetInstrument(string name) + { + try + { + _logger = LogManager.GetLogger(name); + return new VideoRecorderVrsClient(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets the instrument + /// + /// + /// + public object GetInstrument(string name, bool simulateHw) + { + try + { + _logger = LogManager.GetLogger(name); + + if (simulateHw) + return new VideoRecorderSim(name, _configurationManager, _logger); + else + return new VideoRecorderVrsClient(name, _configurationManager, _logger); + } + catch (Exception) + { + throw; + } + } + + /// + /// Gets supported interfaces + /// + /// + public ICollection GetSupportedInterfaces() + { + return _supportedInterfaces.ToArray(); + } + + /// + /// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService + /// + /// + private static IConfigurationManager GetConfigurationManager() + { + return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath); + } + } +} diff --git a/Source/Interfaces/IInstrument/GlobalSuppressions.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/GlobalSuppressions.cs similarity index 100% rename from Source/Interfaces/IInstrument/GlobalSuppressions.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/GlobalSuppressions.cs diff --git a/Source/Interfaces/IInstrument/IInstrument.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrument.cs similarity index 100% rename from Source/Interfaces/IInstrument/IInstrument.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrument.cs diff --git a/Source/Interfaces/IInstrument/IInstrumentFactory.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrumentFactory.cs similarity index 100% rename from Source/Interfaces/IInstrument/IInstrumentFactory.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrumentFactory.cs diff --git a/Source/Interfaces/IInstrument/IInstrumentFactoryInfo.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrumentFactoryInfo.cs similarity index 100% rename from Source/Interfaces/IInstrument/IInstrumentFactoryInfo.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrumentFactoryInfo.cs diff --git a/Source/Interfaces/IInstrument/IInstrumentProxyFactory.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrumentProxyFactory.cs similarity index 100% rename from Source/Interfaces/IInstrument/IInstrumentProxyFactory.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/IInstrumentProxyFactory.cs diff --git a/Source/Interfaces/IInstrument/Instrument.Contracts.cd b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/Instrument.Contracts.cd similarity index 100% rename from Source/Interfaces/IInstrument/Instrument.Contracts.cd rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/Instrument.Contracts.cd diff --git a/Source/Interfaces/IInstrument/Instrument.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/Instrument.cs similarity index 100% rename from Source/Interfaces/IInstrument/Instrument.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/Instrument.cs diff --git a/Source/Interfaces/IInstrument/InstrumentException.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentException.cs similarity index 100% rename from Source/Interfaces/IInstrument/InstrumentException.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentException.cs diff --git a/Source/Interfaces/IInstrument/InstrumentFactory.Metadata.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentFactory.Metadata.cs similarity index 100% rename from Source/Interfaces/IInstrument/InstrumentFactory.Metadata.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentFactory.Metadata.cs diff --git a/Source/Interfaces/IInstrument/InstrumentMetadata.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentMetadata.cs similarity index 100% rename from Source/Interfaces/IInstrument/InstrumentMetadata.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentMetadata.cs diff --git a/Source/Interfaces/IInstrument/InstrumentProxyFactory.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentProxyFactory.cs similarity index 100% rename from Source/Interfaces/IInstrument/InstrumentProxyFactory.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/InstrumentProxyFactory.cs diff --git a/Source/Interfaces/IInstrument/Instruments.Contracts.csproj b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/Instruments.Contracts.csproj similarity index 52% rename from Source/Interfaces/IInstrument/Instruments.Contracts.csproj rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/Instruments.Contracts.csproj index 8f41ca7..977928b 100644 --- a/Source/Interfaces/IInstrument/Instruments.Contracts.csproj +++ b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/Instruments.Contracts.csproj @@ -1,25 +1,21 @@  - + net472 Library Raytheon.Instruments.Contracts - Raytheon.Instruments - Raytheon Technologies Raytheon Configuration Base Instrument interface and export attribute - TEEC - Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy")) - True - 1.5.0.0 - Debug;Release;Deploy + + + 1.6.0.0 - - - + + + \ No newline at end of file diff --git a/Source/Interfaces/IInstrument/SelfTestResult.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/SelfTestResult.cs similarity index 100% rename from Source/Interfaces/IInstrument/SelfTestResult.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/SelfTestResult.cs diff --git a/Source/Interfaces/IInstrument/State.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrument/State.cs similarity index 100% rename from Source/Interfaces/IInstrument/State.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrument/State.cs diff --git a/Source/Interfaces/IInstrumentManager/GlobalSuppressions.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrumentManager/GlobalSuppressions.cs similarity index 100% rename from Source/Interfaces/IInstrumentManager/GlobalSuppressions.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrumentManager/GlobalSuppressions.cs diff --git a/Source/Interfaces/IInstrumentManager/IInstrumentManager.cs b/Source/TSRealLib/HAL/Interfaces/Common/IInstrumentManager/IInstrumentManager.cs similarity index 100% rename from Source/Interfaces/IInstrumentManager/IInstrumentManager.cs rename to Source/TSRealLib/HAL/Interfaces/Common/IInstrumentManager/IInstrumentManager.cs diff --git a/Source/TSRealLib/HAL/Interfaces/Common/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj b/Source/TSRealLib/HAL/Interfaces/Common/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj new file mode 100644 index 0000000..c360701 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/Common/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj @@ -0,0 +1,19 @@ + + + + net472 + Library + Raytheon.Instruments.InstrumentManager.Contracts + Raytheon Configuration + Instrument Manager Interface + + + + 1.8.0.0 + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IBit/BitTestResult.cs b/Source/TSRealLib/HAL/Interfaces/IBit/BitTestResult.cs new file mode 100644 index 0000000..b021f84 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IBit/BitTestResult.cs @@ -0,0 +1,133 @@ +// ********************************************************************************************************** +// BitTestResult.cs +// 6/21/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using System.Runtime.Serialization; +using System; + +namespace Raytheon.Instruments +{ + [Serializable] + [DataContract] + public class BitTestResult + { + [DataMember] + public string FieldArrayValue { get; set; } + + [DataMember] + public string FieldBitValue { get; set; } + + [DataMember] + public string FieldDefaultValue { get; set; } + + [DataMember] + public string FieldInstruType { get; set; } + + [DataMember] + public string FieldMaxValue { get; set; } + + [DataMember] + public string FieldMinValue { get; set; } + + [DataMember] + public string FieldName { get; set; } + + [DataMember] + public string FieldType { get; set; } + + [DataMember] + public string FieldValue { get; set; } + + [DataMember] + public string Variable { get; set; } + + [DataMember] + public string MaxOffset { get; set; } + + [DataMember] + public string MinOffset { get; set; } + + [DataMember] + public string VerifyType { get; set; } + + [DataMember] + public bool IsSelected { get; set; } + + [DataMember] + public bool IsArray { get; set; } + + [DataMember] + public bool IsStructure { get; set; } + + [DataMember] + public bool IsArrayOfStructures { get; set; } + + [DataMember] + public bool IsEnum { get; set; } + + [DataMember] + public bool UsesRegister { get; set; } + + [DataMember] + public bool IsValid { get; set; } + + [DataMember] + public bool UseRange { get; set; } + + [DataMember] + public int ArrayLength { get; set; } + + [DataMember] + public uint ImageWidth { get; set; } + + [DataMember] + public uint ImageHeight { get; set; } + + [DataMember] + public uint ImagePixelSize { get; set; } + + [DataMember] + public ulong BitMask { get; set; } + + [DataMember] + public bool Expanded { get; set; } + + [DataMember] + public int Depth { get; set; } + + [DataMember] + public byte[ ] ImageBuffer { get; set; } + + [DataMember] + public uint ImageBufferSize { get; set; } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IBit/BitTestResults.cs b/Source/TSRealLib/HAL/Interfaces/IBit/BitTestResults.cs new file mode 100644 index 0000000..44f9d7d --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IBit/BitTestResults.cs @@ -0,0 +1,62 @@ +// ********************************************************************************************************** +// BitTestResults.cs +// 6/30/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + [Serializable] + [DataContract] + public class BitTestResults + { + [DataMember] + public string Name { get; set; } + + [DataMember] + public string Label { get; set; } + + [DataMember] + public DateTime Time { get; set; } + + [DataMember] + public IList Results { get; set; } + + public BitTestResult GetResult( string fieldName ) + { + return Results.FirstOrDefault( f => f.FieldName == fieldName ); + } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitNotConnectedException.cs b/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitNotConnectedException.cs new file mode 100644 index 0000000..c1f46df --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitNotConnectedException.cs @@ -0,0 +1,54 @@ +// ********************************************************************************************************** +// BitNotConnectedException.cs +// 7/21/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Instruments.Exceptions +{ + public class BitNotConnectedException : Exception + { + public BitNotConnectedException() + : base("BIT Not Connected, please check your settings") + { + } + + public BitNotConnectedException(string message) + : base($"BIT Not Connected, {message}") + { + } + + public BitNotConnectedException(string message, Exception innerException) + : base($"BIT Not Connected, {message}", innerException) + { + } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitParseException.cs b/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitParseException.cs new file mode 100644 index 0000000..8e131c0 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitParseException.cs @@ -0,0 +1,54 @@ +// ********************************************************************************************************** +// BitParseException.cs +// 7/21/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Instruments.Exceptions +{ + public class BitParseException : Exception + { + public BitParseException() + : base("BIT Message Parsing Error, please check your settings") + { + } + + public BitParseException(string message) + : base($"BIT Message Parsing Error, {message}") + { + } + + public BitParseException(string message, Exception innerException) + : base($"BIT Message Parsing Error, {message}", innerException) + { + } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitTimeoutException.cs b/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitTimeoutException.cs new file mode 100644 index 0000000..10efd77 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IBit/Exceptions/BitTimeoutException.cs @@ -0,0 +1,54 @@ +// ********************************************************************************************************** +// BitTimeoutException.cs +// 7/21/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using System; + +namespace Raytheon.Instruments.Exceptions +{ + public class BitTimeoutException : Exception + { + public BitTimeoutException() + : base("BIT Timed Out, please check your settings") + { + } + + public BitTimeoutException(string message) + : base($"BIT Timed Out, {message}") + { + } + + public BitTimeoutException(string message, Exception innerException) + : base($"BIT Timed Out, {message}", innerException) + { + } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IBit/IBit.cs b/Source/TSRealLib/HAL/Interfaces/IBit/IBit.cs new file mode 100644 index 0000000..08a916b --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IBit/IBit.cs @@ -0,0 +1,84 @@ +// ********************************************************************************************************** +// IBit.cs +// 6/21/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using Raytheon.Communication; +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + [UmsContract] + public interface IBit : IInstrument + { + /// + /// Open the communication interface + /// + [UmsCommand( "IBit.Open" )] + void Open( ); + + /// + /// Close the communication interface + /// + [UmsCommand( "IBit.Close" )] + void Close( ); + + /// + /// Starts execution of the Built In Test + /// + /// could be either a label or message name + /// how log to wait in milliseconds + /// + /// + [UmsCommand( "IBit.RunBIT" )] + bool RunBIT( string messageId, uint timeoutInMs, IEnumerable> messageParams ); + + + /// + /// Starts execution of the Built In Test and waits for result + /// + /// could be either a label or message name + /// could be either a label or message name + /// how log to wait in milliseconds + /// + /// + [UmsCommand( "IBit.RunBITWaitForResults" )] + BitTestResults RunBITWaitForResults( string messageIdOut, string messageIdIn, uint timeoutInMs, IEnumerable> messageParams ); + + + /// + /// Retrieve resutls from previously started test + /// + /// could be either a label or message name + /// + [UmsCommand( "IBit.GetBITResults" )] + BitTestResults GetBITResults( string messageId ); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IBit/IBit.csproj b/Source/TSRealLib/HAL/Interfaces/IBit/IBit.csproj new file mode 100644 index 0000000..6cc411f --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IBit/IBit.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.BIT.Contracts + nterface definition for Built In Test (BIT) + HAL + + + + 1.4.0.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IChiller/IChiller.cs b/Source/TSRealLib/HAL/Interfaces/IChiller/IChiller.cs new file mode 100644 index 0000000..7dea178 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IChiller/IChiller.cs @@ -0,0 +1,62 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Communication; +using System; + +namespace Raytheon.Instruments +{ + /// + /// This interfaces defines the API for a chiller system + /// + [UmsContract] + public interface IChiller : IInstrument + { + /// + /// + /// + [UmsCommand("IChiller.DisableFlow")] + void DisableFlow(); + + /// + /// + /// + [UmsCommand("IChiller.EnableFlow")] + void EnableFlow(); + + /// + /// + /// + /// + [UmsCommand("IChiller.GetCoolantSetpoint")] + double GetCoolantSetpoint(); + + /// + /// + /// + /// + [UmsCommand("IChiller.GetCoolantTemperature")] + double GetCoolantTemperature(); + + /// + /// + /// + /// + [UmsCommand("IChiller.SetCoolantTemperature")] + void SetCoolantTemperature(double temp); + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IChiller/IChiller.csproj b/Source/TSRealLib/HAL/Interfaces/IChiller/IChiller.csproj new file mode 100644 index 0000000..dbb8f06 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IChiller/IChiller.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.Chiller.Contracts + IChiller Instrument Interface + HAL + + + + 1.0.3.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/ICommAsync/ICommAsync.cs b/Source/TSRealLib/HAL/Interfaces/ICommAsync/ICommAsync.cs new file mode 100644 index 0000000..ac8faa5 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ICommAsync/ICommAsync.cs @@ -0,0 +1,114 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Raytheon.Instruments +{ + /// + /// An interface to any device that you can write and read to/from + /// + public interface ICommAsync : IInstrument + { + /// + /// Close the communication interface + /// + void Close( ); + + /// + /// Open the communication interface + /// + void Open( ); + + /// + /// Set the timeout on a read + /// + /// + void SetReadTimeout( uint timeout ); + + /// + /// Reads data from a communication device + /// + /// + /// + /// number of bytes read + Task ReadAsync(byte[] dataRead, CancellationToken token = default(CancellationToken)); + + /// + /// Reads data from a communication device + /// + /// + /// + Task ReadAsync(CancellationToken token = default(CancellationToken)); + + /// + /// Writes data to a communication device + /// + /// + /// + /// the number of bytes written + Task WriteAsync(byte[] dataToSend, uint numBytesToWrite, CancellationToken token = default(CancellationToken)); + + /// + /// Writes data to a communication device + /// + /// + /// + Task WriteAsync(string message, CancellationToken token = default(CancellationToken)); + + /// + /// Send command and get response + /// + Task SendCommandGetResponseAsync(string message, CancellationToken token = default(CancellationToken), int timeoutInMs = 5000); + + /// + /// Send command and get response + /// + Task SendCommandGetResponseAsync(byte[] data, CancellationToken token = default(CancellationToken), int timeoutInMs = 5000); + + /// + /// Keep reading asynchronously + /// + /// + /// + /// + Task KeepReadingAsync( CancellationToken cancellationToken, Action dataReceived ); + + /// + /// Keep reading asynchronously + /// + Task KeepReadingAsync(CancellationToken cancellationToken, Action dataReceived); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/ICommAsync/ICommAsync.csproj b/Source/TSRealLib/HAL/Interfaces/ICommAsync/ICommAsync.csproj new file mode 100644 index 0000000..2600d26 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ICommAsync/ICommAsync.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.CommAsync.Contracts + ICommAsync Instrument Interface + HAL + + + + 1.4.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/ICommDevice/ICommDevice.cs b/Source/TSRealLib/HAL/Interfaces/ICommDevice/ICommDevice.cs new file mode 100644 index 0000000..dc1c00a --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ICommDevice/ICommDevice.cs @@ -0,0 +1,79 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; + +namespace Raytheon.Instruments +{ + /// + /// An interface to any device that you can write and read to/from + /// + public interface ICommDevice : IInstrument + { + /// + /// Close the communication interface + /// + [UmsCommand("ICommDevice.Close")] + void Close(); + + /// + /// Open the communication interface + /// + [UmsCommand("ICommDevice.Open")] + void Open(); + + /// + /// Reads data from a communication device + /// + /// + /// number of bytes read + [UmsCommand("ICommDevice.Read")] + uint Read(ref byte[] dataRead); + + /// + /// Set the timeout on a read + /// + /// + [UmsCommand("ICommDevice.SetReadTimeout")] + void SetReadTimeout(uint timeout); + + /// + /// Writes data to a communication device + /// + /// + /// + /// the number of bytes written + [UmsCommand("ICommDevice.Write")] + uint Write(byte[] data, uint numBytesToWrite); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/ICommDevice/ICommDevice.csproj b/Source/TSRealLib/HAL/Interfaces/ICommDevice/ICommDevice.csproj new file mode 100644 index 0000000..ae4f255 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ICommDevice/ICommDevice.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.CommDevice.Contracts + ICommDevice Instrument Interface + HAL + + + + 1.2.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IDCPwr/DCPwrSentry.cs b/Source/TSRealLib/HAL/Interfaces/IDCPwr/DCPwrSentry.cs new file mode 100644 index 0000000..51f0cfb --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDCPwr/DCPwrSentry.cs @@ -0,0 +1,188 @@ +// ******************************************************************************************* +// ** ** +// ** DCPwrSentry.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Raytheon.Communication; + +namespace Raytheon.Instruments +{ + /// + /// SHUTS DOWN ALL SUPPLIES WHEN AN OVER CURRENT OR VOLTAGE OCCURS + /// This interface will define instruments that watch DCPwr supplies + /// and monitor their over current and voltage limits, when one of the power supplies + /// trips, the others will be shutdown. + /// + [UmsContract] + public sealed class DCPwrSentry + { + #region Private Fields + + private HashSet _Supplies = new HashSet(); + private volatile object _SupplyLock = new object(); + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public DCPwrSentry() + { + + } + + #endregion + + #region Public Methods + + /// + /// Adds the specified supply to monitor and be shut down if the + /// other supplies over current or over voltage + /// + /// The supply. + [UmsCommand("IDCPwrSentry.Add")] + public void Add(IDCPwr supply) + { + if (null != supply && !_Supplies.Contains(supply)) + { + lock (_SupplyLock) + { + _Supplies.Add(supply); + supply.OverCurrent += new EventHandler(supply_OverCurrent); + supply.OverVoltage += new EventHandler(supply_OverVoltage); + } + } + } + + /// + /// Removes the specified supply to monitor and be shut down if the + /// other supplies over current or over voltage + /// + /// The supply. + [UmsCommand("IDCPwrSentry.Remove")] + public void Remove(IDCPwr supply) + { + if (null != supply && _Supplies.Contains(supply)) + { + lock (_SupplyLock) + { + _Supplies.Remove(supply); + supply.OverVoltage -= this.supply_OverVoltage; + supply.OverCurrent -= this.supply_OverCurrent; + } + } + } + + #endregion + + #region Public Events + + /// + /// Occurs when any of the supplies over current. + /// + [UmsEvent("IDCPwrSentry.OverCurrent")] + public event EventHandler OverCurrent; + + /// + /// Occurs when any of the supplies over voltage. + /// + [UmsEvent("IDCPwrSentry.OverVoltage")] + public event EventHandler OverVoltage; + + #endregion + + #region Private Event Handlers From Supplies + + private void supply_OverCurrent(object sender, OverCurrentEventArgs e) + { + //lock our supply list, no changing mid event handling + lock (_SupplyLock) + { + //turn off all supplies + ShutdownSupplies(); + + //notify listeners + if (null != OverCurrent) + { + OverCurrent(this, new OverCurrentEventArgs(_Supplies)); + } + } + } + + private void supply_OverVoltage(object sender, OverVoltageEventArgs e) + { + //lock our supply list, no changing mid event handling + lock (_SupplyLock) + { + //turn off all supplies + ShutdownSupplies(); + + //notify listeners + if (null != OverVoltage) + { + OverVoltage(this, new OverVoltageEventArgs(_Supplies)); + } + } + } + + private void ShutdownSupplies() + { + //lock our supply list, no changing mid event handling + lock (_SupplyLock) + { + //turn off all supplies + foreach (var supply in _Supplies) + { + try + { + supply.Enabled = false; + } + catch (InstrumentException) + { + //catch the instrument exceptions on the supplies we are + //trying to shut down that have over current or voltaged + } + } + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDCPwr/IDCPwr.cs b/Source/TSRealLib/HAL/Interfaces/IDCPwr/IDCPwr.cs new file mode 100644 index 0000000..07b2876 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDCPwr/IDCPwr.cs @@ -0,0 +1,206 @@ +// ******************************************************************************************* +// ** ** +// ** IDCPwr.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using Raytheon.Communication; +using Raytheon.Units; + +namespace Raytheon.Instruments +{ + /// + /// IDCPwr - simple dc power supply interface + /// + [UmsContract] + public interface IDCPwr : IInstrument + { + /// + /// Gets or sets the current limit. + /// + /// + /// The current limit. + /// + Current CurrentLimit + { + [UmsCommand("IDCPwr.GetCurrentLimit")] + get; + + [UmsCommand("IDCPwr.SetCurrentLimit")] + set; + } + + /// + /// Gets or sets a value indicating whether this is enabled. + /// + /// + /// true if enabled; otherwise, false. + /// + bool Enabled + { + [UmsCommand("IDCPwr.GetEnabled")] + get; + + [UmsCommand("IDCPwr.SetEnabled")] + set; + } + + /// + /// Measures the current. + /// + /// current within + [UmsCommand("IDCPwr.MeasureCurrent")] + Current MeasureCurrent(); + + /// + /// Measures the voltage. + /// + /// voltage within + [UmsCommand("IDCPwr.MeasureVoltage")] + Voltage MeasureVoltage(); + + /// + /// Gets or sets the output voltage. + /// + /// + /// The output voltage within + /// + Voltage OutputVoltage + { + [UmsCommand("IDCPwr.GetOutputVoltage")] + get; + + [UmsCommand("IDCPwr.SetOutputVoltage")] + set; + } + + /// + /// Gets or sets the over voltage protection. + /// + /// + /// The over voltage protection within + /// + Voltage OverVoltageProtection + { + [UmsCommand("IDCPwr.GetOverVoltageProtection")] + get; + + [UmsCommand("IDCPwr.SetOverVoltageProtection")] + set; + } + + /// + /// Gets or sets a value indicating whether [over voltage protection enabled]. + /// + /// + /// true if [over voltage protection enabled]; otherwise, false. + /// + bool OverVoltageProtectionEnabled + { + [UmsCommand("IDCPwr.GetOverVoltageProtectionEnabled")] + get; + + [UmsCommand("IDCPwr.SetOverVoltageProtectionEnabled")] + set; + } + + /// + /// Gets or sets the voltage soft limit. + /// + /// + /// The voltage soft limit within + /// + Voltage VoltageSoftLimit + { + [UmsCommand("IDCPwr.GetVoltageSoftLimit")] + get; + + [UmsCommand("IDCPwr.SetVoltageSoftLimit")] + set; + } + + + /// + /// Gets or sets a value indicating whether the power supplies inhibit is enabled. + /// + /// + /// true if [inhibit enabled]; otherwise, false. + /// + bool InhibitEnabled + { + [UmsCommand("IDCPwr.GetInhibitEnabled")] + get; + + [UmsCommand("IDCPwr.SetInhibitEnabled")] + set; + } + + /// + /// Occurs when the supply over currents. + /// + [UmsEvent("IDCPwr.OverCurrent")] + event EventHandler OverCurrent; + + /// + /// Occurs when the supply over voltages. + /// + [UmsEvent("IDCPwr.OverVoltage")] + event EventHandler OverVoltage; + + + /// + /// reads protection status (fault register) of the power supply + /// + /// + [UmsCommand("IDCPwr.ReadProtectionStatus")] + int ReadProtectionStatus(); + + /// + /// Control the power supply internal mechanical relay state + /// + /// True to connect, false to disconnect + [UmsCommand( "IDCPwr.MechanicalRelayOutputControl" )] + void MechanicalRelayOutputControl(bool shallWeConnect); + + //*** possible future enhancements + //SetVoltageTriggerSource(…); + //SetVoltageTriggerLevels(…); + //InitiateVoltageTrigger(); + //TriggerVoltage(); + //SetMeasurementTriggerSource(…); + //InitiateMeasurementTrigger(…); + //TriggerMeasurement(); + //AbortMeasurement(); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDCPwr/IDCPwr.csproj b/Source/TSRealLib/HAL/Interfaces/IDCPwr/IDCPwr.csproj new file mode 100644 index 0000000..59e79f6 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDCPwr/IDCPwr.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.DCPwr.Contracts + IDCPwr Instrument Interface + HAL + + + + 2.7.0.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IDCPwr/OverCurrentEventArgs.cs b/Source/TSRealLib/HAL/Interfaces/IDCPwr/OverCurrentEventArgs.cs new file mode 100644 index 0000000..81023d7 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDCPwr/OverCurrentEventArgs.cs @@ -0,0 +1,77 @@ +// ******************************************************************************************* +// ** ** +// ** OverCurrentEventArgs.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections.ObjectModel; +using Raytheon.Communication; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + /// + /// Over current event notifier + /// + [Serializable] + [DataContract] + public class OverCurrentEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// with the affected power supplies + /// + public OverCurrentEventArgs(ICollection supplies) + { + List namedSupplies = new List(); + if (null != supplies) + { + foreach (var sup in supplies) + { + namedSupplies.Add(sup.Name); + } + } + Supplies = new ReadOnlyCollection(namedSupplies); + } + + /// + /// Gets the affected power supplies. + /// + [DataMember(Order = 0, Name = "Supplies")] + public ReadOnlyCollection Supplies { get; private set; } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDCPwr/OverVoltageEventArgs.cs b/Source/TSRealLib/HAL/Interfaces/IDCPwr/OverVoltageEventArgs.cs new file mode 100644 index 0000000..ea92f99 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDCPwr/OverVoltageEventArgs.cs @@ -0,0 +1,78 @@ +// ******************************************************************************************* +// ** ** +// ** OverVoltageEventArgs.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections.ObjectModel; +using Raytheon.Communication; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + /// + /// Over voltage event notifier + /// + [Serializable] + [DataContract] + public class OverVoltageEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// with the affected power supplies + /// + public OverVoltageEventArgs(ICollection supplies) + { + + List namedSupplies = new List(); + if (null != supplies) + { + foreach (var sup in supplies) + { + namedSupplies.Add(sup.Name); + } + } + Supplies = new ReadOnlyCollection(namedSupplies); + } + + /// + /// Gets the supplies that are affected + /// + [DataMember(Order = 0, Name = "Supplies")] + public ReadOnlyCollection Supplies { get; private set; } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/AbstractDmm.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/AbstractDmm.cs new file mode 100644 index 0000000..3b3d73b --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/AbstractDmm.cs @@ -0,0 +1,438 @@ +// ******************************************************************************************* +// ** ** +// ** AbstractDmm.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Raytheon.Units; +using Raytheon.Instruments.Dmm; + +//disable the no xml warning on this abstract class +#pragma warning disable 1591 + +namespace Raytheon.Instruments +{ + /// + /// AbstractDmm - will do a bunch of work for DMM's as to keep the code to do that work + /// in a single place + /// + public abstract class AbstractDmm : IDmm + { + #region Private Fields + + private volatile object _configurationLock = new object(); + private MeasurementFunction _currentMeasurementType = MeasurementFunction.None; + + #endregion + + #region IDmm Interface + + #region Voltage Measurements + + /// + /// Configures a voltage measurement, but first checks if the type is valid. + /// + public void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution) + { + //lock the configuration while checking it out + lock (_configurationLock) + { + //validate the measurement type + switch (type) + { + case MeasurementFunction.ACPlusDCVolts: + case MeasurementFunction.ACVolts: + case MeasurementFunction.DCVolts: + break; + default: + throw new InvalidMeasurementConfigurationException(type, "Voltage units do not match the measurement type"); + } + + try + { + InternalConfigureVoltageMeasurement(type, range, resolution); + //only set the type if the configure passed + _currentMeasurementType = type; + } + catch (InstrumentException ex) + { + _currentMeasurementType = MeasurementFunction.None; + throw new InvalidMeasurementConfigurationException(type, ex.Message); + } + } + } + + /// + /// Configures the voltage measurement in the implementation class + /// + /// The voltage specific type of measurement. + /// The range. + /// The resolution. + /// + /// throw an InstrumentException if the configuration does not take, the abstract class will + /// catch that and fail the configuration + /// + protected abstract void InternalConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution); + + /// + /// Measure - locks on the configuration and then makes sure the proper type is selected + /// then, calls the abstract class to do the work + /// + public Voltage MeasureVoltage(int timeout) + { + //lock the configuration while measuring + lock (_configurationLock) + { + //validate the measurement type + switch (_currentMeasurementType) + { + case MeasurementFunction.ACPlusDCVolts: + case MeasurementFunction.ACVolts: + case MeasurementFunction.DCVolts: + break; + default: + throw new InvalidMeasurementRequestException(_currentMeasurementType, "Voltage units do not match the configured measurement type"); + } + + return InternalMeasureVoltage(timeout); + } + } + + /// + /// voltage measurement in the implementation class. + /// + /// The timeout. + /// measured voltage + /// + /// throw an InstrumentException if the measurement fails + /// + protected abstract Voltage InternalMeasureVoltage(int timeout); + + #endregion + + #region Current Measurements + + /// + /// Configures a current measurement, but first checks if the type is valid. + /// + public void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution) + { + //lock the configuration while checking it out + lock (_configurationLock) + { + //validate the measurement type + switch (type) + { + case MeasurementFunction.ACCurrent: + case MeasurementFunction.ACPlusDCCurrent: + case MeasurementFunction.DCCurrent: + break; + default: + throw new InvalidMeasurementConfigurationException(type, "Current units do not match the measurement type"); + } + + try + { + InternalConfigureCurrentMeasurement(type, range, resolution); + //only set the type if the configure passed + _currentMeasurementType = type; + } + catch (InstrumentException ex) + { + _currentMeasurementType = MeasurementFunction.None; + throw new InvalidMeasurementConfigurationException(type, ex.Message); + } + } + } + + /// + /// Configures the current measurement in the implementation class + /// + /// The current specific type of measurement. + /// The range. + /// The resolution. + /// + /// throw an InstrumentException if the configuration does not take, the abstract class will + /// catch that and fail the configuration + /// + protected abstract void InternalConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution); + + /// + /// Measure - locks on the configuration and then makes sure the proper type is selected + /// then, calls the abstract class to do the work + /// + public Current MeasureCurrent(int timeout) + { + //lock the configuration while measuring + lock (_configurationLock) + { + //validate the measurement type + switch (_currentMeasurementType) + { + case MeasurementFunction.ACCurrent: + case MeasurementFunction.ACPlusDCCurrent: + case MeasurementFunction.DCCurrent: + break; + default: + throw new InvalidMeasurementRequestException(_currentMeasurementType, "Current units do not match the configured measurement type"); + } + + return InternalMeasureCurrent(timeout); + } + } + + /// + /// Current measurement in the implementation class. + /// + /// The timeout. + /// measured current + /// + /// throw an InstrumentException if the measurement fails + /// + protected abstract Current InternalMeasureCurrent(int timeout); + + #endregion + + #region Resistance Measurements + + /// + /// Configures a resistance measurement, but first checks if the type is valid. + /// + public void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution) + { + //lock the configuration while checking it out + lock (_configurationLock) + { + //validate the measurement type + switch (type) + { + case MeasurementFunction.FourWireResistance: + case MeasurementFunction.TwoWireResistance: + break; + default: + throw new InvalidMeasurementConfigurationException(type, "Resistance units do not match the measurement type"); + } + + try + { + InternalConfigureResistanceMeasurement(type, range, resolution); + //only set the type if the configure passed + _currentMeasurementType = type; + } + catch (InstrumentException ex) + { + _currentMeasurementType = MeasurementFunction.None; + throw new InvalidMeasurementConfigurationException(type, ex.Message); + } + } + } + + /// + /// Configures the resistance measurement in the implementation class + /// + /// The resistance specific type of measurement. + /// The range. + /// The resolution. + /// + /// throw an InstrumentException if the configuration does not take, the abstract class will + /// catch that and fail the configuration + /// + protected abstract void InternalConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution); + + /// + /// Measure - locks on the configuration and then makes sure the proper type is selected + /// then, calls the abstract class to do the work + /// + public Resistance MeasureResistance(int timeout) + { + //lock the configuration while measuring + lock (_configurationLock) + { + //validate the measurement type + switch (_currentMeasurementType) + { + case MeasurementFunction.FourWireResistance: + case MeasurementFunction.TwoWireResistance: + break; + default: + throw new InvalidMeasurementRequestException(_currentMeasurementType, "Current units do not match the configured measurement type"); + } + + return InternalMeasureResistance(timeout); + } + } + + /// + /// Resistance measurement in the implementation class. + /// + /// The timeout. + /// measured Resistance + /// + /// throw an InstrumentException if the measurement fails + /// + protected abstract Resistance InternalMeasureResistance(int timeout); + + #endregion + + #region Frequency Measurements + + /// + /// Configures a frequency measurement, but first checks if the type is valid. + /// + public void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution) + { + //lock the configuration while checking it out + lock (_configurationLock) + { + //validate the measurement type + switch (type) + { + case MeasurementFunction.Frequency: + break; + default: + throw new InvalidMeasurementConfigurationException(type, "Frequency units do not match the measurement type"); + } + + try + { + InternalConfigureFrequencyMeasurement(type, range, resolution); + //only set the type if the configure passed + _currentMeasurementType = type; + } + catch (InstrumentException ex) + { + _currentMeasurementType = MeasurementFunction.None; + throw new InvalidMeasurementConfigurationException(type, ex.Message); + } + } + } + + /// + /// Configures the frequency measurement in the implementation class + /// + /// The frequency specific type of measurement. + /// The range. + /// The resolution. + /// + /// throw an InstrumentException if the configuration does not take, the abstract class will + /// catch that and fail the configuration + /// + protected abstract void InternalConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution); + + /// + /// Measure - locks on the configuration and then makes sure the proper type is selected + /// then, calls the abstract class to do the work + /// + public Frequency MeasureFrequency(int timeout) + { + //lock the configuration while measuring + lock (_configurationLock) + { + //validate the measurement type + switch (_currentMeasurementType) + { + case MeasurementFunction.Frequency: + break; + default: + throw new InvalidMeasurementRequestException(_currentMeasurementType, "Frequency units do not match the configured measurement type"); + } + + return InternalMeasureFrequency(timeout); + } + } + + /// + /// Frequency measurement in the implementation class. + /// + /// The timeout. + /// measured Frequency + /// + /// throw an InstrumentException if the measurement fails + /// + protected abstract Frequency InternalMeasureFrequency(int timeout); + + #endregion + + public MeasurementFunction MeasurementType + { + get + { + MeasurementFunction func = MeasurementFunction.None; + lock (_configurationLock) + { + func = _currentMeasurementType; + } + return func; + } + } + + #endregion + + // + // The IInstrument interface is completely up to the impl class + // + #region IInstrument Interface + + public abstract bool ClearErrors(); + + public abstract string DetailedStatus { get; protected set; } + + public abstract bool DisplayEnabled { get; set; } + + public abstract bool FrontPanelEnabled { get; set; } + + public abstract InstrumentMetadata Info { get; } + + public abstract void Initialize(); + + public abstract string Name { get; protected set; } + + public abstract SelfTestResult PerformSelfTest(); + + public abstract void Reset(); + + public abstract SelfTestResult SelfTestResult { get; protected set; } + + public abstract void Shutdown(); + + public abstract State Status { get; protected set; } + + #endregion + } +} + +#pragma warning restore 1591 \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/CodeAnalysisDictionary.xml b/Source/TSRealLib/HAL/Interfaces/IDmm/CodeAnalysisDictionary.xml new file mode 100644 index 0000000..572ab0e --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/CodeAnalysisDictionary.xml @@ -0,0 +1,27 @@ + + + + + + + Dmm + + + + + + + + + + + + + + + FBE + + RINSS + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/Dmm.Contracts.cd b/Source/TSRealLib/HAL/Interfaces/IDmm/Dmm.Contracts.cd new file mode 100644 index 0000000..d7a7206 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/Dmm.Contracts.cd @@ -0,0 +1,18 @@ + + + + + + AAEAAAgAAAAAAAYAIAAQAAAMAAAABAAAAAAAAAAAAAA= + IDmm.cs + + + + + + AAAAASAAQAAAAAAAAAAAABAgAIAAAAAAAAQAAAEAAgI= + MeasurementFunction.cs + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/DmmTriggerSource.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/DmmTriggerSource.cs new file mode 100644 index 0000000..bc8e37e --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/DmmTriggerSource.cs @@ -0,0 +1,68 @@ +// ******************************************************************************************* +// ** ** +// ** DmmTriggerSource.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Runtime.Serialization; + +//*** currently not used, but left for possible future enhancements + +namespace Raytheon.Instruments.Dmm +{ + /// + /// TriggerSource - enum for the type of trigger to use when measuring + /// + [DataContract] + public enum TriggerSource + { + /// + /// measure immediately + /// + [EnumMember] + Immediate, + + /// + /// use external trigger + /// + [EnumMember] + External, + + /// + /// user software trigger + /// + [EnumMember] + Software + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/GlobalSuppressions.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/GlobalSuppressions.cs new file mode 100644 index 0000000..ff5945c --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/GlobalSuppressions.cs @@ -0,0 +1,53 @@ +// ******************************************************************************************* +// ** ** +// ** GlobalSuppressions.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. +// +// To add a suppression to this file, right-click the message in the +// Error List, point to "Suppress Message(s)", and click +// "In Project Suppression File". +// You do not need to add suppressions to this file manually. + +//none of our RINSS assemblies will be CLS compliant +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")] + +//constructors need the unitized values for information about the range exception +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "Raytheon.Instruments.OverRangeException")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Raytheon.Instruments")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Raytheon.Instruments.Dmm")] diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/IDmm.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/IDmm.cs new file mode 100644 index 0000000..7f55ea4 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/IDmm.cs @@ -0,0 +1,131 @@ +// ******************************************************************************************* +// ** ** +// ** IDmm.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; +using System.Diagnostics.CodeAnalysis; + +namespace Raytheon.Instruments +{ + /// + /// IDmm - simple interface to a DMM device + /// + [UmsContract] + public interface IDmm : IInstrument + { + /// + /// Configures a voltage measurement. + /// + /// a valid voltage measurement type. + /// The measurement range. + /// The measurement resolution. + [UmsCommand("IDmm.ConfigureVoltageMeasurement")] + void ConfigureVoltageMeasurement(MeasurementFunction type, Voltage range, Voltage resolution); + + /// + /// Configures a current measurement. + /// + /// a valid current measurement type. + /// The measurement range. + /// The measurement resolution. + [UmsCommand("IDmm.ConfigureCurrentMeasurement")] + void ConfigureCurrentMeasurement(MeasurementFunction type, Current range, Current resolution); + + /// + /// Configures a resistance measurement. + /// + /// a valid resistance measurement type. + /// The measurement range. + /// The measurement resolution. + [UmsCommand("IDmm.ConfigureResistanceMeasurement")] + void ConfigureResistanceMeasurement(MeasurementFunction type, Resistance range, Resistance resolution); + + /// + /// Configures a Frequency measurement. + /// + /// a valid Frequency measurement type. + /// The measurement range. + /// The measurement resolution. + [UmsCommand("IDmm.ConfigureFrequencyMeasurement")] + void ConfigureFrequencyMeasurement(MeasurementFunction type, Frequency range, Frequency resolution); + + /// + /// Measure - Voltage measurement with current measurement configuration + /// + /// time to try operation before returning (milliseconds) + /// the measured voltage + [UmsCommand("IDmm.MeasureVoltage")] + Voltage MeasureVoltage(int timeout); + + /// + /// Measure - Current measurement with current measurement configuration + /// + /// time to try operation before returning (milliseconds) + /// the measured current + [UmsCommand("IDmm.MeasureCurrent")] + Current MeasureCurrent(int timeout); + + /// + /// Measure - Resistance measurement with current measurement configuration + /// + /// time to try operation before returning (milliseconds) + /// the measured resistance + [UmsCommand("IDmm.MeasureResistance")] + Resistance MeasureResistance(int timeout); + + /// + /// Measure - frequency measurement with current measurement configuration + /// + /// time to try operation before returning (milliseconds) + /// the measured frequency + [UmsCommand("IDmm.MeasureFrequency")] + Frequency MeasureFrequency(int timeout); + + /// + /// Gets the type of the measurement. + /// + /// cannot set during a measurement + /// + /// The type of the measurement. + /// + MeasurementFunction MeasurementType + { + [UmsCommand("IDmm.GetMeasurementType")] + get; + } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/IDmm.csproj b/Source/TSRealLib/HAL/Interfaces/IDmm/IDmm.csproj new file mode 100644 index 0000000..cfa41fe --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/IDmm.csproj @@ -0,0 +1,23 @@ + + + + + net472 + Raytheon.Instruments.Dmm.Contracts + DMM Instrument Interface + HAL + + + + 2.6.0 + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/InvalidMeasurementConfigurationException.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/InvalidMeasurementConfigurationException.cs new file mode 100644 index 0000000..ade717d --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/InvalidMeasurementConfigurationException.cs @@ -0,0 +1,117 @@ +// ******************************************************************************************* +// ** ** +// ** InvalidMeasurementConfigurationException.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.Serialization; +using Raytheon.Instruments.Dmm; +using System.Diagnostics.CodeAnalysis; + +namespace Raytheon.Instruments +{ + /// + /// InvalidMeasurementConfigurationException - exception thrown when client attempts to configure an invalid measurement combo + /// of type and units + /// + [DataContract] + [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] + public class InvalidMeasurementConfigurationException : InstrumentException + { + #region Public Exception Properties + + /// + /// Gets the attempted measurement. + /// + /// + /// The attempted measurement type + /// + [DataMember] + public MeasurementFunction AttemptedMeasurementType { get; private set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + public InvalidMeasurementConfigurationException(MeasurementFunction measurementFunction) + : base() + { + AttemptedMeasurementType = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The message. + public InvalidMeasurementConfigurationException(MeasurementFunction measurementFunction, string message) + : base(message) + { + AttemptedMeasurementType = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The message. + /// The inner exception. + public InvalidMeasurementConfigurationException(MeasurementFunction measurementFunction, string message, Exception innerException) + : base(message, innerException) + { + AttemptedMeasurementType = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The information. + /// The context. + public InvalidMeasurementConfigurationException(MeasurementFunction measurementFunction, SerializationInfo info, StreamingContext context) + : base(info, context) + { + AttemptedMeasurementType = measurementFunction; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/InvalidMeasurementRequestException.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/InvalidMeasurementRequestException.cs new file mode 100644 index 0000000..47d2dec --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/InvalidMeasurementRequestException.cs @@ -0,0 +1,127 @@ +// ******************************************************************************************* +// ** ** +// ** InvalidMeasurementRequestException.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.Serialization; +using Raytheon.Instruments.Dmm; +using System.Diagnostics.CodeAnalysis; + +namespace Raytheon.Instruments +{ + /// + /// InvalidMeasurementRequestException - exception thrown when client attempts to take the not currently + /// configured measurement + /// + [DataContract] + [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] + public class InvalidMeasurementRequestException : InstrumentException + { + #region Public Exception Properties + + /// + /// Gets the attempted measurement. + /// + /// + /// The attempted measurement type + /// + [DataMember] + public MeasurementFunction AttemptedMeasurementType { get; private set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// with a NONE measurement type + /// + public InvalidMeasurementRequestException() + : base() + { + AttemptedMeasurementType = MeasurementFunction.None; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + public InvalidMeasurementRequestException(MeasurementFunction measurementFunction) + : base() + { + AttemptedMeasurementType = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The message. + public InvalidMeasurementRequestException(MeasurementFunction measurementFunction, string message) + : base(message) + { + AttemptedMeasurementType = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The message. + /// The inner exception. + public InvalidMeasurementRequestException(MeasurementFunction measurementFunction, string message, Exception innerException) + : base(message, innerException) + { + AttemptedMeasurementType = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The information. + /// The context. + public InvalidMeasurementRequestException(MeasurementFunction measurementFunction, SerializationInfo info, StreamingContext context) + : base(info, context) + { + AttemptedMeasurementType = measurementFunction; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/MeasurementFunction.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/MeasurementFunction.cs new file mode 100644 index 0000000..c5745bc --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/MeasurementFunction.cs @@ -0,0 +1,108 @@ +// ******************************************************************************************* +// ** ** +// ** MeasurementFunction.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments.Dmm +{ + /// + /// MeasurementFunction - enum for the different DMM capabilities + /// + [DataContract] + public enum MeasurementFunction + { + /// + /// empty measurement + /// + [EnumMember] + None, + + /// + /// measure dc volts + /// + [EnumMember] + DCVolts, + + /// + /// measure ac volts + /// + [EnumMember] + ACVolts, + + /// + /// measure dc current + /// + [EnumMember] + DCCurrent, + + /// + /// measure ac current + /// + [EnumMember] + ACCurrent, + + /// + /// measure two wire resistance + /// + [EnumMember] + TwoWireResistance, + + /// + /// measure four wire resistance + /// + [EnumMember] + FourWireResistance, + + /// + /// measure ac plus dc volts + /// + [EnumMember] + ACPlusDCVolts, + + /// + /// measure ac plus dc current + /// + [EnumMember] + ACPlusDCCurrent, + + /// + /// measure frequency + /// + [EnumMember] + Frequency, + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IDmm/OverRangeException.cs b/Source/TSRealLib/HAL/Interfaces/IDmm/OverRangeException.cs new file mode 100644 index 0000000..cdb0e9b --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IDmm/OverRangeException.cs @@ -0,0 +1,114 @@ +// ******************************************************************************************* +// ** ** +// ** OverRangeException.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.Serialization; +using Raytheon.Instruments.Dmm; + +namespace Raytheon.Instruments +{ + /// + /// OverRangeException - exception thrown when range is exceeded + /// + [DataContract] + public class OverRangeException : InstrumentException + { + #region Public Exception Properties + + /// + /// Gets the attempted measurement. + /// + /// + /// The attempted measurement type + /// + [DataMember] + public MeasurementFunction AttemptedMeasurement { get; private set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + public OverRangeException(MeasurementFunction measurementFunction) + : base() + { + AttemptedMeasurement = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The message. + public OverRangeException(MeasurementFunction measurementFunction, string message) + : base(message) + { + AttemptedMeasurement = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The message. + /// The inner exception. + public OverRangeException(MeasurementFunction measurementFunction, string message, Exception innerException) + : base(message, innerException) + { + AttemptedMeasurement = measurementFunction; + } + + /// + /// Initializes a new instance of the class. + /// + /// The measurement function. + /// The information. + /// The context. + public OverRangeException(MeasurementFunction measurementFunction, SerializationInfo info, StreamingContext context) + : base(info, context) + { + AttemptedMeasurement = measurementFunction; + } + + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IELoad/ELoadModuleMode.cs b/Source/TSRealLib/HAL/Interfaces/IELoad/ELoadModuleMode.cs new file mode 100644 index 0000000..22e3ff6 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IELoad/ELoadModuleMode.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + [DataContract] + public enum EloadModuleMode + { + [EnumMember] + RESISTANCE, + [EnumMember] + VOLTAGE, + [EnumMember] + CURRENT + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IELoad/IELoad.csproj b/Source/TSRealLib/HAL/Interfaces/IELoad/IELoad.csproj new file mode 100644 index 0000000..46a6ff1 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IELoad/IELoad.csproj @@ -0,0 +1,23 @@ + + + + + net472 + Raytheon.Instruments.ELoad.Contracts + IELoad Instrument Interface + HAL + + + + 1.1.0 + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IELoad/IEload.cs b/Source/TSRealLib/HAL/Interfaces/IELoad/IEload.cs new file mode 100644 index 0000000..e7fbc5d --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IELoad/IEload.cs @@ -0,0 +1,155 @@ +//###########################################################################// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +//############################################################################// + +using Raytheon.Communication; +using Raytheon.Units; + +namespace Raytheon.Instruments +{ + /// + /// An interface for all Eload classes to implement. + /// + [UmsContract] + public interface IEload : IInstrument + { + /// + /// Turn off the Eload module. + /// + [UmsCommand( "IEload.Disable" )] + void Disable( ); + + /// + /// Turn on the Eload module. + /// + [UmsCommand( "IEload.Enable" )] + void Enable( ); + + /// + /// Queries IO with command + /// + /// + /// + [UmsCommand( "IEload.IOQuery" )] + string IOQuery( string command ); + + /// + /// Writes IO + /// + /// + [UmsCommand( "IEload.IOWrite" )] + void IOWrite( string command ); + + /// + /// Query if the Eload module input is on. + /// + /// Status of Eload. True = On, False = Off. + [UmsCommand( "IEload.IsInputOn" )] + bool IsInputOn( ); + + /// + /// Reads the current of the Eload module. + /// + /// The current (Amps) + [UmsCommand( "IEload.ReadCurrent" )] + Current ReadCurrent( ); + + /// + /// Reads the mode of the Eload module. + /// + /// The mode. + [UmsCommand( "IEload.ReadMode" )] + EloadModuleMode ReadMode( ); + + /// + /// Reads the overcurrent setting from an Eload module. + /// + /// The current (Amps). + [UmsCommand( "IEload.ReadOverCurrentProtection" )] + Current ReadOverCurrentProtection( ); + + /// + /// Reads the overvoltage setting from an Eload module. + /// + /// The voltage (Volts). + [UmsCommand( "IEload.ReadOverVoltageProtection" )] + Voltage ReadOverVoltageProtection( ); + + /// + /// Query the Eload module for the resistance. + /// + /// The resistance (Ohms). + [UmsCommand( "IEload.ReadResistance" )] + Resistance ReadResistance( ); + + /// + /// Queries the Eload module for the setpoint value. Depends on operation mode. + /// + /// The setpoint value. + [UmsCommand( "IEload.ReadSetpoint" )] + double ReadSetpoint( ); + + /// + /// Query the Eload module for the voltage. + /// + /// The voltage (Volts). + [UmsCommand( "IEload.ReadVoltage" )] + Voltage ReadVoltage( ); + + /// + /// Reads the protection status from an Eload module. + /// + /// The protection status register + [UmsCommand( "IEload.ReadProtectionStatus" )] + ushort ReadProtectionStatus( ); + + /// + /// Resets the Eload setpoint and mode to config file values + /// + [UmsCommand( "IEload.SetInitialSetting" )] + void SetInitialSetting( ); + + /// + /// Change the mode for the Eload module. + /// + /// The desired Eload module mode. + [UmsCommand( "IEload.SetMode" )] + void SetMode( EloadModuleMode mode ); + + /// + /// Change the setpoint and operation mode of the Eload module. + /// + /// The new setpoint. + /// The new mode. + [UmsCommand( "IELoad.SetSetpoint" )] + void SetSetpoint( double newSetpoint, EloadModuleMode mode ); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IELoadSystem/IELoadSystem.cs b/Source/TSRealLib/HAL/Interfaces/IELoadSystem/IELoadSystem.cs new file mode 100644 index 0000000..a9c8394 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IELoadSystem/IELoadSystem.cs @@ -0,0 +1,100 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Communication; +using Raytheon.Units; +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + /// + /// An interface for power supplies to implement. + /// + [UmsContract] + public interface IELoadSystem : IInstrument + { + + [UmsCommand("IELoadSystem.AddEloadChannel")] + void AddEloadChannel(string name, int channelNumber, EloadModuleMode mode, double setpoint, Current overCurrentProtection, Voltage overVoltageProtection); + + [UmsCommand("IELoadSystem.GetErrorCode")] + string GetErrorCode(out int errorCode); + + [UmsCommand("IELoadSystem.GetModuleNames")] + List GetModuleNames(); + + [UmsCommand("IELoadSystem.GetSystemName")] + string GetSystemName(); + + [UmsCommand( "IELoadSystem.IOQuery" )] + string IOQuery( string channelName, string command ); + + [UmsCommand( "IELoadSystem.IOWrite" )] + void IOWrite( string channelName, string command ); + + [UmsCommand("IELoadSystem.IsInputOn")] + bool IsInputOn(string channelName); + + [UmsCommand("IELoadSystem.Enable")] + void Enable(string channelName); + + [UmsCommand("IELoadSystem.Disable")] + void Disable(string channelName); + + [UmsCommand("IELoadSystem.ReadCurrent")] + Current ReadCurrent(string channelName); + + [UmsCommand("IELoadSystem.ReadData")] + void ReadData(string channelName, out Voltage voltage, out Current current, out Resistance resistance, out double setpoint, out bool isInputOn, out EloadModuleMode mode, out ushort status); + + [UmsCommand("IELoadSystem.ReadMode")] + EloadModuleMode ReadMode(string channelName); + + [UmsCommand("IELoadSystem.ReadOverCurrentProtection")] + Current ReadOverCurrentProtection(string channelName); + + [UmsCommand("IELoadSystem.ReadOverVoltageProtection")] + Voltage ReadOverVoltageProtection(string channelName); + + [UmsCommand("IELoadSystem.ReadProtectionStatus")] + ushort ReadProtectionStatus(string channelName); + + [UmsCommand("IELoadSystem.ReadResistance")] + Resistance ReadResistance(string channelName); + + [UmsCommand("IELoadSystem.ReadSetpoint")] + double ReadSetpoint(string channelName); + + [UmsCommand("IELoadSystem.ReadVoltage")] + Voltage ReadVoltage(string channelName); + + [UmsCommand("IELoadSystem.Selftest")] + void Selftest(); + + [UmsCommand("IELoadSystem.SetInitialSetting")] + void SetInitialSetting(string module); + + [UmsCommand("IELoadSystem.SetInitialSettingAll")] + void SetInitialSettingAll(); + + [UmsCommand("IELoadSystem.SetMode")] + void SetMode(string channelName, EloadModuleMode mode); + + [UmsCommand("IELoadSystem.SetSetpoint")] + void SetSetpoint(string channelName, double newSetpoint, EloadModuleMode mode); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IELoadSystem/IELoadSystem.csproj b/Source/TSRealLib/HAL/Interfaces/IELoadSystem/IELoadSystem.csproj new file mode 100644 index 0000000..c596bae --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IELoadSystem/IELoadSystem.csproj @@ -0,0 +1,27 @@ + + + + + net472 + Raytheon.Instruments.ELoadSystem.Contracts + IELoadSystem Instrument Interface + HAL + + + + 1.1.0 + + + + + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IFlowMeter/IFlowMeter.cs b/Source/TSRealLib/HAL/Interfaces/IFlowMeter/IFlowMeter.cs new file mode 100644 index 0000000..7e8dbff --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IFlowMeter/IFlowMeter.cs @@ -0,0 +1,36 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Communication; +using System; + +namespace Raytheon.Instruments +{ + /// + /// This interfaces defines the API for a flow meter + /// + [UmsContract] + public interface IFlowMeter : IInstrument + { + /// + /// + /// + /// + [UmsCommand("IFlowMeter.ReadFlow")] + double ReadFlow(); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IFlowMeter/IFlowMeter.csproj b/Source/TSRealLib/HAL/Interfaces/IFlowMeter/IFlowMeter.csproj new file mode 100644 index 0000000..aa770e6 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IFlowMeter/IFlowMeter.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.FlowMeter.Contracts + FlowMeter Instrument Interface + HAL + + + + 1.0.3.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IFpgaComm/IFpgaComm.cs b/Source/TSRealLib/HAL/Interfaces/IFpgaComm/IFpgaComm.cs new file mode 100644 index 0000000..5bd5d5e --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IFpgaComm/IFpgaComm.cs @@ -0,0 +1,99 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; + +namespace Raytheon.Instruments +{ + /// + /// An interface for FPGA communication + /// + public interface IFpgaComm : IInstrument + { + /// + /// + /// + /// The name of the FPGA + [UmsCommand("IFpgaComm.Initialize")] + void Initialize(string fpgaName); + + /// + /// + /// + /// The name of the FPGA + [UmsCommand("IFpgaComm.LoadFirmware")] + void LoadFirmware(string fpgaName); + + /// + /// + /// + /// The name of the FPGA + /// The address to read from + /// The data conttained in the FPGA at the address specified + [UmsCommand("IFpgaComm.Read")] + uint Read(string fpgaName, uint address); + + /// + /// + /// + /// + /// + /// + /// + /// + /// + [UmsCommand("IFpgaComm.ReadBlock")] + void ReadBlock(string fpgaName, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead); + + /// + /// + /// + /// The name of the FPGA + /// The address to write to + /// The value to write + [UmsCommand("IFpgaComm.Write")] + void Write(string fpgaName, uint address, uint value); + + /// + /// + /// + /// + /// + /// + /// + /// + /// + [UmsCommand("IFpgaComm.WriteBlock")] + void WriteBlock(string fpgaName, uint address, uint numberOfWordsToWrite, uint[] data, bool shallWeIncrementAddress); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IFpgaComm/IFpgaComm.csproj b/Source/TSRealLib/HAL/Interfaces/IFpgaComm/IFpgaComm.csproj new file mode 100644 index 0000000..5362fb3 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IFpgaComm/IFpgaComm.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.FpgaComm.Contracts + FpgaComm Instrument Interface + HAL + + + + 1.1.0 + + + + + + + + diff --git a/Source/Program/Common/ConfigLogic/PowerSupplyConstants.cs b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/ConfigIni.cs similarity index 72% rename from Source/Program/Common/ConfigLogic/PowerSupplyConstants.cs rename to Source/TSRealLib/HAL/Interfaces/IGeneralIO/ConfigIni.cs index 9603279..b6ea34d 100644 --- a/Source/Program/Common/ConfigLogic/PowerSupplyConstants.cs +++ b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/ConfigIni.cs @@ -21,22 +21,24 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ProgramLib +namespace Raytheon.Instruments.GeneralIO { - /// - /// Power supply constants - /// - internal static class PowerSupplyConstants + public enum ConfigIni { - public enum POWER_DEVICE - { - STE_POWER_SUPPLY_SYSTEM, + // list all the keys here + SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION, - // Power modules - UUT_REF_3_3V, - STE_PVM_5V, - STE_GU_INTERFACE_RELAYS_25V, - STE_GU_INTERFACE_RF_INTERFACE_5V, - } + OUTPUT_SIGNALS, + INPUT_SIGNALS, + NUM_CHANNELS_PER_PORT, + CHANNEL_START_INDEX, + NUM_OUTPUT_CHANNELS, + NUM_INPUT_CHANNELS, + + COM_PORT, + DIO_ADDRESS, + DIO_OPTIONS, + DEVICE_NUMBER, + PXI_CARD_SLOT_INDEX } } diff --git a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientConfigXml.cs b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/ConfigXml.cs similarity index 87% rename from Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientConfigXml.cs rename to Source/TSRealLib/HAL/Interfaces/IGeneralIO/ConfigXml.cs index a7f3f0d..2863308 100644 --- a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientConfigXml.cs +++ b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/ConfigXml.cs @@ -21,12 +21,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Raytheon.Instruments.EthernetSockets +namespace Raytheon.Instruments.GeneralIO { - public enum TcpClientConfigXml + public enum ConfigXml { - // List all the keys here - REMOTE_ADDRESS, - REMOTE_PORT + // list all the keys here + DIO_MODULE_DEF_FILEPATH } } diff --git a/Source/TSRealLib/HAL/Interfaces/IGeneralIO/Datatypes.cs b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/Datatypes.cs new file mode 100644 index 0000000..0625888 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/Datatypes.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace Raytheon.Instruments +{ + public class IODatatypes + { + public struct DIOChannelInfo + { + public uint channelNumber; + public int initialValue; + }; + + /// + /// Bit state, high or low + /// + [DataContract] + public enum BitState + { + /// + /// low state + /// + [EnumMember] + Low, + + /// + /// high state + /// + [EnumMember] + High + } + + /// + /// BitType - setup info, input or output type bit + /// + [DataContract] + public enum BitType + { + /// + /// digital input bit + /// + [EnumMember] + Input, + + /// + /// digital output bit + /// + [EnumMember] + Output + } + + /// + /// enumeration for the several types of IO + /// + [DataContract] + public enum IOType + { + /// + /// an analog input + /// + [EnumMember] + AnalogInput, + + /// + /// an analog output + /// + [EnumMember] + AnalogOutput, + + /// + /// a digital input + /// + [EnumMember] + DigitalInput, + + /// + /// a digital output + /// + [EnumMember] + DigitalOutput, + + /// + /// a clock type output + /// + [EnumMember] + Clock, + } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IGeneralIO/IGeneralIO.cs b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/IGeneralIO.cs new file mode 100644 index 0000000..5d92708 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/IGeneralIO.cs @@ -0,0 +1,118 @@ +// ******************************************************************************************* +// ** ** +// ** IGeneralIO.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using Raytheon.Communication; +using Raytheon.Instruments; + +namespace Raytheon.Instruments +{ + /// + /// IGeneralIO - base interface for an IO type instrument + /// + [UmsContract] + public interface IGeneralIO : IInstrument + { + /// + /// Gets the bit's current state + /// + /// + /// + /// the bit's current + /// + [UmsCommand( "IGeneralIO.GetBitState" )] + IODatatypes.BitState GetBitState(string signalName); + + /// + /// Get signal names + /// + /// + /// + /// + [UmsCommand("IGeneralIO.GetSignalNames")] + List GetSignalNames(); + + /// + /// Gets the number of input bits. + /// + /// + /// The number input bits. + /// + UInt32 NumberOfInputBits + { + [UmsCommand( "IGeneralIO.GetNumberOfInputBits" )] + get; + } + + /// + /// Gets the number of output bits. + /// + /// + /// The number output bits. + /// + UInt32 NumberOfOutputBits + { + [UmsCommand( "IGeneralIO.GetNumberOfOutputBits" )] + get; + } + + /// + /// Sets the bit to high or low . + /// + /// + /// Only allowed on output bits + /// + /// + /// The state . + [UmsCommand( "IGeneralIO.SetBit" )] + void SetBit(string signalName, IODatatypes.BitState state); + + /// + /// Command an output bit to logic Z state + /// + /// The output bit number + [UmsCommand( "IGeneralIO.SetTristate" )] + void SetTristate(string signalName); + + //*** possible enhancements + //bool ConfigureBitType(UInt32 bit, GeneralIo.BitType type); + //bool[] GetBits(); + //GeneralIo.BitType GetBitType(UInt32 bit); + //void SetBits(bool[] all); + //bool MaskBits(specialobj[] obj); //maybe an object with bit# and value? + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IGeneralIO/IGeneralIO.csproj b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/IGeneralIO.csproj new file mode 100644 index 0000000..2043c84 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IGeneralIO/IGeneralIO.csproj @@ -0,0 +1,18 @@ + + + + net472 + Raytheon.Instruments.GeneralIO.Contracts + Instrument interface for General IO + HAL + + + + 1.7.0.0 + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IJtag/IJtag.cs b/Source/TSRealLib/HAL/Interfaces/IJtag/IJtag.cs new file mode 100644 index 0000000..a72543d --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IJtag/IJtag.cs @@ -0,0 +1,53 @@ +//******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +//******************************************************************************// + + +using Raytheon.Communication; + +namespace Raytheon.Instruments +{ + /// + /// Interface for Jtag type instruments + /// + [UmsContract] + public interface IJtag : IInstrument + { + /// + /// Basic interface for running JTAG tests + /// + /// Will determine the application and commands + /// that are used for the JTAG job + /// Returns the result of the run + [UmsCommand( "IJtag.PerformJtagJob" )] + int PerformJtagJob( JtagJobInfo jobInfo ); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IJtag/Jtag.Contracts.csproj b/Source/TSRealLib/HAL/Interfaces/IJtag/Jtag.Contracts.csproj new file mode 100644 index 0000000..4d02dbc --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IJtag/Jtag.Contracts.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.Jtag.Contracts + Jtag Instrument Interface + HAL + + + + 1.1.0 + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IJtag/JtagJobInfo.cs b/Source/TSRealLib/HAL/Interfaces/IJtag/JtagJobInfo.cs new file mode 100644 index 0000000..2c534c3 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IJtag/JtagJobInfo.cs @@ -0,0 +1,85 @@ +//******************************************************************************// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +// COMPANY. +// +// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE +// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED +// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION +// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION +// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER +// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER +// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS +// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT +// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL +// PENALTIES. +// +// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 : +// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R, +// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS +// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR +// RECONSTRUCTION OF THE DOCUMENT. +//******************************************************************************// + + +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + /// + /// Class that only contains variables that are used to configure a JTAG job + /// + public class JtagJobInfo + { + /// + /// Unique identifier for the client side + /// + public string jobName; + + /// + /// + public string bsxFilePath; + + /// + /// + public string bsxFile; + + /// + /// + public string bsxFileCommandline; + + /// + /// + public bool shallWeUseDiag1; + + /// + /// + public string diag1File; + + /// + /// + public string diag1CmdLine; + + /// + /// + public bool shallWeUseDiag2; + + /// + /// + public string diag2File; + + /// + /// + public string diag2CmdLine; + + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/ILspsChamber/ILspsChamber.csproj b/Source/TSRealLib/HAL/Interfaces/ILspsChamber/ILspsChamber.csproj new file mode 100644 index 0000000..0679944 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ILspsChamber/ILspsChamber.csproj @@ -0,0 +1,23 @@ + + + + + net472 + Raytheon.Instruments.LspsChamber.Contracts + Low-Background Scanning Point Source Motion interface definition + Library + + + + 1.0.0 + + + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/ILspsChamber/IlspsChamber.cs b/Source/TSRealLib/HAL/Interfaces/ILspsChamber/IlspsChamber.cs new file mode 100644 index 0000000..c1d2f81 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ILspsChamber/IlspsChamber.cs @@ -0,0 +1,234 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using Raytheon.Instruments.LSPS; +using Raytheon.Units; +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + [UmsContract] + public interface ILspsChamber : IInstrument + { + #region AutoFill Functions + [UmsCommand("ILspsChamber.AutoFillCoolDown")] + void AutoFillCoolDown(); + + [UmsCommand("ILspsChamber.AutoFillWarmUp")] + void AutoFillWarmUp(); + + [UmsCommand("ILspsChamber.AutoFillForce")] + void AutoFillForce(); + + [UmsCommand("ILspsChamber.AutoFillTurnOff")] + void AutoFillTurnOff(); + + [UmsCommand("ILspsChamber.GetAutoFillState")] + LSPS.AutoFillState GetAutoFillState(); + + [UmsCommand("ILspsChamber.GetTimeToFill")] + double GetTimeToFill(); + #endregion + + #region NIF Functions + [UmsCommand("ILspsChamber.CloseLspsGateValve")] + void CloseLspsGateValve(); + + [UmsCommand("ILspsChamber.OpenLspsGateValve")] + void OpenLspsGateValve(); + + [UmsCommand("ILspsChamber.GetLspsGateValvePosition")] + GateValvePosition GetLspsGateValvePosition(); + + [UmsCommand("ILspsChamber.GetTemperature")] + double GetTemperature(LSPS.TemperatureIndex tempIndex); + + [UmsCommand("ILspsChamber.GetInputIndex")] + int GetInputIndex(int inputIndex); + #endregion + + #region RIO Functions + [UmsCommand("ILspsChamber.CloseVhfGateValve")] + void CloseVhfGateValve(); + + [UmsCommand("ILspsChamber.OpenVhfGateValve")] + void OpenVhfGateValve(); + + [UmsCommand("ILspsChamber.GetVhfGateValveChamberPressure")] + double GetVhfGateValveChamberPressure(); + + [UmsCommand("ILspsChamber.GetVhfGateValveUutPressure")] + double GetVhfGateValveUutPressure(); + + [UmsCommand("ILspsChamber.GetVhfGateValveClosedInput")] + int GetVhfGateValveClosedInput(); + + [UmsCommand("ILspsChamber.GetVhfGateValveOpenInput")] + int GetVhfGateValveOpenInput(); + #endregion + + #region Chamber Vacuum Functions + [UmsCommand("ILspsChamber.GetLspsChamberPressure")] + double GetLspsChamberPressure(); + + [UmsCommand("ILspsChamber.GetLspsUutPressure")] + double GetLspsUutPressure(); + #endregion + + #region GALIL Functions + [UmsCommand("ILspsChamber.FilterWheelHome")] + void FilterWheelHome(); + + [UmsCommand("ILspsChamber.SetFilterWheelPosition")] + void SetFilterWheelPosition(int position); + + [UmsCommand("ILspsChamber.GetFilterWheelPosition")] + int GetFilterWheelPosition(); + + [UmsCommand("ILspsChamber.GetFilterWheelStatus")] + LSPS.TargetAndFilterWheelStatus GetFilterWheelStatus(); + + [UmsCommand("ILspsChamber.TargetWheelHome")] + void TargetWheelHome(); + + [UmsCommand("ILspsChamber.SetTargetWheelPosition")] + void SetTargetWheelPosition(int position); + + [UmsCommand("ILspsChamber.GetTargetWheelPosition")] + int GetTargetWheelPosition(); + + [UmsCommand("ILspsChamber.GetTargetWheelStatus")] + LSPS.TargetAndFilterWheelStatus GetTargetWheelStatus(); + + [UmsCommand("ILspsChamber.SteeringMirrorHome")] + void SteeringMirrorHome(); + + [UmsCommand("ILspsChamber.SteeringMirrorStop")] + void SteeringMirrorStop(); + + [UmsCommand("ILspsChamber.SteeringMirrorMove")] + void SteeringMirrorMove(double az, double el, double speed); + + [UmsCommand("ILspsChamber.SteeringMirrorGetBeamAngles")] + Tuple SteeringMirrorGetBeamAngles(); + + [UmsCommand("ILspsChamber.SteeringMirrorSetBeamSpeed")] + void SteeringMirrorSetBeamSpeed(double speed); + + [UmsCommand("ILspsChamber.SteeringMirrorSetRightLeftArrowAngle")] + void SteeringMirrorSetRightLeftArrowAngle(double angle); + + [UmsCommand("ILspsChamber.SteeringMirrorSetUpDownArrowAngle")] + void SteeringMirrorSetUpDownArrowAngle(double angle); + + [UmsCommand("ILspsChamber.GetSteeringMirrorStatus")] + Tuple GetSteeringMirrorStatus(); + + [UmsCommand("ILspsChamber.SteeringMirrorLoadProfile")] + void SteeringMirrorLoadProfileFromFile(string profileFilePath); + + [UmsCommand("ILspsChamber.SteeringMirrorLoadProfileStep")] + void SteeringMirrorLoadProfileStep(double az, double el, double speed); + + [UmsCommand("ILspsChamber.SteeringMirrorResetProfile")] + void SteeringMirrorResetProfile(); + + [UmsCommand("ILspsChamber.SteeringMirrorRunProfile")] + void SteeringMirrorRunProfile(LSPS.SteeringMirrorProfileMode profileMode = LSPS.SteeringMirrorProfileMode.LEARNED, + LSPS.SteeringMirrorMovementMode movementMode = LSPS.SteeringMirrorMovementMode.ABSOLUTE); + + [UmsCommand("ILspsChamber.SteeringMirrorMoveToBeginningOfProfile")] + void SteeringMirrorMoveToBeginningOfProfile(); + + [UmsCommand("ILspsChamber.SteeringMirrorRunNextStepInProfile")] + void SteeringMirrorRunNextStepInProfile(); + #endregion + + #region BlackBody Functions + [UmsCommand("ILspsChamber.SetBlackBodySetpointTemperature")] + void SetBlackBodySetpointTemperature(double temperature); + + [UmsCommand("ILspsChamber.GetBlackbodyHeaterPercent")] + double GetBlackbodyHeaterPercent(); + + [UmsCommand("ILspsChamber.GetBlackbodySetpoint")] + double GetBlackbodySetpoint(); + + [UmsCommand("ILspsChamber.GetBlackbodyStability")] + Tuple GetBlackbodyStability(int? logRateInMs = null); + + [UmsCommand("ILspsChamber.GetBlackbodyControlState")] + LSPS.BlackBodyControlState GetBlackbodyControlState(); + + [UmsCommand("ILspsChamber.GetBlackbodyRateOfChange")] + double GetBlackbodyRateOfChange(); + + [UmsCommand("ILspsChamber.GetBlackbodyTemperature")] + Tuple GetBlackbodyTemperature(); + + [UmsCommand("ILspsChamber.GetBlackbodyBIT")] + int GetBlackbodyBIT(); + #endregion + + #region Chopper Functions + [UmsCommand("ILspsChamber.SetChopperFrequency")] + void SetChopperFrequency(double frequency); + + [UmsCommand("ILspsChamber.GetChopperFrequency")] + double GetChopperFrequency(); + + [UmsCommand("ILspsChamber.TurnOffChopperWheel")] + void TurnOffChopperWheel(); + + [UmsCommand("ILspsChamber.SetStopOpen")] + void SetStopOpen(); + + [UmsCommand("ILspsChamber.SetStopClosed")] + void SetStopClosed(); + + [UmsCommand("ILspsChamber.GetChopperStability")] + LSPS.Stability GetChopperStability(); + + [UmsCommand("ILspsChamber.GetChopperState")] + LSPS.ChopperState GetChopperState(); + #endregion + + #region Misc Functions + [UmsCommand("ILspsChamber.SendACommand")] + void SendACommand(string command); + #endregion + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/ILspsChamber/MiscData.cs b/Source/TSRealLib/HAL/Interfaces/ILspsChamber/MiscData.cs new file mode 100644 index 0000000..1d77833 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ILspsChamber/MiscData.cs @@ -0,0 +1,264 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using Raytheon.Units; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments.LSPS +{ + public enum TemperatureIndex + { + TANK_TOP, + TANK_BOTTOM + } + + public enum GateValvePosition + { + OPEN, + CLOSE + } + + public enum WaitOption + { + WAIT, + NO_WAIT + } + + public enum Stability + { + UNSTABLE, + STABLE + } + + public enum AutoFillState + { + OFF, + COOLING, + WARMING + } + + public enum ChopperState + { + OFF = 10, + ON, + MOVING, + STOP_OPEN, + STOP_CLOSE, + FIND_ERROR, + MOVE_ERROR, + CHANGE_DIRECTION, + CHANGE_SPEED, + LOOKING_FOR_STOP_OPEN, + LOOKING_FOR_STOP_CLOSED + } + + public enum BlackBodyControlState + { + LN2_COOLING, + CONTROLLING, + NOT_CONTROLLING + } + + public enum FilterWheelPositions + { + Open = 1, + ND_1PT0, + ND_1PT3, + ND_1PT6, + ND_2PT0, + ND_2PT3, + ND_2PT6, + CLOSED, + DIFFUSED + } + + public enum TargetWheelPositions + { + P_25_URAD = 1, + P_33_URAD, + P_40_URAD, + P_50_URAD, + P_66_URAD, + P_80_URAD, + P_15_URAD, + P_2000_URAD_SQUARE, + P_0PT1875_IN, + P_0PT75_IN_FULL, + P_20_URAD, + SLIT, + P_80_URAD_DUAL, + P_115_URAD, + RETRO_BALL, + BLANK + } + + public enum SteeringMirrorStatus + { + NEEDS_HOME, + HOMING, + MOVING, + FORWARD_LIMIT, + REAR_LIMIT, + FIND_POSITION_ERROR, + FIND_HOME_ERROR, + IN_POSITION, + TIMEOUT, + HOME_FORWARD_LIMIT, + HOME_REAR_LIMIT + } + + public enum TargetAndFilterWheelStatus + { + NEEDS_HOME, + HOMING, + MOVING, + HOME_SWITCH_ERROR, + POSITION_SWITCH_ERROR, + FIND_POSITION_ERROR, + FIND_HOME_ERROR, + IN_POSITION, + TIMEOUT + } + + public enum SteeringMirrorProfileMode + { + LEARNED, + OPEN_LOOP, + PRE_LEARNED, + VELOCITY + } + + public enum SteeringMirrorMovementMode + { + ABSOLUTE, + RELATIVE + } + + public class LSPSPoint + { + public LSPSPoint() { } + public LSPSPoint(double speed, double az, double el) + { + speed_ = speed; + az_ = az; + el_ = el; + } + + public double speed_ { get; set; } + + public double az_ { get; set; } + + public double el_ { get; set; } + } + + public class LSPSData + { + public string Name { get; set; } + + public AutoFillData AutoFill { get; set; } = new AutoFillData(); + + public BlackBodyData BlackBodyData { get; set; } = new BlackBodyData(); + + public CVACData CVACData { get; set; } = new CVACData(); + + public ChopperData ChopperData { get; set; } = new ChopperData(); + + public GalilData GalilData { get; set; } = new GalilData(); + + public NIFData NIFData { get; set; } = new NIFData(); + } + + public class AutoFillData + { + public string TTF { get; set; } = string.Empty; + + public AutoFillState State { get; set; } + } + + public class BlackBodyData + { + public double TempA { get; set; } + + public double TempB { get; set; } + + public double ChangeRate { get; set; } + + public BlackBodyControlState ControlState { get; set; } + + public double Heater { get; set; } + + public double SetPoint { get; set; } + + public LSPS.Stability StabilityA { get; set; } + + public LSPS.Stability StabilityB { get; set; } + + public int Bit { get; set; } + } + + public class CVACData + { + public string CVAC { get; set; } + + public string SVAC { get; set; } + } + + public class ChopperData + { + public double Frequency { get; set; } + + public Stability Stability { get; set; } + + public ChopperState State { get; set; } + } + + public class GalilData + { + public double TWPosition { get; set; } + + public double SMBeamAngleAz { get; set; } + + public double SMBeamAngleEl { get; set; } + + public double FWPosition { get; set; } + } + + public class NIFData + { + public double TankTop { get; set; } + + public double TankBottom { get; set; } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/INetCdfData/INetCdfData.cs b/Source/TSRealLib/HAL/Interfaces/INetCdfData/INetCdfData.cs new file mode 100644 index 0000000..545e5ef --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/INetCdfData/INetCdfData.cs @@ -0,0 +1,51 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using Raytheon.Units; +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + [UmsContract] + public interface INetCdfData : IInstrument + { + [UmsCommand("INetCdfData.ProcessNcdfData")] + void ProcessNcdfData(string prefix, string suffix, string testDataPath); + + [UmsCommand("INetCdfData.SetValue")] + void SetValue(NCDF.Names name, T value, NCDF.AttrPosition videoId); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/INetCdfData/INetCdfData.csproj b/Source/TSRealLib/HAL/Interfaces/INetCdfData/INetCdfData.csproj new file mode 100644 index 0000000..e1bd5a6 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/INetCdfData/INetCdfData.csproj @@ -0,0 +1,23 @@ + + + + + net472 + Raytheon.Instruments.NetCdfData.Contracts + NCDF Data interface definition + Library + + + + 1.0.0 + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/INetCdfData/MiscData.cs b/Source/TSRealLib/HAL/Interfaces/INetCdfData/MiscData.cs new file mode 100644 index 0000000..adc22b1 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/INetCdfData/MiscData.cs @@ -0,0 +1,327 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using Raytheon.Units; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments.NCDF +{ + public enum Names + { + ACTIVITY, + APERTURE, + AZ_LOCATION, + B_B_CONTROLER, + CHOPPER_FREQ, + DATA_FOLDER, + DATE, + EL_LOCATION, + FILENAME, + F_P_A, + INDICATOR_CODE, + SITE_LOCATION, + MEASURED_APERTURE_POSITION, + MEASURED_AZ_POSITION, + _B_B_TEMP, + MEASURED_EL_POSITION, + MEASURED_FILTER_POSITION, + N_FRAMES, + OPERATOR, + POSITION, + REMARKS, + RADCAL_AUTOFILL_STATE, + RADCAL_AUTOFILL_TIMETOFILL, + RADCAL_BB_BIT, + RADCAL_BB_CTRL_STATE, + RADCAL_BB_HEATER, + RADCAL_BB_RATE_O_CHANGE, + RADCAL_BB_SETPOINT, + RADCAL_BB_STABILITY_A, + RADCAL_BB_STABILITY_B, + RADCAL_C_VAC, + RADCAL_CHOPPER_FREQ, + RADCAL_CHOPPER_STABILITY, + RADCAL_CHOPPER_STATE, + RADCAL_GATE_VALVE, + RADCAL_NIF_TEMP_TANK_BOTTOM, + RADCAL_NIF_TEMP_TANK_TOP, + RADCAL_PVAC_RVAC, + RADCAL_PVAC_TVAC, + RADCAL_S_VAC, + VHF_GV_CHAMBER_VAC, + VHF_GV_UUT_VAC, + REGION, + SCAN_MIRROR_X_POSITION, + SCAN_MIRROR_Y_POSITION, + SCAN_SPEED, + SCAN_PATTERN, + SCAN_RADIUS, + SCRIPT_NAME, + SET_POINT_AZ, + SET_POINT_EL, + TARGET_WHEEL_POSITION, + TEST_POSITION_NO, + TEST_PROCEDURE_DOC, + TEST_PROCEDURE_DOC_REV, + TEST_STEP, + TEST_TYPE_CODE, + TIME_RECORDED, + VERSION, + V_O_B_APERTURE, + VOB_CAN_TEMP, + CHOPPER_STATUS, + VOB_FILTER_POS, + VOB_GATE_VALVE_STATUS, + VOB_LAMBDA, + VOB_REGION, + VOB_TARGET_REGION, + CHAMBER_PRESSURE, + VOB_CHOPPER_FREQ, + VSS_INPUT_CHOPPER_FREQ, + VSS_INPUT_CHOPPER_STATUS, + VSS_MID_CHOPPER_FREQ, + VSS_MID_CHOPPER_STATUS, + X_LOCATION, + X_SIZE, + X_TARGET, + Y_LOCATION, + Y_SIZE, + Y_TARGET, + LAST_BAND_SEL, + BAND_SEL, + READ_SEQ_DEL, + ROW_START, + ROW_STOP, + INTEGRATION_TIME, + B1_DET_BIAS_OFFS, + B1_DET_BIAS, + B2_DET_BIAS, + UC_GAIN, + BGSEN, + B1_RAMP, + B2_RAMP, + COL_AMP_GAIN, + COL_AMP_IN_OFFS, + COL_AMP_OUT_OFFS, + OUT_BUF_SLEW, + OUT_BUF_CAS, + RESET_TIME, + GLOBAL_TEST_ENABLE, + UC_RAMP_TEST, + SEEKER_SN, + SEEKER_PN, + GEU_PN, + GEU_SN, + SENSOR_SN, + SENSOR_PN, + IMU_SN, + IMU_PN, + IICCA_SN, + IICCA_PN, + IDA_SN, + IDA_PN, + CRYOSTAT_SN, + CRYOSTAT_PN, + ENVIRONMENT_ERROR, + SET_LAST_BAND_SEL, + SET_BAND_SEL, + SET_READ_SEQ_DEL, + SET_ROW_START, + SET_ROW_STOP, + SET_INTEG_TIME, + SET_B1_DET_BIAS_OFFS, + SET_B1_DET_BIAS, + SET_B2_DET_BIAS, + SET_UC_GAIN, + SET_BGSEN, + SET_B1_RAMP, + SET_B2_RAMP, + SET_COL_AMP_GAIN, + SET_COL_AMP_IN_OFFS, + SET_COL_AMP_OUT_OFFS, + SET_OUT_BUF_SLEW, + SET_OUT_BUF_CAS, + SET_RESET_TIME, + SET_GLOBAL_TEST_ENABLE, + SET_UC_RAMP_TEST, + BAND, + FILE_TYPE, + FRAME_RATE, + INTEGRATION_TIME_BAND1, + INTEGRATION_TIME_BAND2, + LAKESHORE_SLOPE, + LAKESHORE_INTERCEPT, + LOCATION_ORIGIN, + SENSOR_CONFIGURATION, + SERIAL, + VIDEO_TEST, + X_START, + Y_START, + _V_DET_COM, + VRAMP, + IICCA_FIRM_VER, + IDA_VOLTS, + IDA_TEMP, + V_P3_R4_A_S, + V_N3_R4_A, + V_P5_R3_A, + BIAS_RESERVE, + VP_DET_COM_B1, + VP_E_S_D, + VN_OUT, + VP_OUT, + VN_UC, + VP_UC, + VN_D, + VP_D, + VN_A, + VP_A, + BENCH, + SEEKER_BUILD, + SENSOR_BUILD, + PROGRAM_NAME, + TESTPOSITIONTYPE, + TEST_TYPE_VARIANT, + ENVIRONMENT_ERROR_NOTES, + T_E_CHAMBER_I_D, + T_E_G_U_T_S_I_D, + T_E_C_T_S_I_D, + T_E_SHAKER_I_D, + T_E_THERMOTRON_I_D, + T_E_CHAMBER_WINDOW_I_D, + T_E_U_U_T_WINDOW_I_D, + T_E_B_B_CONTROLLER_S_N, + T_E_V_S_S_PYRO_DET, + T_E_CHAMBER_SW_VERSION, + T_E_CHAMBER_SW_BUILD, + T_E_G_U_T_S_S_W_VERSION, + T_E_G_U_T_S_S_W_BUILD, + T_E_V_T_I_FIRMWARE_VERSION, + T_E_V_T_I_FIRMWARE_BUILD, + T_E_I_A_F_S_W_VERSION, + T_E_I_A_F_S_W_BUILD, + MONOCHROMETER_POSITION, + B_B_E_S_TARGET, + EMISSIVITY, + CUTOFFWAVELENGTH, + CUTONWAVELENGTH, + TARGET_REGION, + MEASURED_BLACK_BODY_TEMPERATURE, + MEASURED_MONOCHROMETER_POSITION, + V_O_B_CAN_TEMP, + V_O_B_CHAMBER_PRESSURE, + V_O_B_CHOPPER_STATUS, + V_O_B_LAMBDA, + L_S_P_S_GATE_VALVE_STATUS, + SENSOR, + VGATE, + VOFFSET, + EXTERNAL_A_D_C_V_DET_COM, + INTEG_TIME, + AUTOCOLLIMATOR_EL, + AUTOCOLLIMATOR_AZ, + B_B_E_S_TEMP, + B_B_E_S_FILTER_WHEEL, + VOB_AMP_AVG_R, + VOB_AVG_X_VOLTAGE, + VSS_LOCKIN_1_COUPLE, + VSS_LOCKIN_1_GROUND, + VSS_LOCKIN_1_RESERVE, + VOB_AMP_SEN, + VSS_LOCKIN_1_SLOPE, + VOB_AMP_TIME_CONST, + VOB_AMP2_AVG_R, + VOB_AVG2_X_VOLTAGE, + VSS_LOCKIN_2_COUPLE, + VSS_LOCKIN_2_GROUND, + VSS_LOCKIN_2_RESERVE, + VOB_AMP2_SEN, + VSS_LOCKIN_2_SLOPE, + VOB_AMP2_TIME_CONST, + SET_V_DET_COM, + MONOCHROMETER_1_POSITION, + MONOCHROMETER_2_POSITION, + FILTER, + FPA_SN, + T_E_I_A_F_I_D, + T_E_V_T_I_I_D, + BUILDING, + FOCUS_POSITION, + F_C_D_START_TIME, + F_C_D_FRAMECNT, + F_C_D_LINECUT_TIME, + F_C_D_LINECUT_FRAMECNT, + C_O_L, + SOAK_TEMPERATURE, + SCAN_RATE, + ORIENTATION, + GALILC_FOCUS_POSITION, + GALILC_ABS_FOCUS_POSITION, + GALILC_ENCODER_FOCUS_POSITION, + NUM_NAMES + }; + + public enum AttrPosition + { + GLOBAL, + LATEST_VID, + BOTH + }; + + public enum DataType + { + STRING, + INT, + FLOAT + }; + + public class NetCdfValue + { + public NetCdfValue(string value, string name, bool set, AttrPosition videoId = AttrPosition.GLOBAL, DataType type = DataType.STRING) + { + value_ = value; + name_ = name; + set_ = set; + videoId_ = videoId; + type_ = type; + } + + public string value_ { get; set; } + public string name_ { get; set; } + public bool set_ { get; set; } + public DataType type_ { get; set; } + public AttrPosition videoId_ { get; set; } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IOscilloScope/IOscilloScope.cs b/Source/TSRealLib/HAL/Interfaces/IOscilloScope/IOscilloScope.cs new file mode 100644 index 0000000..39d6bf8 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IOscilloScope/IOscilloScope.cs @@ -0,0 +1,79 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; + +namespace Raytheon.Instruments +{ + public interface IOscilloScope : IInstrument + { + [UmsCommand( "IOscilloScope.IOQuery" )] + string IOQuery( string command ); + + [UmsCommand( "IOscilloScope.IOWrite" )] + void IOWrite( string command, bool shallWeCheckForError = true ); + + [UmsCommand( "IOscilloScope.MeasureFallTime" )] + double MeasureFallTime( int channelNumber ); + + [UmsCommand( "IOscilloScope.MeasureFrequency" )] + double MeasureFrequency( int channelNumber ); + + [UmsCommand( "IOscilloScope.MeasureMaxVoltage" )] + double MeasureMaxVoltage( int channelNumber ); + + [UmsCommand( "IOscilloScope.MeasureMinVoltage" )] + double MeasureMinVoltage( int channelNumber ); + + [UmsCommand( "IOscilloScope.MeasurePulseWidth" )] + double MeasurePulseWidth( int channelNumber ); + + [UmsCommand( "IOscilloScope.MeasureRiseTime" )] + double MeasureRiseTime( int channelNumber ); + + [UmsCommand( "IOscilloScope.MeasureVoltageLevel" )] + double MeasureVoltageLevel( int channelNumber ); + + [UmsCommand( "IOscilloScope.ConfigureChannel" )] + void ConfigureChannel( int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance ); + + [UmsCommand( "IOscilloScope.SetupTrigger" )] + void SetupTrigger( bool useRisingEdge, int channelNumber, double triggerLevel ); + + [UmsCommand( "IOscilloScope.HasItTriggered" )] + bool HasItTriggered( ); + + [UmsCommand( "IOscilloScope.SaveImage" )] + void SaveImage( string fileName ); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IOscilloScope/IOscilloScope.csproj b/Source/TSRealLib/HAL/Interfaces/IOscilloScope/IOscilloScope.csproj new file mode 100644 index 0000000..325e7b4 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IOscilloScope/IOscilloScope.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.OscilloScope.Contracts + OscilloScope Instrument Interface + HAL + + + + 1.3.0.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IPowerMeter/IPowerMeter.cs b/Source/TSRealLib/HAL/Interfaces/IPowerMeter/IPowerMeter.cs new file mode 100644 index 0000000..0b2e726 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IPowerMeter/IPowerMeter.cs @@ -0,0 +1,64 @@ +// ******************************************************************************************* +// ** ** +// ** IPowerMeter.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Raytheon.Communication; +using Raytheon.Units; +using System.Diagnostics.CodeAnalysis; + +namespace Raytheon.Instruments +{ + [UmsContract] + public interface IPowerMeter : IInstrument + { + [UmsCommand("IPowerMeter.EnableChannel")] + bool EnableChannel(int channel, bool enable); + + [UmsCommand("IPowerMeter.GetMeasurement")] + Power GetMeasurement(int channel); + + [UmsCommand("IPowerMeter.SetFrequency")] + bool SetFrequency(int channel, Frequency frequency); + + [UmsCommand("IPowerMeter.ZeroMeter")] + bool ZeroMeter(); + + int Channels { [UmsCommand("IPowerMeter.GetChannels")]get; } + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IPowerMeter/IPowerMeter.csproj b/Source/TSRealLib/HAL/Interfaces/IPowerMeter/IPowerMeter.csproj new file mode 100644 index 0000000..a26bc4c --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IPowerMeter/IPowerMeter.csproj @@ -0,0 +1,20 @@ + + + + + net472 + Raytheon.Instruments.PowerMeter.Contracts + Instrument interface for General IO + HAL + + + + 3.1.0 + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/Constants.cs b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/Constants.cs new file mode 100644 index 0000000..cce4c53 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/Constants.cs @@ -0,0 +1,28 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +namespace Raytheon.Instruments.PowerSupply +{ + /// + /// A spot to hold application constants + /// + public static class Constants + { + public const string PowerSupplySystemDefFilename = "POWER_SUPPLY_SYSTEMS.ini"; + } +} + diff --git a/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/IPowerSupplySystem.cs b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/IPowerSupplySystem.cs new file mode 100644 index 0000000..948eceb --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/IPowerSupplySystem.cs @@ -0,0 +1,243 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using Raytheon.Instruments.PowerSupply; +using System.Collections.Generic; + +namespace Raytheon.Instruments +{ + /// + /// An interface for power systems to implement. + /// + [UmsContract] + public interface IPowerSupplySystem : IInstrument + { + /// + /// Get the power system error register + /// + /// The register value + /// + [UmsCommand( "IPowerSupplySystem.GetErrorCode" )] + string GetErrorCode( out int errorCode ); + + /// + /// Get a list of modules that belong to this power system + /// + /// A list of modules belonging to this system + [UmsCommand( "IPowerSupplySystem.GetModuleNames" )] + List GetModuleNames( ); + + /// + /// Get the dictionary that contains configuration information for each module + /// + /// + Dictionary GetPowerSupplyModuleInfoDict(string powerSystem); + + /// + /// Retrieve the programmed OCP value of a module + /// + /// The module to query + /// The programmed setting + [UmsCommand( "IPowerSupplySystem.GetOverCurrentSetting" )] + double GetOverCurrentSetting( string moduleName ); + + /// + /// Retrieve the programmed OVP value of a module + /// + /// The module to query + /// The programmed setting + [UmsCommand( "IPowerSupplySystem.GetOverVoltageSetting" )] + double GetOverVoltageSetting( string moduleName ); + + /// + /// Retrieve the programmed slew value of a module + /// + /// The module to query + /// The programmed setting + [UmsCommand( "IPowerSupplySystem.GetSlewRate" )] + double GetSlewRate( string name ); + + /// + /// returns back system name + /// + /// + [UmsCommand( "IPowerSupplySystem.GetSystemName" )] + string GetSystemName( ); + + /// + /// Retrieve the programmed voltage setpoint value of a module + /// + /// The module to query + /// The programmed setting + [UmsCommand( "IPowerSupplySystem.GetVoltageSetting" )] + double GetVoltageSetting( string moduleName ); + + /// + /// Query a supple to see if output is enabled + /// + /// The module to query + /// true if output is on, false if it is off + [UmsCommand( "IPowerSupplySystem.IsOutputOn" )] + bool IsOutputOn( string moduleName ); + + /// + /// Measure the current of a module + /// + /// The module to query + /// The measured current + [UmsCommand( "IPowerSupplySystem.MeasureCurrent" )] + double MeasureCurrent( string moduleName ); + + /// + /// Measure the voltage of a module + /// + /// The module to query + /// The measured current + [UmsCommand( "IPowerSupplySystem.MeasureVoltage" )] + double MeasureVoltage( string moduleName ); + + /// + /// Turn off a module output + /// + /// The module to turn off + [UmsCommand( "IPowerSupplySystem.Off" )] + void Off( string moduleName ); + + /// + /// Turn on a module output + /// + /// The module to turn on + [UmsCommand( "IPowerSupplySystem.On" )] + void On( string moduleName ); + + /// + /// Read the protection status register + /// + /// The module to read + /// The register value + [UmsCommand( "IPowerSupplySystem.ReadProtectionStatus" )] + int ReadProtectionStatus( string moduleName ); + + /// + /// Read the power data for a module + /// + /// The module to read + /// THe Power Data + [UmsCommand( "IPowerSupplySystem.ReadPowerData" )] + void ReadPowerData( string moduleName, out double voltage, out double voltageSetpoint, out double current, out bool outputStatus, out int faultStatus ); + + /// + /// Set the slew rate + /// + /// The module to set + /// The slew rate + [UmsCommand( "IPowerSupplySystem.SetSlewRate" )] + void SetSlewRate( string moduleName, double commandedSlew ); + + /// + /// Resets the setpoint voltage to that which was passed into the constructor + /// + /// The module to reset + [UmsCommand( "IPowerSupplySystem.SetInitialVoltage" )] + void SetInitialVoltage( string moduleName ); + + /// + /// Set the voltage setpoint. Use this if you want to change the setpoint to a value that is different than what the module was initialized with + /// + /// The module to set + /// The value to set it to + [UmsCommand( "IPowerSupplySystem.SetVoltageSetpoint" )] + void SetVoltageSetpoint( string moduleName, double volts ); + + /// + /// Disable the system watchdog + /// + [UmsCommand( "IPowerSupplySystem.WatchdogDisable" )] + void WatchdogDisable( ); + + /// + /// Enable the system watchdog + /// + /// The time in seconds which the app must communicate with the power system before the system get inhibited + [UmsCommand( "IPowerSupplySystem.WatchdogEnable" )] + void WatchdogEnable( uint time ); + + /// + /// Set the OCP. Use this if you want to change OCP to a value that is different than what the module was initialized with + /// + /// The module to set + /// The value to set it to + [UmsCommand( "IPowerSupplySystem.SetOverCurrentProtection" )] + void SetOverCurrentProtection( string moduleName, double ocpValue ); + + /// + /// Set the OVP. Use this if you want to change OVP to a value that is different than what the module was initialized with + /// + /// The module to set + /// The value to set it to + [UmsCommand( "IPowerSupplySystem.SetOverVoltageProtection" )] + void SetOverVoltageProtection( string moduleName, double ovpValue ); + + /// + /// Send a command and return the response + /// + /// + /// + [UmsCommand( "IPowerSupplySystem.IOQuery" )] + string IOQuery( string command ); + + /// + /// Send a command + /// + /// + [UmsCommand( "IPowerSupplySystem.IOWrite" )] + void IOWrite( string command ); + + /// + /// Read the power data for a module + /// + /// The module to read + /// THe Power Data + [UmsCommand( "IPowerSupplySystem.ReadPowerData" )] + PowerData ReadPowerData( string moduleName ); + + /// + /// Control the power supply internal mechanical relay state + /// + /// The module to act on + /// True to connect, false to disconnect + [UmsCommand( "IPowerSupplySystem.MechanicalRelayOutputControl" )] + void MechanicalRelayOutputControl( string moduleName, bool shallWeConnect ); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/IPowerSupplySystem.csproj b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/IPowerSupplySystem.csproj new file mode 100644 index 0000000..6ebf342 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/IPowerSupplySystem.csproj @@ -0,0 +1,18 @@ + + + + net472 + Raytheon.Instruments.PowerSupplySystem.Contracts + IPowerSupplySystem Instrument Interface + HAL + + + + 1.3.0.0 + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerData.cs b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerData.cs new file mode 100644 index 0000000..e962c08 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerData.cs @@ -0,0 +1,95 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments.PowerSupply +{ + + /// + /// A container for holding power supply data + /// + + [Serializable] + [DataContract] + public class PowerData + { + /// + /// The constructor + /// + /// + /// + /// + /// + /// + /// + /// + public PowerData(double voltage, double voltageSetpoint, double overVoltageProtection, double current, double overCurrentProtection, bool outputStatus, int faultStatus) + { + Voltage = voltage; + VoltageSetpoint = voltageSetpoint; + OverVoltageProtection = overVoltageProtection; + Current = current; + OverCurrentProtection = overCurrentProtection; + OutputStatus = outputStatus; + FaultStatus = faultStatus; + } + + /// + /// Getter for the Current + /// + [DataMember] + public double Current { get; set; } + + /// + /// Getter for the fault status + /// + [DataMember] + public int FaultStatus { get; set; } + + /// + /// Getter for the output status + /// + [DataMember] + public bool OutputStatus { get; set; } + + /// + /// Getter for OCP value + /// + [DataMember] + public double OverCurrentProtection { get; set; } + + /// + /// Getter for OVP value + /// + [DataMember] + public double OverVoltageProtection { get; set; } + + /// + /// Getter for the voltage measurement + /// + [DataMember] + public double Voltage { get; set; } + + /// + /// Getter for voltage setpoint + /// + [DataMember] + public double VoltageSetpoint { get; set; } + } +} diff --git a/Source/Interfaces/PowerSupply/PowerSupplyConfigIni.cs b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyConfigIni.cs similarity index 88% rename from Source/Interfaces/PowerSupply/PowerSupplyConfigIni.cs rename to Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyConfigIni.cs index c1c8c3d..e8b08fc 100644 --- a/Source/Interfaces/PowerSupply/PowerSupplyConfigIni.cs +++ b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyConfigIni.cs @@ -21,16 +21,15 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Raytheon.Instruments.PowerSupplies +namespace Raytheon.Instruments.PowerSupply { - public enum PowerSupplyConfigIni + public enum ConfigIni { - // list all the sections here - GENERAL, - // list all the keys here + SCPI_DEF_FILEPATH, ETHERNET_ADDRESS, ETHERNET_PORT, + ENABLE_OUTPUT_COUPLING_PROTECTION, MODULE_DEFINITION, COUPLED_MODULES, GROUPED_MODULES, @@ -42,6 +41,7 @@ namespace Raytheon.Instruments.PowerSupplies MIN_VOLTAGE, MAX_VOLTAGE, MIN_CURRENT, - MAX_CURRENT + MAX_CURRENT, + IN_RUSH_DELAY_SECS } } diff --git a/Source/Interfaces/PowerSupply/PowerSupplyConfigXml.cs b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyConfigXml.cs similarity index 90% rename from Source/Interfaces/PowerSupply/PowerSupplyConfigXml.cs rename to Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyConfigXml.cs index 676aed9..79a436c 100644 --- a/Source/Interfaces/PowerSupply/PowerSupplyConfigXml.cs +++ b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyConfigXml.cs @@ -21,11 +21,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Raytheon.Instruments.PowerSupplies +namespace Raytheon.Instruments.PowerSupply { - public enum PowerSupplyConfigXml + public enum ConfigXml { // list all the keys here - INI_FILE_PATH + POWER_SUPPLY_SYSTEM_DEF_FILEPATH } } diff --git a/Source/Interfaces/PowerSupply/PowerSupplyModuleInfo.cs b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyModuleInfo.cs similarity index 84% rename from Source/Interfaces/PowerSupply/PowerSupplyModuleInfo.cs rename to Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyModuleInfo.cs index 443722f..abe8116 100644 --- a/Source/Interfaces/PowerSupply/PowerSupplyModuleInfo.cs +++ b/Source/TSRealLib/HAL/Interfaces/IPowerSupplySystem/PowerSupplyModuleInfo.cs @@ -21,7 +21,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Raytheon.Instruments.PowerSupplies +namespace Raytheon.Instruments.PowerSupply { public class PowerSupplyModuleInfo { @@ -39,7 +39,7 @@ namespace Raytheon.Instruments.PowerSupplies faultStatus = -1; } - public PowerSupplyModuleInfo(string moduleIndex, double overCurrentProtection, double overVoltageProtection, double voltageSetpoint, double voltageSlewRate, double minVoltage, double maxVoltage, double minCurrent, double maxCurrent) + public PowerSupplyModuleInfo(int moduleIndex, double overCurrentProtection, double overVoltageProtection, double voltageSetpoint, double voltageSlewRate, double minVoltage, double maxVoltage) { overCurrentProtection_ = overCurrentProtection; overVoltageProtection_ = overVoltageProtection; @@ -47,12 +47,10 @@ namespace Raytheon.Instruments.PowerSupplies voltageSlewRate_ = voltageSlewRate; voltageLowerLimit_ = minVoltage; voltageUpperLimit_ = maxVoltage; - currentLowerLimit_ = minCurrent; - currentUpperLimit_ = maxCurrent; isOn_ = false; faultStatus = -1; - moduleNameFormat = "(@" + moduleIndex + ")"; + moduleNameFormat = $"(@{moduleIndex})"; } public string moduleNameFormat; diff --git a/Source/TSRealLib/HAL/Interfaces/ISignalGenerator/ISignalGenerator.cs b/Source/TSRealLib/HAL/Interfaces/ISignalGenerator/ISignalGenerator.cs new file mode 100644 index 0000000..d5ae4d2 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ISignalGenerator/ISignalGenerator.cs @@ -0,0 +1,60 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using Raytheon.Framework; + +namespace Raytheon.Instruments +{ + /// + /// An interface for Signal Generators to implement. + /// + [UmsContract] + public interface ISignalGenerator : IInstrument + { + [UmsCommand("ISignalGenerator.Enable")] + void Enable(bool enable); + + [UmsCommand("ISignalGenerator.IOQuery")] + string IOQuery(string command); + + [UmsCommand("ISignalGenerator.IOWrite")] + void IOWrite(string command, bool shallWeCheckForError = true); + + [UmsCommand("ISignalGenerator.SetFrequency")] + void SetFrequency(UnitizedValue frequency); + + [UmsCommand("ISignalGenerator.SetPowerLevel")] + void SetPowerLevel(UnitizedValue powerLevel); + } +} \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/ISignalGenerator/ISignalGenerator.csproj b/Source/TSRealLib/HAL/Interfaces/ISignalGenerator/ISignalGenerator.csproj new file mode 100644 index 0000000..382eebc --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ISignalGenerator/ISignalGenerator.csproj @@ -0,0 +1,20 @@ + + + + net472 + Raytheon.Instruments.SignalGenerator.Contracts + SignalGenerator Instrument Interface + HAL + + + + 1.0.3.0 + + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/ISpecAnalyzer/ISpecAnalyzer.cs b/Source/TSRealLib/HAL/Interfaces/ISpecAnalyzer/ISpecAnalyzer.cs new file mode 100644 index 0000000..c287305 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ISpecAnalyzer/ISpecAnalyzer.cs @@ -0,0 +1,94 @@ +// ****************************************************************************************** +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. ** +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + [DataContract] + public enum SpecAnAveragingType + { + [EnumMember] + RMS, + [EnumMember] + LOG, + [EnumMember] + NONE + }; + + /// + /// An interface for Spectrum Analyzers to implement. + /// + [UmsContract] + public interface ISpecAnalyzer : IInstrument + { + /// + /// + /// + /// + /// + [UmsCommand("ISpecAnalyzer.ConfigureAveraging")] + void ConfigureAveraging(SpecAnAveragingType type, int numOfAverages); + + /// + /// + /// + /// -99 represents auto[TBR] + /// -99 represents auto[TBR]< + [UmsCommand("ISpecAnalyzer.ConfigureBandwidth")] + void ConfigureBandwidth(int rbw, int vbw); + + [UmsCommand("ISpecAnalyzer.ConfigureFrequency")] + void ConfigureFrequency(int centerFreq, int span); + + /// + /// + /// + /// -99 represents auto[TBR] + [UmsCommand("ISpecAnalyzer.ConfigurePowerLevel")] + void ConfigurePowerLevel(int attenuation); + + [UmsCommand("ISpecAnalyzer.IOQuery")] + string IOQuery(string command, int timeout = 10000); + + [UmsCommand("ISpecAnalyzer.IOWrite")] + void IOWrite(string command, bool shallWeCheckForError = true); + + [UmsCommand("ISpecAnalyzer.MeasurePeakAmplitude")] + double MeasurePeakAmplitude(); + + [UmsCommand("ISpecAnalyzer.MeasurePeakFrequency")] + double MeasurePeakFrequency(); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/ISpecAnalyzer/ISpecAnalyzer.csproj b/Source/TSRealLib/HAL/Interfaces/ISpecAnalyzer/ISpecAnalyzer.csproj new file mode 100644 index 0000000..9b9a2b5 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ISpecAnalyzer/ISpecAnalyzer.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.SpecAnalyzer.Contracts + SpecAnalyzer Instrument Interface + HAL + + + + 1.1.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/ISwitch/ISwitch.cs b/Source/TSRealLib/HAL/Interfaces/ISwitch/ISwitch.cs new file mode 100644 index 0000000..7df89ee --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ISwitch/ISwitch.cs @@ -0,0 +1,84 @@ +// ******************************************************************************************* +// ** ** +// ** ISwitch.cs +// ** 4/14/2023 +// ** ** +// ** RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION ** +// ** PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS ** +// ** AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO ** +// ** UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO ** +// ** RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS ** +// ** CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS ** +// ** OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON ** +// ** COMPANY. ** +// ** ** +// ** THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. ** +// ** GOVERNMENT. ** +// ** ** +// ** UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023. +// ** ** +// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE ** +// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED ** +// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION ** +// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION ** +// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER ** +// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER ** +// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS ** +// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT ** +// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL ** +// ** PENALTIES. ** +// ** ** +// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED ** +// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE ** +// ** PROJECTS/PROGRAMS. ** +// ** ** +// ******************************************************************************************* + +using Raytheon.Communication; + +namespace Raytheon.Instruments +{ + /// + /// ISwitch - base interface to a switch device + /// + [UmsContract] + public interface ISwitch : IInstrument + { + /// + /// Connects the specified path. + /// + /// The path. + [UmsCommand("ISwitch.Connect")] + void Connect(string path); + + /// + /// Disconnects the specified path. + /// + /// The path. + [UmsCommand("ISwitch.Disconnect")] + void Disconnect(string path); + + /// + /// Disconnects all paths (opens all switches). + /// + [UmsCommand("ISwitch.DisconnectAll")] + void DisconnectAll(); + + /// + /// Gets a value indicating whether this instance is debounced. + /// + /// + /// true if this instance is debounced; otherwise, false. + /// + bool IsDebounced + { + [UmsCommand("ISwitch.GetIsDebounced")] + get; + } + + //*** possible enhancements + //bool CanConnect(string path); + //string[] GetInputChannelNames(); + //string[] GetOutputChannelNames(); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/ISwitch/ISwitch.csproj b/Source/TSRealLib/HAL/Interfaces/ISwitch/ISwitch.csproj new file mode 100644 index 0000000..a6b6903 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ISwitch/ISwitch.csproj @@ -0,0 +1,18 @@ + + + + net472 + Raytheon.Instruments.Switch.Contracts + Standard Switch Instrument Interface + Library + + + + 1.6.0 + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/HAL/Interfaces/ITempMonitor/ITempMonitor.cs b/Source/TSRealLib/HAL/Interfaces/ITempMonitor/ITempMonitor.cs new file mode 100644 index 0000000..50f740b --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ITempMonitor/ITempMonitor.cs @@ -0,0 +1,36 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Communication; +using System; + +namespace Raytheon.Instruments +{ + /// + /// This interfaces defines the API for a temperature monitor + /// + [UmsContract] + public interface ITempMonitor : IInstrument + { + /// + /// + /// + /// + [UmsCommand("ITempMonitor.ReadTemperature")] + double ReadTemperature(); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/ITempMonitor/ITempMonitor.csproj b/Source/TSRealLib/HAL/Interfaces/ITempMonitor/ITempMonitor.csproj new file mode 100644 index 0000000..8bd2225 --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/ITempMonitor/ITempMonitor.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.TempMonitor.Contracts + TempMonitor Instrument Interface + HAL + + + + 1.0.3.0 + + + + + + + + diff --git a/Source/TSRealLib/HAL/Interfaces/IVideoRecorder/IVideoRecorder.cs b/Source/TSRealLib/HAL/Interfaces/IVideoRecorder/IVideoRecorder.cs new file mode 100644 index 0000000..dfc0b8c --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IVideoRecorder/IVideoRecorder.cs @@ -0,0 +1,83 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Communication; +using System; +using System.Runtime.Serialization; + +namespace Raytheon.Instruments +{ + /// + /// the format saving video + /// + [DataContract] + public enum VideoSaveFormat : uint + { + [EnumMember] + BIN, + [EnumMember] + NCDF + }; + + /// + /// MOVE - rename the file or change the path on the local system + /// COPY_AND_DELETE - Copy the file and delete the original + /// + [DataContract] + public enum MoveControl : uint + { + [EnumMember] + MOVE, + [EnumMember] + COPY_AND_DELETE + }; + + + /// + /// An interface for video recording implementations. + /// + [UmsContract] + public interface IVideoRecorder : IInstrument + { + [UmsCommand("IVideoRecorder.AddNcdfAttributes")] + void AddNcdfAttributes(string videoFile, string attributeFile); + + [UmsCommand("IVideoRecorder.Connect")] + void Connect(); + + [UmsCommand("IVideoRecorder.Disconnect")] + void Disconnect(); + + [UmsCommand("IVideoRecorder.GrabVideoToDisk")] + void GrabVideoToDisk(uint numberOfFrames, VideoSaveFormat format); + + [UmsCommand("IVideoRecorder.")] + void MoveFile(string fromFile, string toFile, MoveControl control); + + [UmsCommand("IVideoRecorder.QueryHardDrive")] + void QueryHardDrive(ref float driveSpace1, ref float driveSpace2, ref float driveSpace3, ref float driveSpace4); + + [UmsCommand("IVideoRecorder.ShowLiveVideo")] + void ShowLiveVideo(); + + [UmsCommand("IVideoRecorder.StopLiveVideo")] + void StopLiveVideo(); + + [UmsCommand("IVideoRecorder.WaitForGrabToComplete")] + string WaitForGrabToComplete(int timeoutms); + } +} diff --git a/Source/TSRealLib/HAL/Interfaces/IVideoRecorder/IVideoRecorder.csproj b/Source/TSRealLib/HAL/Interfaces/IVideoRecorder/IVideoRecorder.csproj new file mode 100644 index 0000000..f2f175e --- /dev/null +++ b/Source/TSRealLib/HAL/Interfaces/IVideoRecorder/IVideoRecorder.csproj @@ -0,0 +1,19 @@ + + + + net472 + Raytheon.Instruments.VideoRecorder.Contracts + VideoRecorder Instrument Interface + HAL + + + + 1.0.4.0 + + + + + + + + diff --git a/Source/TSRealLib/MAL/ManagerMaster/Raytheon.MAL/MalMeasurementLibManager.cs b/Source/TSRealLib/MAL/ManagerMaster/Raytheon.MAL/MalMeasurementLibManager.cs new file mode 100644 index 0000000..ac19958 --- /dev/null +++ b/Source/TSRealLib/MAL/ManagerMaster/Raytheon.MAL/MalMeasurementLibManager.cs @@ -0,0 +1,330 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY +WARNING - THIS DOCUMENT CONTAINS TECHNICAL DATA WHOSE EXPORT OR DISCLOSURE +TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED BY THE INTERNATIONAL +TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTIONS 120-130). VIOLATIONS +ARE SUBJECT TO SEVERE CRIMINAL PENALTIES. + +DISTRIBUTION STATEMENT F: FURTHER DISSEMINATION ONLY AS DIRECTED BY MISSILE +DEFENSE AGENCY, MDA/GMY NEXT GENERATION INTERCEPTOR PROJECT OFFICE +(DATE OF DETERMINATION 14 JUNE 2021) OR HIGHER DOD AUTHORITY. +OTHER REQUESTS FOR THIS DOCUMENT SHALL BE REFERRED TO: MISSILE DEFENSE +AGENCY, CONTRACTS DIRECTORATE, ATTN: GMY-K, BLDG. 5222 MARTIN ROAD, +REDSTONE ARSENAL, AL 35898. + +WARNING - THIS DOCUMENT CONTAINS TECHNICAL DATA WHOSE EXPORT IS RESTRICTED +BY THE ARMS EXPORT CONTROL ACT (TITLE 22, U.S.C., SEC 2751, ET SEQ.) OR +THE EXPORT ADMINISTRATION ACT OF 1979 (TITLE 50, U.S.C., APP.2401 ET SEQ), +AS AMENDED. VIOLATIONS OF THESE EXPORT LAWS ARE SUBJECT TO SEVERE CRIMINAL +PENALTIES. DISSEMINATE IN ACCORDANCE WITH PROVISIONS OF +DOD DIRECTIVE 5230.25 + +DESTRUCTION NOTICE - FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN +DOD 5220.22-M, +NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR +DODM 5200.01-VOLUME 3, DOD INFORMATION SECURITY PROGRAM: PROTECTION OF +CLASSIFIED INFORMATION, ENCLOSURE 3, SECTION 17. FOR CONTROLLED +UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION +-------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; + +using Raytheon.Instruments; +using static MeasurementManagerLib.BitMeasurementManager; + +namespace MeasurementManagerLib +{ + /// + /// + /// + public class MalMeasurementLibManager : IDisposable + { + public FpgaMeasurementManager FpgaMeasurementManager { get; set; } + public PowerSupplyMeasurementManager PowerSupplyMeasurementManager { get; set; } + public SwitchMeasurementManager SwitchMeasurementManager { get; set; } + public BitMeasurementManager BitMeasurementManager { get; set; } + public BitGenSoftMeasurementManager BitGenSoftMeasurementManager { get; set; } + public ChillerCartMeasurementManager ChillerMeasurementManager { get; set; } + public DioMeasurementManager DioMeasurementManager { get; set; } + public JtagMeasurementManager JtagMeasurementManager { get; set; } + public VideoRecorderMeasurementManager VideoRecorderMeasurementManager { get; set; } + public RelayMeasurementManager RelayMeasurementManager { get; set; } + public RfMeasurementManager RfMeasurementManager { get; set; } + public SpaceChamberLSPSMeasurementManager SpaceChamberLSPSMeasurementManager { get; set; } + public TelemetryMeasurementManager TelemetryMeasurementManager { get; set; } + public CryoMeasurementManager CryoMeasurementManager { get; set; } + public OpticalBenchMeasurementManager OpticalBenchMeasurementManager { get; set; } + + public IInstrumentManager InstrumentManager { get; set; } + + ~MalMeasurementLibManager() + { + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + } + + #region PublicFunctions + /// + /// + /// + /// + public MalMeasurementLibManager(IInstrumentManager instrumentManager) + { + InstrumentManager = instrumentManager; + } + + /// + /// Dispose of all resources + /// + public void Dispose() + { + Dispose(true); + } + + /// + /// Initialize the BIT interface manager + /// + /// + /// + public void InitializeBitMeasurementManager(string measurementDefFile, string comDeviceName, string comNodeName, string binDataLogFilename, string asciiDataLogFileName, MessageReceivedDelegate callback) + { + // create the object once no matter how many times the host calls this + if (BitMeasurementManager == null) + { + BitMeasurementManager = new BitMeasurementManager(InstrumentManager, measurementDefFile, comDeviceName, comNodeName, binDataLogFilename, asciiDataLogFileName, callback); + } + } + + /// + /// Initialize the BIT interface manager + /// + /// + /// + /// + public void InitializeBitGenSoftMeasurementManager(List instrumentNames) + { + if (BitGenSoftMeasurementManager == null) + { + BitGenSoftMeasurementManager = new BitGenSoftMeasurementManager(InstrumentManager, instrumentNames); + } + } + + /// + /// Initialize the Chiller interface manager + /// + /// + /// + /// + /// + /// + public void InitializeChillerCartMeasurementManager(string chillerName, string flowMeeterName, string tempSensorName, string errorLog) + { + // create the object once no matter how many times the host calls this + if (ChillerMeasurementManager == null) + { + ChillerMeasurementManager = new ChillerCartMeasurementManager(InstrumentManager, chillerName, flowMeeterName, tempSensorName, errorLog); + } + } + + /// + /// Initialize the Dio interface manager + /// + /// + /// + public void InitializeDioMeasurementManager() + { + // create the object once no matter how many times the host calls this + if (DioMeasurementManager == null) + { + DioMeasurementManager = new DioMeasurementManager(InstrumentManager); + } + } + + /// + /// Initialize the Jtag interface manager + /// + /// + /// + /// + /// + public void InitializeJtagMeasurementManager(string instrumentName, string measurementDefFile) + { + // create the object once no matter how many times the host calls this + if (JtagMeasurementManager == null) + { + JtagMeasurementManager = new JtagMeasurementManager(InstrumentManager, instrumentName, measurementDefFile); + } + } + + /// + /// Initialize the fpga communication manager + /// + /// + /// + /// + public void InitializeFpgaMeasurementManager(List instrumentNames, string instrumentDefFile) + { + // create the object once no matter how many times the host calls this + if (FpgaMeasurementManager == null) + { + FpgaMeasurementManager = new FpgaMeasurementManager(InstrumentManager, instrumentNames, instrumentDefFile); + } + } + + /// + /// Initialize the power system and connect to the power supplies + /// + /// + /// + public void InitializePowerSupplyMeasurementManager() + { + // create the object once no matter how many times the host calls this + if (PowerSupplyMeasurementManager == null) + { + PowerSupplyMeasurementManager = new PowerSupplyMeasurementManager(InstrumentManager); + } + } + + /// + /// Initialize the relay manager + /// + /// + /// + /// + public void InitializeRelayMeasurementManager(List instrumentNames, string configFileName) + { + // create the object once no matter how many times the host calls this + if (RelayMeasurementManager == null) + { + RelayMeasurementManager = new RelayMeasurementManager(InstrumentManager, instrumentNames, configFileName); + } + } + + /// + /// Initializes Rf Measurement Manager + /// + /// + /// + /// + /// + /// + /// + public void InitializeRfMeasurementManager(List switchInstrumentNames, string powerMeeterName, string signalGeneratorName, string specAnalyzerName, string configFileName) + { + // create the object once no matter how many times the host calls this + if (RfMeasurementManager == null) + { + RfMeasurementManager = new RfMeasurementManager(InstrumentManager, switchInstrumentNames, powerMeeterName, signalGeneratorName, specAnalyzerName, configFileName); + } + } + + /// + /// Initializes Space Chamber LSPS Measurement Manager + /// + /// + /// + /// + public void InitializeSpaceChamberLSPSMeasurementManager(string lspsChamber, string netCdfData) + { + // create the object once no matter how many times the host calls this + if (SpaceChamberLSPSMeasurementManager == null) + { + SpaceChamberLSPSMeasurementManager = new SpaceChamberLSPSMeasurementManager(InstrumentManager, lspsChamber, netCdfData); + } + } + + /// + /// Initializes Switch Measurement Manager + /// + /// + /// + /// + /// + /// + public void InitializeSwitchMeasurementManager() + { + // create the object once no matter how many times the host calls this + if (SwitchMeasurementManager == null) + { + SwitchMeasurementManager = new SwitchMeasurementManager(InstrumentManager); + } + } + + /// + /// Initialize the video recorder manager + /// + /// + /// + public void InitializeVideoRecorderMeasurementManager(string deviceName) + { + // create the object once no matter how many times the host calls this + if (VideoRecorderMeasurementManager == null) + { + VideoRecorderMeasurementManager = new VideoRecorderMeasurementManager(InstrumentManager, deviceName); + } + } + + /// + /// Initializes Cryo Measurement Manager + /// + /// + /// + /// + /// + /// + public void InitializeCryoMeasurementManager(string commDeviceName, string serialDeviceName, bool isThereHardware, string errorLogFileName) + { + // create the object once no matter how many times the host calls this + if (CryoMeasurementManager == null) + { + CryoMeasurementManager = new CryoMeasurementManager(InstrumentManager, commDeviceName, serialDeviceName, isThereHardware, errorLogFileName); + } + } + + /// + /// Initializes Optical Bench Measurement Manager + /// + /// + /// + /// + /// + public void InitializeOpticalBenchMeasurementManager(string instrumentName, string measurementDefFile, string instrumentDefFile) + { + // create the object once no matter how many times the host calls this + if (OpticalBenchMeasurementManager == null) + { + OpticalBenchMeasurementManager = new OpticalBenchMeasurementManager(InstrumentManager, instrumentName, measurementDefFile, instrumentDefFile); + } + } + + /// + /// initializes Telemetry Measurement Manager for multiple instruments + /// + /// + /// + public void InitializeTelemetryMeasurementManager(List instrumentNames, string telemetryMalFile) + { + + // create the object once no matter how many times the host calls this + if (TelemetryMeasurementManager == null) + { + TelemetryMeasurementManager = new TelemetryMeasurementManager(InstrumentManager, instrumentNames, telemetryMalFile); + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/ManagerMaster/Raytheon.MAL/Raytheon.MAL.csproj b/Source/TSRealLib/MAL/ManagerMaster/Raytheon.MAL/Raytheon.MAL.csproj new file mode 100644 index 0000000..808b035 --- /dev/null +++ b/Source/TSRealLib/MAL/ManagerMaster/Raytheon.MAL/Raytheon.MAL.csproj @@ -0,0 +1,39 @@ + + + + net472 + Library + Raytheon.MAL + Measure Manager Master + Packages all Measurement Manager assemblies into one package + + + + + + 1.0.0 + + + + NU1603 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BITCommand.cs b/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BITCommand.cs new file mode 100644 index 0000000..29b0c7d --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BITCommand.cs @@ -0,0 +1,215 @@ +// ********************************************************************************************************** +// BITCommand.cs +// 8/31/2023 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// DISTRIBUTION STATEMENT F: FURTHER DISSEMINATION ONLY AS DIRECTED BY +// MISSILE DEFENSE AGENCY, MDA/GMY NEXT GENERATION INTERCEPTOR PROJECT +// OFFICE (DATE OF DETERMINATION 14 JUNE 2021) OR HIGHER DOD AUTHORITY. +// OTHER REQUESTS FOR THIS DOCUMENT SHALL BE REFERRED TO: MISSILE DEFENSE +// AGENCY, CONTRACTS DIRECTORATE, ATTN: GMY‐K, BLDG. 5222 MARTIN ROAD, +// REDSTONE ARSENAL, AL 35898. +// +// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA WHOSE EXPORT IS +// RESTRICTED BY THE ARMS EXPORT CONTROL ACT (TITLE 22, U.S.C., +// SECTION 2751, ET SEQ.) OR THE EXPORT ADMINISTRATION ACT OF 1979 +// (TITLE 50 U.S.C. APP. 2401 ET SEQ.), AS AMENDED. VIOLATIONS OF +// THESE EXPORT LAWS ARE SUBJECT TO SEVERE CRIMINAL PENALTIES. +// DISSEMINATE IN ACCORDANCE WITH PROVISIONS OF DOD DIRECTIVE 5230.25. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY +// PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL +// COMPETITIVE HARM TO RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER +// SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED TO +// OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE +// EXPRESS WRITTEN APPROVAL OF RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE - FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN +// DOD 5220.22-M, NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, +// FEBRUARY 2006, INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, +// SECTION 7, OR DODM 5200.01-VOLUME 3, DOD INFORMATION SECURITY PROGRAM: +// PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, SECTION 17. FOR +// CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM +// 5200.01-VOLUME 4, INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED +// INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +// Ignore Spelling: Deserialized + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; + +namespace BitGenSoftMeasurementManagerLib +{ + + [XmlType(TypeName = "ResponseMessageType")] + public enum ResponseMessageType + { + U, // Unknown or Undefined + R, // Required + E, // Error + P // Parametric + } + + [XmlType(TypeName = "ParamType")] + public enum ParameterType + { + U, // Unknown or Undefined will default to string + N, // Numeric + S, // String + A, // Array + P // p-data array + } + + + [XmlType(TypeName = "BITResponseMsg")] + public class BITResponseMsg + { + [XmlAttribute("type")] + public ResponseMessageType ResponseType { get; set; } + + [XmlText] + public string Name { get; set; } + } + + [XmlType("Value")] + public class BITParameter + { + [XmlAttribute(AttributeName = "name")] + public string Key { get; set; } + + [XmlAttribute(AttributeName = "type")] + public ParameterType ParameterType { get; set; } + + [XmlAttribute(AttributeName = "delim")] + public string Delim { get; set; } + + [XmlText] + public string Value { get; set; } + } + + [Serializable] + public class BITCommand + { + [XmlElement(ElementName = "Command")] + public string Command { get; set; } + + [XmlElement(ElementName = "CommandTimeout")] + public uint CommandTimeout { get; set; } + + [XmlArray("CommandParameters")] + [XmlArrayItem("Value", Type = typeof(BITParameter))] + public List CommandParameters { get; set; } = new List(); + + [XmlArray("CommandResponses")] + [XmlArrayItem("BITResponseMsg", Type = typeof(BITResponseMsg))] + public List CommandResponses { get; set; } = new List(); + + [XmlElement(ElementName = "ParametricResponse")] + public string ParametricResponse { get; set; } + + [XmlElement(ElementName = "ParametricTimeout")] + public uint ParametricTimeout { get; set; } + + [XmlArray("ResponseParameters")] + [XmlArrayItem("Value", Type = typeof(BITParameter))] + public List ResponseParameters { get; set; } = new List(); + + /// + /// converts one hex parameter string into parameter array + /// + public void UnfoldHexParameters() + { + if (!CommandParameters.Any(p => p.ParameterType == ParameterType.P)) + return; + + var paramList = CommandParameters.Where(p => p.ParameterType == ParameterType.P).ToList(); + List removeList = new List(); + foreach (BITParameter param in paramList) + { + AddPDataArrayValues(param.Key, param.Value, param.Delim); + removeList.Add(param); + } + CommandParameters.RemoveAll(c => removeList.Contains(c)); + } + + /// + /// takes a hex string and breaks it up into individual characters + /// then inserts them as parameters + /// + /// + /// + /// + private void AddPDataArrayValues(string key, string value, string delim) + { + var parms = BreakByPages(value, delim); + + int index = 0; + foreach (var item in parms) + { + string itemKey = $"{key}[{index++}]"; + string itemValue = item; + CommandParameters.Add(new BITParameter { Key = itemKey, Value = itemValue } ); + } + } + + /// + /// takes a large hex string and breaks it in multiple pages based on the known header + /// adjusts the size of the page to be divisible by 4 bytes + /// and also adds a 12 byte footer of zero values to the end of the page + /// + /// + /// + /// + private static IEnumerable BreakByPages(string hexStr, string header) + { + const int footerSize = 12; + string[] pages = hexStr.Split(new[] { header }, StringSplitOptions.RemoveEmptyEntries); + + foreach (string page in pages) + { + string completePage = header + page; + int pageSize = (completePage.Length + 7) & ~7; + string paddedPage = completePage.PadRight(pageSize + (footerSize * 2), '0'); + IEnumerable hexChars = BreakIntoHexCharacters(paddedPage); + foreach (string hexChar in hexChars) + { + yield return hexChar; + } + } + } + + /// + /// takes a large string of hex characters and breaks it into individual hex values + /// then yields these values to the calling code + /// + /// + /// + public static IEnumerable BreakIntoHexCharacters(string hexString) + { + int characterSize = 2; + int length = hexString.Length; + for (int i = 0; i < length; i += characterSize) + { + if (i + characterSize > length) + { + hexString = hexString.PadRight(i + characterSize, '0'); + } + yield return "0x" + hexString.Substring(i, characterSize); + } + } + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BitGenSoftMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BitGenSoftMeasurementManager.cs new file mode 100644 index 0000000..d5c2140 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BitGenSoftMeasurementManager.cs @@ -0,0 +1,936 @@ +// ********************************************************************************************************** +// BitGenSoftMeasurementManager.cs +// 7/28/2022 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** + +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using Raytheon.Instruments.Exceptions; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +using BitGenSoftMeasurementManagerLib; + +namespace MeasurementManagerLib +{ + /// + /// Bit Gen Soft Measurement Manager class + /// + public class BitGenSoftMeasurementManager : IDisposable + { + private readonly Logger _logger = LogManager.GetCurrentClassLogger(); + + private readonly Dictionary _bitNodes = new Dictionary(); + + private readonly IInstrumentManager _instrumentManager; + private IConfigurationManager _configurationManager; + private int _checkForMessageIntervalMs = 10; + /// + /// constructor that will create a list of BIT instruments + /// + /// + /// + public BitGenSoftMeasurementManager(IInstrumentManager instrumentManager, List instrumentNames) + : this(instrumentManager) + { + try + { + foreach (string instrumentName in instrumentNames) + { + var bitNode = (IBit)_instrumentManager.GetGenericInstrument(instrumentName); + if (bitNode == null) + { + _logger.Error("Error creating TCP BIT device, check your settings"); + } + else + { + _bitNodes.Add(instrumentName, bitNode); + } + } + } + catch (Exception ex) + { + _logger.Error($"Unable to create BIT instrument\n{ex.Message}"); + } + } + + /// + /// in case instrument manager was passed from upper level + /// + /// + private BitGenSoftMeasurementManager(IInstrumentManager instrumentManager) + { + _instrumentManager = instrumentManager; + InitializeConfigurationManager(); + } + + /// + /// initializes configuration manager, + /// will use configuration path from General Instrument Manager if available + /// otherwise will try to use the instruments path + /// + private void InitializeConfigurationManager() + { + string defaultPath; + if (_instrumentManager is GeneralInstrumentManager generalinstrumentManager) + { + defaultPath = generalinstrumentManager._configLocation; + } + else + { + defaultPath = _instrumentManager._partsLocation; + } + + _configurationManager = new RaytheonConfigurationManager(defaultPath); + + var config = _configurationManager.GetConfiguration("BitGenSoftMeasurementManager"); + + _checkForMessageIntervalMs = config.GetConfigurationValue("Settings", "CheckForMessageIntervalMs", 10); + } + + /// + /// initialize COE nodes based on test type + /// + /// + /// + public void InitNodes() + { + foreach (var node in _bitNodes) + { + try + { + IBit bitNode = node.Value; + bitNode.Initialize(); + bitNode.Open(); + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + } + } + + /// + /// close all connections + /// + /// + public void Dispose() + { + foreach (var bitNode in _bitNodes) + { + bitNode.Value?.Shutdown(); + } + } + + /// + /// straight pass-through the message and parameters + /// + /// + /// + /// + /// + public bool RunBIT(string messageId, uint timeoutInMs, IEnumerable> messageParams = null) + { + if (_bitNodes.Any()) + { + IBit bitNode = _bitNodes.First().Value; + return bitNode.RunBIT(messageId, timeoutInMs, messageParams); + } + else + { + _logger.Error($"Unable to locate BIT node. No nodes defined"); + return false; + } + } + + /// + /// straight pass-through the message and parameters + /// + /// + /// + /// + /// + /// + public bool RunBIT(string instrumentName, string messageId, uint timeoutInMs, IEnumerable> messageParams = null) + { + if (_bitNodes.ContainsKey(instrumentName)) + { + return _bitNodes[instrumentName].RunBIT(messageId, timeoutInMs, messageParams); + } + else + { + _logger.Error($"Unable to locate BIT node {instrumentName}"); + return false; + } + } + + /// + /// always runs the request on the first node, + /// + /// + /// + /// + /// + /// + public BitTestResults RunBITWaitForResults(string messageIdOut, + string messageIdIn, + uint timeoutInMs, + IEnumerable> messageParams = null) + { + if (_bitNodes.Any()) + { + IBit bitNode = _bitNodes.First().Value; + return bitNode.RunBITWaitForResults(messageIdOut, messageIdIn, timeoutInMs, messageParams); + } + else + { + _logger.Error($"Unable to locate BIT node. No nodes defined"); + return null; + } + } + + /// + /// run BIT message and wait for result from the instrument based on the name + /// + /// + /// + /// + /// + /// + /// + public BitTestResults RunBITWaitForResults(string instrumentName, + string messageIdOut, + string messageIdIn, + uint timeoutInMs, + IEnumerable> messageParams = null) + { + if (_bitNodes.ContainsKey(instrumentName)) + { + return _bitNodes[instrumentName].RunBITWaitForResults(messageIdOut, messageIdIn, timeoutInMs, messageParams); + } + else + { + _logger.Error($"Unable to locate BIT node {instrumentName}"); + return null; + } + + } + + /// + /// RunBITWaitForResults for the whole list of BIT Commands + /// runs on the first node + /// + /// + /// + public List RunBITWaitForResultsList(List commands) + { + if (_bitNodes.Any()) + { + return RunBITWaitForResultsList(commands, _bitNodes.First().Value); + } + else + { + _logger.Error("Unable to locate BIT node. No nodes defined"); + return null; + } + } + + /// + /// RunBITWaitForResults for the whole list of BIT Commands + /// + /// + /// + /// + public List RunBITWaitForResultsList(string instrumentName, List commands) + { + if (_bitNodes.ContainsKey(instrumentName)) + { + return RunBITWaitForResultsList(commands, _bitNodes[instrumentName]); + } + else + { + _logger.Error($"Unable to locate BIT node {instrumentName}"); + return null; + } + + } + + /// + /// Runs BIT command and returns the results as a list + /// + /// + /// + public async Task> RunBITWaitForResultsListAsync(List commands) + { + if (_bitNodes.Any()) + { + return await RunBITWaitForResultsListAsync(commands, _bitNodes.First().Value); + } + else + { + _logger.Error("Unable to locate BIT node. No nodes defined"); + return null; + } + } + + /// + /// Runs BIT command for specific instrument and returns the results as a list + /// + /// + /// + /// + public async Task> RunBITWaitForResultsListAsync(string instrumentName, List commands) + { + if (_bitNodes.ContainsKey(instrumentName)) + { + return await RunBITWaitForResultsListAsync(commands, _bitNodes[instrumentName]); + } + else + { + _logger.Error($"Unable to locate BIT node {instrumentName}"); + return null; + } + } + + /// + /// asynchronously runs BIT command and waits for multiple results including parametric messages + /// + /// BIT instrument to run command + /// main command + /// timeout value in ms for the main response + /// optional parameters for the main command + /// list of additional response messages with their respective timeouts to wait for + /// parametric timeout value in ms + /// nack response id when provided will be expected as a possible response for either main response or parametric response + /// + /// + public async Task> RunBITWaitForResultsAsync( string instrumentName, + string bitCommandId, + int retries, + uint timeout, + IEnumerable> commandParams = null, + List parametricResponseIds = null, + uint timeout2 = 0, + string errorMessageId = null) + { + IBit bitGenSoftManager = _bitNodes[instrumentName] ?? throw new Exception("BitGenSoftManager is null. Unable to perform operation."); + + BITCommand command = BuildBITCommand(bitCommandId, retries, timeout, commandParams, parametricResponseIds, timeout2, errorMessageId); + + return await RunBITWaitForResultsListAsync(new List { command }, bitGenSoftManager); + } + + /// + /// keep reading any of the messages from the list + /// + /// + /// + /// + /// + /// + public async Task KeepReadingBitResultsListAsync(string instrumentName, List parametricResponseIds, CancellationToken token) + { + IBit bitNode = _bitNodes[instrumentName] ?? throw new Exception("BitGenSoftManager is null. Unable to perform operation."); + await KeepReadingBitResultsListAsync(parametricResponseIds, token, bitNode); + } + + /// + /// keep reading any of the messages from the list from the first node + /// + /// + /// + /// + /// + public async Task KeepReadingBitResultsListAsync(List parametricResponseIds, CancellationToken token) + { + IBit bitNode = _bitNodes.First().Value; + await KeepReadingBitResultsListAsync(parametricResponseIds, token, bitNode); + } + + /// + /// looking for a any of the messages from the list + /// + /// + /// + /// + /// + /// + public async Task> GetBitResultsListAsync(string instrumentName, List parametricResponseIds, int timeOut) + { + IBit bitNode = _bitNodes[instrumentName] ?? throw new Exception("BitGenSoftManager is null. Unable to perform operation."); + return await GetBitResultsListAsync(parametricResponseIds, timeOut, bitNode); + } + + /// + /// looking for a any of the messages from the list on the first node + /// + /// + /// + /// + /// + public async Task> GetBitResultsListAsync(List parametricResponseIds, int timeOut) + { + IBit bitNode = _bitNodes.First().Value; + return await GetBitResultsListAsync(parametricResponseIds, timeOut, bitNode); + } + + /// + /// look for results in the node until either result was found or canceled + /// + /// + /// + /// + public async Task GetBITResultsAsync(CancellationToken token, string responseId) + { + IBit bitNode = _bitNodes.First().Value; + return await GetBITResultsAsync(token, responseId, bitNode); + } + + /// + /// look for results in the node until either result was found or canceled + /// + /// + /// + /// + /// + public async Task GetBITResultsAsync(string instrumentName, CancellationToken token, string responseId) + { + IBit bitNode = _bitNodes[instrumentName] ?? throw new Exception("BitGenSoftManager is null. Unable to perform operation."); + return await GetBITResultsAsync(token, responseId, bitNode); + } + + /// + /// look for results in either node + /// + /// + /// + public BitTestResults GetBITResults(string messageId) + { + _logger.Trace($"Getting BIT result for: {messageId}."); + if (_bitNodes.Any()) + { + IBit bitNode = _bitNodes.First().Value; + return bitNode.GetBITResults(messageId); + } + else + return null; + } + + /// + /// look for results in either node + /// + /// + /// + /// + public BitTestResults GetBITResults(string instrumentName, string messageId) + { + _logger.Trace($"{instrumentName} Getting BIT result for: {messageId}."); + return _bitNodes.ContainsKey(instrumentName) ? _bitNodes[instrumentName].GetBITResults(messageId) : null; + } + + /// + /// opens a folder parse XML files for BITCommand definitions and returns a list + /// + /// + /// + public Dictionary> GetBITCommands(string directoryPath) + { + Dictionary> bitCommands = new Dictionary>(); + + try + { + string[] xmlFiles; + if (directoryPath.EndsWith(".xml", StringComparison.InvariantCultureIgnoreCase)) + { + xmlFiles = new string[] {directoryPath}; + } + else + { + // Get all XML files recursively in the specified directory + xmlFiles = Directory.GetFiles(directoryPath, "*.xml", SearchOption.TopDirectoryOnly); + } + + foreach (string xmlFile in xmlFiles) + { + ConfigurationFile configFile = new ConfigurationFile(xmlFile); + + List sections = configFile.ReadAllSections(); + + foreach (string section in sections) + { + List commands = configFile.ReadList(section, "BIT_CMD"); + if(bitCommands.ContainsKey(section)) + { + _logger.Warn($"Found a duplicate BIT configuration section {section}, overwriting from {xmlFile} file."); + } + else + { + _logger.Trace($"Adding {section} commands from {xmlFile} file"); + } + bitCommands[section] = commands; + } + } + } + catch (Exception ex) + { + _logger.Error(ex, $"Error reading BIT Command definitions in {directoryPath}"); + throw; + } + + return bitCommands; + } + + #region Private functions + + /// + /// will keep pumping messages from the receiving queue until canceled + /// + /// + /// + /// + /// + private async Task KeepReadingBitResultsListAsync(List parametricResponseIds, CancellationToken token, IBit bitNode) + { + _logger.Trace($"{bitNode.Name} Start continuously reading these messages: {string.Join(", ", parametricResponseIds)}."); + + Dictionary score = new Dictionary(); + do + { + foreach (var responseId in parametricResponseIds) + { + BitTestResults bitTestresults = await GetBITResultsAsync(token, responseId, bitNode); + + if (bitTestresults != null && !string.IsNullOrEmpty(bitTestresults.Label)) + { + if(uint.TryParse(bitTestresults.Label, out uint label)) + { + if(!score.ContainsKey(label)) + { + score.Add(label, 1); + } + else + { + score[label]++; + } + } + } + } + //await Task.Delay(_checkForMessageIntervalMs); + } while (!token.IsCancellationRequested); + + foreach (var item in score) + { + _logger.Trace($"{bitNode.Name} Dequeued the total of {item.Value} BIT messages for 0x{item.Key:X} label"); + } + } + + + /// + /// + /// + /// + /// + /// + /// + private async Task> GetBitResultsListAsync(List parametricResponseIds, int timeOut, IBit node) + { + _logger.Trace($"{node.Name} Start continuously getting BIT results for these messages: {string.Join(", ", parametricResponseIds)}."); + + List results = new List(); + + CancellationTokenSource tokenSource = new CancellationTokenSource(); + List> responseTasks = new List>(); + + foreach (var responseId in parametricResponseIds) + { + responseTasks.Add(GetBITResultsAsync(tokenSource.Token, responseId, node)); + } + + Task timeoutTask = Task.Delay(timeOut); + var completedTask = await Task.WhenAny(responseTasks.Concat(new[] { timeoutTask })); + + tokenSource.Cancel(); + tokenSource.Dispose(); + + if (completedTask == timeoutTask) + { + _logger.Warn($"Timed out after {timeOut} ms while waiting on parametrized response message(s) {string.Join(", ", parametricResponseIds)}"); + } + else + { + var completedResults = responseTasks.Where(t => t.Status == TaskStatus.RanToCompletion && t.Result != null).Select(t => t.Result); + results.AddRange(completedResults); + } + + _logger.Trace($"{node.Name} Completed getting BIT results for these messages: {string.Join(", ", parametricResponseIds)}, found {results?.Count} results"); + + return results; + } + + /// + /// look for results in the node until either result was found or canceled + /// + /// + /// + /// + /// + private async Task GetBITResultsAsync(CancellationToken token, string responseId, IBit node) + { + //_logger.Trace($"{node.Name} Start waiting for BIT message: {responseId}."); + + BitTestResults bitTestResults = null; + do + { + await Task.Delay(_checkForMessageIntervalMs); + try + { + bitTestResults = node.GetBITResults(responseId); + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + break; + } + } while (bitTestResults == null && !token.IsCancellationRequested); + + //_logger.Trace($"{node.Name} Done waiting for BIT message: {responseId}."); + + return bitTestResults; + } + + /// + /// builds a command from parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + private static BITCommand BuildBITCommand(string bitCommandId, + int retries, + uint timeout, + IEnumerable> commandParams = null, + List parametricResponseIds = null, + uint timeout2 = 0, + string errorMessageId = null) + { + BITCommand bitCommand = new BITCommand + { + Command = bitCommandId, + CommandTimeout = timeout, + CommandParameters = new List(), + CommandResponses = new List(), + ParametricResponse = retries.ToString(), + ParametricTimeout = timeout2 + }; + + if (commandParams != null) + { + foreach (var commandParameter in commandParams) + { + bitCommand.CommandParameters.Add(new BITParameter + { + Key = commandParameter.Key, + Value = commandParameter.Value, + ParameterType = ParameterType.U + }); + } + } + if(parametricResponseIds != null) + { + foreach (var response in parametricResponseIds) + { + bitCommand.CommandResponses.Add(new BITResponseMsg + { + Name = response, + ResponseType = ResponseMessageType.P + }); + } + } + if(!string.IsNullOrEmpty(errorMessageId)) + { + bitCommand.CommandResponses.Add(new BITResponseMsg + { + Name = errorMessageId, + ResponseType = ResponseMessageType.E + }); + } + + return bitCommand; + } + + /// + /// + /// + /// + /// + /// + private List RunBITWaitForResultsList(List commands, IBit node) + { + List results = new List(); + + foreach (var command in commands) + { + string bitCommand = command.Command; + string bitResponseId = ResponseGroupForFirstBITCall(command); + uint timeout = command.CommandTimeout; + uint timeout2 = command.ParametricTimeout; + string strParamerticResponse = command.ParametricResponse; + int retries = 0; + if (int.TryParse(strParamerticResponse, out int tmpretries)) + { + retries = tmpretries; + } + List> commandParams = ConvertCommandParameters(command.CommandParameters); + int runIndex = 0; + do + { + runIndex++; + try + { + var result = node.RunBITWaitForResults(bitCommand, bitResponseId, timeout, commandParams); + results.Add(result); + } + catch (BitTimeoutException) + { + _logger.Warn($"Timeout after {timeout} ms on BIT command {bitCommand} waiting for result {bitResponseId}, retry number {runIndex}"); + if (runIndex == retries) + { + throw; + } + } + } while (results == null && runIndex <= retries); + + var responseGroup = ResponseGroupListForParameterBITCall(command); + + if (responseGroup == null || !responseGroup.Any()) + { + continue; + } + + CancellationTokenSource cts = new CancellationTokenSource(); + ParallelOptions options = new ParallelOptions + { + CancellationToken = cts.Token, + MaxDegreeOfParallelism = Environment.ProcessorCount + }; + + try + { + Parallel.ForEach(responseGroup, options, item => + { + var totalWaitTimeMs = _checkForMessageIntervalMs; + BitTestResults parametricresults; + do + { + parametricresults = node.GetBITResults(item); + + if (parametricresults != null) + { + break; + } + else + { + Thread.Sleep(_checkForMessageIntervalMs); + totalWaitTimeMs += _checkForMessageIntervalMs; + } + } while (totalWaitTimeMs < timeout2 && !cts.IsCancellationRequested); + + if (parametricresults == null && !cts.IsCancellationRequested) + { + _logger.Warn($"Timed out while waiting on parametrized response message(s) for {command.Command} command"); + } + + if (parametricresults != null) + { + // replace earlier results (confirmation message) with parametric results + results.Add(parametricresults); + cts.Cancel(); + } + }); + + } + catch (OperationCanceledException) + { + _logger.Trace($"Done waiting on parametrized response message(s) for {command.Command} command"); + } + finally + { + cts.Dispose(); + } + + } + + return results; + } + + /// + /// runs bit command and then + /// + /// + /// + /// + private async Task> RunBITWaitForResultsListAsync(List commands, IBit node) + { + List results = new List(); + + foreach (var command in commands) + { + string bitCommand = command.Command; + string bitResponseId = ResponseGroupForFirstBITCall(command); + uint timeout = command.CommandTimeout; + uint timeout2 = command.ParametricTimeout; + string strParamerticResponse = command.ParametricResponse; + int retries = 0; + if (int.TryParse(strParamerticResponse, out int tmpretries)) + { + retries = tmpretries; + } + List> commandParams = ConvertCommandParameters(command.CommandParameters); + int runIndex = 0; + do + { + runIndex++; + try + { + var result = await Task.Run(() => node.RunBITWaitForResults(bitCommand, bitResponseId, timeout, commandParams)); + results.Add(result); + } + catch (BitTimeoutException) + { + _logger.Warn($"Timeout after {timeout} ms on BIT command {bitCommand} waiting for result {bitResponseId}, retry number {runIndex}"); + if (runIndex == retries) + { + throw; + } + } + } while (results == null && runIndex <= retries); + + var responseGroup = ResponseGroupListForParameterBITCall(command); + + if (responseGroup == null || !responseGroup.Any()) + { + continue; + } + + var paramResults = await GetBitResultsListAsync(responseGroup, (int)timeout2, node); + if (paramResults != null) + { + results.AddRange(paramResults); + } + } + + return results; + } + + /// + /// for the initial BIT message expect to find R (main Response) + /// if any responses marked as E (error) add it to the list as alternative expected response, separated by comma + /// + /// + /// + private static string ResponseGroupForFirstBITCall(BITCommand command) + { + StringBuilder resp = new StringBuilder(); + var tempMainResponseGroup = command.CommandResponses.Where(m => m.ResponseType != ResponseMessageType.E).ToList(); + if (tempMainResponseGroup != null) + { + // check for Rs first and if no messages marked with Rs than check for Us + var mainResponse = tempMainResponseGroup.FirstOrDefault(m => m.ResponseType == ResponseMessageType.R); + if (mainResponse != null) + { + resp.Append(mainResponse.Name); + } + } + + // append all error message ids + foreach (var item in command.CommandResponses.Where(m => m.ResponseType == ResponseMessageType.E)) + { + resp.Append(','); + resp.Append(item.Name); + } + + return resp.ToString(); + } + /// + /// for subsequent parameter response look for either P (parameterized) or U (undefined) + /// if any responses marked as E (error) add it to the list as alternative expected response + /// + /// + /// + private static List ResponseGroupListForParameterBITCall(BITCommand command) + { + List resp = new List(); + bool parameterizedRespExpected = false; + var tempMainResponseGroup = command.CommandResponses.Where(m => m.ResponseType != ResponseMessageType.E).ToList(); + if (tempMainResponseGroup != null) + { + // check for Rs first and if no messages marked with Rs than check for Us + var mainResponse = tempMainResponseGroup.FirstOrDefault(m => m.ResponseType == ResponseMessageType.P || m.ResponseType == ResponseMessageType.U); + if (mainResponse != null) + { + resp.Add(mainResponse.Name); + parameterizedRespExpected = true; + } + } + if (parameterizedRespExpected) + { + // append all error message ids + foreach (var item in command.CommandResponses.Where(m => m.ResponseType == ResponseMessageType.E)) + { + resp.Add(item.Name); + } + } + return resp; + } + + private static List> ConvertCommandParameters(List @in) + { + List> parameters = new List>(); + foreach (var parameter in @in) + { + parameters.Add(new KeyValuePair(parameter.Key, parameter.Value)); + } + return parameters; + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BitGenSoftMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BitGenSoftMeasurementManager.csproj new file mode 100644 index 0000000..4a2bad9 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitGenSoftMeasurementManager/BitGenSoftMeasurementManager.csproj @@ -0,0 +1,22 @@ + + + + + net472 + BitGenSoftMeasurementManager + Composable Test Software Library + Bit GenSoft Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/BitMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/BitMeasurementManager.cs new file mode 100644 index 0000000..b365a85 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/BitMeasurementManager.cs @@ -0,0 +1,491 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using BitMeasurementManagerLib; +using Raytheon.Instruments; +using Raytheon.Common; +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static BitMeasurementManagerLib.BitConfigurableMessageFactory; +using NLog; + +namespace MeasurementManagerLib +{ + /// + /// This class interfaces to a host application for the purpose of sending and receiving messages to/from a UUT + /// + public class BitMeasurementManager : IDisposable + { + #region PublicClassMembers + /// + /// A delegate for host applications to get notified once a particular message arrives + /// + /// The message id that was received + /// The number of bytes in the message + /// An error code + public delegate void MessageReceivedDelegate(uint messageId, uint messageDataLength, int errorCode); + #endregion + + #region PrivateClassMembers + private ICommDevice _commNode; + private ICommDevice _commDevice; + private BitMsgHandler _msgHandler; + private BitMessageIDs _messageIds; + private uint _readWorkerBufferSize; + private uint _readWorkerRestTimeMs; + private string _bitResultsFieldName; + private static object _syncObj = new Object(); + + private static NLog.ILogger _logger; + + #endregion + + #region PrivateFuctions + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + try + { + if (_commNode != null) + { + _commNode.Shutdown(); + } + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + + try + { + if (_msgHandler != null) + { + _msgHandler.Dispose(); + } + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + + /// + /// Write bytes onto an interface + /// + /// the bytes to send + /// the number of bytes to send + private void SendMessage(byte[] message, uint numBytesToSend) + { + lock (_syncObj) + { + uint numBytesSent = 0; + + _msgHandler.WriteOutgoingDataToLog(message, (int)numBytesToSend); + + numBytesSent = _commNode.Write(message, numBytesToSend); + + if (numBytesSent != numBytesToSend) + { + throw new Exception("Sent " + numBytesSent.ToString() + " bytes, expected to send " + numBytesToSend.ToString()); + } + } + } + + /// + /// Send out a message and wait for a response + /// + /// The message to send + /// Timeout in ms + /// + private BitConfigurableMessage SendMessageGetRsp(BitConfigurableMessage messageToSend, uint timeoutInMs) + { + lock (_syncObj) + { + uint cmdMessageId = messageToSend.GetMessageId(); + uint rspMessageId = _messageIds.GetResponseId(cmdMessageId); + + // reset the rsp event + BitMsgRxBuffer.Instance().ResetReceiveEvent(rspMessageId); + + // send out the message + SendMessage(messageToSend); + + // wait for the response + bool didWeGetTheMsg = BitMsgRxBuffer.Instance().WaitForRspMsg(rspMessageId, timeoutInMs); + + if (didWeGetTheMsg == false) + { + throw new Exception("Did not receive msg: " + rspMessageId.ToString()); + } + + return GetNewestMessage(rspMessageId); + } + } + + #endregion + + #region PublicFuctions + + public BitMeasurementManager(IInstrumentManager instrumentManager, + string measurementDefFile, + string comDeviceName, + string comNodeName, + string binDataLogFilename, + string asciiDataLogFileName, + MessageReceivedDelegate callback) + { + const string CONFIGURATION_INI_SECTION_NAME = "CONFIGURATION"; + + try + { + _logger = LogManager.GetCurrentClassLogger(); + + IniFile ini = new IniFile(measurementDefFile); + + // hold onto the UUT byte order and header def + bool shallWeByteSwap = Convert.ToBoolean(ini.ReadValue(CONFIGURATION_INI_SECTION_NAME, "SHALL_WE_BYTE_SWAP")); + BitMsgEndianControl.Instance(shallWeByteSwap, ini); + + _bitResultsFieldName = ini.ReadValue(CONFIGURATION_INI_SECTION_NAME, "BIT_RESULTS_FIELD_NAME"); + + string messageDefFile = ini.ReadValue(CONFIGURATION_INI_SECTION_NAME, "MESSAGE_DEF_FILE"); + string messageInpuStr = ini.ReadValue(CONFIGURATION_INI_SECTION_NAME, "MESSAGE_INPUT_TYPE"); + FactoryType bitMsgFactoryType = (FactoryType)Enum.Parse(typeof(FactoryType), messageInpuStr, true); + + // initialize the BitMessageFactory + BitConfigurableMessageFactory.Instance(messageDefFile, bitMsgFactoryType); + + // initialize the Message ID List, set each message size and set the rsp IDs + _messageIds = new BitMessageIDs(); + Dictionary allMessages = BitConfigurableMessageFactory.Instance().RetreiveAllMessages(); + foreach (var msg in allMessages.Values) + { + uint messageId = msg.GetMessageId(); + uint msgRspId = msg.GetMessageRspId(); + _messageIds.AddId(messageId); + + if (msgRspId != 0xffffffff) + { + _messageIds.SetRspId(messageId, msgRspId); + } + + _messageIds.SetMsgSize(msg.GetMessageId(), msg.GetEntireMsgLength()); + } + + + BitMsgRxBuffer.Instance(_messageIds); + + //_isThereHardware = isThereHardware; + + uint parseBufferSize = Convert.ToUInt32(ini.ReadValue(CONFIGURATION_INI_SECTION_NAME, "PARSE_BUFFER_SIZE")); + + bool shallWeLogOutgoingBinData = Convert.ToBoolean(ini.ReadValue("LOGGING", "SHALL_WE_LOG_OUTGOING_BIN")); + bool shallWeLogOutgoingAsciiData = Convert.ToBoolean(ini.ReadValue("LOGGING", "SHALL_WE_LOG_OUTGOING_ASCII")); + bool shallWeLogIncomingBinData = Convert.ToBoolean(ini.ReadValue("LOGGING", "SHALL_WE_LOG_INCOMING_BIN")); + bool shallWeLogIncomingAsciiData = Convert.ToBoolean(ini.ReadValue("LOGGING", "SHALL_WE_LOG_INCOMING__ASCII")); + bool shallWeLogParserVerboseInfo = Convert.ToBoolean(ini.ReadValue("LOGGING", "SHALL_WE_LOG_VERBOSE_PARSER_INFO")); + + // get the CRC check info + uint crcMask = Convert.ToUInt32(ini.ReadValue("CRC_STATUS", "BITMASK"), 16); + string crcFieldName = ini.ReadValue("CRC_STATUS", "CRC_FIELD_LOGICAL_NAME"); + + // create the message handler + _msgHandler = new BitMsgHandler(_messageIds, callback, parseBufferSize, binDataLogFilename, asciiDataLogFileName, shallWeLogOutgoingBinData, shallWeLogOutgoingAsciiData, shallWeLogIncomingBinData, shallWeLogIncomingAsciiData, crcMask, crcFieldName, shallWeLogParserVerboseInfo); + + // create the communication device + _commDevice = instrumentManager.GetInstrument(comDeviceName); + _commDevice?.Initialize(); + + // get the read thread buffer size and thread rate + _readWorkerBufferSize = Convert.ToUInt32(ini.ReadValue(CONFIGURATION_INI_SECTION_NAME, "READ_WORKER_BUFFER_SIZE")); + _readWorkerRestTimeMs = Convert.ToUInt32(ini.ReadValue(CONFIGURATION_INI_SECTION_NAME, "READ_WORKER_REST_TIME_MS")); + + // create the communication node + _commNode = instrumentManager.GetInstrument(comNodeName); + _commNode?.Initialize(); + } + catch (Exception) + { + Dispose(true); + + throw; + } + + } + + /// + /// The Finalizer + /// + ~BitMeasurementManager() + { + Dispose(false); + } + + /// + /// + /// + /// + public void AddDataTestFunction(byte[] dataToAdd) + { + _msgHandler.AddData(dataToAdd, (uint)dataToAdd.Length); + } + + /// + /// Closes the data files + /// + public void CloseDataFiles() + { + lock (_syncObj) + { + _msgHandler.CloseDataFiles(); + } + } + + /// + /// Instantiate a message object. The host configure its parameters prior to sending it + /// + /// The message id for the message to create + /// The message object + public BitConfigurableMessage CreateMessage(uint messageId) + { + lock (_syncObj) + { + BitConfigurableMessage message = BitConfigurableMessageFactory.Instance().RetreiveMessage(messageId); + return message; + } + } + + /// + /// Release the resources + /// + public void Dispose() + { + Dispose(true); + } + + /// + /// + /// + /// + /// + /// + public TType GetDataItemByName(BitConfigurableMessage message, string name) + { + lock (_syncObj) + { + return message.GetDataItemByName(name); + } + } + + /// + /// + /// + /// + /// + /// + public uint GetDataItemByNameUint(BitConfigurableMessage message, string dataItemName) + { + lock (_syncObj) + { + uint dataValue = GetDataItemByName(message, dataItemName); + + return dataValue; + } + } + + /// + /// Return a list of message IDs that are supported + /// + /// A list of message Ids + public List GetSupportedMessages() + { + lock (_syncObj) + { + List mesages = _messageIds.GetAllIds(); + + return mesages; + } + } + + /// + /// Retrieve the newest message in the buffer + /// + /// The message ID to Retrieve + /// True to delete all of the other messages of this ID + /// The retrieved message + public BitConfigurableMessage GetNewestMessage(uint rspMessageId, bool shallWeDeleteOthers = true) + { + lock (_syncObj) + { + BitConfigurableMessage messageToReturn = BitMsgRxBuffer.Instance().GetNewestMessage(rspMessageId, shallWeDeleteOthers); + + return messageToReturn; + } + } + + /// + /// Retrieve the oldest message in the buffer + /// + /// The message ID to Retrieve + /// The retrieved message + public BitConfigurableMessage GetOldestMessage(uint rspMessageId) + { + lock (_syncObj) + { + BitConfigurableMessage messageToReturn = BitMsgRxBuffer.Instance().GetOldestMessage(rspMessageId); + + return messageToReturn; + } + } + + /// + /// Open the communication device, if it is already open, it closes it and then reopens it + /// + public void OpenCommDevice() + { + lock (_syncObj) + { + // shut it down and reinitialize + _commNode.Shutdown(); + _commNode.Initialize(); + } + } + + /// + /// Runs a BIT test, return the test results + /// + /// + /// The number of ms to wait for a response + /// + /// The test result register + public uint RunBitTest(uint messageId, uint timeoutInMs, params object[] messageParams) + { + lock (_syncObj) + { + BitConfigurableMessage cmdMessage = BitConfigurableMessageFactory.Instance().RetreiveMessage(messageId); + if (messageParams.Length > 0) + { + cmdMessage.SetParams(messageParams); + } + BitConfigurableMessage rspMessage = SendMessageGetRsp(cmdMessage, timeoutInMs); + uint testResult = rspMessage.GetDataItemByName(_bitResultsFieldName.ToUpper()); + return testResult; + } + } + + /// + /// + /// + /// + /// + /// + public void SendMessage(uint messageId, params object[] messageParams) + { + lock (_syncObj) + { + BitConfigurableMessage cmdMessage = BitConfigurableMessageFactory.Instance().RetreiveMessage(messageId); + + if (messageParams.Length > 0) + { + cmdMessage.SetParams(messageParams); + } + + SendMessage(cmdMessage); + } + } + + /// + /// Send out a message and wait for a response + /// + /// The message ID to send + /// + /// The response message for the command that was sent + public BitConfigurableMessage SendMessageGetRsp(uint messageId, uint timeoutInMs, params object[] messageParams) + { + lock (_syncObj) + { + BitConfigurableMessage cmdMessage = BitConfigurableMessageFactory.Instance().RetreiveMessage(messageId); + + if (messageParams.Length > 0) + { + cmdMessage.SetParams(messageParams); + } + + BitConfigurableMessage rspMessage = SendMessageGetRsp(cmdMessage, timeoutInMs); + return rspMessage; + } + } + + /// + /// Send out a message on the comm interface + /// + /// The message to send + public void SendMessage(BitConfigurableMessage message) + { + lock (_syncObj) + { + // get the ascii msg for logging just before sending + string asciiMessage = message.ToString(); + + // get the formatted gu message + uint messageNumBytes = message.GetEntireMsgLength(); + + // allocate an array to hold onto the data that we will send + byte[] messageDataToSend = new byte[messageNumBytes]; + + // get a pointer to the data + GCHandle messagePinnedArray = GCHandle.Alloc(messageDataToSend, GCHandleType.Pinned); + IntPtr pMessageData = messagePinnedArray.AddrOfPinnedObject(); + + // get the encoded data to send + message.Format(pMessageData); + + // free the ptr + messagePinnedArray.Free(); + + // log the data + _msgHandler.WriteOutgoingDataToLog(asciiMessage); + + // send the data + SendMessage(messageDataToSend, messageNumBytes); + } + } + + /// + /// Enable or Disable the Callback for a specific message + /// + /// + /// + public void SetCallbackControl(uint msgId, bool shallWeEnableCallback) + { + lock (_syncObj) + { + _msgHandler.SetCallbackControl(msgId, shallWeEnableCallback); + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/BitMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/BitMeasurementManager.csproj new file mode 100644 index 0000000..8061a93 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/BitMeasurementManager.csproj @@ -0,0 +1,27 @@ + + + + net472 + BitMeasurementManager + Composable Test Software Library + Bit Measurement Manager + Library + + + + 1.1.0 + true + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Interfaces/IConfigurableDataItem.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Interfaces/IConfigurableDataItem.cs new file mode 100644 index 0000000..531a572 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Interfaces/IConfigurableDataItem.cs @@ -0,0 +1,50 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; + +namespace BitMeasurementManagerLib +{ + public interface IConfigurableDataItem + { + Type DataType { get;} + + object Data { get; set; } + + string GetDataItemName(); + + BitConfigurableMessage.DataItemType GetDataItemType(); + + int GetNumDataItems(); + + string GetDefaultValueStr(); + } + + + public interface IConfigurableDataItem : IConfigurableDataItem + { + new TData Data { get; set;} + + new string GetDataItemName(); + + new BitConfigurableMessage.DataItemType GetDataItemType(); + + new int GetNumDataItems(); + + new string GetDefaultValueStr(); + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitInterfaceManagerConstants.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitInterfaceManagerConstants.cs new file mode 100644 index 0000000..31109ac --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitInterfaceManagerConstants.cs @@ -0,0 +1,39 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +namespace BitMeasurementManagerLib +{ + /// + /// A spot to hold application constants + /// + internal static class BitInterfaceManagerConstants + { + // data types + internal static readonly string FLOAT_DATA_TYPE = "FLOAT"; + internal static readonly string UINT_DATA_TYPE = "UINT"; + internal static readonly string UINT_HEX_DATA_TYPE = "UINT_HEX"; + internal static readonly string USHORT_HEX_DATA_TYPE = "USHORT_HEX"; + internal static readonly string USHORT_DATA_TYPE = "USHORT"; + internal static readonly string BYTE_HEX_DATA_TYPE = "BYTE_HEX"; + internal static readonly string BYTE_ARRAY_HEX_DATA_TYPE = "BYTE_ARRAY_HEX"; + internal static readonly string DOUBLE_DATA_TYPE = "DOUBLE"; + internal static readonly string ULONG_DATA_TYPE = "ULONG"; + internal static readonly string ULONG_HEX_DATA_TYPE = "ULONG_HEX"; + internal static readonly string BITS_DATA_TYPE = "BITS"; + } +} + diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitMsgEndianControl.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitMsgEndianControl.cs new file mode 100644 index 0000000..40001a4 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitMsgEndianControl.cs @@ -0,0 +1,97 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace BitMeasurementManagerLib +{ + /// + /// Singleton for holding onto message objects + /// + internal class BitMsgEndianControl + { + #region PublicMembers + public struct HeaderDef + { + public int msgIdByteLocation; + public int msgIdDataLen; + public int secondaryMsgIdByteLocation; + public int secondaryMsgIdDataLen; + public uint secondaryMsgIdExpectedValue; + }; + #endregion + + #region PrivateClassMembers + // class variables + private static BitMsgEndianControl _msgEndianControlInstance; + private bool _shallWeSwap; + private HeaderDef _headerDef; + #endregion + + #region PrivateFuctions + /// + /// The constructor + /// + private BitMsgEndianControl(bool shallWeSwap, IniFile defFile) + { + _shallWeSwap = shallWeSwap; + + _headerDef.msgIdByteLocation = Convert.ToInt32(defFile.ReadValue("MSG_HEADER_DEF", "MSG_ID_LOCATION")); + _headerDef.msgIdDataLen = Convert.ToInt32(defFile.ReadValue("MSG_HEADER_DEF", "MSG_ID_DATA_LEN")); + _headerDef.secondaryMsgIdByteLocation = Convert.ToInt32(defFile.ReadValue("MSG_HEADER_DEF", "SECONDARY_MSG_ID_LOCATION")); + _headerDef.secondaryMsgIdDataLen = Convert.ToInt32(defFile.ReadValue("MSG_HEADER_DEF", "SECONDARY_MSG_ID_DATA_LEN")); + _headerDef.secondaryMsgIdExpectedValue = Convert.ToUInt32(defFile.ReadValue("MSG_HEADER_DEF", "SECONDARY_MSG_ID_EXPECTED_VALUE"), 16); + } + #endregion + + #region PublicFuctions + + /// + /// The way to get access to this singleton + /// + /// the instance to this class + internal static BitMsgEndianControl Instance(bool shallWeSwap = true, IniFile defFile = null) + { + if (_msgEndianControlInstance == null) + { + _msgEndianControlInstance = new BitMsgEndianControl(shallWeSwap, defFile); + } + + return _msgEndianControlInstance; + } + + /// + /// + /// + /// + internal HeaderDef GetHeaderDef() + { + return _headerDef; + } + + /// + /// + /// + /// + internal bool ShallWeSwap() + { + return _shallWeSwap; + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitMsgRxBuffer.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitMsgRxBuffer.cs new file mode 100644 index 0000000..edbf05d --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitMsgRxBuffer.cs @@ -0,0 +1,248 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using System.Collections.Generic; +using Raytheon.Common; + +namespace BitMeasurementManagerLib +{ + /// + /// Singleton for holding onto message objects + /// + internal class BitMsgRxBuffer + { + #region PrivateClassMembers + // class variables + private static BitMsgRxBuffer _msgBufferInstance; + private static object _syncObj = new Object(); + private BitMessageIDs _messageIds; + private Dictionary> _msgList; + private Dictionary _receivedMsgEvents; + #endregion + + #region PrivateFuctions + + /// + /// The constructor + /// + private BitMsgRxBuffer(BitMessageIDs messageIds) + { + _messageIds = messageIds; + + _msgList = new Dictionary>(); + + // create an event for each msg. + _receivedMsgEvents = new Dictionary(); + + List msgIds = _messageIds.GetAllIds(); + + foreach (uint id in msgIds) + { + _receivedMsgEvents[id] = new AutoResetEvent(false); + } + } + #endregion + + #region PublicFuctions + + /// + /// The way to get access to this singleton + /// + /// the instance to this class + internal static BitMsgRxBuffer Instance(BitMessageIDs messageIds = null) + { + if (_msgBufferInstance == null) + { + _msgBufferInstance = new BitMsgRxBuffer(messageIds); + } + + return _msgBufferInstance; + } + + /// + /// Add a message to this buffer + /// + /// The message to add + /// flag for if the other messages of this type should be deleted from the buffer + internal void AddMsg(BitConfigurableMessage msg, bool shouldWeDeleteOthers = true) + { + lock (_syncObj) + { + uint msgId = msg.GetMessageId(); + + if (shouldWeDeleteOthers == true) + { + ErrorLogger.Instance().Write("BitMsgRxBuffer::AddMsg() - clearing list for " + msgId.ToString(), ErrorLogger.LogLevel.INFO); + ClearList(msgId); + } + + if (_msgList.ContainsKey(msgId) == false) + { + ErrorLogger.Instance().Write("BitMsgRxBuffer::AddMsg() - creating new list for " + msgId.ToString(), ErrorLogger.LogLevel.INFO); + _msgList[msgId] = new List(); + } + + ErrorLogger.Instance().Write("BitMsgRxBuffer::AddMsg() - Adding " + msgId.ToString() + " to the list", ErrorLogger.LogLevel.INFO); + _msgList[msgId].Add(msg); + + _receivedMsgEvents[msgId].Set(); + } + } + + /// + /// Remove all messages from the buffer + /// + internal void ClearAllMsgs() + { + lock (_syncObj) + { + foreach (uint id in _msgList.Keys) + { + ClearList(id); + } + } + } + + /// + /// Remove all messages of the command type from the buffer + /// + /// The message id to remove + internal void ClearList(uint id) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id) == true) + { + _msgList[id].Clear(); + + _msgList.Remove(id); + + _receivedMsgEvents[id].Reset(); + } + } + } + + /// + /// Gets the oldest message in the buffer + /// + /// The id of the message to get + /// The oldest message in the buffer + internal BitConfigurableMessage GetOldestMessage(uint id) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id)) + { + List list = _msgList[id]; + + if (list.Count == 0) + { + throw new Exception("BitMsgRxBuffer::GetOldestMessage() - there are no messges in the queue for id: " + id.ToString()); + } + + BitConfigurableMessage oldestMsg = list[0]; + + list.RemoveAt(0); + + return oldestMsg; + } + else + { + throw new Exception("BitMsgRxBuffer::GetOldestMessage() - no message exists with id: " + id.ToString()); + } + } + } + + /// + /// Gets the most recent message from the buffer + /// + /// The id of the message to get + /// flag controlling if the other messages of this type should be deleted + /// The message + internal BitConfigurableMessage GetNewestMessage(uint id, bool shouldWeDeleteOthers = true) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id)) + { + List list = _msgList[id]; + + BitConfigurableMessage newestMsg = list[list.Count - 1]; + + list.RemoveAt(list.Count - 1); + + if (shouldWeDeleteOthers == true) + { + ClearList(id); + } + + return newestMsg; + } + else + { + throw new Exception("BitMsgRxBuffer::GetNewestMessage() - no message exists with id: " + id.ToString("X")); + } + } + } + + /// + /// Get the number of messages of this type in the buffer + /// + /// The id of the message to get + /// the number of messages of this type in the buffer + internal int GetNumMsgsInQueue(uint id) + { + lock (_syncObj) + { + if (_msgList.ContainsKey(id) == true) + { + return _msgList[id].Count; + } + else + { + return 0; + } + } + } + + /// + /// + /// + internal void ResetReceiveEvent(uint id) + { + lock (_syncObj) + { + _receivedMsgEvents[id].Reset(); + } + } + + /// + /// Wait for a message to get added to the buffer + /// + /// The message id to wait for + /// The amount of time in ms to wait + /// true if the message arrived, false if it did not + internal bool WaitForRspMsg(uint id, uint timeoutMs) + { + return _receivedMsgEvents[id].WaitOne((int)timeoutMs); + } + #endregion + + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitSimCommDeviceNode.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitSimCommDeviceNode.cs new file mode 100644 index 0000000..5aa2821 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/BitSimCommDeviceNode.cs @@ -0,0 +1,416 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Instruments; +using Raytheon.Common; +using System; +using System.Runtime.InteropServices; +using System.Threading; + +namespace BitMeasurementManagerLib +{ + /// + /// An interface to sending/receiving data over TCP sockets + /// + internal class BitSimCommDeviceNode : ICommDevice, IDisposable + { + #region PrivateClassMembers + private ICommDevice _commDevice; + private BitMessageIDs _messageIds; + private IWorkerInterface _socketReadWorker; + private Thread _socketReadThread; + private readonly string _name; + private SelfTestResult _selfTestResult; + private State _state; + #endregion + + #region PrivateFunctions + /// + /// The finalizer. Necessary for quitting the read thread + /// + ~BitSimCommDeviceNode() + { + Dispose(false); + } + + /// + /// Quit the threads associated with the node + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + State initialState = _state; + + // close the socket and threads + try + { + if (initialState == State.Ready) + { + Shutdown(); + + _commDevice.Shutdown(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + + // dispose of the resources + try + { + if (initialState == State.Ready) + { + _socketReadWorker.Dispose(); + _state = State.Uninitialized; + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// + /// + /// The name of this instance + /// + /// + /// + /// + public BitSimCommDeviceNode(string name, ICommDevice commDevice, BitMessageIDs messageIds, MsgDevice msgHandler, uint commReadWorkerBufferSize = 100000, uint readWorkerRestTimeInMs = 10) + { + _name = name; + + _commDevice = commDevice; + + _messageIds = messageIds; + + _socketReadWorker = new CommReadWorker(this, msgHandler, commReadWorkerBufferSize, readWorkerRestTimeInMs); + _socketReadThread = new Thread(_socketReadWorker.DoWork); + + // start the read thread + _socketReadThread.Start(); + + _selfTestResult = SelfTestResult.Unknown; + + _state = State.Uninitialized; + } + + public void Open() + { + } + + /// + /// + /// + /// + public bool ClearErrors() + { + return true; + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a BIT Comm Sim Device Node " + _name; + } + } + + public void Close() + { + Dispose(); + } + + /// + /// Close the device + /// + /*public void Close() + { + const int THREAD_QUIT_TIMEOUT_MS = 3000; + + // tell the thread to quit + _socketReadWorker.QuitWork(); + + // close the socket which the thread might be blocked on + _commDevice.Close(); + + if (_socketReadThread.IsAlive) + { + bool didThreadQuit = _socketReadThread.Join(THREAD_QUIT_TIMEOUT_MS); + + if (didThreadQuit == false) + { + ErrorLogger.Instance().Write("BitSimCommDeviceNode::Close() - Logging Thread did not quit as expected, aborting it"); + _socketReadThread.Abort(); + } + else + { + ErrorLogger.Instance().Write("BitSimCommDeviceNode::Close() - Logging Thread quit successfully after join", ErrorLogger.LogLevel.INFO); + } + } + else + { + ErrorLogger.Instance().Write("BitSimCommDeviceNode::Close() - Logging Thread quit successfully", ErrorLogger.LogLevel.INFO); + } + }*/ + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + _commDevice.Initialize(); + _state = State.Ready; + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + return _commDevice.SelfTestResult; + } + + /// + /// Read data from the socket + /// + /// The data that was read + /// the number of bytes read + public uint Read(ref byte[] dataRead) + { + return 0; + } + + /// + /// + public void Reset() + { + Close(); + + Initialize(); + } + + /// + /// + /// + /// + public void SetReadTimeout(uint readTimeout) + { + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// + /// + public void Shutdown() + { + const int THREAD_QUIT_TIMEOUT_MS = 3000; + + if (_state == State.Ready) + { + // tell the thread to quit + _socketReadWorker.QuitWork(); + + // close the socket which the thread might be blocked on + _commDevice.Shutdown(); + + if (_socketReadThread.IsAlive) + { + bool didThreadQuit = _socketReadThread.Join(THREAD_QUIT_TIMEOUT_MS); + + if (didThreadQuit == false) + { + ErrorLogger.Instance().Write("BitSimCommDeviceNode::Close() - Logging Thread did not quit as expected, aborting it"); + _socketReadThread.Abort(); + } + else + { + ErrorLogger.Instance().Write("BitSimCommDeviceNode::Close() - Logging Thread quit successfully after join", ErrorLogger.LogLevel.INFO); + } + } + else + { + ErrorLogger.Instance().Write("BitSimCommDeviceNode::Close() - Logging Thread quit successfully", ErrorLogger.LogLevel.INFO); + } + } + + _state = State.Uninitialized; + } + + /// + /// Send data on the socket + /// + /// The data to send + /// The number of bytes to write from the dataToSend buffer + /// The number of bytes sent + public uint Write(byte[] dataToSend, uint numBytesToWrite) + { + // determine the id and get create the rsp message + IntPtr pDataPtr = Marshal.AllocHGlobal(dataToSend.Length); + Marshal.Copy(dataToSend, 0, pDataPtr, dataToSend.Length); + uint commandId = BitConfigurableMessageHeader.GetMessageId(pDataPtr, (uint)dataToSend.Length); + Marshal.FreeHGlobal(pDataPtr); + + bool isThereAResponse = _messageIds.IsThereAResponseMessage(commandId); + + // if there is a rsp msg, create a dummy msg + if (isThereAResponse == true) + { + uint rspId = _messageIds.GetResponseId(commandId); + BitConfigurableMessage rspMessage = BitConfigurableMessageFactory.Instance().RetreiveMessage(rspId); + BitMsgRxBuffer.Instance().AddMsg(rspMessage); + //uint msgLen = rspMessage.GetEntireMsgLength(); + //byte[] simData = new byte[msgLen]; + //_msgHandler.AddData(); + } + else + { + } + + return (uint)dataToSend.Length; + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/CommDeviceNode.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/CommDeviceNode.cs new file mode 100644 index 0000000..710b041 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/CommDeviceNode.cs @@ -0,0 +1,371 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; + +using System; +using System.Threading; + +namespace Raytheon.Instruments +{ + /// + /// An interface to sending/receiving data over comm devices + /// + internal class CommDeviceNode : ICommDevice, IDisposable + { + #region PrivateClassMembers + private ICommDevice _commDevice; + private IWorkerInterface _socketReadWorker; + private Thread _socketReadThread; + private readonly string _name; + private SelfTestResult _selfTestResult; + private State _state; + + private uint _commReadWorkerBufferSize; + private uint _readWorkerRestTimeInMs; + private MsgDevice _msgHandler; + + #endregion + + #region PrivateFuctions + /// + /// The finalizer. Necessary for quitting the read thread + /// + ~CommDeviceNode() + { + Dispose(false); + } + + + /// + /// Quit the threads associated with the node + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + State initialState = _state; + + // close the socket and threads + try + { + if (initialState == State.Ready) + { + Shutdown(); + _commDevice.Shutdown(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + + // dispose of the resources + try + { + if (initialState == State.Ready) + { + _socketReadWorker.Dispose(); + _state = State.Uninitialized; + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// The constructor + /// + /// The name of this instance + /// The communication device + /// The message handler for this interface + /// The number of bytes for the buffer internal to this class. Each individual read will read upto this buffer size (or until the timeout happens) + /// Number of ms to reset between read calls on the comm interface + public CommDeviceNode(string name, ICommDevice commDevice, MsgDevice msgHandler, uint commReadWorkerBufferSize = 100000, uint readWorkerRestTimeInMs = 10) + { + _name = name; + _commDevice = commDevice; + + _commReadWorkerBufferSize = commReadWorkerBufferSize; + _readWorkerRestTimeInMs = readWorkerRestTimeInMs; + _msgHandler = msgHandler; + + Open(); + } + + /// + /// Starts communication thread + /// + public void Open() + { + _socketReadWorker = new CommReadWorker(this, _msgHandler, _commReadWorkerBufferSize, _readWorkerRestTimeInMs); + _socketReadThread = new Thread(_socketReadWorker.DoWork); + + // start the read thread + _socketReadThread.Start(); + + _selfTestResult = SelfTestResult.Unknown; + _state = State.Uninitialized; + } + + + /// + /// there is no error msg repository + /// + /// + public bool ClearErrors() + { + return false; + } + + /// + /// + /// + public bool DisplayEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public string DetailedStatus + { + get + { + return "This is a Comm Sim Device Node " + _name; + } + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public bool FrontPanelEnabled + { + get + { + return false; + } + set + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public InstrumentMetadata Info + { + get + { + throw new NotImplementedException(); + } + } + + /// + /// + /// + public void Initialize() + { + _commDevice.Initialize(); + _state = State.Ready; + } + + /// + /// + /// + public string Name + { + get + { + return _name; + } + } + + /// + /// + /// + /// + public SelfTestResult PerformSelfTest() + { + throw new NotImplementedException(); + } + + /// + /// Read data from the socket + /// + /// The data that was read + /// the number of bytes read + public uint Read(ref byte[] dataRead) + { + return _commDevice.Read(ref dataRead); + } + + /// + /// Resets communications + /// + public void Reset() + { + Close(); + Open(); + } + + /// + /// + /// + /// + public void SetReadTimeout(uint readTimeout) + { + _commDevice.SetReadTimeout(readTimeout); + } + + /// + /// + /// + public SelfTestResult SelfTestResult + { + get + { + return _selfTestResult; + } + } + + /// + /// + /// + public State Status + { + get + { + return _state; + } + } + + /// + /// Close communications + /// + public void Close() + { + Shutdown(); + } + + /// + /// Close communications + /// + public void Shutdown() + { + if (_state == State.Ready) + { + const int THREAD_QUIT_TIMEOUT_MS = 3000; + + // tell the thread to quit + _socketReadWorker.QuitWork(); + + // close the socket which the thread might be blocked on + _commDevice.Shutdown(); + + if (_socketReadThread.IsAlive) + { + bool didThreadQuit = _socketReadThread.Join(THREAD_QUIT_TIMEOUT_MS); + + if (didThreadQuit == false) + { + ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread did not quit as expected, aborting it"); + _socketReadThread.Abort(); + } + else + { + ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread quit successfully after join", ErrorLogger.LogLevel.INFO); + } + } + else + { + ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread quit successfully", ErrorLogger.LogLevel.INFO); + } + } + + _state = State.Uninitialized; + } + + /// + /// Send data on the socket + /// + /// The data to send + /// The number of bytes to write from the dataToSend buffer + /// The number of bytes sent + public uint Write(byte[] dataToSend, uint numBytesToWrite) + { + return _commDevice.Write(dataToSend, numBytesToWrite); + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/CommReadWorker.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/CommReadWorker.cs new file mode 100644 index 0000000..2e8b1ef --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Lib/CommReadWorker.cs @@ -0,0 +1,178 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using System.Net.Sockets; +using Raytheon.Instruments; +using Raytheon.Common; + +namespace Raytheon.Instruments +{ + /// + /// Takes raw data from an ICommDevice and throws it in a buffer + /// + internal class CommReadWorker : IWorkerInterface + { + #region PrivateClassMembers + private ICommDevice _commNode; + private MsgDevice _msgHandler; + private bool _threadQuitControl; + private AutoResetEvent _quitEvent; + private byte[] _dataRead; + private readonly uint _timeToRestBetweenReadsInMs; + #endregion + + #region PublicFuctions + + /// + /// Constructor + /// + /// The communication interface + /// The message handler for received data + /// The number of bytes for the buffer internal to this class. Each individual read will read upto this buffer size (or until the timeout happens) + /// Number of ms to rest after a read call + public CommReadWorker(ICommDevice commNode, MsgDevice msghandler, uint bufferSize, uint timeToRestBetweenReadsInMs) + { + _commNode = commNode; + _threadQuitControl = false; + _msgHandler = msghandler; + _quitEvent = new AutoResetEvent(false); + _dataRead = new byte[bufferSize]; + _timeToRestBetweenReadsInMs = timeToRestBetweenReadsInMs; + } + + /// + /// Finalizer + /// + ~CommReadWorker() + { + Dispose(false); + } + + /// + /// Dispose of this object. Needed for releasing thread/comm resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Reads the socket and puts data into a buffer + /// + public void DoWork() + { + try + { + while (_threadQuitControl == false) + { + try + { + uint numBytesRead = _commNode.Read(ref _dataRead); + + // add into buffer + if (numBytesRead > 0) + { + _msgHandler.AddData(_dataRead, numBytesRead); + } + + // not using timeToRestBetweenReadsInMs. Just going to wait 1 ms and get back to the read + if (_quitEvent.WaitOne(1)) + { + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - received signal to quit", ErrorLogger.LogLevel.INFO); + _threadQuitControl = true; + } + } + catch (SocketException e) + { + if (e.SocketErrorCode == SocketError.TimedOut) + { + //expected + } + else + { + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - " + e.Message, ErrorLogger.LogLevel.ERROR); + } + } + catch (Exception e) + { + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - " + e.Message, ErrorLogger.LogLevel.ERROR); + } + } + + ErrorLogger.Instance().Write("CommReadWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Commands the worker to stop + /// + public void QuitWork() + { + _quitEvent.Set(); + _threadQuitControl = true; + } + + /// + /// Dispose of this object + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _quitEvent.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessage.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessage.cs new file mode 100644 index 0000000..de0500e --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessage.cs @@ -0,0 +1,961 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace BitMeasurementManagerLib +{ + /// + /// This class implements a message that can be put on a communication interface + /// + public class BitConfigurableMessage + { + #region PublicClassMembers + public enum DataItemType + { + FLOAT, + UINT, + UINT_HEX, + USHORT_HEX, + USHORT, + BYTE_HEX, + BYTE_ARRAY_HEX, + DOUBLE, + ULONG, + ULONG_HEX, + BITS + } + #endregion + + #region PrivateClassMembers + public List _dataItems; + public Dictionary _byteArrayCount; + public Dictionary _bitCount; + private string _messageName; + private uint _entireMsgLen; + private uint _messageId; + private uint _rspMessageId; + #endregion + + #region PublicFuctions + + /// + /// Copy constructor + /// + /// The object to copy + public BitConfigurableMessage(BitConfigurableMessage rhs) + { + // copy over the basic types + _messageId = rhs._messageId; + _rspMessageId = rhs._rspMessageId; + _messageName = String.Copy(rhs._messageName); + + // _entireMsgLen will get set when we add the data items + _entireMsgLen = 0; + + // initialize the objects + _dataItems = new List(); + _byteArrayCount = new Dictionary(); + _bitCount = new Dictionary(); + + // copy the data items over + foreach (IConfigurableDataItem dataItem in rhs._dataItems) + { + AddDataItem(dataItem.GetDataItemName(), dataItem.GetDataItemType(), dataItem.GetNumDataItems(), dataItem.GetDefaultValueStr()); + } + } + + /// + /// + /// + /// + /// + /// + public BitConfigurableMessage(uint messageId, uint rspMessageId, string messageName) + { + _messageId = messageId; + + _rspMessageId = rspMessageId; + + _messageName = messageName; + + _entireMsgLen = 0; + + _dataItems = new List(); + + _byteArrayCount = new Dictionary(); + + _bitCount = new Dictionary(); + } + + /// + /// + /// + /// + public uint GetMessageId() + { + return _messageId; + } + + /// + /// + /// + /// + public uint GetMessageRspId() + { + return _rspMessageId; + } + + /// + /// + /// + /// + /// + /// + /// + public void AddDataItem(string dataItemName, DataItemType dataItemType, int numItems, string defaultValue) + { + if (numItems < 1) + { + throw new Exception("BitConfigurableMessage::AddDataItem() - numItems is not valid: " + numItems + ", data item name is: " + dataItemName); + } + + if (numItems > 1 && (dataItemType != DataItemType.BYTE_ARRAY_HEX && dataItemType != DataItemType.BITS)) + { + throw new Exception("BitConfigurableMessage::AddDataItem() - numItems greater than one only allowed for hex byte arrays and BITs: " + numItems + ", data item name is: " + dataItemName); + } + + if (dataItemType == DataItemType.UINT) + { + uint value = Convert.ToUInt32(defaultValue); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(4 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.UINT_HEX) + { + uint value = Convert.ToUInt32(defaultValue, 16); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(4 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.FLOAT) + { + float value = (float)Convert.ToDouble(defaultValue); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(4 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.USHORT) + { + ushort value = Convert.ToUInt16(defaultValue); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(2 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.USHORT_HEX) + { + ushort value = Convert.ToUInt16(defaultValue, 16); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(2 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.DOUBLE) + { + double value = Convert.ToDouble(defaultValue); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(8 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.ULONG) + { + ulong value = Convert.ToUInt64(defaultValue); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(8 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.ULONG_HEX) + { + ulong value = Convert.ToUInt64(defaultValue, 16); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(8 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.BYTE_HEX) + { + byte value = Convert.ToByte(defaultValue, 16); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _entireMsgLen += (uint)(1 * numItems); + _dataItems.Add(dataItem); + } + else if (dataItemType == DataItemType.BITS) + { + if (numItems > 8) + { + throw new Exception("BitConfigurableMessage::AddDataItem() - trying to add bit field: " + dataItemName + " that has more than 8 bits, bit fields are required to be less than 8 bits at this time"); + } + + // query how many bit fields have been added + // use this later when updating the number of bytes in the message + int totalBitPrevCount = 0; + foreach (KeyValuePair entry in _bitCount) + { + totalBitPrevCount += entry.Value; + } + + + //intention integer division + uint numBytesPrevAdded = (uint)(totalBitPrevCount / 8); + + int totalBitPrevCountRemander = totalBitPrevCount % 8; + + // if remander is not 0, bump up the byte count by 1 + if (totalBitPrevCountRemander != 0) + { + numBytesPrevAdded++; + } + + // convert value to a byte and create the data item + defaultValue = defaultValue.Replace("0b", ""); + defaultValue = defaultValue.Replace("0B", ""); + byte value = Convert.ToByte(defaultValue, 2); + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, value, defaultValue, numItems); + _dataItems.Add(dataItem); + + // store the number of bits for this items + _bitCount[dataItemName.ToUpper()] = numItems; + + // now that we updated the bit fields, query how many bit fields there are + int totalBitCount = 0; + foreach (KeyValuePair entry in _bitCount) + { + totalBitCount += entry.Value; + } + + // intentional integer division + uint numBytesToAdd = (uint)(totalBitCount / 8); + int totalBitCountRemander = totalBitCount % 8; + + // if remander is not 0, bump up the byte count by 1 + if (totalBitCountRemander != 0) + { + numBytesToAdd++; + } + + // increment the message length we crossed a byte boundary with the total number of bits + _entireMsgLen += numBytesToAdd - numBytesPrevAdded; + } + else if (dataItemType == DataItemType.BYTE_ARRAY_HEX) + { + byte value = Convert.ToByte(defaultValue, 16); + + byte[] data = new byte[numItems]; + + for (int i = 0; i < numItems; i++) + { + data[i] = value; + } + + BitConfigurableMessageDataItem dataItem = new BitConfigurableMessageDataItem(dataItemName, dataItemType, data, defaultValue, numItems); + + _dataItems.Add(dataItem); + + _entireMsgLen += (uint)(1 * numItems); + + _byteArrayCount[dataItemName.ToUpper()] = numItems; + } + else + { + throw new Exception("BitConfigurableMessage::AddDataItem() - Unsupported data item type: " + dataItemType.ToString()); + } + } + + /// + /// + /// + /// + public void Format(IntPtr pData) + { + IntPtr pDataLocation = pData; + + // should we byte swap + bool shallWeSwap = BitMsgEndianControl.Instance().ShallWeSwap(); + + // format the data + List formattedData = _dataItems; + + for (int i = 0; i < formattedData.Count; i++) + { + IConfigurableDataItem dataItem = _dataItems[i]; + DataItemType itemType = dataItem.GetDataItemType(); + string itemName = dataItem.GetDataItemName(); + object itemValue = dataItem.Data; + + int dataItemSize = 0; + + if (itemValue is float)// if (itemType == DataItemType.FLOAT) + { + float data = (float)itemValue; + + if (shallWeSwap == true) + { + itemValue = Util.Swap(data); + } + else + { + itemValue = data; + } + + dataItemSize = 4; + + //copy data from our data items, info the buffer + Marshal.StructureToPtr(itemValue, pDataLocation, true); + } + else if (itemValue is uint) + { + uint data = (uint)itemValue; + + if (shallWeSwap == true) + { + itemValue = Util.Swap(data); + } + else + { + itemValue = data; + } + + dataItemSize = 4; + + //copy data from our data items, info the buffer + Marshal.StructureToPtr(itemValue, pDataLocation, true); + } + else if (itemValue is ushort) + { + ushort data = (ushort)itemValue; + + if (shallWeSwap == true) + { + itemValue = Util.Swap(data); + } + else + { + itemValue = data; + } + + dataItemSize = 2; + + //copy data from our data items, info the buffer + Marshal.StructureToPtr(itemValue, pDataLocation, true); + } + else if (itemValue is byte) + { + // handle the case where we stored an array of BITS as a byte + if (itemType == DataItemType.BITS) + { + // grab the value of the first bit item + byte totalBitItemValue = (byte)itemValue; + + // queue up the rest of the BITs to the next byte boundary + int totalBitsProcessed = dataItem.GetNumDataItems(); + + for (int j = i + 1; totalBitsProcessed < 8; j++) + { + // grab the next data items + IConfigurableDataItem bitDataItem = _dataItems[j]; + DataItemType bitItemType = bitDataItem.GetDataItemType(); + + // the next item should be BITS + if (bitItemType != DataItemType.BITS) + { + throw new Exception("BitConfigurableMessage::Format() - Bit fields not consecutive out to byte boundary for msg ID: " + _messageId.ToString("X8")); + } + + int bitItemNumBites = bitDataItem.GetNumDataItems(); + byte bitItemValue = (byte)bitDataItem.Data; + uint mask = (uint)((1 << bitItemNumBites) - 1) << totalBitsProcessed; + + // mask in the next bit value + byte valueToMaskIn = (byte)((bitItemValue << totalBitsProcessed) & mask); + totalBitItemValue = (byte)(totalBitItemValue | valueToMaskIn); + + // increment the bit counter + totalBitsProcessed += bitItemNumBites; + + // increment the outer loop counter since we just processed it + i++; + } + + // double check that we are on a byte boundary + //int byteBoundaryRemainder = totalBitsProcessed % 8; + if (totalBitsProcessed != 8) + { + throw new Exception("BitConfigurableMessage::Format() - Bit fields not equal to 8 for msg ID: " + _messageId.ToString("X8")); + } + + dataItemSize = 1; + + // hold onto the total bit item value + itemValue = (byte)totalBitItemValue; + + //copy data from our data items, info the buffer + Marshal.StructureToPtr(itemValue, pDataLocation, true); + } + else + { + itemValue = (byte)itemValue; + + dataItemSize = 1; + + //copy data from our data items, info the buffer + Marshal.StructureToPtr(itemValue, pDataLocation, true); + } + } + else if (itemValue is double) + { + itemValue = (double)itemValue; + + dataItemSize = 8; + + //copy data from our data items, info the buffer + Marshal.StructureToPtr(itemValue, pDataLocation, true); + } + else if (itemValue is ulong) + { + itemValue = (ulong)itemValue; + + dataItemSize = 8; + + //copy data from our data items, info the buffer + Marshal.StructureToPtr(itemValue, pDataLocation, true); + } + else if (itemValue is Array) + { + IEnumerable en = (IEnumerable)itemValue; + byte[] arrayTemp = en.OfType().ToArray(); + dataItemSize = arrayTemp.Length; + Marshal.Copy(arrayTemp, 0, pDataLocation, dataItemSize); + } + else + { + throw new Exception("BitConfigurableMessage::Format() - Unsupported data item type: " + itemType.ToString()); + } + + // increment the pointer + pDataLocation = IntPtr.Add(pDataLocation, dataItemSize); + } + } + + /// + /// + /// + /// + /// + public byte[] GetDataItemByName_ByteArray(string dataItemName) + { + for (int i = 0; i < _dataItems.Count; i++) + { + if (_dataItems[i].GetDataItemName().ToUpper() == dataItemName.ToUpper()) + { + if (_dataItems[i].GetDataItemType() != DataItemType.BYTE_ARRAY_HEX) + { + throw new Exception("BitConfigurableMessage::GetDataItemByName_ByteArray() - item was not a byte array: " + dataItemName); + } + + IEnumerable en = (IEnumerable)_dataItems[i].Data; + byte[] dataToReturn = en.OfType().ToArray(); + return dataToReturn; + } + } + + throw new Exception("BitConfigurableMessage::GetDataItemByName_ByteArray() - Could not find data item: " + dataItemName); + } + + /// + /// + /// + /// + /// + public T GetDataItemByName(string dataItemName) + { + for (int i = 0; i < _dataItems.Count; i++) + { + if (_dataItems[i].GetDataItemName().ToUpper() == dataItemName.ToUpper()) + { + T value = (T)Convert.ChangeType(_dataItems[i].Data, typeof(T)); + return value; + } + } + + throw new Exception("BitConfigurableMessage::GetDataItemByName() - Could not find data item: " + dataItemName); + } + + /// + /// + /// + /// + public uint GetEntireMsgLength() + { + return _entireMsgLen; + } + + + /// + /// + /// + /// + public void Parse(IntPtr pData) + { + // should we byte swap + bool shallWeSwap = BitMsgEndianControl.Instance().ShallWeSwap(); + + IntPtr pMsgDataPtr = pData; + + for (int i = 0; i < _dataItems.Count; i++) + { + IConfigurableDataItem item = _dataItems[i]; + + object itemData = item.Data; + + if (itemData is float) + { + float itemValue = 0; + + unsafe + { + float* pFloatItem = (float*)pMsgDataPtr; + + itemValue = *pFloatItem; + } + + if (shallWeSwap == true) + { + itemValue = Util.Swap(itemValue); + } + + item.Data = itemValue; + + _dataItems[i] = item; + + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 4); + } + else if (itemData is uint) + { + uint itemValue = 0; + + unsafe + { + uint* pUInt32Item = (uint*)pMsgDataPtr; + + itemValue = *pUInt32Item; + } + + if (shallWeSwap == true) + { + itemValue = Util.Swap(itemValue); + } + + item.Data = itemValue; + + _dataItems[i] = item; + + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 4); + } + else if (itemData is ushort) + { + ushort itemValue = 0; + + unsafe + { + ushort* pUInt16Item = (ushort*)pMsgDataPtr; + + itemValue = *pUInt16Item; + } + + if (shallWeSwap == true) + { + itemValue = Util.Swap(itemValue); + } + + item.Data = itemValue; + + _dataItems[i] = item; + + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 2); + } + else if (itemData is double) + { + double itemValue = 0; + + unsafe + { + double* pDoubleItem = (double*)pMsgDataPtr; + + itemValue = *pDoubleItem; + } + + if (shallWeSwap == true) + { + itemValue = Util.Swap(itemValue); + } + + item.Data = itemValue; + + _dataItems[i] = item; + + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 8); + } + else if (itemData is ulong) + { + ulong itemValue = 0; + + unsafe + { + ulong* pUlongItem = (ulong*)pMsgDataPtr; + + itemValue = *pUlongItem; + } + + if (shallWeSwap == true) + { + itemValue = Util.Swap(itemValue); + } + + item.Data = itemValue; + + _dataItems[i] = item; + + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 8); + } + else if (itemData is byte) + { + // handle the case where we are storing bit arrays as a byte + if (item.GetDataItemType() == DataItemType.BITS) + { + // grab the value of the first bit item + byte rawDataValue = 0; + + // Grab the byte from the msg pointer + unsafe + { + byte* pUInt8Item = (byte*)pMsgDataPtr; + + rawDataValue = *pUInt8Item; + } + + // set the first data item + uint mask = (uint)((1 << item.GetNumDataItems()) - 1); + item.Data = (byte)(rawDataValue & mask); + _dataItems[i] = item; + int totalBitsProcessed = item.GetNumDataItems(); + + // set the rest of the data items + for (int j = i + 1; totalBitsProcessed < 8; j++) + { + IConfigurableDataItem bitDataItem = _dataItems[j]; + + DataItemType bitItemType = bitDataItem.GetDataItemType(); + + // the next item should be BITS + if (bitItemType != DataItemType.BITS) + { + throw new Exception("BitConfigurableMessage::Parse() - Bit fields not consecutive out to byte boundary for msg ID: " + _messageId.ToString("X8")); + } + + // shift the data into the beggining of the byte and mask out the other bits + mask = (uint)((1 << bitDataItem.GetNumDataItems()) - 1); + bitDataItem.Data = (byte)((rawDataValue >> totalBitsProcessed) & mask); + _dataItems[j] = bitDataItem; + + // increment the bit counter + totalBitsProcessed += bitDataItem.GetNumDataItems(); + + // increment the outer loop counter since we just processed it + i++; + } + + // double check that we are on a byte boundary + //int byteBoundaryRemainder = totalBitsProcessed % 8; + if (totalBitsProcessed != 8) + { + throw new Exception("BitConfigurableMessage::Parse() - Bit fields not on byte boundary forequal to 8 msg ID: " + _messageId.ToString("X8")); + } + + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 1); + } + else + { + byte itemValue = 0; + + unsafe + { + byte* pUInt8Item = (byte*)pMsgDataPtr; + + itemValue = *pUInt8Item; + } + + item.Data = itemValue; + + _dataItems[i] = item; + + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 1); + } + } + else if (itemData is Array) + { + int numBytes = _byteArrayCount[item.GetDataItemName().ToUpper()]; + byte[] data = new byte[numBytes]; + + unsafe + { + for (int byteCounter = 0; byteCounter < numBytes; byteCounter++) + { + byte* pUInt8Item = (byte*)pMsgDataPtr; + data[byteCounter] = *pUInt8Item; + pMsgDataPtr = IntPtr.Add(pMsgDataPtr, 1); + } + } + + item.Data = data; + + _dataItems[i] = item; + } + else + { + throw new Exception("BitConfigurableMessage::Parse() - Unsupported data item type: " + item.GetDataItemType().ToString()); + } + } + } + + /// + /// Set the params of the message. + /// This function will iterate over the list of params passed in and sequentially set the data items in the message starting at the data item at index 0 + /// + /// an array of params + public void SetParams(params object[] messageParams) + { + if (messageParams.Length > _dataItems.Count) + { + throw new Exception("BitConfigurableMessage::SetParams() - number of supplied parameters: " + messageParams.Length.ToString() + ", is larger than the number of parameters in the definition file: " + _dataItems.Count.ToString()); + } + + for (int i = 0; i < messageParams.Length; i++) + { + IConfigurableDataItem item = _dataItems[i]; + + object itemData = item.Data; + + if (itemData is uint) + { + item.Data = Convert.ToUInt32(messageParams[i]); + _dataItems[i] = item; + } + else if (itemData is float) + { + item.Data = Convert.ToDouble(messageParams[i]); + _dataItems[i] = item; + } + else if (itemData is ushort) + { + item.Data = Convert.ToUInt16(messageParams[i]); + _dataItems[i] = item; + } + else if (itemData is double) + { + item.Data = Convert.ToDouble(messageParams[i]); + _dataItems[i] = item; + } + else if (itemData is ulong) + { + item.Data = Convert.ToUInt64(messageParams[i]); + _dataItems[i] = item; + } + else if (itemData is byte) + { + item.Data = Convert.ToByte(messageParams[i]); + _dataItems[i] = item; + + // doesnt matter if it is of types BITs or not, the configurable data item already knows + /*if (item.GetDataItemType() == DataItemType.BITS) + { + item.Data = Convert.ToByte(messageParams[i]); + _dataItems[i] = item; + } + else + { + item.Data = Convert.ToByte(messageParams[i]); + _dataItems[i] = item; + }*/ + } + else if (itemData is Array) + { + // convert object to byte array + IEnumerable en = (IEnumerable)messageParams[i]; + byte[] data = en.OfType().ToArray(); + item.Data = data; + _dataItems[i] = item; + } + else + { + throw new Exception("BitConfigurableMessage::SetParams() - unknown type"); + } + } + } + + /// + /// + /// + /// + public override string ToString() + { + string dataToReturn = "Description: " + _messageName + "\r\n"; + dataToReturn += "Payload Data:\r\n"; + + for (int i = 0; i < _dataItems.Count; i++) + { + IConfigurableDataItem dataItem = _dataItems[i]; + DataItemType itemType = dataItem.GetDataItemType(); + string itemName = dataItem.GetDataItemName(); + object itemValue = dataItem.Data; + + if (itemValue is uint) + { + if (itemValue == null) + { + dataToReturn += " " + itemName + ":Not Set\r\n"; + } + else + { + uint data = (uint)itemValue; + + dataToReturn += " " + itemName + ":" + "0x" + data.ToString("X8") + "\r\n"; + } + } + else if (itemValue is ushort) + { + if (itemValue == null) + { + dataToReturn += " " + itemName + ":Not Set\r\n"; + } + else + { + ushort data = (ushort)itemValue; + + dataToReturn += " " + itemName + ":" + "0x" + data.ToString("X4") + "\r\n"; + } + } + else if (itemValue is double) + { + if (itemValue == null) + { + dataToReturn += " " + itemName + ":Not Set\r\n"; + } + else + { + double data = (double)itemValue; + + dataToReturn += " " + itemName + ":" + data + "\r\n"; + } + } + else if (itemValue is ulong) + { + if (itemValue == null) + { + dataToReturn += " " + itemName + ":Not Set\r\n"; + } + else + { + ulong data = (ulong)itemValue; + + dataToReturn += " " + itemName + ":" + data + "\r\n"; + } + } + else if (itemValue is byte) + { + if (itemValue == null) + { + dataToReturn += " " + itemName + ":Not Set\r\n"; + } + else + { + if (itemType == DataItemType.BITS) + { + byte data = (byte)itemValue; + + string binString = Convert.ToString(data, 2).PadLeft(dataItem.GetNumDataItems(), '0'); + + dataToReturn += " " + itemName + ":" + "0b" + binString + "\r\n"; + } + else + { + byte data = (byte)itemValue; + + dataToReturn += " " + itemName + ":" + "0x" + data.ToString("X2") + "\r\n"; + } + } + } + else if (itemValue is Array) + { + string arrayDataStr = ""; + + if (itemValue == null) + { + arrayDataStr += " " + itemName + ":Not Set" + "\r\n"; + } + else + { + IEnumerable en = (IEnumerable)itemValue; + byte[] arrayTemp = en.OfType().ToArray(); + StringBuilder hex = new StringBuilder(arrayTemp.Length * 2); + foreach (byte b in arrayTemp) + hex.AppendFormat("{0:x2}", b); + + arrayDataStr += " " + itemName + ":" + hex.ToString() + "\r\n"; + } + + dataToReturn += arrayDataStr; + } + else if (itemValue is float) + { + if (itemValue == null) + { + dataToReturn += " " + itemName + ":Not Set\r\n"; + } + else + { + float data = (float)itemValue; + + dataToReturn += " " + itemName + ":" + data + "\r\n"; + } + } + else + { + dataToReturn += " " + itemName + ":" + "UNKNOWN TYPE:" + itemType + "\r\n"; + } + } + + return dataToReturn + "\r\n"; + + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageDataItem.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageDataItem.cs new file mode 100644 index 0000000..7601400 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageDataItem.cs @@ -0,0 +1,114 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; + +namespace BitMeasurementManagerLib +{ + /// + /// + /// + /// + public class BitConfigurableMessageDataItem : IConfigurableDataItem + { + #region PublicClassMembers + #endregion + + #region PrivateClassMembers + private string _dataItemName; + private int _numItems; + private string _defaultValueStr; + private BitConfigurableMessage.DataItemType _dataItemType; + #endregion + + #region PublicFunctions + + /// + /// + /// + /// + /// + /// + public BitConfigurableMessageDataItem(string dataItemName, BitConfigurableMessage.DataItemType type, TData dataValue, string defaultValueStr, int numItems) + { + _dataItemName = dataItemName; + _dataItemType = type; + _defaultValueStr = defaultValueStr; + _numItems = numItems; + Data = dataValue; + } + + /// + /// + /// + public Type DataType + { + get { return typeof(TData); } + } + + /// + /// + /// + object IConfigurableDataItem.Data + { + get { return Data; } + set { Data = (TData)value; } + } + + /// + /// + /// + public TData Data { get; set; } + + /// + /// + /// + /// + public string GetDataItemName() + { + return _dataItemName; + } + + /// + /// + /// + /// + public string GetDefaultValueStr() + { + return _defaultValueStr; + } + + /// + /// + /// + /// + public BitConfigurableMessage.DataItemType GetDataItemType() + { + return _dataItemType; + } + + /// + /// + /// + /// + public int GetNumDataItems() + { + return _numItems; + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageExcelFactory.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageExcelFactory.cs new file mode 100644 index 0000000..46c7ca6 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageExcelFactory.cs @@ -0,0 +1,213 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Collections.Generic; + +namespace BitMeasurementManagerLib +{ + /// + /// This class creates BitConfigurableMessage objects + /// + internal class BitConfigurableMessageExcelFactory : BitConfigurableMessageFactory + { + #region PrivateClassMembers + private Dictionary _messageDictionary; + #endregion + + #region PrivateFuctions + + /// + /// + /// + /// + public BitConfigurableMessageExcelFactory(string filename) + { + const int MIN_ROWS = 3; + const int MIN_COLS = 4; + + ExcelReader reader = null; + + try + { + _messageDictionary = new Dictionary(); + + reader = new ExcelReader(filename); + + List sheetNamesList = reader.ReadAllSheetNames(); + + foreach (string sheet in sheetNamesList) + { + // read the whole sheet and split on the lines + string entireSheet = reader.ReadAllRows(sheet, 1, 1); + string[] allRows = entireSheet.Split('\n'); + + // check that there is the min number of rows + if (allRows.Length < MIN_ROWS) + { + throw new Exception("BitConfigurableMessageExcelFactory::BitConfigurableMessageExcelFactory() - Sheet ID: " + sheet + " does not have the min amount of rows: " + MIN_ROWS.ToString()); + } + + // grab the first line where the command ID should be + string messageIdLine = allRows[1]; + string[] messageIdLineTokens = messageIdLine.Split(','); + + // check for the min number of columns + if (messageIdLineTokens.Length < MIN_COLS) + { + throw new Exception("BitConfigurableMessageExcelFactory::BitConfigurableMessageExcelFactory() - Sheet ID: " + sheet + " line 1 does not have the min amount of Cols: " + MIN_COLS.ToString()); + } + + // grab the message ID + uint msgId = Convert.ToUInt32(messageIdLineTokens[3], 16); + + // grab the line with the response msg ID + string rspMessageIdLine = allRows[2]; + string[] rspMessageIdLineTokens = rspMessageIdLine.Split(','); + + // check the number of cols + if (rspMessageIdLineTokens.Length < MIN_COLS) + { + throw new Exception("BitConfigurableMessageExcelFactory::BitConfigurableMessageExcelFactory() - Sheet ID: " + sheet + " line 2 does not have the min amount of Cols: " + MIN_COLS.ToString()); + } + + // grab the rsp msg ID + uint rspMsgId = Convert.ToUInt32(rspMessageIdLineTokens[3], 16); + + // create the message + BitConfigurableMessage msg = new BitConfigurableMessage(msgId, rspMsgId, sheet); + + // process the sheet to create the message object + // we already processed the first two lines, start at 3 + for (int i = 3; i < allRows.Length; i++) + { + var line = allRows[i]; + var values = line.Split(','); + + if (values.Length < MIN_COLS) + { + throw new Exception("BitConfigurableMessageExcelFactory::BitConfigurableMessageExcelFactory() - Sheet ID: " + msgId.ToString("X8") + " does not have all of the fields populated"); + } + + string dataItemName = values[0].Trim().ToUpper(); + string fieldType = values[1].Trim().ToUpper(); + string numberOfItemsTemp = values[2].Trim().ToUpper(); + numberOfItemsTemp = numberOfItemsTemp.Replace(",", ""); + int numberOfItems = Convert.ToInt32(numberOfItemsTemp); + string defaultValue = values[3].Trim().ToUpper(); + + BitConfigurableMessage.DataItemType dataType = BitConfigurableMessage.DataItemType.FLOAT; + + if (fieldType == BitInterfaceManagerConstants.FLOAT_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.FLOAT; + } + else if (fieldType == BitInterfaceManagerConstants.UINT_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.UINT; + } + else if (fieldType == BitInterfaceManagerConstants.UINT_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.UINT_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.USHORT_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.USHORT_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.USHORT_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.USHORT; + } + else if (fieldType == BitInterfaceManagerConstants.BYTE_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.BYTE_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.BYTE_ARRAY_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.BYTE_ARRAY_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.DOUBLE_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.DOUBLE; + } + else if (fieldType == BitInterfaceManagerConstants.ULONG_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.ULONG; + } + else if (fieldType == BitInterfaceManagerConstants.ULONG_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.ULONG_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.BITS_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.BITS; + } + else + { + throw new Exception("BitConfigurableMessageExcelFactory::BitConfigurableMessageExcelFactory() - Unknown type: " + values[1]); + } + + msg.AddDataItem(dataItemName, dataType, numberOfItems, defaultValue); + } + + _messageDictionary[msgId] = msg; + } + } + catch (Exception) + { + throw; + } + finally + { + if (reader != null) + { + reader.Dispose(); + } + } + } + + #endregion + + #region PublicFuctions + + /// + /// + /// + /// + /// + protected override BitConfigurableMessage CreateMessage(uint messageId) + { + if (_messageDictionary.ContainsKey(messageId) == false) + { + throw new Exception("BitConfigurableMessageExcelFactory:CreateMessage() - unknown ID: " + messageId.ToString("X8") + ", make sure this ID is defined in the definition ini file"); + } + + return new BitConfigurableMessage(_messageDictionary[messageId]); + } + + /// + /// + /// + /// + protected override Dictionary GetAllMessages() + { + return _messageDictionary; + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageExcelZipFactory.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageExcelZipFactory.cs new file mode 100644 index 0000000..7acb03f --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageExcelZipFactory.cs @@ -0,0 +1,204 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using ExcelZipLib; +using System; +using System.Collections.Generic; +using System.Globalization; + +namespace BitMeasurementManagerLib +{ + /// + /// This class creates BitConfigurableMessage objects + /// + internal class BitConfigurableMessageExcelZipFactory : BitConfigurableMessageFactory + { + #region PrivateClassMembers + private Dictionary _messageDictionary; + #endregion + + #region PrivateFuctions + + /// + /// + /// + /// + /// + public BitConfigurableMessageExcelZipFactory(string filename) + { + const int MIN_ROWS = 3; + const int MIN_COLS = 4; + + try + { + _messageDictionary = new Dictionary(); + + List allWorkSheets = Workbook.Worksheets(filename); + + foreach (worksheet sheet in allWorkSheets) + { + string test = sheet.ToString(); + + // check that there is the min number of rows + if (sheet.Rows.Count < MIN_ROWS) + { + throw new Exception("BitConfigurableMessageExcelZipFactory::BitConfigurableMessageExcelZipFactory() - Sheet ID: " + sheet + " does not have the min amount of rows: " + MIN_ROWS.ToString()); + } + + // grab the command ID Row + Row cmdIdRow = sheet.Rows[1]; + + if (cmdIdRow.Cells.Length < MIN_COLS) + { + throw new Exception("BitConfigurableMessageExcelZipFactory::BitConfigurableMessageExcelZipFactory() - Sheet ID: " + sheet + " line 1 does not have the min amount of Cols: " + MIN_COLS.ToString()); + } + + string msgIdStr = cmdIdRow.Cells[3].Text.Trim().ToUpper(); + + uint msgId = Convert.ToUInt32(msgIdStr, 16); + + // grab the rsp ID Row + Row rspIdRow = sheet.Rows[2]; + + if (rspIdRow.Cells.Length < MIN_COLS) + { + throw new Exception("BitConfigurableMessageExcelZipFactory::BitConfigurableMessageExcelZipFactory() - Sheet ID: " + sheet + " line 1 does not have the min amount of Cols: " + MIN_COLS.ToString()); + } + + string rspMsgIdStr = rspIdRow.Cells[3].Text.Trim().ToUpper(); + + // grab the rsp msg ID + uint rspMsgId = Convert.ToUInt32(rspMsgIdStr, 16); + + // create the message + BitConfigurableMessage msg = new BitConfigurableMessage(msgId, rspMsgId, msgId.ToString("X8")); + + //remove header, cmd ID and rsp ID rows from worksheet + sheet.Rows.Remove(sheet.Rows[0]); + sheet.Rows.Remove(sheet.Rows[0]); + sheet.Rows.Remove(sheet.Rows[0]); + + // process the sheet to create the message object + // start at 1 to skip the file header + foreach (Row row in sheet.Rows) + { + if (row.Cells.Length < MIN_COLS) + { + throw new Exception("BitConfigurableMessageExcelZipFactory::BitConfigurableMessageFactory() - Sheet ID: " + msgId.ToString("X8") + " does not have all of the fields populated"); + } + + string dataItemName = row.Cells[0].Text.Trim().ToUpper(); + + string fieldType = row.Cells[1].Text.Trim().ToUpper(); + string numberOfItemsTemp = row.Cells[2].Text.Trim().ToUpper(); + numberOfItemsTemp = numberOfItemsTemp.Replace(",", ""); + int numberOfItems = Convert.ToInt32(numberOfItemsTemp); + string defaultValue = row.Cells[3].Text.Trim().ToUpper(); + + BitConfigurableMessage.DataItemType dataType = BitConfigurableMessage.DataItemType.FLOAT; + + if (fieldType == BitInterfaceManagerConstants.FLOAT_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.FLOAT; + } + else if (fieldType == BitInterfaceManagerConstants.UINT_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.UINT; + } + else if (fieldType == BitInterfaceManagerConstants.UINT_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.UINT_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.USHORT_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.USHORT_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.USHORT_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.USHORT; + } + else if (fieldType == BitInterfaceManagerConstants.BYTE_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.BYTE_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.BYTE_ARRAY_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.BYTE_ARRAY_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.DOUBLE_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.DOUBLE; + } + else if (fieldType == BitInterfaceManagerConstants.ULONG_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.ULONG; + } + else if (fieldType == BitInterfaceManagerConstants.ULONG_HEX_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.ULONG_HEX; + } + else if (fieldType == BitInterfaceManagerConstants.BITS_DATA_TYPE.ToUpper()) + { + dataType = BitConfigurableMessage.DataItemType.BITS; + } + else + { + throw new Exception("BitConfigurableMessageExcelZipFactory::BitConfigurableMessageExcelZipFactory() - Unknown type: " + row.FilledCells[0].ToString()); + } + + msg.AddDataItem(dataItemName, dataType, numberOfItems, defaultValue); + } + + // hold onto the message object + _messageDictionary[msgId] = msg; + } + } + catch (Exception) + { + throw; + } + } + #endregion + + #region PublicFuctions + + /// + /// + /// + /// + /// + protected override BitConfigurableMessage CreateMessage(uint messageId) + { + if (_messageDictionary.ContainsKey(messageId) == false) + { + throw new Exception("BitConfigurableMessageExcelZipFactory:CreateMessage() - unknown ID: " + messageId.ToString("X8") + ", make sure this ID is defined in the definition ini file"); + } + + return new BitConfigurableMessage(_messageDictionary[messageId]); + } + + /// + /// + /// + /// + protected override Dictionary GetAllMessages() + { + return _messageDictionary; + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageFactory.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageFactory.cs new file mode 100644 index 0000000..4cb2070 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageFactory.cs @@ -0,0 +1,77 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; +using System.Collections.Generic; + +namespace BitMeasurementManagerLib +{ + /// + /// This class creates BitConfigurableMessage objects + /// + internal abstract class BitConfigurableMessageFactory + { + internal enum FactoryType + { + EXCEL, + EXCEL_ZIP + }; + + private static BitConfigurableMessageFactory _bitFactoryInstance; + + #region PublicFuctions + + public static BitConfigurableMessageFactory Instance(string inputFileName = "", FactoryType type = FactoryType.EXCEL_ZIP) + { + if (_bitFactoryInstance == null) + { + if (type == FactoryType.EXCEL) + { + _bitFactoryInstance = new BitConfigurableMessageExcelFactory(inputFileName); + } + else if (type == FactoryType.EXCEL_ZIP) + { + _bitFactoryInstance = new BitConfigurableMessageExcelZipFactory(inputFileName); + } + else + { + throw new Exception("BitConfigurableMessageFactory::Instance() - unsupport input type: " + type.ToString()); + } + + } + + return _bitFactoryInstance; + } + + protected abstract Dictionary GetAllMessages(); + + protected abstract BitConfigurableMessage CreateMessage(uint messageId); + + public Dictionary RetreiveAllMessages() + { + return _bitFactoryInstance.GetAllMessages(); + } + + public BitConfigurableMessage RetreiveMessage(uint messageId) + { + return _bitFactoryInstance.CreateMessage(messageId); + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageHeader.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageHeader.cs new file mode 100644 index 0000000..0b9227a --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitConfigurableMessageHeader.cs @@ -0,0 +1,205 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace BitMeasurementManagerLib +{ + /// + /// This class implements a message header that is used by the BitConfigurableMessage + /// + public static class BitConfigurableMessageHeader + { + #region PrivateClassMembers + + #endregion + + #region PublicFuctions + + /// + /// + /// + /// + /// + public static uint GetMessageId(IntPtr pData, uint numBytesInPdata) + { + return GetCmdMessageId(pData, numBytesInPdata); + } + + /// + /// + /// + /// + /// + /// + public static uint GetSecondaryMessageId(IntPtr pData, uint numBytesInPdata, out bool isSecondaryIdUsed) + { + return GetSecondaryCmdMessageId(pData, numBytesInPdata, out isSecondaryIdUsed); + } + + /// + /// + /// + /// + /// + /// + private static uint GetSecondaryCmdMessageId(IntPtr pData, uint numBytesInPdata, out bool isSecondaryIdUsed) + { + unsafe + { + isSecondaryIdUsed = false; + + bool shallWeSwap = BitMsgEndianControl.Instance().ShallWeSwap(); + + BitMsgEndianControl.HeaderDef headerDef = BitMsgEndianControl.Instance().GetHeaderDef(); + + // is there enough data? + if (numBytesInPdata <= headerDef.secondaryMsgIdByteLocation + headerDef.secondaryMsgIdDataLen) + { + ErrorLogger.Instance().Write("BitConfigurableMessageHeader::GetSecondaryCmdMessageId() - not enough data form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes, needed " + (headerDef.secondaryMsgIdByteLocation + headerDef.secondaryMsgIdDataLen).ToString() + " for a header", ErrorLogger.LogLevel.INFO); + throw new Exception("BitConfigurableMessageHeader::GetSecondaryCmdMessageId() - not enough data form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes, needed " + (headerDef.secondaryMsgIdByteLocation + headerDef.secondaryMsgIdDataLen).ToString() + " for a header"); + } + + if (headerDef.secondaryMsgIdByteLocation == 0) + { + isSecondaryIdUsed = false; + return 0; + } + else + { + isSecondaryIdUsed = true; + + uint cmdId = 0; + + if (headerDef.secondaryMsgIdDataLen == 1) + { + byte* pCmdIdBytePtr = (byte*)pData.ToPointer() + headerDef.secondaryMsgIdByteLocation; + + cmdId = pCmdIdBytePtr[0]; + } + else if (headerDef.secondaryMsgIdDataLen == 2) + { + ushort* pCmdIdUshortPtr = (ushort*)pData.ToPointer() + headerDef.secondaryMsgIdByteLocation; + + ushort cmdIdTemp = (ushort)pCmdIdUshortPtr[0]; + + if (shallWeSwap == true) + { + cmdIdTemp = Util.Swap(cmdIdTemp); + } + + cmdId = cmdIdTemp; + } + else if (headerDef.secondaryMsgIdDataLen == 4) + { + uint* pCmdIdUInttPtr = (uint*)pData.ToPointer() + headerDef.secondaryMsgIdByteLocation; + + cmdId = (uint)pCmdIdUInttPtr[0]; + + if (shallWeSwap == true) + { + cmdId = Util.Swap(cmdId); + } + } + else + { + throw new Exception("BitConfigurableMessageHeader::GetSecondaryCmdMessageId() - unhandled Cmd ID data length: " + headerDef.msgIdDataLen); + } + + return cmdId; + } + } + } + + /// + /// getter for the message id + /// + /// The id + private static uint GetCmdMessageId(IntPtr pData, uint numBytesInPdata) + { + unsafe + { + bool shallWeSwap = BitMsgEndianControl.Instance().ShallWeSwap(); + + BitMsgEndianControl.HeaderDef headerDef = BitMsgEndianControl.Instance().GetHeaderDef(); + + // is there enough data? + if (numBytesInPdata <= headerDef.msgIdByteLocation + headerDef.msgIdDataLen) + { + ErrorLogger.Instance().Write("BitConfigurableMessageHeader::GetCmdMessageId() - not enough data form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes, needed " + (headerDef.msgIdByteLocation + headerDef.msgIdDataLen).ToString() + " for a header", ErrorLogger.LogLevel.INFO); + throw new Exception("BitConfigurableMessageHeader::GetCmdMessageId() - not enough data form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes, needed " + (headerDef.msgIdByteLocation + headerDef.msgIdDataLen).ToString() + " for a header"); + } + + uint cmdId = 0; + + if (headerDef.msgIdDataLen == 1) + { + byte* pCmdIdBytePtr = (byte*)pData.ToPointer() + headerDef.msgIdByteLocation; + + cmdId = pCmdIdBytePtr[0]; + } + else if (headerDef.msgIdDataLen == 2) + { + ushort* pCmdIdUshortPtr = (ushort*)pData.ToPointer() + headerDef.msgIdByteLocation; + + ushort cmdIdTemp = (ushort)pCmdIdUshortPtr[0]; + + if (shallWeSwap == true) + { + cmdIdTemp = Util.Swap(cmdIdTemp); + } + + cmdId = cmdIdTemp; + } + else if (headerDef.msgIdDataLen == 4) + { + uint* pCmdIdUInttPtr = (uint*)pData.ToPointer() + headerDef.msgIdByteLocation; + + cmdId = (uint)pCmdIdUInttPtr[0]; + + if (shallWeSwap == true) + { + cmdId = Util.Swap(cmdId); + } + } + else + { + throw new Exception("BitConfigurableMessageHeader::GetCmdMessageId() - unhandled Cmd ID data length: " + headerDef.msgIdDataLen); + } + + return cmdId; + } + } + + /// + /// Getter for the header length + /// The Header is considered to be all of the data up to the message ID + /// + /// The header length in bytes. The head Length is the number of bytes from the beginning of the message through the message ID + public static uint GetHeaderSize() + { + BitMsgEndianControl.HeaderDef headerDef = BitMsgEndianControl.Instance().GetHeaderDef(); + + int idSize = headerDef.msgIdByteLocation + headerDef.msgIdDataLen; + + return (uint)idSize; + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitMessageIDs.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitMessageIDs.cs new file mode 100644 index 0000000..8e7f1f4 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/Messages/BitMessageIDs.cs @@ -0,0 +1,144 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; + +namespace BitMeasurementManagerLib +{ + /// + /// + /// + internal class BitMessageIDs + { + #region PrivateClassMembers + private Dictionary _idToSizeMap; + private Dictionary _cmdIdToRspIdMap; + private List _msgIds; + #endregion + + #region PublicFuctions + + /// + /// + /// + internal BitMessageIDs() + { + _idToSizeMap = new Dictionary(); + _cmdIdToRspIdMap = new Dictionary(); + _msgIds = new List(); + } + + /// + /// + /// + /// + internal void AddId(uint messageId) + { + _idToSizeMap.Add(messageId, 0); + _msgIds.Add(messageId); + } + + /// + /// + /// + /// + /// + internal bool ContainsId(uint id) + { + return _idToSizeMap.ContainsKey(id); + } + + /// + /// + /// + /// + internal List GetAllIds() + { + return _msgIds; + } + + /// + /// + /// + /// + /// + internal uint GetResponseId(uint cmdId) + { + if (_cmdIdToRspIdMap.ContainsKey(cmdId) == false) + { + throw new Exception("BitMessageIDs::GetResponseId() - cmdIdToRspIdMap does not contains messageId: " + cmdId.ToString("X8")); + } + + return _cmdIdToRspIdMap[cmdId]; + } + + /// + /// + /// + /// + /// + internal uint GetSize(uint id) + { + if (_idToSizeMap.ContainsKey(id) == false) + { + throw new Exception("BitMessageIDs::GetSize() - _idToSizeMap does not contais messageId: " + id.ToString("X8")); + } + + return _idToSizeMap[id]; + } + + /// + /// + /// + /// + /// + internal bool IsThereAResponseMessage(uint cmdId) + { + if (_cmdIdToRspIdMap.ContainsKey(cmdId) == false) + { + return false; + } + else + { + return true; + } + } + + /// + /// + /// + /// + /// + internal void SetMsgSize(uint msgId, uint numBytes) + { + _idToSizeMap[msgId] = numBytes; + } + + /// + /// + /// + /// + /// + internal void SetRspId(uint cmdId, uint rspId) + { + _cmdIdToRspIdMap[cmdId] = rspId; + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/MsgHandler/BitMsgHandler.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/MsgHandler/BitMsgHandler.cs new file mode 100644 index 0000000..24d9e3e --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/MsgHandler/BitMsgHandler.cs @@ -0,0 +1,389 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using Raytheon.Common; +using System.IO; +using System.Collections.Generic; + +namespace BitMeasurementManagerLib +{ + /// + /// Handles received messages from the UUT + /// + internal class BitMsgHandler : MsgDevice + { + #region PublicClassMembers + public enum ErrorCodes + { + NO_ERROR = 0, + UNKNOWN_MSG_ID = 1 + }; + #endregion + + #region PrivateClassMembers + private static object _syncObj = new Object(); + private BinaryWriter _binWriter; + private StreamWriter _asciiWriter; + private MeasurementManagerLib.BitMeasurementManager.MessageReceivedDelegate _callback; + private SortedDictionary _callbackControl; + private readonly BitMessageIDs _messageIds; + private readonly bool _shallWeLogOutgoingBinData; + private readonly bool _shallWeLogOutgoingAsciiData; + private readonly bool _shallWeLogIncomingBinData; + private readonly bool _shallWeLogIncomingAsciiData; + private readonly uint _bitmask; + private readonly string _crcFieldName; + #endregion + + #region PublicFuctions + + /// + /// The constructor + /// + /// Host callback for received messages + /// The size of the internal parsing buffer + /// THe binary file log name + /// The ascii file log name + /// + /// + /// + /// + unsafe public BitMsgHandler(BitMessageIDs messageIds, MeasurementManagerLib.BitMeasurementManager.MessageReceivedDelegate callback, uint bufferSize, string binLogFileName, string asciiLogFileName, bool shallWeLogOutgoingBinData, bool shallWeLogOutgoingAsciiData, bool shallWeLogIncomingBinData, bool shallWeLogIncomingAsciiData, uint crcBitmask, string crcFieldName, bool shallWePerformVerboseParserLogging) + : base(new BitMsgParser(messageIds, shallWePerformVerboseParserLogging), bufferSize) + { + _messageIds = messageIds; + + // hold onto the callback + _callback = callback; + + _shallWeLogOutgoingBinData = shallWeLogOutgoingBinData; + _shallWeLogOutgoingAsciiData = shallWeLogOutgoingAsciiData; + _shallWeLogIncomingBinData = shallWeLogIncomingBinData; + _shallWeLogIncomingAsciiData = shallWeLogIncomingAsciiData; + + _bitmask = crcBitmask; + _crcFieldName = crcFieldName; + + // set all messages to not issue a callback. Host can change it as necessary + _callbackControl = new SortedDictionary(); + List msgIds = messageIds.GetAllIds(); + + foreach (uint id in msgIds) + { + _callbackControl[id] = false; + } + + _binWriter = null; + + _asciiWriter = null; + + SetLogFileNames(binLogFileName, asciiLogFileName); + + // set the callback + base.SetCompleteMessageCallback(this.OnCompleteMessage); + } + + /// + /// The finalizer + /// + ~BitMsgHandler() + { + Dispose(false); + } + + /// + /// Add data to the buffer. For this Handler, we are just going to log out the data + /// + /// The data to add + /// The number of bytes in the data buffer + public override void AddData(byte[] data, uint numBytes) + { + // log out raw data and add to buffer for processing + lock (_syncObj) + { + WriteIncomingDataToLog(data, (int)numBytes); + + AddToBuffer(data, numBytes); + } + } + + /// + /// Clear all data from the buffer. We are just logging out data, no buffer to clear + /// + public void ClearData() + { + ClearBuffer(); + } + + /// + /// + /// + public void CloseDataFiles() + { + lock (_syncObj) + { + if (_binWriter != null) + { + _binWriter.Close(); + _binWriter.Dispose(); + _binWriter = null; + } + + if (_asciiWriter != null) + { + _asciiWriter.Close(); + _asciiWriter.Dispose(); + _asciiWriter = null; + } + } + } + + /// + /// The callback function for when a complete message is received. We are just logging out data, no messages to handle. + /// + /// The id of the message received + /// The data for the message received + /// the number of bytes in pData + /// The parser error code + unsafe public void OnCompleteMessage(uint msgId, IntPtr pData, uint numBytes, uint errorCode) + { + try + { + if (_messageIds.ContainsId(msgId) == false) + { + ErrorLogger.Instance().Write("BitMsgHandler::OnCompleteMessage() - detected unknown msg id: " + msgId.ToString()); + } + else + { + // create the msg and parse it + BitConfigurableMessage msg = BitConfigurableMessageFactory.Instance().RetreiveMessage(msgId); + msg.Parse(pData); + + int callbackValue = 0; + + // check for crc errors + if (_bitmask != 0x00000000) + { + uint rawStatus = msg.GetDataItemByName(_crcFieldName); + var maskedStatus = rawStatus & _bitmask; + + if (maskedStatus != 0) + { + ErrorLogger.Instance().Write($"Message Status register indicates that a CRC error may have occurred. Raw status read: 0x{rawStatus:X8}. Masked status value: 0x{maskedStatus:X8}"); + callbackValue = -1; + } + } + + // get the ascii msg + string asciiMessage = msg.ToString(); + + // log it + WriteIncomingDataToLog(asciiMessage); + + // add the message to the buffer in case the host wants it + BitMsgRxBuffer.Instance().AddMsg(msg, false); + + // issue callback if requested + uint id = msg.GetMessageId(); + + if (_callbackControl[id] == true) + { + _callback(id, msg.GetEntireMsgLength(), callbackValue); + } + + // some debugging + ErrorLogger.Instance().Write("BitMsgHandler::HandleMsg() - added message " + msgId.ToString("X8") + " to buffer ", ErrorLogger.LogLevel.INFO); + } + } + catch (Exception err) + { + //@@@ need to flow error to the host + ErrorLogger.Instance().Write("BitMsgHandler::HandleMsg() - caught an error: " + err.Message, ErrorLogger.LogLevel.ERROR); + } + } + + /// + /// Subscribe a callback to a specific msg + /// + /// The msg to subscribe to + /// true to get the callbacks, false to not get them + public void SetCallbackControl(uint msgId, bool shallWeIssueCallback) + { + _callbackControl[msgId] = shallWeIssueCallback; + } + + /// + /// Set the data file log names. Closes the previous file and opens a new one + /// + /// The binary file log name + /// The ascii file log name + public void SetLogFileNames(string binFileName, string asciiFileName) + { + lock (_syncObj) + { + if (_binWriter != null) + { + _binWriter.Close(); + } + + _binWriter = new BinaryWriter(File.Open(binFileName, FileMode.Create)); + + if (_asciiWriter != null) + { + _asciiWriter.Close(); + } + + _asciiWriter = new StreamWriter(File.Open(asciiFileName, FileMode.Create)); + } + } + + /// + /// Stops the message handler + /// + public void QuitHandler() + { + base.QuitThread(); + } + + /// + /// Write bin data to a file + /// + /// The data to write + /// The number of bytes to write + public void WriteIncomingDataToLog(byte[] data, int numBytes) + { + lock (_syncObj) + { + if (_binWriter == null && _shallWeLogIncomingBinData == true) + { + throw new Exception("BitMsgHandler::WriteIncomingDataToLog() - Trying to log bin data before the log file is open"); + } + else if (_shallWeLogIncomingBinData == true) + { + // write the data out and flush it for immediate viewing + _binWriter.Write(data, 0, (int)numBytes); + _binWriter.Flush(); + } + } + } + + /// + /// Write ascii data to a log file. Prepends a timestamp to the data + /// + /// The data to write + public void WriteIncomingDataToLog(string data) + { + lock (_syncObj) + { + if (_asciiWriter == null && _shallWeLogIncomingAsciiData == true) + { + throw new Exception("BitMsgHandler::WriteIncomingDataToLog() - Trying to log ascii data before the log file is open"); + } + else if (_shallWeLogIncomingAsciiData == true) + { + string timestamp = "Time: " + Util.GetTimeString(); + + string dataToLog = timestamp + "\r\n" + data; + + _asciiWriter.WriteLine(dataToLog); + + _asciiWriter.Flush(); + } + } + } + + /// + /// Write bin data to a file + /// + /// The data to write + /// The number of bytes to write + public void WriteOutgoingDataToLog(byte[] data, int numBytes) + { + lock (_syncObj) + { + if (_binWriter == null && _shallWeLogOutgoingBinData == true) + { + throw new Exception("BitMsgHandler::WriteOutgoingDataToLog() - Trying to log bin data before the log file is open"); + } + else if (_shallWeLogOutgoingBinData == true) + { + _binWriter.Write(data, 0, numBytes); + + _binWriter.Flush(); + } + } + } + + /// + /// Write ascii data to a log file. Prepends a timestamp to the data + /// + /// The data to write + public void WriteOutgoingDataToLog(string data) + { + lock (_syncObj) + { + if (_asciiWriter == null && _shallWeLogOutgoingAsciiData == true) + { + throw new Exception("BitMsgHandler::WriteOutgoingDataToLog() - Trying to log ascii data before the log file is open"); + } + else if (_shallWeLogOutgoingAsciiData == true) + { + string timestamp = "Time: " + Util.GetTimeString(); + + string dataToLog = timestamp + "\r\n" + data; + + _asciiWriter.WriteLine(dataToLog); + + _asciiWriter.Flush(); + } + } + } + + /// + /// + /// + /// + protected override void Dispose(bool disposing) + { + if (disposing) + { + try + { + // call the parent dispose first + base.Dispose(disposing); + + // now dispose of our resources + if (_binWriter != null) + { + _binWriter.Dispose(); + } + + if (_asciiWriter != null) + { + _asciiWriter.Dispose(); + } + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + } + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/BitMeasurementManager/MsgHandler/BitMsgParser.cs b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/MsgHandler/BitMsgParser.cs new file mode 100644 index 0000000..53182f4 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/BitMeasurementManager/MsgHandler/BitMsgParser.cs @@ -0,0 +1,234 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Common; +using System; + +namespace BitMeasurementManagerLib +{ + /// + /// Parses out messages that go between the VRSUI and the Test Controller + /// This class is meant to be used by both the test controller and the VRSUI, so it parses out messages that target either of those systems + /// + internal class BitMsgParser : IMsgParser + { + #region PublicClassMembers + + #endregion + + #region PrivateClassMembers + private readonly BitMessageIDs _messageIdToSizeMap; + private BitMsgEndianControl.HeaderDef _headerDef; + private readonly bool _shallWePerformVerboseParserLogging; + #endregion + + #region PrivateFuctions + + /// + /// + /// + /// + /// + /// + /// + /// + /// + private bool HandleData(IntPtr pData, uint numBytesInPdata, ref uint bytesToRemove, ref uint messageId, ref uint errorCode) + { + // check to see if we have enough data for at least a standard header + uint payloadHeaderSize = BitConfigurableMessageHeader.GetHeaderSize(); + + if (numBytesInPdata < payloadHeaderSize) + { + ErrorLogger.Instance().Write("BitMsgParser::HandleData() - not enough data in the buffer to form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes, needed " + payloadHeaderSize.ToString() + " for a header", ErrorLogger.LogLevel.INFO); + bytesToRemove = 0; + return false; + } + + uint id = BitConfigurableMessageHeader.GetMessageId(pData, numBytesInPdata); + bool isSecondaryIdUsed = false; + uint secondaryId = BitConfigurableMessageHeader.GetSecondaryMessageId(pData, numBytesInPdata, out isSecondaryIdUsed); + + // check that this is an expected message + if (_messageIdToSizeMap.ContainsId(id) == false) + { + uint numBytesToRemove = Resync(pData, numBytesInPdata); + string msg = "BitMsgParser::HandleData() - unknown id received: " + id.ToString("X8") + " When resyncing threw away " + numBytesToRemove.ToString() + " Bytes"; + ErrorLogger.Instance().Write(msg, ErrorLogger.LogLevel.ERROR); + bytesToRemove = numBytesToRemove; + return false; + } + + // look at secondary ID if applicable + if (isSecondaryIdUsed == true) + { + if (secondaryId != _headerDef.secondaryMsgIdExpectedValue) + { + uint numBytesToRemove = Resync(pData, numBytesInPdata); + string msg = "BitMsgParser::HandleData() - detected seondary ID: " + secondaryId.ToString("X8") + " was not as expected: " + _headerDef.secondaryMsgIdExpectedValue.ToString("X8") + " When resyncing threw away " + numBytesToRemove.ToString() + " Bytes"; + ErrorLogger.Instance().Write(msg, ErrorLogger.LogLevel.ERROR); + bytesToRemove = numBytesToRemove; + return false; + } + } + + uint msgSize = _messageIdToSizeMap.GetSize(id); + + // do we have enough data to make the complete message + if (numBytesInPdata < msgSize) + { + ErrorLogger.Instance().Write("BitMsgParser::HandleData() - not enough data in the buffer to form a entire message. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes, expected msg size is: " + msgSize.ToString(), ErrorLogger.LogLevel.INFO); + // need to wait for more data + bytesToRemove = 0; + return false; + } + + // everything has checked out, set the return params + bytesToRemove = msgSize; + + if (_shallWePerformVerboseParserLogging == true) + { + ErrorLogger.Instance().Write("BitMsgParser::HandleData() - found msg: " + id.ToString() + " which has " + msgSize.ToString() + " bytes", ErrorLogger.LogLevel.INFO); + } + + messageId = id; + + return true; + } + + /// + /// + /// + /// + /// + /// The number of bytes to remove from the buffer + private uint Resync(IntPtr pData, uint numBytesInPdata) + { + ErrorLogger.Instance().Write("BitMsgParser::Resync() - Begin", ErrorLogger.LogLevel.INFO); + + // increment pData by 1 + pData = IntPtr.Add(pData, 1); + + // keep track of how many bytes to remove + uint bytesToRemove = 1; + + // update bytes remaining + numBytesInPdata = numBytesInPdata - 1; + + bool didWeFindMsg = false; + + while (didWeFindMsg == false) + { + // check to see if we have enough data for at least a standard header + uint payloadHeaderSize = BitConfigurableMessageHeader.GetHeaderSize(); + + if (numBytesInPdata < payloadHeaderSize) + { + ErrorLogger.Instance().Write("BitMsgParser::Resync() - not enough data in the buffer to form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes, needed " + payloadHeaderSize.ToString() + " for a header. Removing " + bytesToRemove.ToString() + " bytes", ErrorLogger.LogLevel.INFO); + break; + } + + uint id = BitConfigurableMessageHeader.GetMessageId(pData, numBytesInPdata); + bool isSecondaryIdUsed = false; + uint secondaryId = BitConfigurableMessageHeader.GetSecondaryMessageId(pData, numBytesInPdata, out isSecondaryIdUsed); + + // check that this is an expected message + if (_messageIdToSizeMap.ContainsId(id) == false) + { + // need to keep looking + // increment pData by 1 + pData = IntPtr.Add(pData, 1); + + // keep track of how many bytes to remove + bytesToRemove++; + + // update bytes remaining + numBytesInPdata--; + } + else + { + // look at secondary ID if applicable + if (isSecondaryIdUsed == true) + { + if (secondaryId != _headerDef.secondaryMsgIdExpectedValue) + { + // need to keep looking + // increment pData by 1 + pData = IntPtr.Add(pData, 1); + + // keep track of how many bytes to remove + bytesToRemove++; + + // update bytes remaining + numBytesInPdata--; + } + else + { + didWeFindMsg = true; + ErrorLogger.Instance().Write("BitMsgParser::Resync() - Detected message ID: " + id.ToString("X8") + ". Detected Secondary ID: " + secondaryId.ToString("X8") + " Resync complete. Removing " + bytesToRemove.ToString() + " Bytes", ErrorLogger.LogLevel.INFO); + break; + } + } + else + { + didWeFindMsg = true; + ErrorLogger.Instance().Write("BitMsgParser::Resync() - Detected message ID: " + id.ToString("X8") + ". Resync complete. Removing " + bytesToRemove.ToString() + " Bytes", ErrorLogger.LogLevel.INFO); + break; + } + } + } + + ErrorLogger.Instance().Write("BitMsgParser::Resync() - returning " + bytesToRemove.ToString(), ErrorLogger.LogLevel.INFO); + + return bytesToRemove; + + } + #endregion + + #region PublicFuctions + + /// + /// + /// + /// + /// + public BitMsgParser(BitMessageIDs messageIds, bool shallWePerformVerboseParserLogging) + { + // Using it to hold onto valid message ids and the size + _messageIdToSizeMap = messageIds; + _shallWePerformVerboseParserLogging = shallWePerformVerboseParserLogging; + _headerDef = BitMsgEndianControl.Instance().GetHeaderDef(); + } + + /// + /// Search the data buffer for the next valid message + /// + /// The data buffer to search + /// The number of bytes in pData + /// The number of bytes to remove from the buffer + /// The message id of the message that was found + /// true if a message was found, false otherwise + public bool Run(IntPtr pData, uint numBytesInPdata, ref uint bytesToRemove, ref uint messageId, ref uint errorCode) + { + // default error code to 0; + errorCode = 0; + + return HandleData(pData, numBytesInPdata, ref bytesToRemove, ref messageId, ref errorCode); + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ChillerCartMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ChillerCartMeasurementManager.cs new file mode 100644 index 0000000..597839e --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ChillerCartMeasurementManager.cs @@ -0,0 +1,498 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using Raytheon.Instruments; +using Raytheon.Common; +using System; +using System.Threading; +using ChillerCartMeasurementManagerLib; +using NLog; + +namespace MeasurementManagerLib +{ + /// + /// This class manages chiller instruments and provides an abstraction + /// + public class ChillerCartMeasurementManager : IDisposable + { + #region PublicMembers + public delegate void ChillerDelegate(double temperature, double coolantSetpoint, int errorCode); + public delegate void FlowMeterDelegate(double flow, int errorCode); + public delegate void TemperatureDelegate(double temperature, int errorCode); + #endregion + + #region PrivateMembers + private readonly IChiller _chiller; + private readonly IFlowMeter _flowMeter; + private readonly ITempMonitor _tempMonitor; + private ChillerDataLogWorker _chillerDataLogWorker; + private Thread _chillerDataLogThread; + private FlowMeterDataLogWorker _flowMeterDataLogWorker; + private Thread _flowMeterDataLogThread; + private TempDataLogWorker _tempMonDataLogWorker; + private Thread _tempMonDataLogThread; + + private static NLog.ILogger _logger; + + #endregion + + #region PrivateFunctions + + /// + /// Dispose of this object's resources + /// + /// Currently disposing + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // stop the logging if it is still running + try + { + ChillerLogStop(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + + // stop the logging if it is still running + try + { + FlowMeterLogStop(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + + // stop the logging if it is still running + try + { + TemperatureSensorLogStop(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + + // dispose the thread + try + { + if (_chillerDataLogWorker != null) + { + _chillerDataLogWorker.Dispose(); + } + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + + // dispose the thread + try + { + if (_flowMeterDataLogWorker != null) + { + _flowMeterDataLogWorker.Dispose(); + } + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + + // dispose the thread + try + { + if (_tempMonDataLogWorker != null) + { + _tempMonDataLogWorker.Dispose(); + } + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + + // dispose other resources + if (_chiller != null) + { + try + { + _chiller.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + if (_flowMeter != null) + { + try + { + _flowMeter.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + if (_tempMonitor != null) + { + try + { + _tempMonitor.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + try + { + ErrorLogger.Instance().Dispose(); + } + catch (Exception) + { + // nothing to do + } + } + + } + + /// + /// The Finalizer + /// + ~ChillerCartMeasurementManager() + { + Dispose(false); + } + + #endregion + + #region PublicFunctions + + /// + /// constructor that uses instrument manager to create an instrument + /// + /// + /// + /// + /// + /// + /// + public ChillerCartMeasurementManager(IInstrumentManager instrumentManager, string chillerName, string flowMeeterName, string tempSensorName, string errorLog) + { + try + { + _logger = LogManager.GetCurrentClassLogger(); + + // these gets created in the start logging functions + _chillerDataLogWorker = null; + _chillerDataLogThread = null; + _flowMeterDataLogWorker = null; + _flowMeterDataLogThread = null; + _tempMonDataLogWorker = null; + _tempMonDataLogThread = null; + + _chiller = null; + _flowMeter = null; + _tempMonitor = null; + + if (!string.IsNullOrEmpty(chillerName)) + { + _chiller = instrumentManager.GetInstrument(chillerName); + _chiller?.Initialize(); + } + + if (!string.IsNullOrEmpty(flowMeeterName)) + { + _flowMeter = instrumentManager.GetInstrument(flowMeeterName); + _flowMeter?.Initialize(); + } + + if (!string.IsNullOrEmpty(tempSensorName)) + { + _tempMonitor = instrumentManager.GetInstrument(tempSensorName); + _tempMonitor?.Initialize(); + } + } + catch (Exception) + { + Dispose(true); + + throw; + } + } + + + + /// + /// + /// + /// + public double ChillerGetCoolantTemperature() + { + return _chiller.GetCoolantTemperature(); + } + + /// + /// + /// + /// + public double ChillerGetCoolantTemperatureSetpoint() + { + return _chiller.GetCoolantSetpoint(); + } + + /// + /// + /// + public void ChillerDisableFlow() + { + _chiller.DisableFlow(); + } + + /// + /// + /// + public void ChillerEnableFlow() + { + _chiller.EnableFlow(); + } + + /// + /// + /// + /// + /// + /// An optional delegate for the host to receive the data + public void ChillerLogStart(string filename, int threadRestTimeMs, ChillerCartMeasurementManager.ChillerDelegate callback) + { + if (_chillerDataLogWorker != null) + { + //Should not be logging. Stop Logger + ChillerLogStop(); + _chillerDataLogWorker.Dispose(); + } + + //Start logging on a new thread. Also, start calling callback with requested data + _chillerDataLogWorker = new ChillerDataLogWorker(this, filename, threadRestTimeMs, callback); + _chillerDataLogThread = new Thread(_chillerDataLogWorker.DoWork); + _chillerDataLogThread.Start(); + } + + /// + /// + /// + public void ChillerLogStop() + { + const int THREAD_QUIT_TIMEOUT = 3000; + + //Is the logger running + if (_chillerDataLogWorker != null) + { + _chillerDataLogWorker.QuitWork(); + + if ((_chillerDataLogThread != null) && (_chillerDataLogThread.IsAlive)) + { + bool didThreadQuit = _chillerDataLogThread.Join(THREAD_QUIT_TIMEOUT); + + if (didThreadQuit == false) + { + _logger?.Error("Logging Thread did not quit as expected, aborting it"); + _chillerDataLogThread.Abort(); + } + else + { + _logger?.Info("Logging Thread quit successfully after join"); + } + } + else + { + _logger?.Info("Logging Thread quit successfully"); + } + } + } + + /// + /// + /// + /// + public void ChillerSetCoolantTemperature(double setpoint) + { + _chiller.SetCoolantTemperature(setpoint); + } + + /// + /// + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + /// + /// An optional delegate for the host to receive the data + public void FlowMeterLogStart(string filename, int threadRestTimeMs, ChillerCartMeasurementManager.FlowMeterDelegate callback) + { + if (_flowMeterDataLogWorker != null) + { + //Should not be logging. Stop logger + FlowMeterLogStop(); + _flowMeterDataLogWorker.Dispose(); + } + + //Start logging on a new thread. Also, start calling callback with requested data + _flowMeterDataLogWorker = new FlowMeterDataLogWorker(this, filename, threadRestTimeMs, callback); + _flowMeterDataLogThread = new Thread(_flowMeterDataLogWorker.DoWork); + _flowMeterDataLogThread.Start(); + } + + /// + /// + /// + public void FlowMeterLogStop() + { + const int THREAD_QUIT_TIMEOUT = 5000; + + //Are we logging + if (_flowMeterDataLogWorker != null) + { + _flowMeterDataLogWorker.QuitWork(); + + if ((_flowMeterDataLogThread != null) && (_flowMeterDataLogThread.IsAlive)) + { + bool didThreadQuit = _flowMeterDataLogThread.Join(THREAD_QUIT_TIMEOUT); + + if (didThreadQuit == false) + { + _logger?.Error("Logging Thread did not quit as expected, aborting it"); + _flowMeterDataLogThread.Abort(); + } + else + { + _logger?.Info("Logging Thread quit successfully after join"); + } + } + else + { + _logger?.Info("Logging Thread quit successfully"); + } + } + } + + /// + /// + /// + /// + public double FlowMeterReadFlow() + { + return _flowMeter.ReadFlow(); + } + + /// + /// + /// + /// + public double TemperatureSensorReadTemperature() + { + return _tempMonitor.ReadTemperature(); + } + + /// + /// Start the temperature sensor log thread + /// + /// + /// + /// An optional delegate for the host to receive the data + public void TemperatureSensorLogStart(string filename, int threadRestTimeMs, ChillerCartMeasurementManager.TemperatureDelegate callback) + { + if (_tempMonDataLogWorker != null) + { + //Should not be logging. Stop logger + TemperatureSensorLogStop(); + _tempMonDataLogWorker.Dispose(); + } + + //Start logging on a new thread. Also, start calling callback with requested data + _tempMonDataLogWorker = new TempDataLogWorker(this, filename, threadRestTimeMs, callback); + _tempMonDataLogThread = new Thread(_tempMonDataLogWorker.DoWork); + _tempMonDataLogThread.Start(); + } + + /// + /// Stop the temperature sensor log thread + /// + public void TemperatureSensorLogStop() + { + const int THREAD_QUIT_TIMEOUT = 3000; + + //Are we logging + if (_tempMonDataLogWorker != null) + { + _tempMonDataLogWorker.QuitWork(); + + if ((_tempMonDataLogThread != null) && (_tempMonDataLogThread.IsAlive)) + { + bool didThreadQuit = _tempMonDataLogThread.Join(THREAD_QUIT_TIMEOUT); + + if (didThreadQuit == false) + { + _logger?.Error("Logging Thread did not quit as expected, aborting it"); + _tempMonDataLogThread.Abort(); + } + else + { + _logger?.Info("Logging Thread quit successfully after join"); + } + } + else + { + _logger?.Info("Logging Thread quit successfully"); + } + + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ChillerCartMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ChillerCartMeasurementManager.csproj new file mode 100644 index 0000000..d2c89e2 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ChillerCartMeasurementManager.csproj @@ -0,0 +1,24 @@ + + + + net472 + ChillerCartMeasurementManager + Composable Test Software Library + Chiller Cart Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/ChillerDataLogWorker.cs b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/ChillerDataLogWorker.cs new file mode 100644 index 0000000..3a2411a --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/ChillerDataLogWorker.cs @@ -0,0 +1,209 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using Raytheon.Common; +using System.IO; +using MeasurementManagerLib; + +namespace ChillerCartMeasurementManagerLib +{ + /// + /// A worker class that will periodically query the chiller for its status and log it out + /// + internal class ChillerDataLogWorker : IWorkerInterface + { + #region PrivateMembers + private bool _threadQuitControl; + private bool _createHeader; + private AutoResetEvent _quitEvent; + private StreamWriter _fileWriter; + private readonly ChillerCartMeasurementManager _controller; + private readonly ChillerCartMeasurementManager.ChillerDelegate _callback; + private readonly string _logFileName; + private readonly int _threadRestTimeMs; + #endregion + + #region PrivateFunctions + /// + /// Finalizer + /// + ~ChillerDataLogWorker() + { + // Do not change this code. Put cleanup code in Dispose(bool disposing) above. + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _fileWriter.Dispose(); + + _quitEvent.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFunctions + /// + /// + /// + /// + /// + /// + /// + public ChillerDataLogWorker(ChillerCartMeasurementManager controller, string logFileName, int threadRestTimeMs, ChillerCartMeasurementManager.ChillerDelegate callback) + { + _threadQuitControl = false; + _quitEvent = new AutoResetEvent(false); + + _createHeader = true; + + _controller = controller; + + _callback = callback; + _threadRestTimeMs = threadRestTimeMs; + _logFileName = logFileName; + + + //If file exists + if (File.Exists(_logFileName)) + { + _createHeader = false; + } + + //Create file or append to file + _fileWriter = new StreamWriter(_logFileName, true); + _fileWriter.AutoFlush = true; + + //Create the header for the new file + if (_createHeader) + { + _fileWriter.WriteLine("Time, Temperature, Temperature Setpoint"); + } + } + + + /// + /// Dispose of this object. Needed for releasing thread/comm resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public void DoWork() + { + try + { + while (_threadQuitControl == false) + { + try + { + if (_quitEvent.WaitOne(_threadRestTimeMs)) + { + _threadQuitControl = true; + } + else + { + double temperature = _controller.ChillerGetCoolantTemperature(); + double temperatureSetpoint = _controller.ChillerGetCoolantTemperatureSetpoint(); + + string logData = Util.GetTimeString() + ", Temperature: " + temperature.ToString() + ", TemperatureSetpoint: " + temperatureSetpoint.ToString(); + + _fileWriter.WriteLine(logData); + + //Invoke the callback if valid + if (_callback != null && _threadQuitControl == false) + { + _callback.Invoke(temperature, temperatureSetpoint, 0); + } + } + } + catch (Exception e) + { + string msg = e.Message; + ErrorLogger.Instance().Write(msg + "\r\n" + e.StackTrace, ErrorLogger.LogLevel.ERROR); + + _fileWriter.WriteLine(Util.GetTimeString() + ", " + msg); + + //Send error code to callback if valid + _callback?.Invoke(-1, -1, -1); + } + } + ErrorLogger.Instance().Write("ChillerCartDataLogWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + + //Send error code to callback if valid + _callback?.Invoke(-1, -1, -1); + } + } + + /// + /// Stops the thread, closes the datalogger and calls move file + /// + public void QuitWork() + { + _threadQuitControl = true; + + _quitEvent.Set(); + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/FlowMeterDataLogWorker.cs b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/FlowMeterDataLogWorker.cs new file mode 100644 index 0000000..21f58c8 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/FlowMeterDataLogWorker.cs @@ -0,0 +1,214 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using Raytheon.Common; +using System.IO; +using MeasurementManagerLib; + +namespace ChillerCartMeasurementManagerLib +{ + /// + /// A worker class that will periodically query the flow meter for its status and log it out + /// + internal class FlowMeterDataLogWorker : IWorkerInterface + { + #region PrivateMembers + private bool _threadQuitControl; + private bool _createHeader; + private AutoResetEvent _quitEvent; + private StreamWriter _fileWriter; + private readonly ChillerCartMeasurementManager _controller; + private readonly ChillerCartMeasurementManager.FlowMeterDelegate _callback; + private readonly string _logFileName; + private readonly int _threadRestTimeMs; + #endregion + + #region PrivateFunctions + /// + /// Finalizer + /// + ~FlowMeterDataLogWorker() + { + // Do not change this code. Put cleanup code in Dispose(bool disposing) above. + Dispose(false); + } + + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _fileWriter.Dispose(); + + _quitEvent.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFunctions + /// + /// + /// + /// + /// + /// + /// + public FlowMeterDataLogWorker(ChillerCartMeasurementManager controller, string logFileName, int threadRestTimeMs, ChillerCartMeasurementManager.FlowMeterDelegate callback) + { + _threadQuitControl = false; + _quitEvent = new AutoResetEvent(false); + + _createHeader = true; + + _controller = controller; + + _callback = callback; + _threadRestTimeMs = threadRestTimeMs; + _logFileName = logFileName; + + //If file exists + if (File.Exists(_logFileName)) + { + _createHeader = false; + } + + //Create file or append to file + _fileWriter = new StreamWriter(_logFileName, true); + _fileWriter.AutoFlush = true; + + //Create the header for the new file + if (_createHeader) + { + _fileWriter.WriteLine("Time, Flow"); + } + } + + /// + /// Dispose of this object. Needed for releasing thread/comm resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public void DoWork() + { + try + { + while (_threadQuitControl == false) + { + try + { + if (_quitEvent.WaitOne(_threadRestTimeMs)) + { + _threadQuitControl = true; + } + else + { + double flow = _controller.FlowMeterReadFlow(); + + string logData = Util.GetTimeString() + "," + flow.ToString(); + + _fileWriter.WriteLine(logData); + + //Invoke the callback if valid + if (_callback != null && _threadQuitControl == false) + { + _callback.Invoke(flow, 0); + } + } + } + catch (Exception e) + { + string msg = e.Message; + + ErrorLogger.Instance().Write(msg + "\r\n" + e.StackTrace, ErrorLogger.LogLevel.ERROR); + + _fileWriter.WriteLine(Util.GetTimeString() + ", " + msg); + + //Invoke the callback if valid + if (_callback != null && _threadQuitControl == false) + { + _callback.Invoke(-1, -1); + } + } + } + ErrorLogger.Instance().Write("FlowMeterDataLogWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + + //Send error code to callback if valid + if (_callback != null && _threadQuitControl == false) + { + _callback.Invoke(-1, -1); + } + } + } + + /// + /// Stops the thread, closes the datalogger and calls move file + /// + public void QuitWork() + { + _threadQuitControl = true; + + _quitEvent.Set(); + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/TempDataLogWorker.cs b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/TempDataLogWorker.cs new file mode 100644 index 0000000..5bad98d --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/ChillerCartMeasurementManager/ThreadWorkers/TempDataLogWorker.cs @@ -0,0 +1,210 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Threading; +using Raytheon.Common; +using System.IO; +using MeasurementManagerLib; + +namespace ChillerCartMeasurementManagerLib +{ + /// + /// A worker class that will periodically query the temperature sensor for its status and log it out + /// + internal class TempDataLogWorker : IWorkerInterface + { + #region PrivateMembers + private bool _threadQuitControl; + private bool _createHeader; + private AutoResetEvent _quitEvent; + private StreamWriter _fileWriter; + private readonly ChillerCartMeasurementManager _controller; + private readonly ChillerCartMeasurementManager.TemperatureDelegate _callback; + private readonly string _logFileName; + private readonly int _threadRestTimeMs; + + #endregion + + #region PrivateFunctions + /// + /// Finalizer + /// + ~TempDataLogWorker() + { + // Do not change this code. Put cleanup code in Dispose(bool disposing) above. + Dispose(false); + } + + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _fileWriter.Dispose(); + + _quitEvent.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFunctions + + /// + /// + /// + /// + /// + /// + /// + public TempDataLogWorker(ChillerCartMeasurementManager controller, string logFileName, int threadRestTimeMs, ChillerCartMeasurementManager.TemperatureDelegate callback) + { + _threadQuitControl = false; + _quitEvent = new AutoResetEvent(false); + + _createHeader = true; + + _controller = controller; + + _callback = callback; + _threadRestTimeMs = threadRestTimeMs; + _logFileName = logFileName; + + //If file exists + if (File.Exists(_logFileName)) + { + _createHeader = false; + } + + //Create file or append to file + _fileWriter = new StreamWriter(_logFileName, true); + _fileWriter.AutoFlush = true; + + //Create the header for the new file + if (_createHeader) + { + _fileWriter.WriteLine("Time, Temperature, Temperature Setpoint"); + } + } + + + /// + /// Dispose of this object. Needed for releasing thread/comm resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + public void DoWork() + { + try + { + while (_threadQuitControl == false) + { + try + { + if (_quitEvent.WaitOne(_threadRestTimeMs)) + { + _threadQuitControl = true; + } + else + { + double temp = _controller.TemperatureSensorReadTemperature(); + + string logData = Util.GetTimeString() + ", Flow: " + temp.ToString(); + + _fileWriter.WriteLine(logData); + + //Invoke the callback if valid + if (_callback != null && _threadQuitControl == false) + { + _callback.Invoke(temp, 0); + } + } + } + catch (Exception e) + { + string msg = e.Message; + ErrorLogger.Instance().Write(msg + "\r\n" + e.StackTrace, ErrorLogger.LogLevel.ERROR); + + _fileWriter.WriteLine(Util.GetTimeString() + ", " + msg); + + //Send error code to callback if valid + _callback?.Invoke(-1, -1); + } + } + ErrorLogger.Instance().Write("TempDataLogWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + + //Send error code to callback if valid + _callback(-1, -1); + } + } + + /// + /// Stops the thread, closes the datalogger and calls move file + /// + public void QuitWork() + { + _threadQuitControl = true; + + _quitEvent.Set(); + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMeasurementManager.cs new file mode 100644 index 0000000..3fcaa38 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMeasurementManager.cs @@ -0,0 +1,120 @@ +using Raytheon.Instruments; +using CryoMeasurementManagerLib; + +using System; + +namespace MeasurementManagerLib +{ + public class CryoMeasurementManager + { + private bool _isThereHardware; + private ICommDevice _commDevice; + private ICommDevice _serialDevice; + + public CryoMeasurementManager(bool isThereHardware, string measurementDefFile, string instrumentDefFile, string errorLogFileName) + { + if (measurementDefFile == null) + { + throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - measurementDefFile input parameter is null."); + } + if (instrumentDefFile == null) + { + throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - instrumentDefFile input parameter is null."); + } + if (errorLogFileName == null) + { + throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - errorLogFileName input parameter is null."); + } + _isThereHardware = isThereHardware; + } + + /// + /// constructor that uses instrument manager to create an instrument + /// + /// + /// + /// + /// + /// + /// + public CryoMeasurementManager(IInstrumentManager instrumentManaegr, string commDeviceName, string serialDeviceName, bool isThereHardware, string errorLogFileName) + { + if (errorLogFileName == null) + { + throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - errorLogFileName input parameter is null."); + } + _isThereHardware = isThereHardware; + + if(!string.IsNullOrEmpty(commDeviceName)) + { + _commDevice = instrumentManaegr.GetInstrument(commDeviceName); + } + + if(!string.IsNullOrEmpty(serialDeviceName)) + { + _serialDevice = instrumentManaegr.GetInstrument(serialDeviceName); + } + } + + public CryoMeasurementManager(string instrumentName, string errorLogFileName, bool isThereHardware) + { + _isThereHardware = isThereHardware; + } + + + private void SendMessageGetResponse(CryoMessage message) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void StartFastCoolDown(object[] inputs) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void StartLogging(string fileName) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void StartSlowCoolDown(object[] inputs) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void StopLogging() + { + try + { + } + catch (Exception) + { + throw; + } + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMeasurementManager.csproj new file mode 100644 index 0000000..7d33a47 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMeasurementManager.csproj @@ -0,0 +1,22 @@ + + + + net472 + CryoMeasurementManager + Composable Test Software Library + Cryo Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMessage.cs b/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMessage.cs new file mode 100644 index 0000000..5e8dffb --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/CryoMeasurementManager/CryoMessage.cs @@ -0,0 +1,65 @@ +using System; + +namespace CryoMeasurementManagerLib +{ + public class CryoMessage + { + protected string _command; + + protected uint _id; + + public CryoMessage(int id) + { + } + + public void Extract() + { + try + { + } + catch (Exception) + { + throw; + } + } + + public string GetCommand() + { + string str; + try + { + str = "@@@DEFAULT RETURN STRING;"; + } + catch (Exception) + { + throw; + } + return str; + } + + public uint GetId() + { + uint num; + try + { + num = 0; + } + catch (Exception) + { + throw; + } + return num; + } + + public void Insert() + { + try + { + } + catch (Exception) + { + throw; + } + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/DioMeasurementManager/DioMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/DioMeasurementManager/DioMeasurementManager.cs new file mode 100644 index 0000000..300406e --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/DioMeasurementManager/DioMeasurementManager.cs @@ -0,0 +1,164 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using Raytheon.Instruments.GeneralIO; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Reflection; +using System.Threading; + +namespace MeasurementManagerLib +{ + /// + /// This class manages IDIO instruments and provides an abstraction + /// + public class DioMeasurementManager : IDisposable + { + #region PrivateClassMembers + private SortedDictionary _signalNameToObjectMap = new SortedDictionary(); + + private static NLog.ILogger _logger; + #endregion + + #region PublicClassFunctions + + /// + /// constructor with the instrument manager + /// + /// General Instrument Manager + public DioMeasurementManager(IInstrumentManager instrumentManager) + { + _logger = LogManager.GetCurrentClassLogger(); + + ICollection dioModuleList = instrumentManager.GetInstruments(typeof(IGeneralIO)); + // populate the maps + foreach (IGeneralIO dioModule in dioModuleList) + { + dioModule.Initialize(); + + List signalNames = dioModule.GetSignalNames(); + + foreach (string signalName in signalNames) + { + if (_signalNameToObjectMap.ContainsKey(signalName.ToUpper())) + { + throw new Exception("There is more than 1 DIO card that have the same signal name: " + signalName); + } + + _signalNameToObjectMap[signalName.ToUpper()] = dioModule; + } + } + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get the state(0 or 1) of an input signal + /// + /// The signal to get the state of + /// 0 if the signal is low, 1 if the signal is high + public IODatatypes.BitState GetInputSignalState(string signalName) + { + return _signalNameToObjectMap[signalName.ToUpper()].GetBitState(signalName); + } + + /// + /// Set the state of an output signal + /// + /// The name of the output signal + /// The state, 0 for low, 1 for high, 2 for logic Z + /// number of ms to wait after setting signal + public void SetOutputSignalState(string signalName, IODatatypes.BitState state, uint timeToSleepMs = 100) + { + _signalNameToObjectMap[signalName.ToUpper()].SetBit(signalName, state); + + // wait a bit + Thread.Sleep((int)timeToSleepMs); + } + + #endregion + + #region PrivateClassFunctions + + /// + /// The Finalizer + /// + ~DioMeasurementManager() + { + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + foreach (KeyValuePair entry in _signalNameToObjectMap) + { + try + { + entry.Value.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + try + { + ErrorLogger.Instance().Dispose(); + } + catch (Exception) + { + // nothing to do + } + } + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/DioMeasurementManager/DioMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/DioMeasurementManager/DioMeasurementManager.csproj new file mode 100644 index 0000000..3e80738 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/DioMeasurementManager/DioMeasurementManager.csproj @@ -0,0 +1,22 @@ + + + + net472 + DioMeasurementManager + Composable Test Software Library + Dio Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/FpgaMeasurementManager/FpgaMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/FpgaMeasurementManager/FpgaMeasurementManager.cs new file mode 100644 index 0000000..1ab602a --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/FpgaMeasurementManager/FpgaMeasurementManager.cs @@ -0,0 +1,384 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using System; +using System.Collections.Generic; + +namespace MeasurementManagerLib +{ + /// + /// This class manages IFpgaComm instruments and provides an abstraction + /// + public class FpgaMeasurementManager : IDisposable + { + #region PrivateClassMembers + // fpga name to object + private readonly Dictionary _fpgaDeviceMap; + // fpga to MemoryMap + private readonly Dictionary _fpgaMemMaps; + + private static NLog.ILogger _logger; + #endregion + + #region PrivateFuctions + + /// + /// Finalizer. + /// + ~FpgaMeasurementManager() + { + Dispose(false); + } + + /// + /// Disposing + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + foreach (KeyValuePair entry in _fpgaDeviceMap) + { + try + { + entry.Value.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + } + + /// + /// Initialize the communication to the fpga + /// + /// the name of the fpga as defined in the config file + private void Initialize(string fpga) + { + if (_fpgaDeviceMap.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("could not find device: " + fpga); + } + + _fpgaDeviceMap[fpga].Initialize(fpga); + } + + #endregion + + #region PublicFuctions + + /// + /// constructor with instrument manager + /// + /// + /// + /// + public FpgaMeasurementManager(IInstrumentManager instrumentManager, List instrumentNames, string instrumentDefFile) + { + _logger = LogManager.GetCurrentClassLogger(); + + _fpgaDeviceMap = new Dictionary(); + + foreach (string name in instrumentNames) + { + _fpgaDeviceMap[name] = instrumentManager.GetInstrument(name); + _fpgaDeviceMap[name]?.Initialize(name); + } + + // setup the memory maps + _fpgaMemMaps = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + ConfigurationFile ini = new ConfigurationFile(instrumentDefFile); + + foreach (KeyValuePair entry in _fpgaDeviceMap) + { + string memMapFile = ini.ReadValue(entry.Key, "MEM_MAP"); + + if (memMapFile.ToUpper().Trim() != "NONE") + { + _fpgaMemMaps.Add(entry.Key.ToUpper(), new MemoryMap(memMapFile)); + } + } + } + + /// + /// Dispose of resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get the comm device + /// + /// + /// + public IFpgaComm GetFpgaCommDevice(string fpga) + { + if (_fpgaDeviceMap.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("could not find device: " + fpga); + } + + return _fpgaDeviceMap[fpga.ToUpper()]; + } + + /// + /// Returns all of the fpga names + /// + /// A list of fpga device names + public List GetFpgaNames() + { + List fpgaList = new List(); + + foreach (KeyValuePair entry in _fpgaDeviceMap) + { + fpgaList.Add(entry.Key); + } + + return fpgaList; + } + + /// + /// Read a register that is defined by a memory map logical name + /// If a subitem is commanded, this returns just the value of the subitems + /// + /// the name of the fpga as defined in the config file + /// The name of the mem map item in the memory map file + /// + public uint RegisterRead(string fpga, string memMapItemName) + { + if (_fpgaMemMaps.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("no memory map exists for fpga: " + fpga); + } + + MemoryMap.MemoryMapFields fields = _fpgaMemMaps[fpga.ToUpper()].GetRegisterInfoByString(memMapItemName); + + uint registerValue = _fpgaDeviceMap[fpga.ToUpper()].Read(fpga, fields._address); + + uint itemValue = Util.ParseRegisterItem(registerValue, fields._startBit, fields._numBits); + + return itemValue; + } + + /// + /// Read a register given an address + /// + /// the name of the fpga as defined in the config file + /// the address to read + /// + public uint RegisterRead(string fpga, uint address) + { + if (_fpgaDeviceMap.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("could not find device: " + fpga); + } + + return _fpgaDeviceMap[fpga.ToUpper()].Read(fpga, address); + } + + /// + /// Read a register given an address with optional offset + /// + /// + /// + /// + /// + /// + public uint RegisterRead(string fpga, string memMapItemName, uint offset = 0) + { + if (_fpgaMemMaps.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("no memory map exists for fpga: " + fpga); + } + + MemoryMap.MemoryMapFields fields = _fpgaMemMaps[fpga.ToUpper()].GetRegisterInfoByString(memMapItemName); + + uint registerValue = _fpgaDeviceMap[fpga.ToUpper()].Read(fpga, fields._address + offset); + + uint itemValue = Util.ParseRegisterItem(registerValue, fields._startBit, fields._numBits); + + return itemValue; + } + + /// + /// reads block from fpga + /// + /// + /// + /// + /// + /// + /// + public void ReadBlock(string fpga, uint address, uint numberOfWordsToRead, bool shallWeIncrementAddress, ref uint[] dataRead) + { + if (_fpgaDeviceMap.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("FpgaMeasurementManager::ReadBlock - could not find device: " + fpga); + } + + if (address == 0) + { + _fpgaDeviceMap[fpga.ToUpper()].ReadBlock(fpga, address, numberOfWordsToRead, shallWeIncrementAddress, ref dataRead); + } + else + { + throw new Exception("Not yet implemented"); + } + } + + /// + /// Write a register given an address + /// + /// the name of the fpga as defined in the config file + /// The address to write to + /// The data to write to the register + public void RegisterWrite(string fpga, uint address, uint dataToWrite) + { + if (_fpgaDeviceMap.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("could not find device: " + fpga); + } + + _fpgaDeviceMap[fpga.ToUpper().ToUpper()].Write(fpga, address, dataToWrite); + } + + /// + /// write a register that is defined by a memory map logical name + /// If a sub item is commanded, the current values of the other items remain unchanged + /// + /// the name of the fpga as defined in the config file + /// The name of the mem map item in the memory map file + /// The data to write to the register + /// The offset off of memMapItemName + public void RegisterWrite(string fpga, string memMapItemName, uint dataToWrite, uint offset = 0) + { + if (_fpgaMemMaps.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("no memory map exists for fpga: " + fpga); + } + + MemoryMap.MemoryMapFields fields = _fpgaMemMaps[fpga.ToUpper()].GetRegisterInfoByString(memMapItemName); + + uint address = fields._address + offset; + + // if commanded to write to a sub register, only write out those bits + if (fields._numBits < 32) + { + // read existing value + uint originalValue = RegisterRead(fpga, address); + + //Apply inverse mask to current register contents to zero out just the bits we want to write + uint maskValue = Util.ApplyBitMask(originalValue, fields._startBit, fields._numBits, true); + + // Shift the desired data to set to match the zeroed register + dataToWrite = dataToWrite << fields._startBit; + + dataToWrite = maskValue | dataToWrite; + } + + _fpgaDeviceMap[fpga.ToUpper()].Write(fpga, address, dataToWrite); + } + + /// + /// + /// + /// + /// + /// + /// + public void RegisterWriteBlock(string fpga, string memMapItemName, uint numWordsToWrite, uint[] dataToWrite, bool shallWeIncrementAddress, uint offset = 0) + { + if (_fpgaMemMaps.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("no memory map exists for fpga: " + fpga); + } + + MemoryMap.MemoryMapFields fields = _fpgaMemMaps[fpga.ToUpper()].GetRegisterInfoByString(memMapItemName); + + uint address = fields._address + offset; + + // if commanded to write to a sub register, only write out those bits + if (fields._numBits < 32) + { + throw new Exception("can only write a block of data to a 32 bit register. fpga: " + fpga); + } + + _fpgaDeviceMap[fpga.ToUpper()].WriteBlock(fpga, address, numWordsToWrite, dataToWrite, shallWeIncrementAddress); + } + + /// + /// Writes the default value (as specified in the memory map) to the register + /// If a sub item is commanded, the current values of the other items remain unchanged + /// + /// The name of the FPGA + /// The memory map item which we will restore the default. + public void RegisterWriteDefault(string fpga, string memMapItemName) + { + if (_fpgaMemMaps.ContainsKey(fpga.ToUpper()) == false) + { + throw new Exception("no memory map exists for fpga: " + fpga); + } + + MemoryMap.MemoryMapFields fields = _fpgaMemMaps[fpga.ToUpper()].GetRegisterInfoByString(memMapItemName); + + uint dataToWrite = fields._regDefault; + + // if commanded to write to a sub register, only write out those bits + if (fields._numBits < 32) + { + // read existing value + uint originalValue = RegisterRead(fpga, fields._address); + + //Apply inverse mask to current register contents to zero out just the bits we want to write + uint maskValue = Util.ApplyBitMask(originalValue, fields._startBit, fields._numBits, true); + + // Shift the desired data to set to match the zeroed register + dataToWrite = dataToWrite << fields._startBit; + + dataToWrite = maskValue | dataToWrite; + } + + _fpgaDeviceMap[fpga.ToUpper()].Write(fpga, fields._address, dataToWrite); + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/FpgaMeasurementManager/FpgaMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/FpgaMeasurementManager/FpgaMeasurementManager.csproj new file mode 100644 index 0000000..ea938ab --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/FpgaMeasurementManager/FpgaMeasurementManager.csproj @@ -0,0 +1,26 @@ + + + + net472 + FpgaMeasurementManager + Composable Test Software Library + Fpga Measurement Manager + Library + + + + 1.1.0 + + + + NU1603 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/JtagMeasurementManager/JtagMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/JtagMeasurementManager/JtagMeasurementManager.cs new file mode 100644 index 0000000..f2298bc --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/JtagMeasurementManager/JtagMeasurementManager.cs @@ -0,0 +1,286 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace MeasurementManagerLib +{ + /// + /// This class provides an abstraction for running jtag jobs via the command line + /// + public class JtagMeasurementManager : IDisposable + { + #region PrivateMembers + private readonly IJtag _jtag; + private Dictionary _jtagMeasurements; + private static NLog.ILogger _logger; + #endregion + + #region PrivateFunctions + + /// + /// Finalizer. + /// + ~JtagMeasurementManager() + { + Dispose(false); + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _jtag.Shutdown(); + } + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Parses Measurement Definition File + /// + /// + private void ParseMeasurementDef(ConfigurationFile configurationFile) + { + const string BSX_FILE_PATH_KEY = "BSX_FILE_PATH"; + const string BSX_FILE_KEY = "BSX_FILE"; + const string BSX_COMMAND_LINE_KEY = "BSX_FILE_COMMAND_LINE"; + + const string USE_DIAG_CMD_LINE1_KEY = "USE_DIAG_CMD_LINE_1"; + const string DIAG_FILE1_KEY = "DIAG_FILE_1"; + const string DIAG_CMD_LINE1_KEY = "DIAG_CMD_LINE_1"; + + const string USE_DIAG_CMD_LINE2_KEY = "USE_DIAG_CMD_LINE_2"; + const string DIAG_FILE2_KEY = "DIAG_FILE_2"; + const string DIAG_CMD_LINE2_KEY = "DIAG_CMD_LINE_2"; + + // read in all of the sections + List sections = configurationFile.ReadAllSections(); + + foreach (string section in sections) + { + string bsxFilePath = configurationFile.ReadValue(section, BSX_FILE_PATH_KEY); + string bsxFile = configurationFile.ReadValue(section, BSX_FILE_KEY); + string bsxCmdLine = configurationFile.ReadValue(section, BSX_COMMAND_LINE_KEY); + + bool useDiag1 = configurationFile.ReadValue(section, USE_DIAG_CMD_LINE1_KEY); + string diag1File = "Not Set"; + string diag1CmdLine = "Not Set"; + if (useDiag1 == true) + { + diag1File = configurationFile.ReadValue(section, DIAG_FILE1_KEY); + diag1CmdLine = configurationFile.ReadValue(section, DIAG_CMD_LINE1_KEY); + } + + bool useDiag2 = configurationFile.ReadValue(section, USE_DIAG_CMD_LINE2_KEY); + string diag2File = "Not Set"; + string diag2CmdLine = "Not Set"; + if (useDiag2 == true) + { + diag2File = configurationFile.ReadValue(section, DIAG_FILE2_KEY); + diag2CmdLine = configurationFile.ReadValue(section, DIAG_CMD_LINE2_KEY); + } + + JtagJobInfo info = new JtagJobInfo + { + bsxFilePath = bsxFilePath, + bsxFile = bsxFile, + bsxFileCommandline = bsxCmdLine, + + shallWeUseDiag1 = useDiag1, + diag1File = diag1File, + diag1CmdLine = diag1CmdLine, + + shallWeUseDiag2 = useDiag2, + diag2File = diag2File, + diag2CmdLine = diag2CmdLine + }; + + _jtagMeasurements.Add(section.ToUpper(), info); + } + } + + + /// + /// Parses Measurement Definition File + /// + /// + private void ParseMeasurementDef(string measurementDefFile) + { + const string BSX_FILE_PATH_KEY = "BSX_FILE_PATH"; + const string BSX_FILE_KEY = "BSX_FILE"; + const string BSX_COMMAND_LINE_KEY = "BSX_FILE_COMMAND_LINE"; + + const string USE_DIAG_CMD_LINE1_KEY = "USE_DIAG_CMD_LINE_1"; + const string DIAG_FILE1_KEY = "DIAG_FILE_1"; + const string DIAG_CMD_LINE1_KEY = "DIAG_CMD_LINE_1"; + + const string USE_DIAG_CMD_LINE2_KEY = "USE_DIAG_CMD_LINE_2"; + const string DIAG_FILE2_KEY = "DIAG_FILE_2"; + const string DIAG_CMD_LINE2_KEY = "DIAG_CMD_LINE_2"; + + // read in all of the sections + IniFile ini = new IniFile(measurementDefFile); + List sections = ini.ReadAllSections(); + + foreach (string section in sections) + { + string bsxFilePath = ini.ReadValue(section, BSX_FILE_PATH_KEY); + string bsxFile = ini.ReadValue(section, BSX_FILE_KEY); + string bsxCmdLine = ini.ReadValue(section, BSX_COMMAND_LINE_KEY); + + bool useDiag1 = Convert.ToBoolean(ini.ReadValue(section, USE_DIAG_CMD_LINE1_KEY)); + string diag1File = "Not Set"; + string diag1CmdLine = "Not Set"; + if (useDiag1 == true) + { + diag1File = ini.ReadValue(section, DIAG_FILE1_KEY); + diag1CmdLine = ini.ReadValue(section, DIAG_CMD_LINE1_KEY); + } + + bool useDiag2 = Convert.ToBoolean(ini.ReadValue(section, USE_DIAG_CMD_LINE2_KEY)); + string diag2File = "Not Set"; + string diag2CmdLine = "Not Set"; + if (useDiag2 == true) + { + diag2File = ini.ReadValue(section, DIAG_FILE2_KEY); + diag2CmdLine = ini.ReadValue(section, DIAG_CMD_LINE2_KEY); + } + + JtagJobInfo info = new JtagJobInfo(); + info.bsxFilePath = bsxFilePath; + info.bsxFile = bsxFile; + info.bsxFileCommandline = bsxCmdLine; + + info.shallWeUseDiag1 = useDiag1; + info.diag1File = diag2File; + info.diag1CmdLine = diag1CmdLine; + + info.shallWeUseDiag2 = useDiag2; + info.diag2File = diag2File; + info.diag2CmdLine = diag2CmdLine; + + _jtagMeasurements.Add(section.ToUpper(), info); + } + } + + #endregion + + #region PublicFuctions + + /// + /// constructor that uses instrument manager + /// + /// + /// + /// + public JtagMeasurementManager(IInstrumentManager instrumentManager, string instrumentName, string measurementDefFile = "") + { + _logger = LogManager.GetCurrentClassLogger(); + + _jtagMeasurements = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + _jtag = instrumentManager.GetInstrument(instrumentName); + _jtag?.Initialize(); + + if (string.IsNullOrEmpty(measurementDefFile)) + measurementDefFile = "JtagMeasurementManager.xml"; + + // parse the ini file for measurement definitions + ParseMeasurementDef(new ConfigurationFile(measurementDefFile)); + } + + /// + /// Dispose of resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + public List GetJtagMeasurementList() + { + return _jtagMeasurements.Keys.ToList(); + //List measurements = new List(); + //foreach (KeyValuePair entry in _jtagMeasurements) + //{ + // measurements.Add(entry.Key); + //} + //return measurements; + } + + /// + /// Perform a JTAG job + /// + /// The name of the job as defined in the input def file + /// + public int PerformJtagJob(string jobName) + { + if (_jtagMeasurements.ContainsKey(jobName.ToUpper()) == false) + { + throw new Exception("Could not find measurement: " + jobName); + } + + JtagJobInfo measurement = _jtagMeasurements[jobName.ToUpper()]; + + return _jtag.PerformJtagJob(measurement); + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/JtagMeasurementManager/JtagMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/JtagMeasurementManager/JtagMeasurementManager.csproj new file mode 100644 index 0000000..9663168 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/JtagMeasurementManager/JtagMeasurementManager.csproj @@ -0,0 +1,26 @@ + + + + net472 + JtagMeasurementManager + Composable Test Software Library + Jtag Measurement Manager + Library + + + + 1.1.0 + + + + NU1603 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/OpticalBenchMeasurementManager/OpticalBenchMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/OpticalBenchMeasurementManager/OpticalBenchMeasurementManager.cs new file mode 100644 index 0000000..d777f64 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/OpticalBenchMeasurementManager/OpticalBenchMeasurementManager.cs @@ -0,0 +1,225 @@ +using Raytheon.Instruments; +using System; +using System.Collections.Generic; + +namespace MeasurementManagerLib +{ + public class OpticalBenchMeasurementManager + { + private readonly ICommDevice _opticalBench; + + /// + /// constructor that uses instrument manager + /// + /// + /// + /// + /// + public OpticalBenchMeasurementManager(IInstrumentManager instrumentManager, string instrumentName, string measurementDefFile, string instrumentDefFile) + { + _opticalBench = instrumentManager.GetInstrument(instrumentName); + _opticalBench?.Initialize(); + } + + public void CloseShutter() + { + try + { + } + catch (Exception) + { + throw; + } + } + + public List GetTargetWheelNames() + { + List strs; + try + { + strs = null; + } + catch (Exception) + { + throw; + } + return strs; + } + + public void MoveSeekerAbs(double az, double el) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void MoveSeekerAbs(double az, double el, double rl) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void OpenShutter() + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetBackgroundScene(int scene) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetBlackBodySetpointTemperature(double temperature) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetChopperFrequency(double frequency) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetChopperOff() + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetChopperOn() + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetFilterWheel(int filter) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetTargetPosition(double az, double el) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetTargetSize(double size) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetTargetSource(int source) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetTargetWheel(string targetName) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void SetFocus(double position) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void CenterTargetOnPixel(int pixelX, int pixelY, double chopperRate, double minAmp, double maxOE) + { + try + { + } + catch (Exception) + { + throw; + } + } + + public void LoadProfile() + { + try + { + } + catch (Exception) + { + throw; + } + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/OpticalBenchMeasurementManager/OpticalBenchMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/OpticalBenchMeasurementManager/OpticalBenchMeasurementManager.csproj new file mode 100644 index 0000000..de4d87a --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/OpticalBenchMeasurementManager/OpticalBenchMeasurementManager.csproj @@ -0,0 +1,22 @@ + + + + net472 + OpticalBenchMeasurementManager + Composable Test Software Library + Optical Bench Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/PowerSupplyMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/PowerSupplyMeasurementManager.cs new file mode 100644 index 0000000..5b550dc --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/PowerSupplyMeasurementManager.cs @@ -0,0 +1,780 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + + +// Ignore Spelling: Selftest ovp ocp + +using NLog; +using Raytheon.Instruments; +using Raytheon.Instruments.PowerSupply; +using Raytheon.Common; +using System; +using System.CodeDom; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace MeasurementManagerLib +{ + /// + /// The entry point for the library that controls power supplies. + /// This class parses out the definition of all power supplies in a system and provides control to the host. + /// In simple cases, the host only needs to fill in the ini file and use the OutputDisable() and OutputEnable() functions. + /// A variety of other capability is exposed for more complex applications. + /// + public class PowerSupplyMeasurementManager : IDisposable + { + #region PublicClassMembers + /// + /// A callback definition for the power monitor. + /// The host may pass in this delegate to PowerLogStart() to receive callbacks from the monitor thread. + /// + /// The callback returns a comma delimited string of the format: "System, Module, voltage, voltage setpoint, current, output status, fault status"; + /// If an exception is thrown in the monitor thread, this value will be set to -1, else it will be 0; + public delegate void PowerMonitorDelegate(List retData, int errorCode); + + #endregion + + #region PrivateClassMembers + // power system name to power system object + private SortedDictionary _powerSystemNameToObjectMap; + + // power module name to power system object + private SortedDictionary _powerModuleNameToObjectMap; + private PowerSupplyDataLogWorker _dataLogWorker; + private Thread _dataLogThread; + + // these are used to remember the logging thread params if the host is loading new power def files + string _prevPowerLogFileName; + int _prevPowerLogRestTime; + PowerMonitorDelegate _prevPowerLogCallback; + + private static NLog.ILogger _logger; + private IInstrumentManager _instrumentManager; + + private string _powerSystemWithFailedSelfTest = String.Empty; + + #endregion + + #region PublicFuctions + + /// + /// will create an array of power systems with power supplies + /// + /// + /// + public PowerSupplyMeasurementManager(IInstrumentManager instrumentManager) + { + _logger = LogManager.GetCurrentClassLogger(); + _instrumentManager = instrumentManager; + + _powerSystemNameToObjectMap = new SortedDictionary(); + + // create some maps to support the functions the MAL input + _powerSystemNameToObjectMap = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + _powerModuleNameToObjectMap = new SortedDictionary(StringComparer.InvariantCultureIgnoreCase); + + ICollection powerSystemList = _instrumentManager.GetInstruments(typeof(IPowerSupplySystem)); + // populate the maps + foreach (IPowerSupplySystem powerSystem in powerSystemList) + { + powerSystem.Initialize(); + _powerSystemNameToObjectMap[powerSystem.Name.ToUpper()] = powerSystem; + + List moduleNames = powerSystem.GetModuleNames(); + + foreach (string moduleName in moduleNames) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper())) + { + throw new Exception("There is more than 1 power system that have the same module name: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()] = powerSystem; + } + } + + PerformPowerSupplySelfTests(); + + if (_powerSystemWithFailedSelfTest != String.Empty) + { + throw new Exception($"{_powerSystemWithFailedSelfTest}'s self-test failed."); + } + } + + /// + /// Perform self test on power supply system + /// Self test for each power system takes a while, so we don't want to run self test every time we initialize the power system + /// So we only want to run self test under 2 conditions: + /// 1. Certain time has elapsed since last power off + /// 2. Certain time has elapsed since last self test run ( in the absence of power off time) + /// + /// + /// + private void PerformPowerSupplySelfTests() + { + _logger.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + string errorMsg = String.Empty; + + ICollection powerSystemList = _instrumentManager.GetInstruments(typeof(IPowerSupplySystem)); + + Task[] taskArray = new Task[powerSystemList.Count]; + + int index = 0; + foreach (IPowerSupplySystem powerSystem in powerSystemList) + { + // perform self test on power system + Task task = Task.Factory.StartNew(() => PerformPowerSupplySelfTestTask(powerSystem)); + taskArray.SetValue(task,index++); + } + + Task.WaitAll(taskArray); + } + + /// + /// Perform self test on power supply system + /// + /// + /// + private void PerformPowerSupplySelfTestTask(IPowerSupplySystem powerSystem) + { + SelfTestResult result = SelfTestResult.Pass; + + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() for {powerSystem.Name} is running..."); + + try + { + result = powerSystem.PerformSelfTest(); + + if (result == SelfTestResult.Fail && String.IsNullOrEmpty(_powerSystemWithFailedSelfTest)) + { + _powerSystemWithFailedSelfTest = powerSystem.Name; + } + } + catch (Exception ex) + { + _logger?.Error(ex.Message + "\n" + ex.StackTrace); + } + + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() for {powerSystem.Name} is exiting..."); + } + + /// + /// Disable the power supply display interface. + /// + /// The name of the system to disable, as defined in the config file + public void DisplayDisable(string powerSystem) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Could not find power system: " + powerSystem); + } + + _powerSystemNameToObjectMap[powerSystem.ToUpper()].DisplayEnabled = false; + } + + /// + /// Enable the power supply display interface. + /// + /// The name of the system to disable, as defined in the config file + public void DisplayEnable(string powerSystem) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Could not find power system: " + powerSystem); + } + + _powerSystemNameToObjectMap[powerSystem.ToUpper()].DisplayEnabled = true; + } + + /// + /// Dispose of this object. + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Get all of the power module names + /// + /// Array of the system/module names. + public List GetPowerModuleList() + { + List powerModules = new List(); + + foreach (KeyValuePair item in _powerModuleNameToObjectMap) + { + powerModules.Add(item.Key); + } + + return powerModules; + } + + /// + /// Get the power module names for a given system + /// + /// Array of the system/module names. + public List GetPowerSupplyList(string powerSystem) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Unknown power system: " + powerSystem); + } + + return _powerSystemNameToObjectMap[powerSystem.ToUpper()].GetModuleNames(); + }//GetPowerSupplyModuleInfoDict + + /// + /// Get the dictionary that contains configuration information for each module + /// + /// + public Dictionary GetPowerSupplyModuleInfoDict(string powerSystem) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Unknown power system: " + powerSystem); + } + + return _powerSystemNameToObjectMap[powerSystem.ToUpper()].GetPowerSupplyModuleInfoDict(powerSystem); + } + + /// + /// Gets the Power System names. + /// + /// Array of power system names, as defined in the config file + public List GetPowerSupplySystemList() + { + List powerSystems = new List(); + + foreach (KeyValuePair item in _powerSystemNameToObjectMap) + { + powerSystems.Add(item.Key); + } + + return powerSystems; + } + + /// + /// Query the supply and returns the programed OCP. Should match what was in the definition file. + /// + /// The name of the power supply. + /// The programmed overcurrent protection value + public double GetOverCurrentProtection(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].GetOverCurrentSetting(moduleName); + } + + /// + /// Query the supply and returns the programed OVP. Should match what was in the definition file. + /// + /// The name of the power supply. + /// The programmed overvoltage protection value. + public double GetOverVoltageProtection(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].GetOverVoltageSetting(moduleName); + } + + /// + /// Query the supply and returns the programed slew rate + /// + /// + /// The programmed slew rate + public double GetSlewRate(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].GetSlewRate(moduleName); + } + + /// + /// Query the system that contains the passed in module and returns the system error code. + /// + /// The module to query. + /// The error code. + /// The string form of the error code. Will be empty string if there is no error. + public string GetSystemErrorCode(string moduleName, out int errorCode) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].GetErrorCode(out errorCode); + } + + /// + /// Query the supply and returns the programmed voltage setpoint. + /// After construction, this should match what was in the definition file. + /// The host may override the value by calling SetVoltageSetpoint(). + /// + /// The name of the power supply. + /// The programmed voltage setpoint. + public double GetVoltageSetpoint(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].GetVoltageSetting(moduleName); + } + + /// + /// Query the supply and returns true if output is enabled. + /// + /// The name of the power supply. + /// True if output is enabled, false if it is not enabled. + public bool IsPowerSupplyOn(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].IsOutputOn(moduleName); + } + + /// + /// Sends a SCPI command to the power system and reads the response + /// + /// The name of the power system. + /// The SCPI command to send + /// + public string IOQuery(string powerSystem, string command) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Could not find power system: " + powerSystem); + } + + return _powerSystemNameToObjectMap[powerSystem.ToUpper()].IOQuery(command); + } + + /// + /// Sends a SCPI command to the power system + /// + /// The name of the power system. + /// The SCPI command to send + public void IOWrite(string powerSystem, string command) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Could not find power system: " + powerSystem); + } + + _powerSystemNameToObjectMap[powerSystem.ToUpper()].IOWrite(command); + } + + /// + /// Read the current of a module. + /// + /// The module to read. + /// The current (Amps). + public double MeasureCurrent(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].MeasureCurrent(moduleName); + } + + /// + /// Query the supply for its voltage. + /// + /// The module to read. + /// The voltage (Volts). + public double MeasureVoltage(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].MeasureVoltage(moduleName); + } + + /// + /// Disable the output of the power supply. + /// + /// The name of the power supply module. + public void OutputDisable(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].Off(moduleName); + } + + /// + /// Enable the output of the power supply. + /// + /// The name of the module to enable. + public void OutputEnable(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].On(moduleName); + } + + /// + /// start logging of power supply data. + /// Queries the list of all power modules. + /// Logs data to the define path. + /// Returns data to defined callback function. + /// + /// Path to create the log file. + /// The time to wait between queries. + /// Function to call. Null can be passed in in which case no hot callback will be issued + public void PowerLogStart(string fileName, int threadRestTimeMs, PowerMonitorDelegate callback) + { + // if we have been running before, stop just in case the host did not + if (_dataLogWorker != null) + { + PowerLogStop(); + + _dataLogWorker.Dispose(); + } + + _dataLogWorker = new PowerSupplyDataLogWorker(this, fileName, threadRestTimeMs, callback); + + _dataLogThread = new Thread(_dataLogWorker.DoWork); + + // start the thread back up + _dataLogThread.Start(); + + _prevPowerLogFileName = fileName; + _prevPowerLogRestTime = threadRestTimeMs; + _prevPowerLogCallback = callback; + } + + /// + /// stops logging data and closes the file. + /// + public void PowerLogStop() + { + // Wait up to 5 seconds for the thread to quit + const int THREAD_QUIT_TIMEOUT_MS = 5000; + + string functionName = $"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}()"; + + if (_dataLogWorker != null) + { + _dataLogWorker.QuitWork(); + + if ((_dataLogThread != null) && _dataLogThread.IsAlive) + { + bool didThreadQuit = _dataLogThread.Join(THREAD_QUIT_TIMEOUT_MS); + + if (didThreadQuit == false) + { + _logger.Error($"{functionName} - Logging Thread did not quit as expected, aborting it"); + _dataLogThread.Abort(); + } + else + { + _logger.Debug("{functionName} - Logging Thread quit successfully after join"); + } + } + else + { + _logger.Debug("{functionName} - Logging Thread quit successfully"); + } + } + + _prevPowerLogFileName = null; + _prevPowerLogRestTime = 0; + _prevPowerLogCallback = null; + } + + /// + /// Control the power supply internal mechanical relay state + /// + /// True to connect, false to disconnect + public void MechanicalRelayOutputControl(string moduleName, bool shallWeConnect) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].MechanicalRelayOutputControl(moduleName, shallWeConnect); + } + + /// + /// Query all power supply data in a single call. + /// + /// The name of the module to query. + /// The voltage that was read. + /// The voltage setpoint that was read. + /// The current that was read. + /// The output status. True if output is enabled, false if output is disabled. + /// The value of the fault status register. See power supply docs for meaning (0 means no fault). + /*public void ReadPowerData(string moduleName, out double voltage, out double voltageSetpoint, out double current, out bool outputStatus, out int faultStatus) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("PowerSupplyManager::ReadPowerData() - could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].ReadPowerData(moduleName, out voltage, out voltageSetpoint, out current, out outputStatus, out faultStatus); + }*/ + + /// + /// Query all power supply data in a single call. + /// + /// The name of the module to query. + public PowerData ReadPowerData(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].ReadPowerData(moduleName); + } + + /// + /// + /// + /// + /// + public int ReadProtectionStatus(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + return _powerModuleNameToObjectMap[moduleName.ToUpper()].ReadProtectionStatus(moduleName); + } + + /// + /// Resets the setpoint voltage to the value contained in the ini file + /// + /// The module to reset + public void SetInitialVoltage(string moduleName) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].SetInitialVoltage(moduleName); + } + + /// + /// Every power supply gets its voltage set to what was in the ini file + /// + public void SetInitialVoltageAll() + { + List powerModules = GetPowerModuleList(); + foreach (string powerModule in powerModules) + { + SetInitialVoltage(powerModule); + } + } + + /// + /// Sets the slew rate in volts per second + /// + /// The name of the power module + /// slew in volts per second + /*public void SetSlewRate(string moduleName, double slewRate) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("PowerSupplyManager::SetSlewRate() - could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].SetSlewRate(moduleName, slewRate); + }*/ + + /// + /// + /// + /// + /// + public void SetOverCurrentProtection(string moduleName, double ocpValue) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].SetOverCurrentProtection(moduleName, ocpValue); + } + + /// + /// + /// + /// + /// + public void SetOverVoltageProtection(string moduleName, double ovpValue) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].SetOverVoltageProtection(moduleName, ovpValue); + } + + /// + /// Set the setpoint voltage of a module. + /// + /// The module to set. + /// The setpoint voltage. + public void SetVoltageSetpoint(string moduleName, double setpointVoltage) + { + if (_powerModuleNameToObjectMap.ContainsKey(moduleName.ToUpper()) == false) + { + throw new Exception("Could not find module: " + moduleName); + } + + _powerModuleNameToObjectMap[moduleName.ToUpper()].SetVoltageSetpoint(moduleName, setpointVoltage); + } + + /// + /// Disable the power system watchdog. + /// + /// The power system to act on. + public void WatchdogDisable(string powerSystem) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Could not find power system: " + powerSystem); + } + + _powerSystemNameToObjectMap[powerSystem.ToUpper()].WatchdogDisable(); + } + + /// + /// Enable the power system watchdog. + /// + /// The system to act on. + /// The number of seconds for the watchdog. + public void WatchdogEnable(string powerSystem, uint timeInSeconds) + { + if (_powerSystemNameToObjectMap.ContainsKey(powerSystem.ToUpper()) == false) + { + throw new Exception("Could not find power system: " + powerSystem); + } + + _powerSystemNameToObjectMap[powerSystem.ToUpper()].WatchdogEnable(timeInSeconds); + } + + #endregion + + #region PrivateClassFunctions + /// + /// The Finalizer + /// + ~PowerSupplyMeasurementManager() + { + Dispose(false); + } + + /// + /// Dispose of this object. + /// + /// True = currently disposing, False = not disposing. + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + _logger.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + // stop the logging if it is still running + try + { + PowerLogStop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message + "\r\n" + ex.StackTrace); + } + + // dispose the thread + try + { + if (_dataLogWorker != null) + { + _dataLogWorker.Dispose(); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message + "\r\n" + ex.StackTrace); + } + + // dispose of the other resources + foreach (KeyValuePair entry in _powerSystemNameToObjectMap) + { + try + { + entry.Value.Shutdown(); + } + catch (Exception ex) + { + _logger.Error(ex.Message + "\r\n" + ex.StackTrace); + } + } + } + } + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/PowerSupplyMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/PowerSupplyMeasurementManager.csproj new file mode 100644 index 0000000..ffe295e --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/PowerSupplyMeasurementManager.csproj @@ -0,0 +1,22 @@ + + + + net472 + PowerSupplyMeasurementManager + Composable Test Software Library + Power Supply Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/ThreadWorkers/PowerSupplyDataLogWorker.cs b/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/ThreadWorkers/PowerSupplyDataLogWorker.cs new file mode 100644 index 0000000..4b1e460 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/PowerSupplyMeasurementManger/ThreadWorkers/PowerSupplyDataLogWorker.cs @@ -0,0 +1,246 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; +using System.Threading; +using Raytheon.Common; +using System.IO; +using Raytheon.Instruments; +using Raytheon.Instruments.PowerSupply; + +namespace MeasurementManagerLib +{ + /// + /// A worker for iterating through each supply in the system, querying its' data, logging it out, and issuing callbacks to the host + /// + internal class PowerSupplyDataLogWorker : IWorkerInterface + { + #region PrivateClassMembers + + private bool _threadQuitControl; + private AutoResetEvent _quitEvent; + private StreamWriter _fileWriter; + private readonly string _logFilePath; + private readonly int _threadRestTimeMs; + private readonly PowerSupplyMeasurementManager.PowerMonitorDelegate _callback; + private readonly PowerSupplyMeasurementManager _controller; + + #endregion + + #region PrivateFunctions + + /// + /// Finalizer + /// + ~PowerSupplyDataLogWorker() + { + Dispose(false); + } + + /// + /// Release of resources + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + _fileWriter.Dispose(); + + _quitEvent.Dispose(); + } + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + #endregion + + #region PublicFuctions + + /// + /// The constructor + /// + /// The controller for the power supplies + /// The file name to log the data to + /// The number os ms to rest after each iteration through the loop + /// The host callback function. If null, no callback is issued + public PowerSupplyDataLogWorker(PowerSupplyMeasurementManager controller, string fileName, int threadRestTimeMs, PowerSupplyMeasurementManager.PowerMonitorDelegate callback) + { + _controller = controller; + + // these gets set in SetControlParams + _logFilePath = fileName; + _callback = callback; + _threadRestTimeMs = threadRestTimeMs; + + _fileWriter = new StreamWriter(_logFilePath, true); + + _threadQuitControl = false; + _quitEvent = new AutoResetEvent(false); + } + + /// + /// Dispose of this object. Needed for releasing thread/comm resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Loops thorugh each supply in the system, queries the status, logs it out and calls the host callback + /// + public void DoWork() + { + try + { + //Used to handle the labels at the top of the CSV log file generated + const string LOG_PREFIX = "DateTime,Module,Voltage,VoltageSetpoint,Current,IsOutputOn,fault status"; + + // callback error codes + const int NO_ERROR = 0; + const int ERROR = -1; + + List powerModules = _controller.GetPowerModuleList(); + + _fileWriter.WriteLine(LOG_PREFIX); + + while (_threadQuitControl == false) + { + try + { + if (_quitEvent.WaitOne(_threadRestTimeMs)) + { + _threadQuitControl = true; + } + else + { + //string callbackData = CALLBACK_PREFIX; + List callBackDataList = new List(); + + //get data from each supply + foreach (string powerModule in powerModules) + { + // check for quit event and exit if needed + if (_quitEvent.WaitOne(1) == true) + { + _threadQuitControl = true; + + break; + } + + PowerData data = _controller.ReadPowerData(powerModule); + + PowerMonitorCallbackData callbackData; + callbackData.powerModule = powerModule; + callbackData.voltage = data.Voltage; + callbackData.voltageSetpoint = data.VoltageSetpoint; + callbackData.current = data.Current; + callbackData.outputStatus = data.OutputStatus; + callbackData.ovpocpStatus = data.FaultStatus; + callbackData.overVoltageProtectionValue = data.OverVoltageProtection; + callbackData.overCurrentProtectionValue = data.OverCurrentProtection; + + callBackDataList.Add(callbackData); + + string log = Util.GetTimeString() + "," + powerModule + "," + Convert.ToString(data.Voltage) + "," + Convert.ToString(data.VoltageSetpoint) + "," + Convert.ToString(data.Current) + "," + Convert.ToString(data.OutputStatus) + "," + Convert.ToString(data.FaultStatus); + + // log out the data + _fileWriter.WriteLine(log); + _fileWriter.Flush(); + + // check for quit event and exit if needed + if (_quitEvent.WaitOne(1) == true) + { + _threadQuitControl = true; + + break; + } + } + + // At this point our return and log strings are both built, so return back the data string on the callback + if (_callback != null && _threadQuitControl == false && callBackDataList.Count != 0) + { + _callback(callBackDataList, NO_ERROR); + } + } + } + catch (Exception e) + { + string msg = e.Message; + + ErrorLogger.Instance().Write(msg + "\r\n" + e.StackTrace, ErrorLogger.LogLevel.ERROR); + + _fileWriter.WriteLine(Util.GetTimeString() + ", " + msg); + + // if callbacks are enabled, alert the host to the error + if (_callback != null && _threadQuitControl == false) + { + _callback(null, ERROR); + } + } + } + + ErrorLogger.Instance().Write("PowerSupplyDataLogWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO); + } + catch (Exception err) + { + ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace); + } + } + + /// + /// Stops the thread, closes the datalogger and calls move file + /// + public void QuitWork() + { + _threadQuitControl = true; + + _quitEvent.Set(); + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/RelayMeasurementManager/RelayMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/RelayMeasurementManager/RelayMeasurementManager.cs new file mode 100644 index 0000000..74e4030 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/RelayMeasurementManager/RelayMeasurementManager.cs @@ -0,0 +1,369 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace MeasurementManagerLib +{ + /// + /// This class manages ISwitch instruments (That act as Relays) and provides an abstraction + /// + public class RelayMeasurementManager : IDisposable + { + #region PrivateClassMembers + public enum InitialState + { + OPEN, + CLOSED + }; + + [Serializable] + public class RelayInfo + { + public string RelayModule { get; set; } + public string Relay { get; set; } + + public List Relays { get; set; } = new List(); + + public InitialState InitialState { get; set; } + + public RelayInfo() + { + InitialState = InitialState.OPEN; + RelayModule = string.Empty; + Relay = string.Empty; + } + + public RelayInfo(string relayModule, string relay, InitialState initialState) + { + RelayModule = relayModule; + Relay = relay; + InitialState = initialState; + } + }; + + private static readonly object _syncObj = new Object(); + private readonly Dictionary _relayCards; + private readonly Dictionary _relayMeasurementMap; + + private const string RELAY_MEASUREMENTS = "RelayMeasurements"; + + //const char COMMA_DELIM = ','; + private const char FIELD_DELIM = '|'; + private const char DASH_DELIM = '-'; + + private static NLog.ILogger _logger; + + #endregion + + #region PrivateClassFunctions + + /// + /// The Finalizer + /// + ~RelayMeasurementManager() + { + Dispose(false); + } + + + /// + /// Confirm each relay entry in the measurement file refers back to a card in the instrument file + /// + private void CheckForValidRelayFormat() + { + foreach (KeyValuePair entry in _relayMeasurementMap) + { + RelayInfo relays = entry.Value; + + if (_relayCards.ContainsKey(relays.RelayModule) == false) + { + throw new Exception("relay card field does not exist: " + relays.RelayModule); + } + } + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + try + { + if (disposing) + { + foreach (KeyValuePair relayCard in _relayCards) + { + if (_relayCards[relayCard.Key] != null) + { + _relayCards[relayCard.Key].Shutdown(); + } + } + } + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// Parses the ini file for measurement definitions + /// Populates the Dictionaries with the enum names and ini file data + /// + private void ParseMeasurementDef(string defFile) + { + IniFile iniReader = new IniFile(defFile); + + // read in all of the sections + List keys = iniReader.ReadAllKeys(RELAY_MEASUREMENTS); + + foreach (string key in keys) + { + string value = iniReader.ReadValue(RELAY_MEASUREMENTS, key); + + List field = value.Split(FIELD_DELIM).ToList(); + + if (field.Count != 2) + { + throw new Exception("expected two fields on line: " + value); + } + + string relayItem = field[0]; + + List relayDef = relayItem.Split(DASH_DELIM).ToList(); + + if (relayDef.Count != 2) + { + throw new Exception("Relay Entry : " + relayItem + " did not have two tokens as expected"); + } + + string relayCard = relayDef[0].Trim().ToUpper(); + string relay = relayDef[1].Trim(); + + InitialState initState = (InitialState)Enum.Parse(typeof(InitialState), field[1], true); + + RelayInfo relayInfo = new RelayInfo(relayCard, relay, initState); + + _relayMeasurementMap[key.ToUpper()] = relayInfo; + } + } + #endregion + + #region PublicClassFunctions + + /// + /// constructor that uses instrument manager for building instruments + /// + /// + /// + /// + public RelayMeasurementManager(IInstrumentManager instrumentManager, List instrumentNames, string configFileName = "") + { + _logger = LogManager.GetCurrentClassLogger(); + + _relayMeasurementMap = new Dictionary(); + _relayCards = new Dictionary(); + + foreach (string name in instrumentNames) + { + _relayCards[name] = instrumentManager.GetInstrument(name); + _relayCards[name]?.Initialize(); + } + + if(string.IsNullOrEmpty(configFileName)) + { + configFileName = "RelayMeasurementManager.xml"; + } + + ConfigurationFile configurationFile = new ConfigurationFile(configFileName); + + List relayInfoList = configurationFile.ReadList(RELAY_MEASUREMENTS, "Relays", new List()); + + foreach (var relayInfo in relayInfoList) + { + _relayMeasurementMap[relayInfo.RelayModule] = relayInfo; + } + + CheckForValidRelayFormat(); + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// + /// + /// + public void ConnectRelay(string measurementName) + { + lock (_syncObj) + { + if (_relayMeasurementMap.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + //get the card and relay + RelayInfo relayInfo = _relayMeasurementMap[measurementName]; + + //close all defined relays for measurement + if (relayInfo.Relays.Any()) + { + foreach (var relay in relayInfo.Relays) + { + _relayCards[relayInfo.RelayModule.ToUpper()].Connect(relay); + } + } + + //close the relay + if (!string.IsNullOrEmpty(relayInfo.Relay)) + { + _relayCards[relayInfo.RelayModule.ToUpper()].Connect(relayInfo.Relay); + } + } + } + + /// + /// + /// + /// + public void DisconnectRelay(string measurementName) + { + lock (_syncObj) + { + if (_relayMeasurementMap.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + //get the card and relay + RelayInfo relayInfo = _relayMeasurementMap[measurementName]; + + //open all defined relays for measurement + if (relayInfo.Relays.Any()) + { + foreach (var relay in relayInfo.Relays) + { + _relayCards[relayInfo.RelayModule.ToUpper()].Disconnect(relay); + } + } + + //open the relays + if (!string.IsNullOrEmpty(relayInfo.Relay)) + { + _relayCards[relayInfo.RelayModule.ToUpper()].Disconnect(relayInfo.Relay); + } + } + } + + /// + /// Return a list of relay measurements + /// + /// A list of relays + public List GetRelayMeasurementList() + { + lock (_syncObj) + { + List relayList = new List(); + + foreach (KeyValuePair name in _relayMeasurementMap) + { + relayList.Add(name.Key); + } + + return relayList; + } + } + + /// + /// + /// + public void ResetToInitialState() + { + lock (_syncObj) + { + foreach (KeyValuePair item in _relayMeasurementMap) + { + InitialState initState = item.Value.InitialState; + string relayItem = item.Key; + + if (initState == InitialState.CLOSED) + { + ConnectRelay(relayItem); + } + else + { + DisconnectRelay(relayItem); + } + } + } + } + + /// + /// Command a self test on the Relay instrument + /// + /*public uint SelfTest() + { + lock (_syncObj) + { + SelfTestResult result = _dio.PerformSelfTest(); + + return (uint)result; + } + }*/ + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/RelayMeasurementManager/RelayMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/RelayMeasurementManager/RelayMeasurementManager.csproj new file mode 100644 index 0000000..1fc6173 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/RelayMeasurementManager/RelayMeasurementManager.csproj @@ -0,0 +1,26 @@ + + + + net472 + RelayMeasurementManager + Composable Test Software Library + Relay Measurement Manager Library + Library + + + + 1.1.0 + + + + NU1603 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/RfMeasurementManager/RfMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/RfMeasurementManager/RfMeasurementManager.cs new file mode 100644 index 0000000..ca3c1b6 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/RfMeasurementManager/RfMeasurementManager.cs @@ -0,0 +1,1064 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using Raytheon.Units; +using Raytheon.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace MeasurementManagerLib +{ + /// + /// This class manages RF instruments and provides an abstraction + /// + public class RfMeasurementManager : IDisposable + { + #region PrivateClassMembers + private struct SpecAnMeasurementFields + { + public List _relays; + public SpecAnAveragingType _avgType; + public int _numAverages; + public int _rbw; + public int _vbw; + public int _centerFreq; + public int _span; + //public int _referanceLevel; + public int _attenuation; + public int _delay; + + public SpecAnMeasurementFields(List relays, SpecAnAveragingType avgType, int numAverages, int rbw, int vbw, int centerFreq, int span, /*int referanceLevel,*/ int attenuation, int delay) + { + _relays = relays; + _avgType = avgType; + _numAverages = numAverages; + _rbw = rbw; + _vbw = vbw; + _centerFreq = centerFreq; + _span = span; + //_referanceLevel = referanceLevel; + _attenuation = attenuation; + _delay = delay; + } + } + + private struct PowerMeterPowerMeasurementFields + { + public List _relays; + public readonly int _channel; + public readonly int _freq; + public readonly int _delay; + + public PowerMeterPowerMeasurementFields(List relays, int channel, int frequency, int delay) + { + _relays = relays; + _channel = channel; + _freq = frequency; + _delay = delay; + } + } + + private struct SignalGeneratorMeasurementFields + { + public List _relays; + public readonly int _powerLevel; + public readonly int _freq; + public readonly int _delay; + + public SignalGeneratorMeasurementFields(List relays, int powerLevel, int frequency, int delay) + { + _relays = relays; + _powerLevel = powerLevel; + _freq = frequency; + _delay = delay; + } + } + + private static object _syncObj = new Object(); + private Dictionary _switchCards; + private IPowerMeter _powerMeter; + private ISignalGenerator _sigGen; + private ISpecAnalyzer _specAn; + private Dictionary _powerMeterPowerMeasurements; + private Dictionary _signalGeneratorMeasurements; + private Dictionary _specAnMeasurements; + + private static NLog.ILogger _logger; + #endregion + + #region PrivateClassFunctions + + /// + /// The Finalizer + /// + ~RfMeasurementManager() + { + Dispose(false); + } + + /// + /// Confirm each relay entry in the measurement file refers back to a card in the instrument file + /// + private void CheckForValidRelayFormat() + { + foreach (KeyValuePair entry in _powerMeterPowerMeasurements) + { + List relays = entry.Value._relays; + + foreach (string relayDef in relays) + { + string[] relayInfo = relayDef.Split('-'); + if (relayInfo.Length != 2) + { + throw new Exception("Power Meter measurement relay format is not correct: " + relayDef); + } + + if (_switchCards.ContainsKey(relayInfo[0].ToUpper()) == false) + { + throw new Exception("Power Meter measurement relay card field does not exist: " + relayInfo[0]); + } + } + } + + foreach (KeyValuePair entry in _signalGeneratorMeasurements) + { + List relays = entry.Value._relays; + + foreach (string relayDef in relays) + { + string[] relayInfo = relayDef.Split('-'); + if (relayInfo.Length != 2) + { + throw new Exception("Sig Gen measurement relay format is not correct: " + relayDef); + } + + if (_switchCards.ContainsKey(relayInfo[0].ToUpper()) == false) + { + throw new Exception("Sig Gen measurement relay card field does not exist: " + relayInfo[0]); + } + } + } + } + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + if (_powerMeter != null) + { + try + { + _powerMeter.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + if (_sigGen != null) + { + try + { + _sigGen.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + if (_specAn != null) + { + try + { + _specAn.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + foreach (KeyValuePair switchCard in _switchCards) + { + if (_switchCards[switchCard.Key] != null) + { + try + { + _switchCards[switchCard.Key].Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + } + } + + /// + /// Parses the ini file for measurement definitions + /// Populates the Dictionaries with the enum names and ini file data + /// + private void ParseMeasurementDef(ConfigurationFile configurationFile) + { + const string POWER_METER_MEASUREMENT = "PowerMeterReadPower"; + const string SIG_GEN_MEASUREMENT = "SignalGeneratorEnable"; + const string SPEC_AN_PEAK_AMP_MEASUREMENT = "SpecAnMeasurePeakAmplitude"; + const string SPEC_AN_PEAK_FREQ_MEASUREMENT = "SpecAnMeasurePeakFrequency"; + + const char COMMA_DELIM = ','; + + const int INI_POWER_METER_RELAY_INDEX = 0; + const int INI_POWER_METER_CHANNEL_NUM_INDEX = 1; + const int INI_POWER_METER_FREQ_INDEX = 2; + const int INI_POWER_METER_DELAY_INDEX = 3; + + const int INI_SIG_GEN_RELAY_INDEX = 0; + const int INI_SIG_GEN_POWER_LEVEL_INDEX = 1; + const int INI_SIG_GEN_FREQ_INDEX = 2; + const int INI_SIG_GEN_DELAY_INDEX = 3; + + const int INI_SPEC_AN_RELAY_INDEX = 0; + const int INI_SPEC_AN_AVG_TYPE_INDEX = 1; + const int INI_SPEC_AN_NUM_AVG_TYPE_INDEX = 2; + const int INI_SPEC_AN_RBW_INDEX = 3; + const int INI_SPEC_AN_VBW_INDEX = 4; + const int INI_SPEC_AN_CENTER_FREQ_INDEX = 5; + const int INI_SPEC_AN_SPAN_INDEX = 6; + //const int INI_SPEC_AN_REF_POWER_INDEX = 7; + const int INI_SPEC_AN_ATTENUATION_INDEX = 7; + const int INI_SPEC_AN_DELAY_INDEX = 8; + + // read in all of the sections + List sections = configurationFile.ReadAllSections(); + + foreach (string section in sections) + { + if (section.ToUpper().Contains(POWER_METER_MEASUREMENT.ToUpper())) + { + List keys = configurationFile.ReadAllKeys(section); + foreach (string key in keys) + { + List valueList = configurationFile.ReadList(section, key); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_POWER_METER_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_POWER_METER_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + int channel = Convert.ToInt32(valueList[INI_POWER_METER_CHANNEL_NUM_INDEX]); + int freq = Convert.ToInt32(valueList[INI_POWER_METER_FREQ_INDEX]); + int delay = Convert.ToInt32(valueList[INI_POWER_METER_DELAY_INDEX]); + _powerMeterPowerMeasurements.Add(key.ToUpper(), new PowerMeterPowerMeasurementFields(relayList, channel, freq, delay)); + } + } + else if (section.ToUpper().Contains(SIG_GEN_MEASUREMENT.ToUpper())) + { + List keys = configurationFile.ReadAllKeys(section); + foreach (string key in keys) + { + List valueList = configurationFile.ReadList(section, key); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_SIG_GEN_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_SIG_GEN_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + int powLevel = Convert.ToInt32(valueList[INI_SIG_GEN_POWER_LEVEL_INDEX]); + int freq = Convert.ToInt32(valueList[INI_SIG_GEN_FREQ_INDEX]); + int delay = Convert.ToInt32(valueList[INI_SIG_GEN_DELAY_INDEX]); + _signalGeneratorMeasurements.Add(key.ToUpper(), new SignalGeneratorMeasurementFields(relayList, powLevel, freq, delay)); + } + } + else if (section.ToUpper().Contains(SPEC_AN_PEAK_AMP_MEASUREMENT.ToUpper())) + { + List keys = configurationFile.ReadAllKeys(section); + foreach (string key in keys) + { + List valueList = configurationFile.ReadList(section, key); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_SPEC_AN_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_SPEC_AN_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + + SpecAnAveragingType avgType = (SpecAnAveragingType)Enum.Parse(typeof(SpecAnAveragingType), valueList[INI_SPEC_AN_AVG_TYPE_INDEX], true); + int numAverages = Convert.ToInt32(valueList[INI_SPEC_AN_NUM_AVG_TYPE_INDEX]); + int rbw = Convert.ToInt32(valueList[INI_SPEC_AN_RBW_INDEX]); + int vbw = Convert.ToInt32(valueList[INI_SPEC_AN_VBW_INDEX]); + int centerFreq = Convert.ToInt32(valueList[INI_SPEC_AN_CENTER_FREQ_INDEX]); + int span = Convert.ToInt32(valueList[INI_SPEC_AN_SPAN_INDEX]); + //int refPower = Convert.ToInt32(valueList[INI_SPEC_AN_REF_POWER_INDEX]); + int attenuation = Convert.ToInt32(valueList[INI_SPEC_AN_ATTENUATION_INDEX]); + int delay = Convert.ToInt32(valueList[INI_SPEC_AN_DELAY_INDEX]); + _specAnMeasurements.Add(key.ToUpper(), new SpecAnMeasurementFields(relayList, avgType, numAverages, rbw, vbw, centerFreq, span, /*refPower,*/ attenuation, delay)); + } + } + else if (section.ToUpper().Contains(SPEC_AN_PEAK_FREQ_MEASUREMENT.ToUpper())) + { + List keys = configurationFile.ReadAllKeys(section); + foreach (string key in keys) + { + List valueList = configurationFile.ReadList(section, key); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_SPEC_AN_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_SPEC_AN_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + + SpecAnAveragingType avgType = (SpecAnAveragingType)Enum.Parse(typeof(SpecAnAveragingType), valueList[INI_SPEC_AN_AVG_TYPE_INDEX], true); + int numAverages = Convert.ToInt32(valueList[INI_SPEC_AN_NUM_AVG_TYPE_INDEX]); + int rbw = Convert.ToInt32(valueList[INI_SPEC_AN_RBW_INDEX]); + int vbw = Convert.ToInt32(valueList[INI_SPEC_AN_VBW_INDEX]); + int centerFreq = Convert.ToInt32(valueList[INI_SPEC_AN_CENTER_FREQ_INDEX]); + int span = Convert.ToInt32(valueList[INI_SPEC_AN_SPAN_INDEX]); + //int refPower = Convert.ToInt32(valueList[INI_SPEC_AN_REF_POWER_INDEX]); + int attenuation = Convert.ToInt32(valueList[INI_SPEC_AN_ATTENUATION_INDEX]); + int delay = Convert.ToInt32(valueList[INI_SPEC_AN_DELAY_INDEX]); + _specAnMeasurements.Add(key.ToUpper(), new SpecAnMeasurementFields(relayList, avgType, numAverages, rbw, vbw, centerFreq, span, /*refPower,*/ attenuation, delay)); + } + } + } + } + + + /// + /// Parses the ini file for measurement definitions + /// Populates the Dictionaries with the enum names and ini file data + /// + private void ParseMeasurementDef(string defFile) + { + const string POWER_METER_MEASUREMENT = "PowerMeterReadPower"; + const string SIG_GEN_MEASUREMENT = "SignalGeneratorEnable"; + const string SPEC_AN_PEAK_AMP_MEASUREMENT = "SpecAnMeasurePeakAmplitude"; + const string SPEC_AN_PEAK_FREQ_MEASUREMENT = "SpecAnMeasurePeakFrequency"; + + const char BAR_DELIM = '|'; + const char COMMA_DELIM = ','; + + const int INI_POWER_METER_RELAY_INDEX = 0; + const int INI_POWER_METER_CHANNEL_NUM_INDEX = 1; + const int INI_POWER_METER_FREQ_INDEX = 2; + const int INI_POWER_METER_DELAY_INDEX = 3; + + const int INI_SIG_GEN_RELAY_INDEX = 0; + const int INI_SIG_GEN_POWER_LEVEL_INDEX = 1; + const int INI_SIG_GEN_FREQ_INDEX = 2; + const int INI_SIG_GEN_DELAY_INDEX = 3; + + const int INI_SPEC_AN_RELAY_INDEX = 0; + const int INI_SPEC_AN_AVG_TYPE_INDEX = 1; + const int INI_SPEC_AN_NUM_AVG_TYPE_INDEX = 2; + const int INI_SPEC_AN_RBW_INDEX = 3; + const int INI_SPEC_AN_VBW_INDEX = 4; + const int INI_SPEC_AN_CENTER_FREQ_INDEX = 5; + const int INI_SPEC_AN_SPAN_INDEX = 6; + //const int INI_SPEC_AN_REF_POWER_INDEX = 7; + const int INI_SPEC_AN_ATTENUATION_INDEX = 7; + const int INI_SPEC_AN_DELAY_INDEX = 8; + + IniFile iniReader = new IniFile(defFile); + + // read in all of the sections + List sections = iniReader.ReadAllSections(); + + foreach (string section in sections) + { + if (section.ToUpper().Contains(POWER_METER_MEASUREMENT.ToUpper())) + { + List keys = iniReader.ReadAllKeys(section); + foreach (string key in keys) + { + string value = iniReader.ReadValue(section, key); + string[] valueList = value.Split(BAR_DELIM); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_POWER_METER_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_POWER_METER_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + int channel = Convert.ToInt32(valueList[INI_POWER_METER_CHANNEL_NUM_INDEX]); + int freq = Convert.ToInt32(valueList[INI_POWER_METER_FREQ_INDEX]); + int delay = Convert.ToInt32(valueList[INI_POWER_METER_DELAY_INDEX]); + _powerMeterPowerMeasurements.Add(key.ToUpper(), new PowerMeterPowerMeasurementFields(relayList, channel, freq, delay)); + } + } + else if (section.ToUpper().Contains(SIG_GEN_MEASUREMENT.ToUpper())) + { + List keys = iniReader.ReadAllKeys(section); + foreach (string key in keys) + { + string value = iniReader.ReadValue(section, key); + string[] valueList = value.Split(BAR_DELIM); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_SIG_GEN_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_SIG_GEN_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + int powLevel = Convert.ToInt32(valueList[INI_SIG_GEN_POWER_LEVEL_INDEX]); + int freq = Convert.ToInt32(valueList[INI_SIG_GEN_FREQ_INDEX]); + int delay = Convert.ToInt32(valueList[INI_SIG_GEN_DELAY_INDEX]); + _signalGeneratorMeasurements.Add(key.ToUpper(), new SignalGeneratorMeasurementFields(relayList, powLevel, freq, delay)); + } + } + else if (section.ToUpper().Contains(SPEC_AN_PEAK_AMP_MEASUREMENT.ToUpper())) + { + List keys = iniReader.ReadAllKeys(section); + foreach (string key in keys) + { + string value = iniReader.ReadValue(section, key); + string[] valueList = value.Split(BAR_DELIM); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_SPEC_AN_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_SPEC_AN_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + + SpecAnAveragingType avgType = (SpecAnAveragingType)Enum.Parse(typeof(SpecAnAveragingType), valueList[INI_SPEC_AN_AVG_TYPE_INDEX], true); + int numAverages = Convert.ToInt32(valueList[INI_SPEC_AN_NUM_AVG_TYPE_INDEX]); + int rbw = Convert.ToInt32(valueList[INI_SPEC_AN_RBW_INDEX]); + int vbw = Convert.ToInt32(valueList[INI_SPEC_AN_VBW_INDEX]); + int centerFreq = Convert.ToInt32(valueList[INI_SPEC_AN_CENTER_FREQ_INDEX]); + int span = Convert.ToInt32(valueList[INI_SPEC_AN_SPAN_INDEX]); + //int refPower = Convert.ToInt32(valueList[INI_SPEC_AN_REF_POWER_INDEX]); + int attenuation = Convert.ToInt32(valueList[INI_SPEC_AN_ATTENUATION_INDEX]); + int delay = Convert.ToInt32(valueList[INI_SPEC_AN_DELAY_INDEX]); + _specAnMeasurements.Add(key.ToUpper(), new SpecAnMeasurementFields(relayList, avgType, numAverages, rbw, vbw, centerFreq, span, /*refPower,*/ attenuation, delay)); + } + } + else if (section.ToUpper().Contains(SPEC_AN_PEAK_FREQ_MEASUREMENT.ToUpper())) + { + List keys = iniReader.ReadAllKeys(section); + foreach (string key in keys) + { + string value = iniReader.ReadValue(section, key); + string[] valueList = value.Split(BAR_DELIM); + + // support for no relays (direct connect to scope) + List relayList = new List(); + if (valueList[INI_SPEC_AN_RELAY_INDEX].Trim() == "") + { + // no relays, nothing to do + } + else + { + relayList = valueList[INI_SPEC_AN_RELAY_INDEX].Split(COMMA_DELIM).ToList(); + } + + for (int i = 0; i < relayList.Count; ++i) + { + relayList[i] = relayList[i].Trim(); + } + + SpecAnAveragingType avgType = (SpecAnAveragingType)Enum.Parse(typeof(SpecAnAveragingType), valueList[INI_SPEC_AN_AVG_TYPE_INDEX], true); + int numAverages = Convert.ToInt32(valueList[INI_SPEC_AN_NUM_AVG_TYPE_INDEX]); + int rbw = Convert.ToInt32(valueList[INI_SPEC_AN_RBW_INDEX]); + int vbw = Convert.ToInt32(valueList[INI_SPEC_AN_VBW_INDEX]); + int centerFreq = Convert.ToInt32(valueList[INI_SPEC_AN_CENTER_FREQ_INDEX]); + int span = Convert.ToInt32(valueList[INI_SPEC_AN_SPAN_INDEX]); + //int refPower = Convert.ToInt32(valueList[INI_SPEC_AN_REF_POWER_INDEX]); + int attenuation = Convert.ToInt32(valueList[INI_SPEC_AN_ATTENUATION_INDEX]); + int delay = Convert.ToInt32(valueList[INI_SPEC_AN_DELAY_INDEX]); + _specAnMeasurements.Add(key.ToUpper(), new SpecAnMeasurementFields(relayList, avgType, numAverages, rbw, vbw, centerFreq, span, /*refPower,*/ attenuation, delay)); + } + } + } + } + + /// + /// Will command the switch cards close a specified list of relays + /// + /// + private void SwitchRelayClose(List relayList) + { + foreach (string combo in relayList) + { + //break out the card and relay + string[] cardRelay = combo.Split('-'); + string cardObject = cardRelay[0].Trim(); + string relay = cardRelay[1].Trim(); + + //open the relays + _switchCards[cardObject.ToUpper()].Connect(relay); + } + } + + /// + /// Will command the switch card open all relays or the specified list of relays + /// + /// Optional list of relays to open + private void SwitchRelayOpen(List relayList) + { + foreach (string combo in relayList) + { + //break out the card and relay + string[] cardRelay = combo.Split('-'); + string cardObject = cardRelay[0].Trim(); + string relay = cardRelay[1].Trim(); + + //open the relays + _switchCards[cardObject.ToUpper()].Disconnect(relay); + } + } + + #endregion + + #region PublicClassFunctions + + public RfMeasurementManager(IInstrumentManager instrumentManager, + List switchInstrumentNames, + string powerMeeterName, + string signalGeneratorName, + string specAnalyzerName, + string configFileName = "") + { + + _logger = LogManager.GetCurrentClassLogger(); + + // initialize class members + _powerMeterPowerMeasurements = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + _signalGeneratorMeasurements = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + _specAnMeasurements = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + _switchCards = new Dictionary(); + + if(string.IsNullOrEmpty(configFileName)) + { + configFileName = "RfMeasurementManager.xml"; + } + + ParseMeasurementDef(new ConfigurationFile(configFileName)); + + foreach (string name in switchInstrumentNames) + { + _switchCards[name] = instrumentManager.GetInstrument(name); + _switchCards[name]?.Initialize(); + } + + if (!string.IsNullOrEmpty(powerMeeterName)) + { + _powerMeter = instrumentManager.GetInstrument(powerMeeterName); + _powerMeter?.Initialize(); + } + + if (!string.IsNullOrEmpty(signalGeneratorName)) + { + _sigGen = instrumentManager.GetInstrument(signalGeneratorName); + _sigGen?.Initialize(); + } + + if (!string.IsNullOrEmpty(specAnalyzerName)) + { + _specAn = instrumentManager.GetInstrument(specAnalyzerName); + _specAn?.Initialize(); + } + + CheckForValidRelayFormat(); + } + + /// + /// Dispose of this objects resources + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// A getter for the list of power measurements (as defined in the input def file) + /// + /// A list of power measurements + public List PowerMeterGetPowerMeasurementList() + { + lock (_syncObj) + { + List measurements = new List(); + + foreach (KeyValuePair entry in _powerMeterPowerMeasurements) + { + measurements.Add(entry.Key); + } + + return measurements; + } + } + + /// + /// + /// + /// + /// + public double PowerMeterReadPower(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (_powerMeterPowerMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + // grab the measurement params + PowerMeterPowerMeasurementFields measurement = _powerMeterPowerMeasurements[measurementName.ToUpper()]; + + measurementRelays = measurement._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + bool ret = _powerMeter.SetFrequency(measurement._channel, Frequency.FromHertz(measurement._freq)); + + if (ret == false) + { + throw new Exception("set frequency failed for measurement: " + measurementName); + } + + // wait a bit + Thread.Sleep(measurement._delay); + + // make the measurement + double returnValue = _powerMeter.GetMeasurement(measurement._channel).Watts; + + return returnValue; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// + /// + /// + public void PowerMeterSelfTest() + { + + lock (_syncObj) + { + SelfTestResult res = _powerMeter.PerformSelfTest(); + + if (res != SelfTestResult.Pass) + { + throw new Exception("did not pass, the result was: " + res.ToString()); + } + } + } + + /// + /// + /// + /// + /// + public void SignalGeneratorDisable(string measurementName) + { + try + { + lock (_syncObj) + { + if (_signalGeneratorMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + // grab the measurement params + SignalGeneratorMeasurementFields measurement = _signalGeneratorMeasurements[measurementName.ToUpper()]; + + List measurementRelays = measurement._relays; + + _sigGen.Enable(false); + + // wait a bit + Thread.Sleep(measurement._delay); + + // close the relays + SwitchRelayOpen(measurementRelays); + } + } + catch (Exception) + { + throw; + } + } + + /// + /// + /// + /// + /// + public void SignalGeneratorEnable(string measurementName) + { + try + { + lock (_syncObj) + { + if (_signalGeneratorMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + // grab the measurement params + SignalGeneratorMeasurementFields measurement = _signalGeneratorMeasurements[measurementName.ToUpper()]; + + List measurementRelays = measurement._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + _sigGen.SetFrequency(new UnitizedValue(measurement._freq)); + + _sigGen.SetPowerLevel(new UnitizedValue(measurement._powerLevel)); + + // wait a bit + Thread.Sleep(measurement._delay); + + _sigGen.Enable(true); + } + } + catch (Exception) + { + throw; + } + } + + + /// + /// Sends a SCPI command to the Sig Gen and reads the response + /// + /// The SCPI command to send + /// + public string SignalGeneratorIOQuery(string command) + { + lock (_syncObj) + { + lock (_syncObj) + { + return _sigGen.IOQuery(command); + } + } + } + + /// + /// Sends a SCPI command to the Sig Gen + /// + /// The SCPI command to send + public void SignalGeneratorIOWrite(string command) + { + lock (_syncObj) + { + lock (_syncObj) + { + _sigGen.IOWrite(command); + } + } + } + + /// + /// + /// + /// + public void SignalGeneratorSelfTest() + { + lock (_syncObj) + { + SelfTestResult res = _sigGen.PerformSelfTest(); + + if (res != SelfTestResult.Pass) + { + throw new Exception("did not pass, the result was: " + res.ToString()); + } + } + } + + /// + /// Sends a SCPI command to the Spec An and reads the response + /// + /// The SCPI command to send + /// + public string SpecAnIOQuery(string command, int timeout = 10000) + { + lock (_syncObj) + { + lock (_syncObj) + { + return _specAn.IOQuery(command, timeout); + } + } + } + + /// + /// Sends a SCPI command to the Spec An + /// + /// The SCPI command to send + public void SpecAnIOWrite(string command) + { + lock (_syncObj) + { + lock (_syncObj) + { + _specAn.IOWrite(command); + } + } + } + + /// + /// + /// + /// + /// + public double SpecAnMeasurePeakAmplitude(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (_specAnMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + // grab the measurement params + SpecAnMeasurementFields measurement = _specAnMeasurements[measurementName.ToUpper()]; + + measurementRelays = measurement._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + _specAn.ConfigureAveraging(measurement._avgType, measurement._numAverages); + + _specAn.ConfigureBandwidth(measurement._rbw, measurement._vbw); + + _specAn.ConfigureFrequency(measurement._centerFreq, measurement._span); + + _specAn.ConfigurePowerLevel(/*measurement._referanceLevel,*/ measurement._attenuation); + + // wait a bit + Thread.Sleep(measurement._delay); + + double amp = _specAn.MeasurePeakAmplitude(); + + return amp; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// + /// + /// + /// + public double SpecAnMeasurePeakFrequency(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (_specAnMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + // grab the measurement params + SpecAnMeasurementFields measurement = _specAnMeasurements[measurementName.ToUpper()]; + + measurementRelays = measurement._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + _specAn.ConfigureAveraging(measurement._avgType, measurement._numAverages); + + _specAn.ConfigureBandwidth(measurement._rbw, measurement._vbw); + + _specAn.ConfigureFrequency(measurement._centerFreq, measurement._span); + + _specAn.ConfigurePowerLevel(/*measurement._referanceLevel,*/ measurement._attenuation); + + // wait a bit + Thread.Sleep(measurement._delay); + + double freq = _specAn.MeasurePeakFrequency(); + + return freq; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// + /// + /// + public void SpecAnSelfTest() + { + lock (_syncObj) + { + SelfTestResult res = _specAn.PerformSelfTest(); + + if (res != SelfTestResult.Pass) + { + throw new Exception("did not pass, the result was: " + res.ToString()); + } + } + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/RfMeasurementManager/RfMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/RfMeasurementManager/RfMeasurementManager.csproj new file mode 100644 index 0000000..a6b9101 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/RfMeasurementManager/RfMeasurementManager.csproj @@ -0,0 +1,29 @@ + + + + net472 + RfMeasurementManager + Composable Test Software Library + Rf Measurement Manager Library + Library + + + + 1.1.0 + + + + NU1603 + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/SpaceChamberLSPSMeasurementManager/SpaceChamberLspsMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/SpaceChamberLSPSMeasurementManager/SpaceChamberLspsMeasurementManager.cs new file mode 100644 index 0000000..79eaa52 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/SpaceChamberLSPSMeasurementManager/SpaceChamberLspsMeasurementManager.cs @@ -0,0 +1,1353 @@ +// Ignore Spelling: Uut + +using NLog; +using Raytheon.Instruments; +using Raytheon.Units; +using System; +using System.Windows; +using System.Collections.Generic; +using System.Drawing; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; + +namespace MeasurementManagerLib +{ + public class SpaceChamberLSPSMeasurementManager + { + private INetCdfData netCdfData_ = null; + private readonly ILspsChamber lspsChamber_; + private readonly ILogger _logger; + + /// + /// TODO: add video recorder instrument name as parameter + /// constructor that uses instrument manager for creating an instrument + /// + /// + /// + public SpaceChamberLSPSMeasurementManager(IInstrumentManager instrumentManager, string lspsChamber, string netCdfData) + { + _logger = LogManager.GetCurrentClassLogger(); + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + lspsChamber_ = instrumentManager.GetInstrument(lspsChamber); + if (lspsChamber_ == null) + { + throw new Exception($"Instrument manager failed to create LSPS Chamber Device {lspsChamber}. Check your settings."); + } + lspsChamber_.Initialize(); + + netCdfData_ = instrumentManager.GetInstrument(netCdfData); + if (netCdfData_ == null) + { + throw new Exception($"Instrument manager failed to create NetCdfData Device {netCdfData}. Check your settings."); + } + } + + /// + /// shuts down LSPS manager, clears resources + /// + public void Shutdown() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + lspsChamber_?.Shutdown(); + } + + #region Autofill functions + /// + /// Auto Fill Cool Down + /// + public void AutoFillCoolDown(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.AutoFillCoolDown(); + + Raytheon.Instruments.LSPS.AutoFillState state; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Autofill to transition to cooling. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + state = lspsChamber_.GetAutoFillState(); + } while (state != Raytheon.Instruments.LSPS.AutoFillState.COOLING); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Auto Fill Warm Up + /// + public void AutoFillWarmUp(int pollingRateInMs = 1000, int timeOutInMs = 10000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.AutoFillWarmUp(); + + Raytheon.Instruments.LSPS.AutoFillState state; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Autofill to transition to cooling. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + state = lspsChamber_.GetAutoFillState(); + } while (state != Raytheon.Instruments.LSPS.AutoFillState.WARMING); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Auto Fill Force + /// + public void AutoFillForce() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.AutoFillForce(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Auto Fill Turn Off + /// + public void AutoFillTurnOff(int pollingRateInMs = 1000, int timeOutInMs = 60000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.AutoFillTurnOff(); + + Raytheon.Instruments.LSPS.AutoFillState state; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Autofill to transition to cooling. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + state = lspsChamber_.GetAutoFillState(); + } while (state != Raytheon.Instruments.LSPS.AutoFillState.OFF); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + #endregion + + #region NIF Functions + /// + /// Close Gate Valve + /// + public void CloseLspsGateValve(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.CloseLspsGateValve(); + WaitForLspsGateValveOperation(Raytheon.Instruments.LSPS.GateValvePosition.CLOSE, pollingRateInMs, timeOutInMs); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Open Gate Valve + /// + public void OpenLspsGateValve(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.OpenLspsGateValve(); + WaitForLspsGateValveOperation(Raytheon.Instruments.LSPS.GateValvePosition.OPEN, pollingRateInMs, timeOutInMs); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Wait for UUT Gate Valve to be in position + /// + private void WaitForLspsGateValveOperation(Raytheon.Instruments.LSPS.GateValvePosition gateValvePosition, int pollingRateInMs, int timeOutInMs) + { + int val = 0; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for LSPS Gate Valve to {gateValvePosition.ToString()}. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + val = lspsChamber_.GetInputIndex((int)gateValvePosition); + } while (val == 0); + + stopwatch.Stop(); + } + + /// + /// Get UUT Gate Valve Position + /// + public double GetTemperature(Raytheon.Instruments.LSPS.TemperatureIndex tempIndex) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + return lspsChamber_.GetTemperature(tempIndex); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + #endregion + + #region RIO Functions + /// + /// Close Gate Valve + /// + public void CloseVhfGateValve(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.CloseVhfGateValve(); + + WaitForVhfGateValveOperation(Raytheon.Instruments.LSPS.GateValvePosition.CLOSE, pollingRateInMs, timeOutInMs); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Open Gate Valve + /// + public void OpenVhfGateValve(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.OpenVhfGateValve(); + + WaitForVhfGateValveOperation(Raytheon.Instruments.LSPS.GateValvePosition.OPEN, pollingRateInMs, timeOutInMs); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Wait for VHF Gate Valve to be in position + /// + private void WaitForVhfGateValveOperation(Raytheon.Instruments.LSPS.GateValvePosition gateValvePosition, int pollingRateInMs, int timeOutInMs) + { + int val = 0; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for VHF Gate Valve to {gateValvePosition.ToString()}. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + + if (gateValvePosition == Raytheon.Instruments.LSPS.GateValvePosition.OPEN) + val = lspsChamber_.GetVhfGateValveOpenInput(); + else + val = lspsChamber_.GetVhfGateValveClosedInput(); + } while (val == 0); + + stopwatch.Stop(); + } + + /// + /// Verify Gate Valve Chamber Pressure + /// + public void VerifyGateValveChamberPressure(double minLimit, double maxLimit) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + double val = lspsChamber_.GetVhfGateValveChamberPressure(); + + if (val < minLimit || val > maxLimit) + { + throw new Exception($"Gate valve chamber pressure is out of range. Measured: {val}. Limits: [{minLimit}, {maxLimit}]"); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Verify Gate Valve Canister Pressure + /// + public void VerifyGateValveCanisterPressure(double minLimit, double maxLimit) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + double val = lspsChamber_.GetVhfGateValveUutPressure(); + + if (val < minLimit || val > maxLimit) + { + throw new Exception($"Gate valve canister pressure is out of range. Measured: {val}. Limits: [{minLimit}, {maxLimit}]"); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + #endregion + + #region Chamber Vacuum Functions + /// + /// Verify Chamber Pressure (CVAC) + /// + public void VerifyLspsChamberPressure(double minLimit, double maxLimit) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + double val = lspsChamber_.GetLspsChamberPressure(); + + if (val < minLimit || val > maxLimit) + { + throw new Exception($"PLC Chamber pressure is out of range. Measured: {val}. Limits: [{minLimit}, {maxLimit}]"); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Verify Sensor Pressure (SVAC) + /// + public void VerifyLspsUutPressure(double minLimit, double maxLimit) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + double val = lspsChamber_.GetLspsUutPressure(); + + if (val < minLimit || val > maxLimit) + { + throw new Exception($"PLC Chamber pressure is out of range. Measured: {val}. Limits: [{minLimit}, {maxLimit}]"); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + #endregion + + #region GALIL Functions + public void FilterWheelHome(int pollingRateInMs = 2000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.FilterWheelHome(); + + Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus status; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for FilterWheel to home. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + status = lspsChamber_.GetFilterWheelStatus(); + } while (status != Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus.IN_POSITION); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Set Filter Wheel position + /// + /// + public void SetFilterWheelPosition(int position, int pollingRateInMs = 2000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SetFilterWheelPosition(position); + + Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus status; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for FilterWheel to move. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + status = lspsChamber_.GetFilterWheelStatus(); + } while (status != Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus.IN_POSITION); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Get Filter Wheel position + /// + /// + public int GetFilterWheelPosition() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + return lspsChamber_.GetFilterWheelPosition(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void TargetWheelHome(int pollingRateInMs = 2000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.TargetWheelHome(); + + Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus status; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for TargetWheel to home. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + status = lspsChamber_.GetTargetWheelStatus(); + } while (status != Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus.IN_POSITION); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Sets target wheel position + /// + /// + public void SetTargetWheelPosition(int position, int pollingRateInMs = 2000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SetTargetWheelPosition(position); + + Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus status; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for TargetWheel to move. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + status = lspsChamber_.GetTargetWheelStatus(); + } while (status != Raytheon.Instruments.LSPS.TargetAndFilterWheelStatus.IN_POSITION); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorHome(int pollingRateInMs = 2000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SteeringMirrorHome(); + + Tuple steeringMirrorStatus; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Steering Mirror to home. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + steeringMirrorStatus = lspsChamber_.GetSteeringMirrorStatus(); + } while (steeringMirrorStatus.Item1 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION || steeringMirrorStatus.Item2 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Get target wheel position + /// + /// + public int GetTargetWheelPosition() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + return lspsChamber_.GetTargetWheelPosition(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorStop(int pollingRateInMs = 2000, int timeOutInMs = 10000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SteeringMirrorStop(); + + Tuple steeringMirrorStatus; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Steering Mirror to stop. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + steeringMirrorStatus = lspsChamber_.GetSteeringMirrorStatus(); + } while (steeringMirrorStatus.Item1 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION || steeringMirrorStatus.Item2 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorMove(double az, double el, double speed, Raytheon.Instruments.LSPS.WaitOption waitOption = Raytheon.Instruments.LSPS.WaitOption.WAIT, int pollingRateInMs = 2000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SteeringMirrorMove(az, el, speed); + + if (waitOption == Raytheon.Instruments.LSPS.WaitOption.WAIT) + { + Tuple steeringMirrorStatus; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Steering Mirror to move. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + steeringMirrorStatus = lspsChamber_.GetSteeringMirrorStatus(); + } while (steeringMirrorStatus.Item1 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION || steeringMirrorStatus.Item2 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION); + stopwatch.Stop(); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public Tuple SteeringMirrorGetBeamAngles() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + return lspsChamber_.SteeringMirrorGetBeamAngles(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorSetBeamSpeed(double speed) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.SteeringMirrorSetBeamSpeed(speed); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorSetRightLeftArrowAngle(double angle) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.SteeringMirrorSetRightLeftArrowAngle(angle); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorSetUpDownArrowAngle(double angle) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.SteeringMirrorSetUpDownArrowAngle(angle); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorLoadProfile(string profileFilePath) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.SteeringMirrorLoadProfileFromFile(profileFilePath); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorResetProfile() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_?.SteeringMirrorResetProfile(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorRunProfile(Raytheon.Instruments.LSPS.SteeringMirrorProfileMode profileMode = Raytheon.Instruments.LSPS.SteeringMirrorProfileMode.LEARNED, + Raytheon.Instruments.LSPS.SteeringMirrorMovementMode movementMode = Raytheon.Instruments.LSPS.SteeringMirrorMovementMode.ABSOLUTE, + Raytheon.Instruments.LSPS.WaitOption waitOption = Raytheon.Instruments.LSPS.WaitOption.NO_WAIT, + int pollingRateInMs = 2000, int timeOutInMs = 360000 + ) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SteeringMirrorSetBeamSpeed(12000); + lspsChamber_.SteeringMirrorRunProfile(profileMode, movementMode); + + if (waitOption == Raytheon.Instruments.LSPS.WaitOption.WAIT) + { + Tuple steeringMirrorStatus; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Steering Mirror to complete profile move. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + steeringMirrorStatus = lspsChamber_.GetSteeringMirrorStatus(); + } while (steeringMirrorStatus.Item1 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION || steeringMirrorStatus.Item2 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION); + stopwatch.Stop(); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorMoveToBeginningOfProfile(Raytheon.Instruments.LSPS.WaitOption waitOption = Raytheon.Instruments.LSPS.WaitOption.WAIT, int pollingRateInMs = 2000, int timeOutInMs = 240000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SteeringMirrorMoveToBeginningOfProfile(); + + if (waitOption == Raytheon.Instruments.LSPS.WaitOption.WAIT) + { + Tuple steeringMirrorStatus; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Steering Mirror to move. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + steeringMirrorStatus = lspsChamber_.GetSteeringMirrorStatus(); + } while (steeringMirrorStatus.Item1 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION || steeringMirrorStatus.Item2 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION); + stopwatch.Stop(); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void SteeringMirrorRunNextStepInProfile(Raytheon.Instruments.LSPS.WaitOption waitOption = Raytheon.Instruments.LSPS.WaitOption.WAIT, int pollingRateInMs = 2000, int timeOutInMs = 30000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SteeringMirrorRunNextStepInProfile(); + + if (waitOption == Raytheon.Instruments.LSPS.WaitOption.WAIT) + { + Tuple steeringMirrorStatus; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Steering Mirror to move. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + steeringMirrorStatus = lspsChamber_.GetSteeringMirrorStatus(); + } while (steeringMirrorStatus.Item1 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION || steeringMirrorStatus.Item2 != Raytheon.Instruments.LSPS.SteeringMirrorStatus.IN_POSITION); + stopwatch.Stop(); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + #endregion + + #region BlackBody Functions + /// + /// Set BlackBody Setpoint Temperature + /// + /// + /// + /// + public void SetBlackBodySetpointTemperature(double temperature, Raytheon.Instruments.LSPS.WaitOption waitOption = Raytheon.Instruments.LSPS.WaitOption.NO_WAIT, int pollingRateInMs = 2000, int timeOutInMs = 600000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SetBlackBodySetpointTemperature(temperature); + + if (waitOption == Raytheon.Instruments.LSPS.WaitOption.WAIT) + { + ConfirmBlackBodySetpointTemperature(temperature, pollingRateInMs, timeOutInMs); + } + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Confirm BlackBody Setpoint Temperature + /// + /// + /// + /// + public void ConfirmBlackBodySetpointTemperature(double temperature, int pollingRateInMs = 2000, int timeOutInMs = 600000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + const double TEMP_DELTA_ALLOWED = 0.1; + + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + Tuple temp; + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for blackbody to reach temperature setpoint. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + temp = lspsChamber_.GetBlackbodyTemperature(); + } while (Math.Abs(temp.Item1 - temperature) >= TEMP_DELTA_ALLOWED); + + Tuple stability; + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for blackbody's temperature to stabilize. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + stability = lspsChamber_.GetBlackbodyStability(); + } while (stability.Item1 != Raytheon.Instruments.LSPS.Stability.STABLE); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + #endregion + + #region Chopper Functions + /// + /// Set Chopper Frequency + /// + /// + public void SetChopperFrequency(double frequency, int pollingRateInMs = 1000, int timeOutInMs = 600000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SetChopperFrequency(frequency); + + const double FREQ_DELTA_ALLOWED = 0.0001; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Chopper to reach frequency setpoint. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + } while (Math.Abs(lspsChamber_.GetChopperFrequency() - frequency) >= FREQ_DELTA_ALLOWED); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Chopper to stabilize. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + } while (lspsChamber_.GetChopperStability() != Raytheon.Instruments.LSPS.Stability.STABLE); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Turn off Chopper wheel + /// + public void TurnOffChopperWheel(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.TurnOffChopperWheel(); + + Raytheon.Instruments.LSPS.ChopperState state; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Chopper Wheel to turn off. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + state = lspsChamber_.GetChopperState(); + } while (state != Raytheon.Instruments.LSPS.ChopperState.OFF); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Stop chopper wheel at open position + /// + public void SetStopOpen(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SetStopOpen(); + + Raytheon.Instruments.LSPS.ChopperState state; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Chopper Wheel to stop in Open position. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + state = lspsChamber_.GetChopperState(); + } while (state != Raytheon.Instruments.LSPS.ChopperState.STOP_OPEN); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Chopper Wheel to stabilize. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + } while (lspsChamber_.GetChopperStability() != Raytheon.Instruments.LSPS.Stability.STABLE); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + /// + /// Stop chopper wheel at closed position + /// + public void SetStopClosed(int pollingRateInMs = 1000, int timeOutInMs = 120000) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SetStopClosed(); + + Raytheon.Instruments.LSPS.ChopperState state; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Chopper Wheel to stop in Closed position. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + state = lspsChamber_.GetChopperState(); + } while (state != Raytheon.Instruments.LSPS.ChopperState.STOP_CLOSE); + + do + { + if (stopwatch.ElapsedMilliseconds > timeOutInMs) + { + throw new Exception($"Timed out waiting for Chopper Wheel to stabilize. Timeout value: {timeOutInMs} ms"); + } + + Thread.Sleep(pollingRateInMs); + } while (lspsChamber_.GetChopperStability() != Raytheon.Instruments.LSPS.Stability.STABLE); + + stopwatch.Stop(); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + #endregion + + #region Misc Functions + /// + /// Send A Command. Only for SET commands. + /// DO NOT use for GET Commands as they require processing of returned data + /// + /// + public void SendACommand(string command) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + lspsChamber_.SendACommand(command); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void ProcessNcdfData(string prefix, string suffix, string testDataPath) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + + try + { + netCdfData_.ProcessNcdfData(prefix, suffix, testDataPath); + } + catch (Exception ex) + { + _logger.Error(ex.Message); + throw; + } + } + + public void AddNcdfAttributes() + { + //-----------------------------Autofill------------------------------------ + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_AUTOFILL_TIMETOFILL, lspsChamber_.GetTimeToFill(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_AUTOFILL_STATE, lspsChamber_.GetAutoFillState().ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + //-----------------------------Blackbody------------------------------------ + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.MEASURED_BLACK_BODY_TEMPERATURE, lspsChamber_.GetBlackbodyTemperature().Item1, Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_BB_RATE_O_CHANGE, lspsChamber_.GetBlackbodyRateOfChange(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_BB_CTRL_STATE, lspsChamber_.GetBlackbodyControlState().ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_BB_HEATER, lspsChamber_.GetBlackbodyHeaterPercent(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_BB_SETPOINT, lspsChamber_.GetBlackbodySetpoint(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_BB_STABILITY_A, lspsChamber_.GetBlackbodyStability().Item1.ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_BB_STABILITY_B, lspsChamber_.GetBlackbodyStability().Item2.ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_BB_BIT, lspsChamber_.GetBlackbodyBIT(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + //-----------------------------CVAC------------------------------------ + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_C_VAC, lspsChamber_.GetLspsChamberPressure(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_S_VAC, lspsChamber_.GetLspsUutPressure(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + //-----------------------------Chopper------------------------------------ + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_CHOPPER_FREQ, lspsChamber_.GetChopperFrequency(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_CHOPPER_STABILITY, lspsChamber_.GetChopperStability().ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_CHOPPER_STATE, lspsChamber_.GetChopperState().ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + //-----------------------------Galil------------------------------------ + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.TARGET_WHEEL_POSITION, lspsChamber_.GetTargetWheelPosition(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.MEASURED_APERTURE_POSITION, lspsChamber_.GetTargetWheelPosition(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.MEASURED_AZ_POSITION, lspsChamber_.SteeringMirrorGetBeamAngles().Item1, Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.MEASURED_EL_POSITION, lspsChamber_.SteeringMirrorGetBeamAngles().Item2, Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.MEASURED_FILTER_POSITION, lspsChamber_.GetFilterWheelPosition(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.SCAN_PATTERN, "oscillate", Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + //-----------------------------NIF------------------------------------ + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_NIF_TEMP_TANK_TOP, lspsChamber_.GetTemperature(Raytheon.Instruments.LSPS.TemperatureIndex.TANK_TOP), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_NIF_TEMP_TANK_BOTTOM, lspsChamber_.GetTemperature(Raytheon.Instruments.LSPS.TemperatureIndex.TANK_BOTTOM), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.RADCAL_GATE_VALVE, lspsChamber_.GetLspsGateValvePosition().ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.L_S_P_S_GATE_VALVE_STATUS, lspsChamber_.GetLspsGateValvePosition().ToString(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + //-----------------------------RIO------------------------------------ + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.VHF_GV_CHAMBER_VAC, lspsChamber_.GetVhfGateValveChamberPressure(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + + netCdfData_.SetValue(Raytheon.Instruments.NCDF.Names.VHF_GV_UUT_VAC, lspsChamber_.GetVhfGateValveUutPressure(), Raytheon.Instruments.NCDF.AttrPosition.GLOBAL); + } + + /// + /// Balance On Pixel Location + /// + /// + /// + /// + /// + /// + public void BalanceOnPixelLocation(int pixelX, int pixelY, double chopperRate, double minAmp, double maxOE) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + //_lspsVideo?.BalanceOnPixelLocation(pixelX, pixelY, chopperRate, minAmp, maxOE); + } + + /// + /// Center Target On Pixel + /// + /// + /// + /// + //public void CenterTargetOnPixel(int curTargetX, int curTargetY, Point endPt) + //{ + // logger_?.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + // //_lspsVideo?.CenterTargetOnPixel(curTargetX, curTargetY, endPt); + //} + + /// + /// Moves to pixel location for the Seeker + /// + /// + /// + /// + /// + /// + /// + public void MoveToPixelLocationSeeker(int pixelX, int pixelY, double chopperRate, double minAmp, double maxOE) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + //_lspsVideo?.MoveToPixelLocationSeeker(pixelX, pixelY, chopperRate, minAmp, maxOE); + } + + /// + /// Moves to pixel location for the Sensor + /// + /// + /// + /// + /// + /// + /// + public void MoveToPixelLocationSensor(int pixelX, int pixelY, double chopperRate, double minAmp, double maxOE) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + //_lspsVideo?.MoveToPixelLocationSensor(pixelX, pixelY, chopperRate, minAmp, maxOE); + } + + /// + /// Move UUT Rel + /// + /// + /// + public void MoveUutRel(double az, double el) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + //_lspsChamber?.MoveUutRel(az, el); + } + + /// + /// Seeker Find Target No Move + /// + /// + /// + /// + /// + /// + public void SeekerFindTargetNoMove(int targetX, int targetY, double chopperRate, double minAmp, double maxOE) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + //_lspsVideo?.SeekerFindTargetNoMove(targetX, targetY, chopperRate, minAmp, maxOE); + } + + /// + /// Sensor Find Target No Move + /// + /// + /// + /// + /// + /// + public void SensorFindTargetNoMove(int targetX, int targetY, double chopperRate, double minAmp, double maxOE) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + //_lspsVideo?.SensorFindTargetNoMove(targetX, targetY, chopperRate, minAmp, maxOE); + } + + /// + /// Center Target On Pixel + /// + /// + /// + /// + /// + /// + public void CenterTargetOnPixel(int pixelX, int pixelY, double chopperRate, double minAmp, double maxOE) + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); + //Point endPt = new Point(pixelX, pixelY); + // Interface signature is different + //_lspsVideo?.CenterTargetOnPixel(0, 0, endPt); + } + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/SpaceChamberLSPSMeasurementManager/SpaceChamberLspsMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/SpaceChamberLSPSMeasurementManager/SpaceChamberLspsMeasurementManager.csproj new file mode 100644 index 0000000..cbc2e14 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/SpaceChamberLSPSMeasurementManager/SpaceChamberLspsMeasurementManager.csproj @@ -0,0 +1,27 @@ + + + + net472 + SpaceChamberLspsMeasurementManager + Composable Test Software Library + Space Chamber LSPS Measurement Manager + Library + + + + 1.1.0 + + + + NU1603 + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/SpaceChamberVOBMeasurementManager/SpaceChamberVOBMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/SpaceChamberVOBMeasurementManager/SpaceChamberVOBMeasurementManager.cs new file mode 100644 index 0000000..8535fd4 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/SpaceChamberVOBMeasurementManager/SpaceChamberVOBMeasurementManager.cs @@ -0,0 +1,647 @@ +using Raytheon.Instruments; +using STE_Library_Common; +using System; +using System.Threading; + +namespace SpaceChamberVOBMeasurementManagerLib +{ + public class SpaceChamberVOBMeasurementManager + { + private int _galicFwPos; + + private bool _bit; + + private string _errorDesc; + + private bool _focusState; + + private ICommDevice _commDevice; + + private bool _isThereHardware; + + private Thread _vobMonitorHealthThread; + + private IWorkerInterface _vobMonitorHealthWorker; + + private IMsgParser _vobMsgParser; + + private Thread _vobUpdateThread; + + private IWorkerInterface _vobUpdateWorker; + + + /// + /// constructor that uses instrument manager for creating an instrument + /// + /// + /// + public SpaceChamberVOBMeasurementManager(IInstrumentManager instrumentManager, string deviceName) + { + _commDevice = instrumentManager.GetInstrument(deviceName); + _commDevice?.Initialize(); + } + + public SpaceChamberVOBMeasurementManager(bool isThereHardware, string measurementDefFile, string instrumentDefFile) + { + if (measurementDefFile == null) + { + throw new ArgumentNullException("SpaceChamberVOBMeasurementManager::SpaceChamberVOBMeasurementManager() - measurementDefFile input parameter is null."); + } + if (instrumentDefFile == null) + { + throw new ArgumentNullException("SpaceChamberVOBMeasurementManager::SpaceChamberVOBMeasurementManager() - instrumentDefFile input parameter is null."); + } + this._isThereHardware = isThereHardware; + } + + public void BalanceOnPixelLocation() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void bbSetTemp(double temp, int timeout) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void chopperPowerOff() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void closeRgaGateValve() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void closeUutGateValve() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void deleteProfilePoint(int index) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void disableAxis() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void enableAxis() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void galilcFocusMove(double destination, float speed, int mode) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void galilChopperSetFrequency(double frequency, int timeout) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public bool galilMono1Grating() + { + bool flag; + try + { + flag = false; + } + catch (Exception exception) + { + throw; + } + return flag; + } + + public void getAxesStatus() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void getBeamAngles() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void getBits() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public double getCoarseAngle() + { + double num; + try + { + num = 0; + } + catch (Exception exception) + { + throw; + } + return num; + } + + public void getCoarseSelection() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public double getFocusPosition() + { + double num; + try + { + num = double.MaxValue; + } + catch (Exception exception) + { + throw; + } + return num; + } + + public bool getFocusState() + { + bool flag; + try + { + flag = false; + } + catch (Exception exception) + { + throw; + } + return flag; + } + + public double getMirrorAngles() + { + double num; + try + { + num = 0; + } + catch (Exception exception) + { + throw; + } + return num; + } + + public void getRGAGateValveState() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public int getTargetWheelPos() + { + int num; + try + { + num = 0; + } + catch (Exception exception) + { + throw; + } + return num; + } + + public void getUutGateValveState() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void getVacuumPressures() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void getVacuumSetpoints() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void homeAxis() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void homeTargetWheel() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void homeXyAxes() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void homeXyuAxes() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void loadProfile() + { + try + { + } + catch (Exception exception) + { + throw; + } + + } + + public void openRgaGateValve() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void openUutGateValve() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void quit() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void resetProfile() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void runProfile(int mode) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + private void SendMessageGetResponse(string command) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void setAxisPosAbs(double position, double speed) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void setAxisPosRel(double position, double speed) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetBackgroundScene(int scene) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetChopperFrequency(double frequency) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetChopperOff() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetChopperOn() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void setCoarseSel() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetTargetPosition(double az, double el) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetTargetSize(double size) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetTargetSource(int source) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void setTargetWheel(int pos) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void setXyPos(double azPos, double elPos, double speed) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void stopAllAxes() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void stopTargetWheel() + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void VssMonoSetWaveLength(double wave) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + public void CenterTargetOnPixel(int pixelX, int pixelY, double chopperRate, double minAmp, double maxOE) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + + public void SetFocus(double position) + { + try + { + } + catch (Exception exception) + { + throw; + } + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/SpaceChamberVOBMeasurementManager/SpaceChamberVOBMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/SpaceChamberVOBMeasurementManager/SpaceChamberVOBMeasurementManager.csproj new file mode 100644 index 0000000..b164b2e --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/SpaceChamberVOBMeasurementManager/SpaceChamberVOBMeasurementManager.csproj @@ -0,0 +1,67 @@ + + + + net472 + SpaceChamberVOBMeasurementManager + SpaceChamberVOBMeasurementManager + Composable Test Software Library + Space Chamber VOB Measurement Manager + Raytheon Technologies + TEEC + Copyright © Raytheon Technologies $(Year) + $(Version)$(Suffix) + Library + True + Debug;Release;Deploy + $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + + + NU5118 + + + + + + + + + all + + + + + + Interfaces\IMsgParser.cs + + + Interfaces\IWorkerInterface.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/SwitchMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/SwitchMeasurementManager.cs new file mode 100644 index 0000000..04c83a2 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/SwitchMeasurementManager.cs @@ -0,0 +1,1402 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using Raytheon.Instruments.Dmm; +using Raytheon.Units; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace MeasurementManagerLib +{ + /// + /// The interface to the instruments contained in the vsu test station. + /// This class reads in test station configuration ini file that contains: + /// - DMM measurement definitions + /// The host of this class can invoke those measurements by commanding the this class with the ini file string names + /// which insulates the caller from having to know the details of that measurement + /// + public class SwitchMeasurementManager : IDisposable + { + #region PublicMembers + + /// + /// Type of DMM Resistance Measurements + /// + public enum DMMResistanceType + { + TWO, + FOUR, + }; + + public enum DMMVoltageType + { + DC, + AC, + }; + + public delegate void SwitchMeasurementDelegate(); + + /// + /// Struct for holding on to DMM measurement definitions + /// + public struct DMMFrequencyMeasurementFields + { + public readonly double _range; + public readonly double _resolution; + public readonly double _scaleFactor; + public readonly int _delay; + public List _relays; + public readonly double _voltRange; + public readonly double _numReads; + + public DMMFrequencyMeasurementFields(double range, double resolution, int delay, double scaleFactor, List relays, double voltRange, double numReads) + { + _range = range; + _resolution = resolution; + _delay = delay; + _scaleFactor = scaleFactor; + _relays = relays; + _voltRange = voltRange; + _numReads = numReads; + } + } + + /// + /// Struct for holding on to DMM measurement definitions + /// + public struct DMMVoltageMeasurementFields + { + public readonly double _range; + public readonly double _resolution; + public readonly double _scaleFactor; + public readonly int _delay; + public List _relays; + public DMMVoltageType _voltageType; + + public DMMVoltageMeasurementFields(double range, double resolution, int delay, double scaleFactor, List relays, DMMVoltageType voltageType) + { + _range = range; + _resolution = resolution; + _delay = delay; + _scaleFactor = scaleFactor; + _relays = relays; + _voltageType = voltageType; + } + } + + /// + /// Struct for holding on to DMM measurement definitions + /// + public struct DMMResistanceMeasurementFields + { + public readonly string _pcode; + public readonly double _range; + public readonly double _resolution; + public readonly double _scaleFactor; + public readonly int _delay; + public List _relays; + public DMMResistanceType _dmmResistanceType; + public readonly string _cableAndPinId; + public readonly double _lowerLimit; + public readonly double _upperLimit; + + public DMMResistanceMeasurementFields(string pcode, double range, double resolution, int delay, double scaleFactor, List relays, DMMResistanceType type, string cableAndPinId, double lowerLimit, double upperLimit) + { + _pcode = pcode; + _range = range; + _resolution = resolution; + _delay = delay; + _scaleFactor = scaleFactor; + _relays = relays; + _dmmResistanceType = type; + _cableAndPinId = cableAndPinId; + _lowerLimit = lowerLimit; + _upperLimit = upperLimit; + } + } + + public struct SwitchMeasurementFields + { + public List _relays; + + public SwitchMeasurementFields(List relays) + { + _relays = relays; + } + } + + /// + /// State for a trigger edge. + /// + public enum ScopeEdge + { + FALLING = 0, + RISING, + HOLDING + }; + + public readonly struct ScopePulseWidthMeasurementFields + { + public readonly List _relays; + public readonly int _channelNumber; + public readonly ScopeEdge _edge; + public readonly double _timePerDivision; + public readonly double _timeOffset; + public readonly double _triggerLevel; + public readonly double _voltageOffset; + public readonly double _voltageScale; + public readonly string _inputImpedance; + //public readonly double m_measurementTime; + public readonly int _delay; + public readonly bool _shallWeSaveImage; + public readonly int _maxTriggerWaitTime; + + public ScopePulseWidthMeasurementFields(List relays, int channelNumber, ScopeEdge edge, double timePerDivision, double timeOffset, double triggerLevel, double voltageOffset, double voltageScale, string inputImpedance, int delay, bool shallWeSaveImage, int maxTriggerWaitTime) + { + _relays = relays; + _channelNumber = channelNumber; + _edge = edge; + _inputImpedance = inputImpedance; + _timePerDivision = timePerDivision; + _timeOffset = timeOffset; + _triggerLevel = triggerLevel; + _voltageOffset = voltageOffset; + _voltageScale = voltageScale; + _delay = delay; + _shallWeSaveImage = shallWeSaveImage; + _maxTriggerWaitTime = maxTriggerWaitTime; + } + } + + public readonly struct ScopeFrequencyMeasurementFields + { + public readonly List _relays; + public readonly int _channelNumber; + public readonly ScopeEdge _edge; + public readonly double _timePerDivision; + public readonly double _timeOffset; + public readonly double _triggerLevel; + public readonly double _voltageOffset; + public readonly double _voltageScale; + public readonly string _inputImpedance; + //public readonly double m_measurementTime; + public readonly int _delay; + public readonly bool _shallWeSaveImage; + public readonly int _maxTriggerWaitTime; + + public ScopeFrequencyMeasurementFields(List relays, int channelNumber, ScopeEdge edge, double timePerDivision, double timeOffset, double triggerLevel, double voltageOffset, double voltageScale, string inputImpedance, int delay, bool shallWeSaveImage, int maxTriggerWaitTime) + { + _relays = relays; + _channelNumber = channelNumber; + _edge = edge; + _inputImpedance = inputImpedance; + _timePerDivision = timePerDivision; + _timeOffset = timeOffset; + _triggerLevel = triggerLevel; + _voltageOffset = voltageOffset; + _voltageScale = voltageScale; + _delay = delay; + _shallWeSaveImage = shallWeSaveImage; + _maxTriggerWaitTime = maxTriggerWaitTime; + } + } + + //public Dictionary _dmmFrequencyMeasurements = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + public Dictionary DmmFrequencyMeasurements + { + get { return _dmmFrequencyMeasurements; } + set { _dmmFrequencyMeasurements = value; CheckForDmmFrequencyConfigValidity(); } + } + public Dictionary DmmResistanceMeasurements + { + get { return _dmmResistanceMeasurements; } + set { _dmmResistanceMeasurements = value; CheckForDmmResistanceConfigValidity(); } + } + public Dictionary DmmVoltageMeasurements + { + get { return _dmmVoltageMeasurements; } + set { _dmmVoltageMeasurements = value; CheckForDmmVoltageConfigValidity(); } + } + public Dictionary SwitchMeasurements { get; set; } + public Dictionary ScopeFreqMeasurements + { + get { return _scopeFreqMeasurements; } + set { _scopeFreqMeasurements = value; CheckForScopeFrequencyConfigValidity(); } + } + public Dictionary ScopePulseWidthMeasurements + { + get { return _scopePulseWidthMeasurements; } + set { _scopePulseWidthMeasurements = value; CheckForScopePulseWidthConfigValidity(); } + } + public List RelayExclusionList { get; set; } + + #endregion + + + #region PrivateClassMembers + /// + /// private class members + /// + private readonly IDmm _dmm; + private readonly IOscilloScope _scope; + + private readonly Dictionary _switchCards; + + private static readonly object _syncObj = new Object(); + + private static NLog.ILogger _logger; + + private Dictionary _dmmResistanceMeasurements; + private Dictionary _dmmFrequencyMeasurements; + private Dictionary _dmmVoltageMeasurements; + private Dictionary _scopeFreqMeasurements; + private Dictionary _scopePulseWidthMeasurements; + + #endregion + + + #region PrivateFunctions + + /// + /// The Finalizer + /// + ~SwitchMeasurementManager() + { + Dispose(false); + } + + /// + /// Check configuration information is correct + /// + private void CheckForDmmResistanceConfigValidity() + { + foreach (KeyValuePair entry in DmmResistanceMeasurements) + { + List relays = entry.Value._relays; + + foreach (string relayDef in relays) + { + string[] relayInfo = relayDef.Split('-'); + if (relayInfo.Length != 2) + { + throw new Exception("Dmm resistance measurement relay format is not correct: " + relayDef); + } + + if (_switchCards.ContainsKey(relayInfo[0].ToUpper()) == false) + { + throw new Exception("Dmm resistance measurement relay card field does not exist: " + relayInfo[0]); + } + } + } + } + + /// + /// Check configuration information is correct + /// + private void CheckForDmmFrequencyConfigValidity() + { + foreach (KeyValuePair entry in DmmFrequencyMeasurements) + { + List relays = entry.Value._relays; + + foreach (string relayDef in relays) + { + string[] relayInfo = relayDef.Split('-'); + if (relayInfo.Length != 2) + { + throw new Exception("Dmm frequency measurement relay format is not correct: " + relayDef); + } + + if (_switchCards.ContainsKey(relayInfo[0].ToUpper()) == false) + { + throw new Exception("Dmm frequency measurement relay card field does not exist: " + relayInfo[0]); + } + } + } + } + + /// + /// Check configuration information is correct + /// + private void CheckForDmmVoltageConfigValidity() + { + foreach (KeyValuePair entry in DmmVoltageMeasurements) + { + List relays = entry.Value._relays; + + foreach (string relayDef in relays) + { + string[] relayInfo = relayDef.Split('-'); + if (relayInfo.Length != 2) + { + throw new Exception("Dmm voltage measurement relay format is not correct: " + relayDef); + } + + if (_switchCards.ContainsKey(relayInfo[0].ToUpper()) == false) + { + throw new Exception("Dmm voltage measurement relay card field does not exist: " + relayInfo[0]); + } + } + } + } + + /// + /// Check configuration information is correct + /// + private void CheckForScopeFrequencyConfigValidity() + { + foreach (KeyValuePair entry in ScopeFreqMeasurements) + { + List relays = entry.Value._relays; + + foreach (string relayDef in relays) + { + string[] relayInfo = relayDef.Split('-'); + if (relayInfo.Length != 2) + { + throw new Exception("Scope frequency measurement relay format is not correct: " + relayDef); + } + + if (_switchCards.ContainsKey(relayInfo[0].ToUpper()) == false) + { + throw new Exception("Scope frequency measurement relay card field does not exist: " + relayInfo[0]); + } + } + } + } + + /// + /// Check configuration information is correct + /// + private void CheckForScopePulseWidthConfigValidity() + { + foreach (KeyValuePair entry in ScopePulseWidthMeasurements) + { + List relays = entry.Value._relays; + + foreach (string relayDef in relays) + { + string[] relayInfo = relayDef.Split('-'); + if (relayInfo.Length != 2) + { + throw new Exception("Scope pulse width measurement relay format is not correct: " + relayDef); + } + + if (_switchCards.ContainsKey(relayInfo[0].ToUpper()) == false) + { + throw new Exception("Scope pulse width measurement relay card field does not exist: " + relayInfo[0]); + } + } + } + } + + /// + /// Check a list of relays against a list of not allowed relays + /// + /// + /// True if everything is good and checks out, false if relaysToCheck contains a relay on the not allowed list + private bool CheckRelayVerificationList(List relaysToCheck) + { + for (int i = 0; i < relaysToCheck.Count; i++) + { + string relayToCheck = relaysToCheck[i]; + + for (int j = 0; j < RelayExclusionList.Count; j++) + { + string notAllowedRelay = RelayExclusionList[j]; + + if (relayToCheck.ToUpper() == notAllowedRelay.ToUpper()) + { + return false; + } + } + } + + return true; + } + + /// + /// + /// + /// + /// + /// + /// + /// + private void ConfigureDmmSettingsAndCloseAnyRelays(string measurementName, out List measurementRelays, out DMMResistanceMeasurementFields measurement, out MeasurementFunction type, bool delayAfterClosingRelay = true) + { + if (DmmResistanceMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + measurement = DmmResistanceMeasurements[measurementName.ToUpper()]; + measurementRelays = measurement._relays; + + byte desiredMeasurementType = (byte)measurement._dmmResistanceType; + + SwitchRelayClose(measurementRelays); + + if (delayAfterClosingRelay) + { + Thread.Sleep(measurement._delay); + } + + type = Raytheon.Instruments.Dmm.MeasurementFunction.TwoWireResistance; + if (measurement._dmmResistanceType == DMMResistanceType.TWO) + { + type = Raytheon.Instruments.Dmm.MeasurementFunction.TwoWireResistance; + } + else if (measurement._dmmResistanceType == DMMResistanceType.FOUR) + { + type = Raytheon.Instruments.Dmm.MeasurementFunction.FourWireResistance; + } + else + { + throw new Exception("unknown resistance type: " + measurement._dmmResistanceType.ToString()); + } + } + + /// + /// Dispose of this objects resources + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + if (_dmm != null) + { + try + { + _dmm.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + if (_switchCards != null) + { + foreach (KeyValuePair switchCard in _switchCards) + { + try + { + if (_switchCards[switchCard.Key] != null) + { + _switchCards[switchCard.Key].Shutdown(); + } + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + + if (_scope != null) + { + try + { + _scope.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + + try + { + ErrorLogger.Instance().Dispose(); + } + catch (Exception) + { + // nothing to do + } + } + } + + /// + /// Will command the switch cards close a specified list of relays + /// + /// + private void SwitchRelayClose(List relayList) + { + // open all relays on the switch. Just extra layer of protection so we don't short out the relays + SwitchRelayOpenAll(); + Thread.Sleep(10); + + // verify none of the relays are on the exclusion list + bool areRelaysOk = CheckRelayVerificationList(relayList); + + if (areRelaysOk == false) + { + throw new Exception("Commanded relay is not allowed"); + } + + foreach (string combo in relayList) + { + //break out the card and relay + string[] cardRelay = combo.Split('-'); + string cardObject = cardRelay[0].Trim(); + string relay = cardRelay[1].Trim(); + + //close the relays + _switchCards[cardObject.ToUpper()].Connect(relay); + } + } + + /// + /// Will command the switch card open all relays or the specified list of relays + /// + /// Optional list of relays to open + private void SwitchRelayOpen(List relayList) + { + foreach (string combo in relayList) + { + //break out the card and relay + string[] cardRelay = combo.Split('-'); + string cardObject = cardRelay[0].Trim(); + string relay = cardRelay[1].Trim(); + + //open the relays + _switchCards[cardObject.ToUpper()].Disconnect(relay); + } + } + + /// + /// Opens all relays on all switch cards + /// + private void SwitchRelayOpenAll() + { + foreach (KeyValuePair switchCard in _switchCards) + { + _switchCards[switchCard.Key].DisconnectAll(); + } + } + + #endregion + + #region PublicFunctions + + /// + /// constructor that uses instrument manager for creating an instrument + /// + /// + /// + /// + /// + /// + public SwitchMeasurementManager(IInstrumentManager instrumentManager) + { + _logger = LogManager.GetCurrentClassLogger(); + + _switchCards = new Dictionary(); + + ICollection switchCardList = instrumentManager.GetInstruments(typeof(ISwitch)); + foreach (ISwitch switchCard in switchCardList) + { + _switchCards[switchCard.Name] = switchCard; + _switchCards[switchCard.Name]?.Initialize(); + } + + ICollection dmmList = instrumentManager.GetInstruments(typeof(IDmm)); + if (dmmList.Count > 0) + { + _dmm = (IDmm)dmmList.First(); + _dmm.Initialize(); + } + + ICollection scopeList = instrumentManager.GetInstruments(typeof(IOscilloScope)); + if (scopeList.Count > 0) + { + _scope = (IOscilloScope)dmmList.First(); + _scope.Initialize(); + } + } + + /// + /// Dispose of this objects resources + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + public void Dispose() + { + try + { + lock (_syncObj) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// A getter for the list of frequency measurements (as defined in the input def file) + /// + /// A list of frequency measurements + public List DmmGetFrequencyMeasurementList() + { + lock (_syncObj) + { + List measurements = new List(); + + foreach (KeyValuePair entry in DmmFrequencyMeasurements) + { + measurements.Add(entry.Key); + } + + return measurements; + } + } + + /// + /// A getter for the list of resistance measurements (as defined in the input def file) + /// + /// A list of resistance measurements + public List DmmGetResistanceMeasurementList() + { + lock (_syncObj) + { + List measurements = new List(); + + foreach (KeyValuePair entry in DmmResistanceMeasurements) + { + measurements.Add(entry.Key); + } + + return measurements; + } + } + + /// + /// Make a DMM frequency measurement + /// + /// frequency measurement to make (the name from the input def file) + /// The measured frequency + public double DmmReadFrequency(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (DmmFrequencyMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + // grab the measurement params + DMMFrequencyMeasurementFields measurement = DmmFrequencyMeasurements[measurementName.ToUpper()]; + + measurementRelays = measurement._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + // wait a bit + Thread.Sleep(measurement._delay); + + // make the measurement + _dmm.ConfigureFrequencyMeasurement(Raytheon.Instruments.Dmm.MeasurementFunction.Frequency, Frequency.FromHertz(measurement._voltRange), Frequency.FromHertz(measurement._resolution)); + + double returnValue = _dmm.MeasureFrequency(100).Hertz; + + // Multiply by the scale factor + returnValue = returnValue * measurement._scaleFactor; + + // return the measurement + return returnValue; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// Make a DMM resistance measurement + /// + /// The resistance measurement to make (the name from the input def file) + /// The measured resistance + public double DmmReadResistance(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + ConfigureDmmSettingsAndCloseAnyRelays(measurementName, out measurementRelays, out DMMResistanceMeasurementFields measurement, out MeasurementFunction type); + + // make the measurement + _dmm.ConfigureResistanceMeasurement(type, Resistance.FromOhms(measurement._range), Resistance.FromOhms(measurement._resolution)); + double returnValue = _dmm.MeasureResistance(100).Ohms; + + // Multiply by the scale factor + returnValue *= measurement._scaleFactor; + + // return the measurement + return returnValue; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// Make a DMM resistance measurement up to intNumberOfReadings times or when the measurement is within percentRangeToStopInDecimal of the previous measurement + /// + /// The measured resistance + public double DmmReadResistanceAndStopReadingWithinACertainRange(string measurementName, double percentRangeToStopInDecimal, int maxNumberOfReadings = 50) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + ConfigureDmmSettingsAndCloseAnyRelays(measurementName, out measurementRelays, out DMMResistanceMeasurementFields measurement, out MeasurementFunction type, false); + + var returnValue = 0.0; + var lastReadLess = 0.0; + var lastReadPlus = 0.0; + var numOfReadings = 0; + do + { + Thread.Sleep(measurement._delay); + lastReadLess = returnValue * (1 - percentRangeToStopInDecimal); + lastReadPlus = returnValue * (1 + percentRangeToStopInDecimal); + + _dmm.ConfigureResistanceMeasurement(type, Resistance.FromOhms(measurement._range), Resistance.FromOhms(measurement._resolution)); + returnValue = _dmm.MeasureResistance(100).Ohms; + numOfReadings++; + } while (!(lastReadLess <= returnValue && returnValue <= lastReadPlus) && numOfReadings < maxNumberOfReadings); + + returnValue *= measurement._scaleFactor; + + return returnValue; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// A getter for the list of voltage measurements(as defined in the input def file) + /// + /// A list of voltage measurements + public List DmmGetVoltageMeasurementList() + { + lock (_syncObj) + { + List measurements = new List(); + + foreach (KeyValuePair entry in DmmVoltageMeasurements) + { + measurements.Add(entry.Key); + } + + return measurements; + } + } + + /// + /// make a DMM voltage measurement + /// + /// The measurement to make(the name from the input def file) + /// The measured voltage + public double DmmReadVoltage(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (DmmVoltageMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + DMMVoltageMeasurementFields measurement = DmmVoltageMeasurements[measurementName.ToUpper()]; + + measurementRelays = measurement._relays; + + //Select DMM Resistance Measurement Type + byte desiredMeasurementType = (byte)measurement._voltageType; + + // close the relays + SwitchRelayClose(measurementRelays); + + // wait a bit + Thread.Sleep(measurement._delay); + + // make the measurement + _dmm.ConfigureVoltageMeasurement(Raytheon.Instruments.Dmm.MeasurementFunction.DCVolts, Voltage.FromVolts(measurement._range), Voltage.FromVolts(measurement._resolution)); + + double returnVal = _dmm.MeasureVoltage(100).Volts; + + // Multiply by the scale factor + returnVal = returnVal * measurement._scaleFactor; + + // return the measurement + return returnVal; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// A getter for the list of scope freq measurements(as defined in the input def file) + /// + /// A list of scope freq measurements + public List ScopeGetFrequencyMeasurementList() + { + lock (_syncObj) + { + List measurements = new List(); + + foreach (KeyValuePair entry in ScopeFreqMeasurements) + { + measurements.Add(entry.Key); + } + + return measurements; + } + } + + /// + /// A getter for the list of scope freq measurements(as defined in the input def file) + /// + /// A list of scope freq measurements + public List ScopeGetPulseWidthMeasurementList() + { + lock (_syncObj) + { + List measurements = new List(); + + foreach (KeyValuePair entry in ScopePulseWidthMeasurements) + { + measurements.Add(entry.Key); + } + + return measurements; + } + } + + /// + /// Make a fall time measurement with the scope + /// + /// The measurement to make(the name from the input def file) + /// + public double ScopeReadFallTime(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + //@@@ port over from RKV + + throw new NotImplementedException(); + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// Make a frequency measurement with the scope + /// + /// The measurement to make(the name from the input def file) + /// + public double ScopeReadFrequency(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (ScopeFreqMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + ScopeFrequencyMeasurementFields measurement = ScopeFreqMeasurements[measurementName.ToUpper()]; + + measurementRelays = measurement._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + // wait a bit + Thread.Sleep(measurement._delay); + + // setup channel + _scope.ConfigureChannel(measurement._channelNumber, measurement._timePerDivision, measurement._timeOffset, measurement._voltageOffset, measurement._voltageScale, measurement._inputImpedance); + + //Set-up trigger + bool useRisingEdge = true; + if (measurement._edge != ScopeEdge.RISING) + { + useRisingEdge = false; + } + + _scope.SetupTrigger(useRisingEdge, measurement._channelNumber, measurement._triggerLevel); + + bool hasScopeTriggered = false; + + // look for trigger up to the timeout time + DateTime delayEndTime = DateTime.Now.AddMilliseconds(measurement._maxTriggerWaitTime); + while (hasScopeTriggered == false && DateTime.Now < delayEndTime) + { + // wait a bit and check the trigger again + Thread.Sleep(100); + hasScopeTriggered = _scope.HasItTriggered(); + } + + // Check if scope is triggered. + if (hasScopeTriggered == false) + { + throw new Exception("The scope trigger operation is not completed."); + } + + double freq = _scope.MeasureFrequency(measurement._channelNumber); + + // save the image + if (measurement._shallWeSaveImage == true) + { + _scope.SaveImage(measurementName); + } + + return freq; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// Make a max voltage measurement with the scope + /// + /// The measurement to make(the name from the input def file) + /// + public double ScopeReadMaxVoltage(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + //@@@ port over from RKV + + throw new NotImplementedException(); + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// Make a min voltage measurement with the scope + /// + /// The measurement to make(the name from the input def file) + /// + public double ScopeReadMinVoltage(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + //@@@ port over from RKV + + throw new NotImplementedException(); + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// make a pulse width measurement with the scope + /// + /// The measurement to make(the name from the input def file) + /// + public double ScopeReadPulseWidth(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (ScopePulseWidthMeasurements.ContainsKey(measurementName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + measurementName); + } + + ScopePulseWidthMeasurementFields measurement = ScopePulseWidthMeasurements[measurementName.ToUpper()]; + + measurementRelays = measurement._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + // wait a bit + Thread.Sleep(measurement._delay); + + // setup channel + _scope.ConfigureChannel(measurement._channelNumber, measurement._timePerDivision, measurement._timeOffset, measurement._voltageOffset, measurement._voltageScale, measurement._inputImpedance); + + //Set-up trigger + bool useRisingEdge = true; + if (measurement._edge != ScopeEdge.RISING) + { + useRisingEdge = false; + } + + _scope.SetupTrigger(useRisingEdge, measurement._channelNumber, measurement._triggerLevel); + + bool hasScopeTriggered = false; + + // look for trigger up to the timeout time + DateTime delayEndTime = DateTime.Now.AddMilliseconds(measurement._maxTriggerWaitTime); + while (hasScopeTriggered == false && DateTime.Now < delayEndTime) + { + // wait a bit and check the trigger again + Thread.Sleep(100); + hasScopeTriggered = _scope.HasItTriggered(); + } + + // Check if scope is triggered. + if (hasScopeTriggered == false) + { + throw new Exception("The scope trigger operation is not completed."); + } + + double pulseWidth = _scope.MeasurePulseWidth(measurement._channelNumber); + + // save the image + if (measurement._shallWeSaveImage == true) + { + _scope.SaveImage(measurementName); + } + + return pulseWidth; + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// Make a rise time measurement with the scope + /// + /// The measurement to make(the name from the input def file) + /// + public double ScopeReadRiseTime(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + //@@@ port over from RKV + + throw new NotImplementedException(); + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// Make a voltage level measurement with the scope + /// + /// The measurement to make(the name from the input def file) + /// + public double ScopeReadVoltageLevel(string measurementName) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + //@@@ port over from RKV + + throw new NotImplementedException(); + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + /// + /// + /// + public void ScopeSelfTest() + { + lock (_syncObj) + { + SelfTestResult res = _scope.PerformSelfTest(); + + if (res != SelfTestResult.Pass) + { + throw new Exception("did not pass, the result was: " + res.ToString()); + } + } + } + + /// + /// Sends a SCPI command to the scope and reads the response + /// + /// The SCPI command to send + /// + public string ScopeIOQuery(string command) + { + lock (_syncObj) + { + return _scope.IOQuery(command); + } + } + + /// + /// Sends a SCPI command to the scope + /// + /// The SCPI command to send + public void ScopeIOWrite(string command) + { + lock (_syncObj) + { + _scope.IOWrite(command); + } + } + + /// + /// + /// + /// + /// + /*public void SwitchControl(string switchControlName, bool shallWeClose) + { + try + { + lock (_syncObj) + { + } + } + catch (Exception) + { + throw; + } + }*/ + + /// + /// Closes the switches defined in the config file, then issues a callback to the host to invoke some stimulus and make a measurement, then opens the relays + /// + /// The measurement to make(the name from the input def file) + /// The function to call after the switches have been set + public void SwitchMeasurement(string switchMeasurementTestName, SwitchMeasurementDelegate callback) + { + // hold onto the relays for the catch + List measurementRelays = null; + + try + { + lock (_syncObj) + { + if (SwitchMeasurements.ContainsKey(switchMeasurementTestName.ToUpper()) == false) + { + throw new Exception("could not find measurement: " + switchMeasurementTestName); + } + + // grab the relays + measurementRelays = SwitchMeasurements[switchMeasurementTestName]._relays; + + // close the relays + SwitchRelayClose(measurementRelays); + + //Call the Callback for Measurement so the host can do what they need to do + callback(); + } + } + catch (Exception) + { + throw; + } + finally + { + // open the relays + if (measurementRelays != null) + { + SwitchRelayOpen(measurementRelays); + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/SwitchMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/SwitchMeasurementManager.csproj new file mode 100644 index 0000000..e65f1b7 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/SwitchMeasurementManager.csproj @@ -0,0 +1,28 @@ + + + + net472 + SwitchMeasurementManager + Composable Test Software Library + Switch Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/app.config b/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/app.config new file mode 100644 index 0000000..91ab49b --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/SwitchMeasurementManager/app.config @@ -0,0 +1,25 @@ + + + + +
+
+ + + + + + http://lxidevice/bin/PiCards + + + + + http://lxidevice/bin/PiCards + + + + + + + + diff --git a/Source/TSRealLib/MAL/Managers/TelemetryMeasurementManager/TelemetryMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/TelemetryMeasurementManager/TelemetryMeasurementManager.cs new file mode 100644 index 0000000..4b1d25e --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/TelemetryMeasurementManager/TelemetryMeasurementManager.cs @@ -0,0 +1,335 @@ +// ********************************************************************************************************** +// TelemetryMeasurementManager.cs +// 2/19/2024 +// NGI - Next Generation Interceptor +// +// Contract No. HQ0856-21-C-0003/1022000209 +// +// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S. +// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS. +// +// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON +// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. +// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON +// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED +// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF +// RAYTHEON COMPANY. +// +// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +// +// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M, +// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006, +// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3, +// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3, +// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4, +// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION. +// +// CONTROLLED BY: MISSILE DEFENSE AGENCY +// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE +// CUI CATEGORY: CTI +// DISTRIBUTION/DISSEMINATION CONTROL: F +// POC: Alex Kravchenko (1118268) +// ********************************************************************************************************** +using NLog; +using Raytheon.Common; +using Raytheon.Instruments; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace MeasurementManagerLib +{ + internal class TelemetryClient + { + public ICommAsync Client { get; set; } + public CancellationTokenSource TokenSource { get; set; } + public string BaseDirectory { get; set; } + public string BaseFileName { get; set; } + public int BufferSize { get; set; } + public FileRecordingMode FileRecordingMode { get; set; } + } + + // create a resulting file based on mode + public enum FileRecordingMode + { + /// + /// use default configuration value + /// + Undefined, + /// + /// user client provided name as is + /// overwrite the existing file + /// + None, + /// + /// append date time at the end of the base file name + /// + UnigueDateTime, + /// + /// append rolling index number at the end of the file name + /// + UniqueIndex + } + + public class TelemetryMeasurementManager : IDisposable + { + private readonly ILogger _logger; + private readonly Dictionary _clients = new Dictionary(); + + private const string DefaultConfigurationName = "TelemetryManager.xml"; + + /// + /// adds multiple instruments for Telemetry or any other data collection + /// + /// + /// + /// + /// + public TelemetryMeasurementManager(IInstrumentManager instrumentManager, List instrumentNames, string configName = "") + { + _logger = LogManager.GetCurrentClassLogger(); + + if (instrumentNames == null) + { + throw new ArgumentOutOfRangeException(nameof(instrumentNames)); + } + + if (string.IsNullOrEmpty(configName)) + { + configName = DefaultConfigurationName; + } + IConfigurationFile config = new ConfigurationFile(configName); + + instrumentNames.ForEach(i => AddInstrument(instrumentManager, i, config)); + } + + /// + /// starts recording for the first instrument + /// + /// + /// + public void StartRecording(string fileName = "", FileRecordingMode recordingMode = FileRecordingMode.UnigueDateTime) + { + StartRecording(_clients.FirstOrDefault().Key, fileName, recordingMode); + } + + /// + /// starts recording for the specified instrument + /// + /// + /// + /// + /// + public void StartRecording(string instrumentName, string fileName = "", FileRecordingMode recordingMode = FileRecordingMode.Undefined) + { + if (string.IsNullOrEmpty(instrumentName) || !_clients.ContainsKey(instrumentName)) + { + throw new InvalidOperationException($"No Telemetry Instrument Found for {instrumentName}."); + } + + var telemetryClient = _clients[instrumentName]; + + var client = telemetryClient.Client; + var token = telemetryClient.TokenSource.Token; + if(string.IsNullOrEmpty(fileName)) + { + fileName = telemetryClient.BaseFileName; + } + if(recordingMode == FileRecordingMode.Undefined) + { + recordingMode = telemetryClient.FileRecordingMode; + } + + if (!Directory.Exists(telemetryClient.BaseDirectory)) + { + // The directory does not exist, so create it + Directory.CreateDirectory(telemetryClient.BaseDirectory); + Console.WriteLine($"Directory '{telemetryClient.BaseDirectory}' created successfully."); + } + + string filePath = Path.Combine(telemetryClient.BaseDirectory, fileName); + string uniqueFileName; + + if(recordingMode == FileRecordingMode.UnigueDateTime) + { + uniqueFileName = GenerateUniqueFileNameDyDateTime(filePath); + } + else if(recordingMode == FileRecordingMode.UniqueIndex) + { + uniqueFileName = GenerateUniqueFileNameByIndex(filePath); + } + else + { + uniqueFileName = fileName; + if(File.Exists(uniqueFileName)) + { + File.Delete(uniqueFileName); + } + } + + _logger.Debug($"Starting Recording in {uniqueFileName}"); + + try + { + client.Initialize(); + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + throw; + } + + var fileStream = new FileStream(uniqueFileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, bufferSize: telemetryClient.BufferSize, useAsync: true); + + // use a thread from the thread pool and provide a function to write incoming data into a file + Task.Run(async () => await client.KeepReadingAsync(token, async (byte[] incomingData) => + { + await fileStream?.WriteAsync(incomingData, 0, incomingData.Length); + }).ContinueWith((r) => + { + // done recording + if (r.IsFaulted) + { + _logger.Error(r.Exception, r.Exception.Message); + } + else + { + _logger.Info($"Telemetry Manager Recording Completed for {uniqueFileName}"); + } + + try + { + client?.Close(); + client = null; + } + catch (Exception ex) + { + _logger.Error(ex, ex.Message); + } + finally + { + fileStream?.Dispose(); + fileStream = null; + } + })); + } + + /// + /// stops recording + /// + public void StopRecording() + { + _logger.Debug("Stopping Recording."); + + foreach (var instrumentName in _clients.Keys) + { + StopRecording(instrumentName); + } + } + + /// + /// stops recording for specific instrument name + /// + /// + public void StopRecording(string instrumentName) + { + if (!_clients.ContainsKey(instrumentName)) + return; + + _logger.Debug($"Stopping Recording for {instrumentName}."); + + var telemetryClient = _clients[instrumentName]; + var tokenSource = telemetryClient.TokenSource; + + if (!tokenSource.IsCancellationRequested) + { + tokenSource.Cancel(); + } + tokenSource.Dispose(); + } + + /// + /// Cleanup code + /// + public void Dispose() + { + StopRecording(); + + foreach (var tokenClient in _clients.Values) + { + var client = tokenClient?.Client; + client?.Close(); + } + } + + /// + /// generates unique file name + /// + /// + /// + private static string GenerateUniqueFileNameDyDateTime(string existingFilePath) + { + string directory = Path.GetDirectoryName(existingFilePath); + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(existingFilePath); + string extension = Path.GetExtension(existingFilePath); + + // Append a timestamp to the original filename + string uniqueFileName = $"{fileNameWithoutExtension}_{DateTime.Now:MMddHHmmss}{extension}"; + + // Combine with the directory path + return Path.Combine(directory, uniqueFileName); + } + + /// + /// generates unique file name based on rolling index + /// + /// + /// + private static string GenerateUniqueFileNameByIndex(string existingFilePath) + { + string directoryPath = Path.GetDirectoryName(existingFilePath); + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(existingFilePath); + string extension = Path.GetExtension(existingFilePath); + + int index = 1; // Initialize the rolling index + while (File.Exists(Path.Combine(directoryPath, $"{fileNameWithoutExtension}_{index}{extension}"))) + { + index++; // Increment the index until a unique file name is found + } + + // return appended index to the original filename + return Path.Combine(directoryPath, $"{fileNameWithoutExtension}_{index}{extension}"); + } + + /// + /// adds single instrument to the collection + /// + /// + /// + /// + private void AddInstrument(IInstrumentManager instrumentManager, string instrumentName, IConfigurationFile config) + { + _logger.Info($"TelemetryMeasurementManager - Adding Instrument Name {instrumentName}\nConfiguration {config.FileName}"); + + string baseDirectory = config.ReadValue($"Telemetry_{instrumentName}", "Directory", $"./{instrumentName}"); + string baseFileName = config.ReadValue($"Telemetry_{instrumentName}", "BaseFileName", $"./{instrumentName}"); + FileRecordingMode fileRecordingMode = config.ReadValue($"Telemetry_{instrumentName}", "FileRecordingMode", FileRecordingMode.UnigueDateTime); + + int bufferSize = config.ReadValue($"Telemetry_{instrumentName}", "BufferSize", 4096); + + _clients.Add(instrumentName, new TelemetryClient + { + Client = (ICommAsync)instrumentManager.GetGenericInstrument(instrumentName), + TokenSource = new CancellationTokenSource(), + BaseDirectory = baseDirectory, + BaseFileName = baseFileName, + BufferSize = bufferSize, + FileRecordingMode = fileRecordingMode, + }); + } + + } +} diff --git a/Source/TSRealLib/MAL/Managers/TelemetryMeasurementManager/TelemetryMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/TelemetryMeasurementManager/TelemetryMeasurementManager.csproj new file mode 100644 index 0000000..3a383e2 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/TelemetryMeasurementManager/TelemetryMeasurementManager.csproj @@ -0,0 +1,26 @@ + + + + net472 + TelemetryMeasurementManager + Composable Test Software Library + Telemetry Measurement Manager + Library + + + + 1.1.0 + + + + NU1603 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/Managers/VideoRecorderMeasurementManager/VideoRecorderMeasurementManager.cs b/Source/TSRealLib/MAL/Managers/VideoRecorderMeasurementManager/VideoRecorderMeasurementManager.cs new file mode 100644 index 0000000..20f2393 --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/VideoRecorderMeasurementManager/VideoRecorderMeasurementManager.cs @@ -0,0 +1,257 @@ +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ + +using NLog; +using Raytheon.Instruments; +using System; +using System.Collections.Generic; +using System.IO; + +namespace MeasurementManagerLib +{ + /// + /// This class manages IVideoRecorder instruments and provides an abstraction + /// + public class VideoRecorderMeasurementManager : IDisposable + { + #region PublicClassMembers + public enum AttributeType + { + STRING, + INT, + FLOAT + }; + + public struct NcdfAttribute + { + public AttributeType type; + public string key; + public string value; + }; + #endregion + + #region PrivateClassMembers + private IVideoRecorder _videoRecorder; + private static NLog.ILogger _logger; + #endregion + + #region PrivateClassFunctions + + /// + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + if (_videoRecorder != null) + { + try + { + _videoRecorder.Shutdown(); + } + catch (Exception err) + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + } + } + } + #endregion + + #region PublicClassFunctions + + public VideoRecorderMeasurementManager(IInstrumentManager instrumentManager, string deviceName) + { + _logger = LogManager.GetCurrentClassLogger(); + + _videoRecorder = instrumentManager.GetInstrument(deviceName); + _videoRecorder?.Initialize(); + } + + /// + /// The Finalizer + /// + ~VideoRecorderMeasurementManager() + { + Dispose(false); + } + + /// + /// Read the attributes from attributeFile(Created by CreateAttributeFile()) and insert them into videoFile + /// + /// + /// + public void AddNcdfAttributes(string videoFile, string attributeFile) + { + _videoRecorder.AddNcdfAttributes(videoFile, attributeFile); + } + + /// + /// Connect to the video recorder + /// + public void Connect() + { + _videoRecorder.Connect(); + } + + /// + /// Create an attribute file that the video recorders can consume + /// + /// The name of the file to create + /// A list of attributes to place in the file + public static void CreateAttributeFile(string fileName, List attributeList) + { + const char DELIM = '\t'; + + // Create a file to write to. + using (StreamWriter writer = File.CreateText(fileName)) + { + foreach (NcdfAttribute attribute in attributeList) + { + string type = Convert.ToInt32(attribute.type).ToString(); + string lineToWrite = type + DELIM + attribute.key + DELIM + attribute.value; + writer.WriteLine(lineToWrite); + } + } + } + + /// + /// Disconnect from the video recorder + /// + public void Disconnect() + { + _videoRecorder.Disconnect(); + } + + /// + /// Dispose of this object + /// + public void Dispose() + { + try + { + Dispose(true); + + GC.SuppressFinalize(this); + } + catch (Exception err) + { + try + { + _logger?.Error(err.Message + "\r\n" + err.StackTrace); + } + catch (Exception) + { + //Do not rethrow. Exception from error logger that has already been garbage collected + } + } + } + + /// + /// record video to the hard drive. This function returns once the grab has begun, Use WaitForGrabToComplete() to know when the grab is completed + /// + /// The number of frames to collect + /// 0 for binary, 1 for ncdf + public void GrabVideoToDisk(uint numberOfFrames, uint saveFormat) + { + var saveFormatTemp = VideoSaveFormat.BIN; + + if ((VideoSaveFormat)saveFormat == VideoSaveFormat.BIN) + { + saveFormatTemp = VideoSaveFormat.BIN; + } + else if ((VideoSaveFormat)saveFormat == VideoSaveFormat.NCDF) + { + saveFormatTemp = VideoSaveFormat.NCDF; + } + else + { + throw new Exception("saveFormat must be 0 or 1: " + saveFormat.ToString()); + } + + _videoRecorder.GrabVideoToDisk(numberOfFrames, saveFormatTemp); + } + + /// + /// Query the video system for its hard drive status + /// + /// The number of free Gigabytes + /// The number of free Gigabytes + /// The number of free Gigabytes + /// The number of free Gigabytes + public void QueryHardDrive(ref float driveSpace1, ref float driveSpace2, ref float driveSpace3, ref float driveSpace4) + { + _videoRecorder.QueryHardDrive(ref driveSpace1, ref driveSpace2, ref driveSpace3, ref driveSpace4); + } + + /// + /// Move a file to new location/new name + /// + /// The abs location of the file to move + /// The abs location to move to + /// 0 to move the file (via a rename on the recording system), 1 to copy the file and then delete the orginal (may take a long time if file is large) + public void MoveFile(string fromFile, string toFile, uint moveControl) + { + MoveControl moveControlTemp = MoveControl.MOVE; + + if ((MoveControl)moveControl == MoveControl.MOVE) + { + moveControlTemp = MoveControl.MOVE; + } + else if ((MoveControl)moveControl == MoveControl.COPY_AND_DELETE) + { + moveControlTemp = MoveControl.COPY_AND_DELETE; + } + else + { + throw new Exception("moveControl must be 0 or 1: " + moveControlTemp.ToString()); + } + + _videoRecorder.MoveFile(fromFile, toFile, moveControlTemp); + } + + /// + /// Command the video recorder to display live video + /// + public void ShowLiveVideo() + { + _videoRecorder.ShowLiveVideo(); + } + + /// + /// Command the video recorder to stop live video display + /// + public void StopLiveVideo() + { + _videoRecorder.StopLiveVideo(); + } + + /// + /// After calling GrabVideoToDisk(), use this function to know when the grab is complete + /// + /// The number of milliseconds to wait for the grab complete message + /// + public string WaitForGrabToComplete(int timeoutms) + { + return _videoRecorder.WaitForGrabToComplete(timeoutms); + } + + #endregion + } +} diff --git a/Source/TSRealLib/MAL/Managers/VideoRecorderMeasurementManager/VideoRecorderMeasurementManager.csproj b/Source/TSRealLib/MAL/Managers/VideoRecorderMeasurementManager/VideoRecorderMeasurementManager.csproj new file mode 100644 index 0000000..a4306ea --- /dev/null +++ b/Source/TSRealLib/MAL/Managers/VideoRecorderMeasurementManager/VideoRecorderMeasurementManager.csproj @@ -0,0 +1,22 @@ + + + + net472 + VideoRecorderMeasurementManager + Composable Test Software Library + Video Recorder Measurement Manager + Library + + + + 1.1.0 + + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Cell.cs b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Cell.cs new file mode 100644 index 0000000..d4b32d6 --- /dev/null +++ b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Cell.cs @@ -0,0 +1,118 @@ +using System; +using System.Globalization; +using System.Text.RegularExpressions; +using System.Xml.Serialization; + +namespace ExcelZipLib +{ + public class Cell + { + /// + /// Used for converting from Excel column/row to column index starting at 0 + /// + [XmlAttribute("r")] + public string CellReference + { + get + { + return ColumnIndex.ToString(); + } + set + { + ColumnIndex = GetColumnIndex(value); + if (ColumnIndex > worksheet.MaxColumnIndex) + worksheet.MaxColumnIndex = ColumnIndex; + } + } + + /// + /// The t type + /// + [XmlAttribute("t")] + public string tType = ""; + + /// + /// Original value of the Excel cell + /// + [XmlElement("v")] + public string Value + { + get + { + return _value; + } + set + { + _value = value; + if (tType.Equals("s")) + { + Text = Workbook.SharedStrings.si[Convert.ToInt32(_value)].t; + return; + } + if (tType.Equals("str")) + { + Text = _value; + return; + } + try + { + Amount = Convert.ToDouble(_value, CultureInfo.InvariantCulture); + Text = Amount.ToString("#,##0.##"); + IsAmount = true; + } + catch (Exception ex) + { + Amount = 0; + Text = String.Format("Cell Value '{0}': {1}", _value, ex.Message); + } + } + } + + /// + /// Index of the orignal Excel cell column starting at 0 + /// + [XmlIgnore] + public int ColumnIndex; + + /// + /// Text of the Excel cell (if it was a string) + /// + [XmlIgnore] + public string Text = ""; + + /// + /// Amount of the Excel cell (if it was a number) + /// + [XmlIgnore] + public double Amount; + + /// + /// The is amount + /// + [XmlIgnore] + public bool IsAmount; + + /// + /// The _value. + /// + private string _value = ""; + + /// + /// Gets the index of the column. + /// + /// The cell reference. + /// + private int GetColumnIndex(string CellReference) + { + string colLetter = new Regex("[A-Za-z]+").Match(CellReference).Value.ToUpper(); + int colIndex = 0; + + for (int i = 0; i < colLetter.Length; i++) + { + colIndex *= 26; + colIndex += (colLetter[i] - 'A' + 1); + } + return colIndex - 1; + } + } +} diff --git a/Source/TSRealLib/MAL/SupportProjects/ExcelZip/ExcelZip.csproj b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/ExcelZip.csproj new file mode 100644 index 0000000..d14d64d --- /dev/null +++ b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/ExcelZip.csproj @@ -0,0 +1,21 @@ + + + + net472 + ExcelZip + Composable Test Software Library + Microsoft Excel Zip Library + Library + + + + 1.0.0 + + + + + + + + + \ No newline at end of file diff --git a/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Row.cs b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Row.cs new file mode 100644 index 0000000..35c1ad6 --- /dev/null +++ b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Row.cs @@ -0,0 +1,35 @@ +using System.Xml.Serialization; + +namespace ExcelZipLib +{ + public class Row + { + /// + /// The filled cells. + /// + [XmlElement("c")] + public Cell[] FilledCells; + + /// + /// The cells. + /// + [XmlIgnore] + public Cell[] Cells; + + /// + /// Expands the cells. + /// + /// The number of columns. + public void ExpandCells(int NumberOfColumns) + { + Cells = new Cell[NumberOfColumns]; + + foreach (var cell in FilledCells) + { + Cells[cell.ColumnIndex] = cell; + } + + FilledCells = null; + } + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/SupportProjects/ExcelZip/SharedStrings.cs b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/SharedStrings.cs new file mode 100644 index 0000000..a41b0d1 --- /dev/null +++ b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/SharedStrings.cs @@ -0,0 +1,49 @@ +using System; +using System.Xml; +using System.Xml.Serialization; + +namespace ExcelZipLib +{ + [Serializable()] + [XmlType(Namespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main")] + [XmlRoot("sst", Namespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main")] + public class sst + { + /// + /// The unique count + /// + [XmlAttribute] + public string uniqueCount; + + /// + /// The count + /// + [XmlAttribute] + public string count; + + /// + /// The si + /// + [XmlElement("si")] + [NonSerialized] + public SharedString[] si; + + /// + /// Initializes a new instance of the class. + /// + public sst() + { + } + } + + /// + /// The shared string class. + /// + public class SharedString + { + /// + /// The t. + /// + public string t; + } +} \ No newline at end of file diff --git a/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Workbook.cs b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Workbook.cs new file mode 100644 index 0000000..2fe5e6a --- /dev/null +++ b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Workbook.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace ExcelZipLib +{ + public class Workbook + { + /// + /// The shared strings + /// + public static sst SharedStrings; + + /// + /// All worksheets in the Excel workbook deserialized + /// + /// Full path and filename of the Excel xlsx-file + /// + public static List Worksheets(string ExcelFileName) + { + worksheet ws; + List allWorkSheets = new List(); + + using (ZipArchive zipArchive = ZipFile.Open(ExcelFileName, ZipArchiveMode.Read)) + { + SharedStrings = DeserializedZipEntry(GetZipArchiveEntry(zipArchive, @"xl/sharedStrings.xml")); + + foreach (var worksheetEntry in (WorkSheetFileNames(zipArchive)).OrderBy(x => x.FullName)) + { + ws = DeserializedZipEntry(worksheetEntry); + + ws.NumberOfColumns = worksheet.MaxColumnIndex + 1; + + ws.ExpandRows(); + + allWorkSheets.Add(ws); + } + return allWorkSheets; + } + } + + /// + /// Method converting an Excel cell value to a date + /// + /// + /// + public static DateTime DateFromExcelFormat(string ExcelCellValue) + { + return DateTime.FromOADate(Convert.ToDouble(ExcelCellValue)); + } + + /// + /// Gets the zip archive entry. + /// + /// The zip archive. + /// Name of the zip entry. + /// + private static ZipArchiveEntry GetZipArchiveEntry(ZipArchive ZipArchive, string ZipEntryName) + { + return ZipArchive.Entries.First(n => n.FullName.Equals(ZipEntryName)); + } + + /// + /// Works the sheet file names. + /// + /// The zip archive. + /// + private static IEnumerable WorkSheetFileNames(ZipArchive ZipArchive) + { + foreach (var zipEntry in ZipArchive.Entries) + if (zipEntry.FullName.StartsWith("xl/worksheets/sheet")) + yield return zipEntry; + } + + /// + /// Deserializeds the zip entry. + /// + /// + /// The zip archive entry. + /// + private static T DeserializedZipEntry(ZipArchiveEntry ZipArchiveEntry) + { + using (Stream stream = ZipArchiveEntry.Open()) + return (T)new XmlSerializer(typeof(T)).Deserialize(XmlReader.Create(stream)); + } + } +} diff --git a/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Worksheet.cs b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Worksheet.cs new file mode 100644 index 0000000..9f31ace --- /dev/null +++ b/Source/TSRealLib/MAL/SupportProjects/ExcelZip/Worksheet.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace ExcelZipLib +{ + [Serializable()] + [XmlType(Namespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main")] + [XmlRoot("worksheet", Namespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main")] + public class worksheet + { + /// + /// The rows + /// + [XmlArray("sheetData")] + [XmlArrayItem("row")] + [NonSerialized] + public List Rows; + + /// + /// The number of columns + /// + [XmlIgnore] + public int NumberOfColumns; // Total number of columns in this worksheet + + /// + /// The maximum column index + /// + public static int MaxColumnIndex = 0; // Temporary variable for import + + /// + /// Initializes a new instance of the class. + /// + public worksheet() + { + } + + /// + /// Expands the rows. + /// + public void ExpandRows() + { + foreach (var row in Rows) + row.ExpandCells(NumberOfColumns); + } + } +} \ No newline at end of file diff --git a/Source/Instruments/GeneralIntsrumentManager/GeneralInstrumentManager.cs b/Source/TSRealLib/RINSS/InstrumentManager/GeneralIntsrumentManager/GeneralInstrumentManager.cs similarity index 98% rename from Source/Instruments/GeneralIntsrumentManager/GeneralInstrumentManager.cs rename to Source/TSRealLib/RINSS/InstrumentManager/GeneralIntsrumentManager/GeneralInstrumentManager.cs index bba565b..8db324f 100644 --- a/Source/Instruments/GeneralIntsrumentManager/GeneralInstrumentManager.cs +++ b/Source/TSRealLib/RINSS/InstrumentManager/GeneralIntsrumentManager/GeneralInstrumentManager.cs @@ -233,14 +233,12 @@ namespace Raytheon.Instruments ConfigureInstruments(); } } - catch (CompositionException ex) + catch (CompositionException) { - _logger.ErrorException(ex, "Error in composition during Consumer Instrument Manager initialization"); throw; } - catch (Exception ex) + catch (Exception) { - _logger.ErrorException(ex, "Error initializing the instrument manager"); throw; } } @@ -758,10 +756,9 @@ namespace Raytheon.Instruments inst = factory.Value.GetInstrument(instName, !_isThereHardware); _logger.Info($"Creating instrument '{instName}'"); } - catch (Exception ex) + catch (Exception) { - _logger.WarnException(ex, ex.Message); - inst = null; + throw; } if (null == inst) @@ -790,8 +787,6 @@ namespace Raytheon.Instruments } else { - _logger.Warn($"{instName} did not have a matching factory with supported type {instFactory}"); - if (InstrumentFactories.Count() > 0) { var factories = new StringBuilder(); @@ -803,7 +798,9 @@ namespace Raytheon.Instruments } _logger.Info(factories.ToString()); } - } + + throw new Exception($"{instName} did not have a matching factory with supported type {instFactory}"); + } } } else diff --git a/Source/TSRealLib/RINSS/InstrumentManager/GeneralIntsrumentManager/GeneralInstrumentManager.csproj b/Source/TSRealLib/RINSS/InstrumentManager/GeneralIntsrumentManager/GeneralInstrumentManager.csproj new file mode 100644 index 0000000..bb72260 --- /dev/null +++ b/Source/TSRealLib/RINSS/InstrumentManager/GeneralIntsrumentManager/GeneralInstrumentManager.csproj @@ -0,0 +1,28 @@ + + + + net472 + Library + Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager + General Instrument Manager + + + + 1.5.0 + + + + + + + + + + + + + + + + + diff --git a/Source/UnitTests/ProgramUnitTest.cs b/Source/UnitTests/ProgramUnitTest.cs index 82f0b37..c50df66 100644 --- a/Source/UnitTests/ProgramUnitTest.cs +++ b/Source/UnitTests/ProgramUnitTest.cs @@ -16,18 +16,9 @@ GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; - using NLog; -using ProgramLib; +using System; using System.Threading; -using ProgramGui.Model; -using System.Collections.Generic; -using ProgramGui; -using ProgramGui.ViewModel; -using System.Threading.Tasks; -using System.Windows; -using ProgramGui.View; namespace UnitTests { @@ -47,6 +38,7 @@ namespace UnitTests try { ProgramLib.Program.Instance("partNumber", "SerialNumber", false); + ProgramLib.Program.Instance().InitializeDioMeasurementManager(); ProgramLib.Program.Instance().InitializePowerSupplyMeasurementManager(); ProgramLib.Program.Instance().InitializeGuiManager(); ProgramLib.Program.Instance().InitializeSupportThreads(); @@ -67,7 +59,24 @@ namespace UnitTests } catch (Exception ex) { - _logger.Error(ex.Message + "\n" + ex.StackTrace); + _logger.Error(ex.Message + "\r\n" + ex.StackTrace); + } + } + + [TestMethod] + public void SttoTest() + { + try + { + ProgramLib.Program.Instance("partNumber", "SerialNumber", false); + ProgramLib.Program.Instance().InitializeSwitchMeasurementManager(); + ProgramLib.Program.Instance().InitializeGuiManager(); + + ProgramLib.Program.Instance().Perform_GMA_ATP_001_UUT_STTO(); + } + catch (Exception ex) + { + _logger.Error(ex.Message + "\r\n" + ex.StackTrace); } } } diff --git a/Source/UnitTests/UnitTests.csproj b/Source/UnitTests/UnitTests.csproj index d8aa33d..85246f3 100644 --- a/Source/UnitTests/UnitTests.csproj +++ b/Source/UnitTests/UnitTests.csproj @@ -17,6 +17,10 @@ Debug;Release + + NU1603 + + @@ -71,18 +75,21 @@ - - + + + - - - + + + + + diff --git a/Source/readme.txt b/Source/readme.txt index e22e76b..defff38 100644 --- a/Source/readme.txt +++ b/Source/readme.txt @@ -1,24 +1,5 @@ -Issue 1: -On initial check-in or doing a new pull, Git will fail with long file name issue - -Add the following to registry (there's alreawdy a longpath.reg in the how-to folder file created so just run that): - "LongPathsEnabled"=dword:00000001 to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem - -Make sure Git for Windows is installed -Open command prompt in admin mode and run: git config --system core.longpaths true - ------------------------------------------------------------------------------------------ -Issue 2: - -If the solution folder is located in some long path, Visual Studio will not be able to extract Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager.1.4.1.nupkg -to cache folder. Even if we manually move the DLL to the cache folder, Visuao Studio will not see it - -Find a location where the path is not too long and it will build. So work out of there instead - ------------------------------------------------------------------------------------------ -Issue 3: If building for the first time after doing a Git pull, it will fail because there are a few packages that need to be built first and published to the "SolutionPackages" folder since other projects that depend on packages in that folder. -So if the build fails, keep building until succeeds. Takes about 5 tries +So if the build fails, try building again until all the projects are built.