Big changes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private ILogger _logger;
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new BITCOEDeviceInstrument(name, _configurationManager, _driverType, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new BITCOEDeviceInstrument(name, _configurationManager, _driverType, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.BITCOEDeviceNode</AssemblyName>
|
||||
<Description>Specialized instrument implementation of IBit interface for running real time Build In Tests via COE</Description>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Deploy|AnyCPU'">
|
||||
<Optimize>False</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.BIT.Contracts" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\COEComm\COEComm.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// type conversion utility with a special case for enums
|
||||
/// </summary>
|
||||
public static class TypeConverter
|
||||
{
|
||||
public static T ChangeType<T>(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<T, TC>() where TC : System.ComponentModel.TypeConverter
|
||||
{
|
||||
TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper class contains extention fuctions for reading types other than strings from configuration,
|
||||
/// as well as reading lists of values
|
||||
/// </summary>
|
||||
public static class ConfigurationHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// template function for reading different types from configuration
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static T GetConfigurationValue<T>(this IConfiguration configuration, string section, string key, string defaultValue)
|
||||
{
|
||||
var tmpResult = configuration.GetConfigurationValue(section, key, defaultValue);
|
||||
return !string.IsNullOrEmpty(tmpResult) ? TypeConverter.ChangeType<T>(tmpResult) : default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns multivalue result (list of T) from configuration
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static List<T> GetConfigurationListValue<T>(this IConfiguration configuration, string section, string key, List<T> 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($"</{key}>");
|
||||
}
|
||||
xmlStr.Append($"</{key}s>");
|
||||
|
||||
configuration.SetXmlConfiguration(section, xmlStr.ToString());
|
||||
return defaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var stringRes = BuildElementListFromXml(tmpResult, key);
|
||||
return new List<T>(stringRes.Select(x => TypeConverter.ChangeType<T>(x)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns values from XML section converted to string list
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
private static List<string> BuildElementListFromXml(string data, string key)
|
||||
{
|
||||
XElement doc = XElement.Parse(data);
|
||||
IEnumerable<XElement> xmlMessages = from m
|
||||
in doc.Elements($"{key}s").Elements(key)
|
||||
select m;
|
||||
var messages = xmlMessages.Select(x => x.Value);
|
||||
return messages?.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.COEComm</AssemblyName>
|
||||
<Description>C# wrapper for the COE Windows, integrated real-time software operating environment designed for use in embedded systems</Description>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>1701;1702;NU1803</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);CopyFilesTargetName</PrepareForRunDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<coeDLLs>build\R04.$(Configuration)\x86\coeWindows-shared.dll</coeDLLs>
|
||||
<coeDLLs Condition="'$(Configuration)'=='Debug' OR '$(Configuration)'=='Release' OR '$(Configuration)'=='Deploy'">build\R04.06.05.02\x86\coeWindows-shared.dll;build\R04.06.05.02\x86\coeWindows-sharedd.dll</coeDLLs>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="$(coeDLLs)">
|
||||
<PackagePath>lib\$(TargetFramework)</PackagePath>
|
||||
<TargetPath></TargetPath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<Pack>True</Pack>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyFilesTargetName" BeforeTargets="Build">
|
||||
<Copy SourceFiles="$(coeDLLs)" DestinationFolder="$(OutDir)" />
|
||||
</Target>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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<T> 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, double> m_ConstMap;
|
||||
private readonly Dictionary<string, int> m_SizeMap;
|
||||
private readonly Dictionary<string, int> m_PadMap;
|
||||
|
||||
public BytePackingXml(string icdStr) : base()
|
||||
{
|
||||
// Create the dictionaries
|
||||
m_ConstMap = new Dictionary<string, double>();
|
||||
m_PadMap = new Dictionary<string, int>();
|
||||
m_SizeMap = new Dictionary<string, int>();
|
||||
|
||||
// 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 <constant> tag
|
||||
if ((name != "") && (constStr != ""))
|
||||
{
|
||||
AddItemToMap(m_ConstMap, name, constNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(
|
||||
"ERROR: Constant Definition Incorrect - <name>:" + name +
|
||||
" <value>:" + 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 <typedef> tag
|
||||
if ((name != "") && (type != ""))
|
||||
{
|
||||
AddItemToMap(m_PadMap, name, typePad);
|
||||
AddItemToMap(m_SizeMap, name, typeSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(
|
||||
"ERROR: Typedef Definition Incorrect - <name>:" + name +
|
||||
" <value>:" + 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 <name> 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 <enum><item> tag
|
||||
if ((name != "") && (constStr != ""))
|
||||
{
|
||||
AddItemToMap(m_ConstMap, name, constNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"ERROR: Enumeration Item Definition Incorrect - <name>: {name} <value>: {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 <name> 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 <type> 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<string, int> 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<string, double> 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> - " + 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 = "<item>" +
|
||||
"<name>" + Message.PADDING_ITEM_NAME + "</name>" +
|
||||
"<type>char</type>" +
|
||||
"<arrayLength>" + padAdd + "</arrayLength>" +
|
||||
"<instruType>S</instruType>" +
|
||||
"</item>";
|
||||
if (CurrentElement != null)
|
||||
{
|
||||
CurrentElement.InsertBefore(pad);
|
||||
}
|
||||
else // End padding
|
||||
{
|
||||
ParentElement.AppendChild(pad);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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<string, ReadImageDelegate> 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<string, ReadImageDelegate>();
|
||||
|
||||
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<string, string> enums = m_Icd.GetEnumerations(FieldType);
|
||||
if (enums.ContainsValue(Value) == true)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> 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
|
||||
}
|
||||
}
|
||||
@@ -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 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?xml-stylesheet type=\"text/xsl\" ?><interface>";
|
||||
|
||||
private uint m_MaxMsgSize = 0;
|
||||
private readonly List<string> m_IncludeList;
|
||||
|
||||
private MessageXmlDocument() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public MessageXmlDocument(string Pathname,
|
||||
ILogger logger) :
|
||||
base()
|
||||
{
|
||||
_logger = logger;
|
||||
_XmlFileName = Pathname;
|
||||
|
||||
m_IncludeList = new List<string>();
|
||||
RecurseProcessing(Pathname);
|
||||
|
||||
BuiltXML = string.Concat(BuiltXML, "</interface>");
|
||||
BytePackingXml addPacking = new BytePackingXml(BuiltXML);
|
||||
LoadXml(addPacking.OuterXml);
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetEnumerations(string Type)
|
||||
{
|
||||
Dictionary<string, string> enumList = new Dictionary<string, string>();
|
||||
|
||||
// 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("<description>")) != -1)
|
||||
{
|
||||
item = item.Remove(index, item.IndexOf("</description>") + 14 - index);
|
||||
}
|
||||
while ((index = item.IndexOf("<!--")) != -1)
|
||||
{
|
||||
item = item.Remove(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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<string, XmlParser.CommonXmlElements> _commonElements = new Dictionary<string, XmlParser.CommonXmlElements>(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
// store messages defined in xml files
|
||||
private readonly List<XmlParser.XmlMbitMessage> _mbitMessages = new List<XmlParser.XmlMbitMessage>();
|
||||
|
||||
// store duplicate messages for diagnostic purposes
|
||||
private readonly Dictionary<string, List<string>> _duplicateMbitMessages = new Dictionary<string, List<string>>();
|
||||
|
||||
// store each enumeration type and its associate key/value pairs
|
||||
private readonly Dictionary<string, XmlParser.XmlEnumeration> _xmlEnums = new Dictionary<string, XmlParser.XmlEnumeration>(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
// store duplicate enumerations for diagnostic purposes
|
||||
private readonly Dictionary<string, List<string>> _duplicateEnums = new Dictionary<string, List<string>>();
|
||||
|
||||
// store each structure type and its associated data members
|
||||
private readonly Dictionary<string, XmlParser.XmlStructure> _xmlStructures = new Dictionary<string, XmlParser.XmlStructure>(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
// store duplicate structures for diagnostic purposes
|
||||
private readonly Dictionary<string, List<string>> _duplicateStructures = new Dictionary<string, List<string>>();
|
||||
|
||||
// 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<string, XmlParser.XmlConstant> _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<string, XmlParser.XmlConstant> _xmlConstantsLookUpByNameSpace = null;
|
||||
|
||||
// store duplicate constants for diagnostic purposes
|
||||
private readonly Dictionary<string, List<string>> _duplicateConstants = new Dictionary<string, List<string>>();
|
||||
|
||||
// store names of files that contain data types that we need to generate
|
||||
public List<string> m_dataTypeFilesToBeGenerated = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Parse XML files from the path folder
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public bool ParseXmlFiles(string path)
|
||||
{
|
||||
bool isSuccessful = true;
|
||||
string xmlNamespace = string.Empty;
|
||||
List<XmlParser.XmlConstant> constantList = new List<XmlParser.XmlConstant>();
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
_logger.Error($"Path {path} not found");
|
||||
|
||||
isSuccessful = false;
|
||||
return isSuccessful;
|
||||
}
|
||||
|
||||
string[] files = Directory.GetFiles(path, "*.xml", SearchOption.AllDirectories);
|
||||
|
||||
List<string> dataTypeFiles = new List<string>(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<string> comments = new List<string>();
|
||||
|
||||
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<string, List<string>> 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<string, List<string>> 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<string, List<string>> 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<string, List<string>> 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string> fileIncludes = new List<string>();
|
||||
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<string> comments = new List<string>();
|
||||
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<string> comments = new List<string>();
|
||||
//public Dictionary<string, string> enumKeyAndValuePairs = new Dictionary<string, string>();
|
||||
public List<XmlEnumItem> enumItems = new List<XmlEnumItem>();
|
||||
}
|
||||
|
||||
public class XmlEnumItem
|
||||
{
|
||||
public List<string> comments = new List<string>();
|
||||
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<string> comments = new List<string>();
|
||||
public List<XmlStructureItem> structDataItems = new List<XmlStructureItem>();
|
||||
}
|
||||
|
||||
public class XmlStructureItem
|
||||
{
|
||||
public string nameSpace = string.Empty;
|
||||
public List<string> comments = new List<string>();
|
||||
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<string> comments = new List<string>();
|
||||
|
||||
public List<XmlParser.XmlStructureItem> dataItems = new List<XmlParser.XmlStructureItem>();
|
||||
}
|
||||
|
||||
///===================================================================================
|
||||
/// XmlParser.getCommonElementsFromXml
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Each XML file contains common elements such as header, includes, etc
|
||||
/// We want to parse it and save the common elements
|
||||
/// </summary>
|
||||
/// <param name="nav">navigator object that points to the current XML node we are at</param>
|
||||
/// <param name="commonElements">data structure that stores all the common elements of each XML file</param>
|
||||
///===================================================================================
|
||||
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
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Get the file includes specify by the XML file
|
||||
/// </summary>
|
||||
/// <param name="nav">navigator object that points to the current XML node we are at</param>
|
||||
/// <param name="commonElements">data structure that stores all the common elements of each XML file</param>
|
||||
///===================================================================================
|
||||
public static void GetFileIncludes(XPathNavigator nav, CommonXmlElements commonElements)
|
||||
{
|
||||
do
|
||||
{
|
||||
commonElements.fileIncludes.Add(nav.Value.Trim());
|
||||
|
||||
} while (nav.MoveToNext());
|
||||
}
|
||||
|
||||
///===================================================================================
|
||||
/// XmlParser.getConstant
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Parse the symbolic constant defined by the XML
|
||||
/// </summary>
|
||||
/// <param name="nav">navigator object that points to the current XML node we are at</param>
|
||||
/// <param name="nameSpace">the XML file name that defines this constant</param>
|
||||
/// <param name="xmlConstants">the Dictionary that stores this constant information</param>
|
||||
/// <param name="duplicateConstants">the Dictioanry that stores duplicate constant definitions</param>
|
||||
///===================================================================================
|
||||
public static void GetConstant(XPathNavigator nav, string nameSpace, List<XmlConstant> xmlConstants, Dictionary<string, List<string>> 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
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Parse the enumeration type defined by the XML
|
||||
/// </summary>
|
||||
/// <param name="nav">navigator object that points to the current XML node we are at</param>
|
||||
/// <param name="nameSpace">the XML file name that defines this enumeration type</param>
|
||||
/// <param name="xmlEnum">data structure that stores enumeration data</param>
|
||||
/// <param name="duplicateEnums">the Dictioanry that stores duplicate enumeration type</param>
|
||||
///===================================================================================
|
||||
public static void GetEnumeration(XPathNavigator nav, string nameSpace, Dictionary<string, XmlEnumeration> xmlEnums, Dictionary<string, List<string>> duplicateEnums)
|
||||
{
|
||||
string enumTypeName = string.Empty;
|
||||
string tempEnumTypeName = "temp";
|
||||
Dictionary<string, XmlEnumeration> tempXmlEnums = new Dictionary<string, XmlEnumeration>
|
||||
{
|
||||
[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<string>();
|
||||
}
|
||||
|
||||
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
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Parse each enumerated key/value pair
|
||||
/// </summary>
|
||||
/// <param name="nav">navigator object that points to the current XML node we are at</param>
|
||||
/// <param name="xmlEnum">data structure that stores enumeration data</param>
|
||||
///===================================================================================
|
||||
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<string, XmlStructure> xmlStructures, List<string> comments, Dictionary<string, List<string>> duplicateStructures)
|
||||
{
|
||||
string structureTypeName = string.Empty;
|
||||
string tempStructureTypeName = "temp";
|
||||
Dictionary<string, XmlStructure> tempXmlStructures = new Dictionary<string, XmlStructure>();
|
||||
|
||||
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<string>(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<string>();
|
||||
}
|
||||
|
||||
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
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Parse the data structure defined by the XML
|
||||
/// </summary>
|
||||
/// <param name="nav">navigator object that points to the current XML node we are at</param>
|
||||
/// <param name="xmlStructureItem">data structure that stores all data members of the data structure</param>
|
||||
///===================================================================================
|
||||
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
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Parse the message defined by the XML
|
||||
/// </summary>
|
||||
/// <param name="nav">navigator object that points to the current XML node we are at</param>
|
||||
/// <param name="nameSpace">the XML file name that defines this message</param>
|
||||
/// <param name="mbitMessages">list of messages defined by XML</param>
|
||||
/// <param name="duplicateMbitMessages">the Dictioanry that stores duplicate messages</param>
|
||||
///===================================================================================
|
||||
public static void GetMbitMessage(XPathNavigator nav, string nameSpace, List<XmlMbitMessage> mbitMessages, Dictionary<string, List<string>> 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<string>();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
///===================================================================================
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="message">description of the exception</param>
|
||||
///===================================================================================
|
||||
public XmlParsingException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
1361
Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coe.cs
Normal file
1361
Source/TSRealLib/HAL/Implementations/BIT/COEComm/coeCSharp/coe.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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<uint, IntPtr> _packets;
|
||||
public coe.CallBackDelegate _delegate;
|
||||
private GCHandle _GCdelegate;
|
||||
|
||||
internal coeDataInterchangePackets()
|
||||
{
|
||||
_packets = new Dictionary<uint, IntPtr>();
|
||||
_delegate = new coe.CallBackDelegate(Find);
|
||||
_GCdelegate = GCHandle.Alloc(_delegate);
|
||||
}
|
||||
|
||||
~coeDataInterchangePackets()
|
||||
{
|
||||
foreach (KeyValuePair<uint, IntPtr> 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// Message Attributes
|
||||
/// </summary>
|
||||
[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; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message: base class
|
||||
/// </summary>
|
||||
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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// The coeMessageBasic class is a template that can be used to create user messages
|
||||
/// </summary>
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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<uint> mySequence = new coeSequence<uint>(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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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<T>
|
||||
{
|
||||
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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
//\\<UnlimitedRights>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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>
|
||||
|
||||
//\\<EximUndetermined>
|
||||
//----------------------------------------------------------------------------//
|
||||
// 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 //
|
||||
//----------------------------------------------------------------------------//
|
||||
//\\<\Unclassified>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.COECommDevice</AssemblyName>
|
||||
<Description>Specialized instrument for running real time Build In Tests via COE implementing ICommDevice interface</Description>
|
||||
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.BIT.Contracts" Version="1.4.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommDevice.Contracts" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\COEComm\COEComm.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This device supports different ways of communicating with other COE nodes
|
||||
/// TCP
|
||||
/// UDP
|
||||
/// Serial
|
||||
/// </summary>
|
||||
public enum DriverType
|
||||
{
|
||||
Undefined,
|
||||
TCP,
|
||||
UDP,
|
||||
Serial
|
||||
};
|
||||
|
||||
public class COECommDeviceInstrument : ICommDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Nlog Logger
|
||||
/// </summary>
|
||||
readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Cancellation token to stop reading incoming messages
|
||||
/// </summary>
|
||||
private CancellationTokenSource _cancellationTokenSource = null;
|
||||
|
||||
/// <summary>
|
||||
/// collection of the messages received
|
||||
/// </summary>
|
||||
private readonly Dictionary<Tuple<string, DateTime>, OeMessage> _messages;
|
||||
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
/// <summary>
|
||||
/// UDP, TCP, Serial or Undefined
|
||||
/// </summary>
|
||||
private DriverType _driverType;
|
||||
|
||||
/// <summary>
|
||||
/// dictionary of options when initializing COE endpoint and router
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, List<KeyValuePair<string, string>>> _options = new Dictionary<string, List<KeyValuePair<string, string>>>();
|
||||
|
||||
/// <summary>
|
||||
/// reference to the main wrapper class for Common Operating Environment
|
||||
/// </summary>
|
||||
private readonly coe _coe;
|
||||
|
||||
/// <summary>
|
||||
/// COE endpoint
|
||||
/// </summary>
|
||||
private coeEndpoint _endpoint;
|
||||
|
||||
/// <summary>
|
||||
/// used for initialization of the endpoint
|
||||
/// </summary>
|
||||
private uint _maxMessageSize;
|
||||
private uint _epQueueDepth;
|
||||
|
||||
/// <summary>
|
||||
/// collection of all labels with message names per every XML file
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, Dictionary<uint, string>> _icds = new Dictionary<string, Dictionary<uint, string>>();
|
||||
|
||||
/// <summary>
|
||||
/// timeout can be set for the reader in a separate call
|
||||
/// </summary>
|
||||
private uint _receiverTimeout;
|
||||
|
||||
/// <summary>
|
||||
/// Number of milliseconds to wake up and check the message when receiving
|
||||
/// </summary>
|
||||
private int _checkForMessageIntervalMs;
|
||||
|
||||
/// <summary>
|
||||
/// collection of response labels or messages that COE endpoint should be registered for
|
||||
/// </summary>
|
||||
private List<uint> _responseLabels = new List<uint>();
|
||||
|
||||
/// <summary>
|
||||
/// collection of message XML documents (processed XML files) used in COE communications
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, MessageXmlDocument> _xmlDocs = new Dictionary<string, MessageXmlDocument>();
|
||||
|
||||
/// <summary>
|
||||
/// instrument constructor
|
||||
/// </summary>
|
||||
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<Tuple<string, DateTime>, 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes COE instrument
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
_logger.Trace($"{Name}({_driverType}) Initializing...");
|
||||
|
||||
if (_driverType == DriverType.Undefined)
|
||||
_driverType = _configuration.GetConfigurationValue<DriverType>("Parameters", "DriverType", "TCP");
|
||||
|
||||
_options.Clear();
|
||||
_options.Add("ROUTER_CONFIG", new List<KeyValuePair<string, string>>
|
||||
{
|
||||
{ new KeyValuePair<string, string>("NODE_ID", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "NODE_ID", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_STATE", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "DISPLAY_DEBUG_STATE", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_LABEL_MESSAGE", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "DISPLAY_DEBUG_LABEL_MESSAGE", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_BRIDGE_REGISTRATION", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "DISPLAY_DEBUG_BRIDGE_REGISTRATION", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_ROUTER_DATABASE", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "DISPLAY_DEBUG_ROUTER_DATABASE", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "DISPLAY_DEBUG_SEND", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "DISPLAY_DEBUG_RECV", "0")) },
|
||||
{ new KeyValuePair<string, string>("BUFFER_SIZE", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "BUFFER_SIZE", "256")) },
|
||||
{ new KeyValuePair<string, string>("ENABLE_REGISTRATION_MESSAGES", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "ENABLE_REGISTRATION_MESSAGES", "1")) },
|
||||
{ new KeyValuePair<string, string>("THREAD_STACK_SIZE", _configuration.GetConfigurationValue<string>("ROUTER_CONFIG", "THREAD_STACK_SIZE", "16384")) },
|
||||
});
|
||||
|
||||
_options.Add("ROUTER_PROTOCOL_CONFIG", new List<KeyValuePair<string, string>>
|
||||
{
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue<string>("ROUTER_PROTOCOL_CONFIG", "DISPLAY_DEBUG_SEND", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue<string>("ROUTER_PROTOCOL_CONFIG", "DISPLAY_DEBUG_RECV", "0")) },
|
||||
{ new KeyValuePair<string, string>("THREAD_STACK_SIZE", _configuration.GetConfigurationValue<string>("ROUTER_PROTOCOL_CONFIG", "THREAD_STACK_SIZE", "16384")) },
|
||||
});
|
||||
|
||||
var poolEntry = _configuration.GetConfigurationValue<string>("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<KeyValuePair<string, string>>();
|
||||
foreach (var entry in poolEntries)
|
||||
{
|
||||
entries.Add(new KeyValuePair<string, string>("POOL_ENTRY", entry));
|
||||
}
|
||||
_options.Add("ROUTER_BUFFER_POOLS", entries);
|
||||
}
|
||||
}
|
||||
|
||||
_options.Add("BASIC_REGISTRATION_CONFIG", new List<KeyValuePair<string, string>>
|
||||
{
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_SEND", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND_BUFFER", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_SEND_BUFFER", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_RECV", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV_BUFFER", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_RECV_BUFFER", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_STATE", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_STATE", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_PING_SEND", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_PING_SEND", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_PING_RECV", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "DISPLAY_DEBUG_PING_RECV", "0")) },
|
||||
{ new KeyValuePair<string, string>("THREAD_STACK_SIZE", _configuration.GetConfigurationValue<string>("BASIC_REGISTRATION_CONFIG", "THREAD_STACK_SIZE", "16384")) },
|
||||
});
|
||||
|
||||
switch (_driverType)
|
||||
{
|
||||
case DriverType.UDP:
|
||||
_options.Add("UDP_MEDIA_BINDING_CONFIG", new List<KeyValuePair<string, string>>
|
||||
{
|
||||
{ new KeyValuePair<string, string>("LOCAL_IP_ADDRESS", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "LOCAL_IP_ADDRESS", "127.0.0.1")) },
|
||||
{ new KeyValuePair<string, string>("REMOTE_IP_ADDRESS", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "REMOTE_IP_ADDRESS", "127.0.0.1")) },
|
||||
{ new KeyValuePair<string, string>("LOCAL_SEND_PORT", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "LOCAL_SEND_PORT", "32010")) },
|
||||
{ new KeyValuePair<string, string>("LOCAL_RECV_PORT", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "LOCAL_RECV_PORT", "32020")) },
|
||||
{ new KeyValuePair<string, string>("REMOTE_SEND_PORT", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "REMOTE_SEND_PORT", "32011")) },
|
||||
{ new KeyValuePair<string, string>("REMOTE_RECV_PORT", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "REMOTE_RECV_PORT", "32021")) },
|
||||
{ new KeyValuePair<string, string>("RECV_TIMEOUT", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "RECV_TIMEOUT", "200")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "0")) },
|
||||
{ new KeyValuePair<string, string>("MTU_SIZE", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "MTU_SIZE", "1472")) },
|
||||
{ new KeyValuePair<string, string>("THREAD_STACK_SIZE", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "THREAD_STACK_SIZE", "16384")) },
|
||||
{ new KeyValuePair<string, string>("THREAD_NAME", _configuration.GetConfigurationValue<string>("UDP_MEDIA_BINDING_CONFIG", "THREAD_NAME", "UDP_MB_RCV")) },
|
||||
});
|
||||
break;
|
||||
|
||||
case DriverType.TCP:
|
||||
_options.Add("TCP_MEDIA_BINDING_CONFIG", new List<KeyValuePair<string, string>>
|
||||
{
|
||||
{ new KeyValuePair<string, string>("LOCAL_PORT", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "LOCAL_PORT", "9990")) },
|
||||
{ new KeyValuePair<string, string>("NUM_PORTS", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "NUM_PORTS", "32")) },
|
||||
{ new KeyValuePair<string, string>("NUM_DYNAMIC_NODES", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "NUM_DYNAMIC_NODES", "32")) },
|
||||
{ new KeyValuePair<string, string>("SERVER_ADDRESS", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "SERVER_ADDRESS", "127.0.0.1:9990")) },
|
||||
{ new KeyValuePair<string, string>("UDP_TX_BUFFER_SIZE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "UDP_TX_BUFFER_SIZE", "5000")) },
|
||||
{ new KeyValuePair<string, string>("UDP_RX_BUFFER_SIZE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "UDP_RX_BUFFER_SIZE", "32768")) },
|
||||
{ new KeyValuePair<string, string>("TCP_TX_BUFFER_SIZE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "TCP_TX_BUFFER_SIZE", "5000")) },
|
||||
{ new KeyValuePair<string, string>("TCP_RX_BUFFER_SIZE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "TCP_RX_BUFFER_SIZE", "4096")) },
|
||||
{ new KeyValuePair<string, string>("PACKET_SIZE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "PACKET_SIZE", "5128")) },
|
||||
{ new KeyValuePair<string, string>("TCP_SELECT_VALUE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "TCP_SELECT_VALUE", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISABLE_NAG_DELAY", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISABLE_NAG_DELAY", "1")) },
|
||||
{ new KeyValuePair<string, string>("TIMER_RATE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "TIMER_RATE", "1000")) },
|
||||
{ new KeyValuePair<string, string>("CONNECT_KA_RATE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "CONNECT_KA_RATE", "1")) },
|
||||
{ new KeyValuePair<string, string>("RECV_KA_RATE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "RECV_KA_RATE", "1")) },
|
||||
{ new KeyValuePair<string, string>("SERVER_CONNECT_RATE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "SERVER_CONNECT_RATE", "1")) },
|
||||
{ new KeyValuePair<string, string>("RECV_THREAD_STACK_SIZE", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_STACK_SIZE", "4096")) },
|
||||
{ new KeyValuePair<string, string>("RECV_THREAD_PRIORITY", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_PRIORITY", "0")) },
|
||||
{ new KeyValuePair<string, string>("RECV_THREAD_AFFINITY", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "RECV_THREAD_AFFINITY", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND_BUFFER", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND_BUFFER", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_UDP_RECV", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_UDP_RECV", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_UDP_RECV_BUFFER", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_UDP_RECV_BUFFER", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_TCP_RECV", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_TCP_RECV", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_TCP_RECV_BUFFER", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_TCP_RECV_BUFFER", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "1")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV_BUFFER", _configuration.GetConfigurationValue<string>("TCP_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV_BUFFER", "1")) },
|
||||
});
|
||||
break;
|
||||
|
||||
case DriverType.Serial:
|
||||
_options.Add("SERIAL_MEDIA_BINDING_CONFIG", new List<KeyValuePair<string, string>>
|
||||
{
|
||||
{ new KeyValuePair<string, string>("DEVICE_NAME", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "DEVICE_NAME", "\\\\.\\COM1")) },
|
||||
{ new KeyValuePair<string, string>("BAUD_RATE", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "BAUD_RATE", "9600")) },
|
||||
{ new KeyValuePair<string, string>("DATA_BITS", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "DATA_BITS", "8")) },
|
||||
{ new KeyValuePair<string, string>("STOP_BITS", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "STOP_BITS", "1")) },
|
||||
{ new KeyValuePair<string, string>("PARITY", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "PARITY", "0")) },
|
||||
{ new KeyValuePair<string, string>("FLOW_CONTROL", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "FLOW_CONTROL", "0")) },
|
||||
{ new KeyValuePair<string, string>("MTU_SIZE", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "MTU_SIZE", "256")) },
|
||||
{ new KeyValuePair<string, string>("RECV_PROCESSING_DELAY", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "RECV_PROCESSING_DELAY", "100")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_SEND", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_SEND", "0")) },
|
||||
{ new KeyValuePair<string, string>("DISPLAY_DEBUG_RECV", _configuration.GetConfigurationValue<string>("SERIAL_MEDIA_BINDING_CONFIG", "DISPLAY_DEBUG_RECV", "0")) },
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
_logger.Error($"{Name}({_driverType}) Configured driver type not valid");
|
||||
break;
|
||||
}
|
||||
|
||||
_maxMessageSize = _configuration.GetConfigurationValue<uint>("Parameters", "MaxMessageSize", "5000");
|
||||
_epQueueDepth = _configuration.GetConfigurationValue<uint>("Parameters", "EPQueueDepth", "5000");
|
||||
_checkForMessageIntervalMs = _configuration.GetConfigurationValue<int>("Parameters", "CheckForMessageIntervalMs", "100");
|
||||
|
||||
var responseLabels = _configuration.GetConfigurationListValue("ResponseMessageIds", "ResponseLabel", new List<string> { "1", "2" });
|
||||
|
||||
var bitFilePaths = _configuration.GetConfigurationListValue("BitFilePaths", "FilePath", new List<string> { "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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// performs self-test
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
_logger.Trace($"{Name}({_driverType}) Performing Self Test...");
|
||||
|
||||
// TODO implement method
|
||||
return SelfTestResult.Pass;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets COE device comms
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public void Reset()
|
||||
{
|
||||
_logger.Trace($"{Name}({_driverType}) Resetting...");
|
||||
|
||||
Close();
|
||||
|
||||
Open();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shuts down COE device
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// Opens COE connection
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close COE endpoint
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
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";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the timeout value for COE reading operation
|
||||
/// </summary>
|
||||
/// <param name="timeout"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public void SetReadTimeout(uint timeout)
|
||||
{
|
||||
_logger.Trace($"{Name}({_driverType}) Setting read timeout {timeout} ms ...");
|
||||
|
||||
_receiverTimeout = timeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reads COE message either based on the label or just top message
|
||||
/// </summary>
|
||||
/// <param name="dataRead">
|
||||
/// might contain a COE label
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
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<Tuple<string, DateTime>, 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keep reading messages and stash them in _messages dictionary with label and timestamp as a key
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
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<string, DateTime>(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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes COE message
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="numBytesToWrite"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// if byte array contains byte representation of XML then returns XML string
|
||||
/// else returns empty string
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
private static string FromByteArrayToXml(byte[] data) => System.Text.Encoding.Default.GetString(data);
|
||||
private static byte[] FromStringToByteArray(string data) => System.Text.Encoding.UTF8.GetBytes(data);
|
||||
|
||||
/// <summary>
|
||||
/// Extract message node from XML for the OeMessage class
|
||||
/// </summary>
|
||||
/// <param name="xmlData"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// if message id can be converted to uint returns the value
|
||||
/// otherwise returns the related label from the message id by dictionary lookup
|
||||
/// </summary>
|
||||
/// <param name="label"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// return file path for the file that contains the label
|
||||
/// </summary>
|
||||
/// <param name="label"></param>
|
||||
/// <returns></returns>
|
||||
private string WhichFileContainsTheLabel(uint label)
|
||||
{
|
||||
foreach (var item in _icds)
|
||||
{
|
||||
if (item.Value.Keys.Contains(label))
|
||||
{
|
||||
return item.Key;
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reads xml file and extracts all message names with associated labels
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
private Dictionary<uint, string> ProcessFileForNamesAndLabels(string filePath)
|
||||
{
|
||||
var doc = new XPathDocument(filePath);
|
||||
|
||||
XPathNavigator node = doc.CreateNavigator();
|
||||
XPathNodeIterator nodeset = node.Select("interface/message");
|
||||
|
||||
var result = new Dictionary<uint, string>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// converts from string representation of a label to uint value
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private ILogger _logger;
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new COECommDeviceInstrument(name, _configurationManager, _driverType, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// type conversion utility with a special case for enums
|
||||
/// </summary>
|
||||
public static class TypeConverter
|
||||
{
|
||||
public static T ChangeType<T>(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<T, TC>() where TC : System.ComponentModel.TypeConverter
|
||||
{
|
||||
TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper class contains extension fictions for reading types other than strings from configuration,
|
||||
/// as well as reading lists of values
|
||||
/// </summary>
|
||||
public static class ConfigurationHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// template function for reading different types from configuration
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static T GetConfigurationValue<T>(this IConfiguration configuration, string section, string key, string defaultValue)
|
||||
{
|
||||
var tmpResult = configuration.GetConfigurationValue(section, key, defaultValue);
|
||||
return !string.IsNullOrEmpty(tmpResult) ? TypeConverter.ChangeType<T>(tmpResult) : default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns multi-value result (list of T) from configuration
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static List<T> GetConfigurationListValue<T>(this IConfiguration configuration, string section, string key, List<T> 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($"</{key}>");
|
||||
}
|
||||
xmlStr.Append($"</{key}s>");
|
||||
|
||||
configuration.SetXmlConfiguration(section, xmlStr.ToString());
|
||||
return defaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var stringRes = BuildElementListFromXml(tmpResult, key);
|
||||
return new List<T>(stringRes.Select(x => TypeConverter.ChangeType<T>(x)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns values from XML section converted to string list
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
private static List<string> BuildElementListFromXml(string data, string key)
|
||||
{
|
||||
XElement doc = XElement.Parse(data);
|
||||
IEnumerable<XElement> xmlMessages = from m
|
||||
in doc.Elements($"{key}s").Elements(key)
|
||||
select m;
|
||||
var messages = xmlMessages.Select(x => x.Value);
|
||||
return messages?.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Chiller class used to interact with the FTS chiller.
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateFunctions
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~ChillerFTS()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open socket to the chiller
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the object's resources.
|
||||
/// </summary>
|
||||
/// <param name="disposing">Currently disposing.</param>
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a command to the chiller and request a response
|
||||
/// </summary>
|
||||
/// <param name="cmd">Command to send.</param>
|
||||
/// <returns>Response from the chiller.</returns>
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Change the units of measurement for the chiller.
|
||||
/// </summary>
|
||||
/// <param name="units">Celsius/Fahrenheit</param>
|
||||
private void SetDegreesUnits(DEGREES units)
|
||||
{
|
||||
lock (m_sync)
|
||||
{
|
||||
//Set the units of measurement to Celsius
|
||||
string rsp = SendMessageGetResponse(_DEGREES + units.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ChillerFTS factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for the chiller. It makes a socket connection to the chiller and sets the degrees to Celsius
|
||||
/// </summary>
|
||||
/// <param name="name">The name</param>
|
||||
/// <param name="ipAddress">IP Address of the equipment</param>
|
||||
/// <param name="port">Port of the equipment</param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="comPortName"></param>
|
||||
/// <param name="delayBeforeReadMs"></param>
|
||||
/// <param name="baudRate"></param>
|
||||
/// <param name="parity"></param>
|
||||
/// <param name="dataBits"></param>
|
||||
/// <param name="stopBits"></param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop the chiller pump.
|
||||
/// </summary>
|
||||
public void DisableFlow()
|
||||
{
|
||||
lock (m_sync)
|
||||
{
|
||||
//Send the command to stop coolant flow
|
||||
string rsp = SendMessageGetResponse(_FLOWDISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this objects resources
|
||||
/// </summary>
|
||||
[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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the chiller pump.
|
||||
/// </summary>
|
||||
public void EnableFlow()
|
||||
{
|
||||
lock (m_sync)
|
||||
{
|
||||
//Send the command to start coolant flow
|
||||
string rsp = SendMessageGetResponse(_FLOWENABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the current setting for the coolant.
|
||||
/// </summary>
|
||||
/// <returns>The current coolant setting.</returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the temperature of the coolant reservoir.
|
||||
/// </summary>
|
||||
/// <returns>The temperature of the coolant.</returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the coolant temperature to a desired setpoint.
|
||||
/// </summary>
|
||||
/// <param name="temp">The desired coolant temperature.</param>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.ChillerFTS</AssemblyName>
|
||||
<Product>Chiller FTS implementation</Product>
|
||||
<Description>Chiller FTS implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.Chiller.Contracts" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ChillerSim\ChillerSim.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new ChillerFTS(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// A simulated chiller
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateFunctions
|
||||
~ChillerSim()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Dispose of the object's resources.
|
||||
/// </summary>
|
||||
/// <param name="disposing">Currently disposing.</param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// ChillerFTS factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public ChillerSim(string deviceName, IConfigurationManager configurationManager, ILogger logger)
|
||||
{
|
||||
Name = deviceName;
|
||||
|
||||
_logger = logger;
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public ChillerSim(string name)
|
||||
{
|
||||
Name = name;
|
||||
_setPoint = 20.0;
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stop the chiller pump.
|
||||
/// </summary>
|
||||
public void DisableFlow()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this objects resources
|
||||
/// </summary>
|
||||
[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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the chiller pump.
|
||||
/// </summary>
|
||||
public void EnableFlow()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the current setting for the coolant.
|
||||
/// </summary>
|
||||
/// <returns>The current coolant setting.</returns>
|
||||
public double GetCoolantSetpoint()
|
||||
{
|
||||
return _setPoint;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the temperature of the coolant reservoir.
|
||||
/// </summary>
|
||||
/// <returns>The temperature of the coolant.</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the coolant temperature to a desired setpoint.
|
||||
/// </summary>
|
||||
/// <param name="temp">The desired coolant temperature.</param>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.ChillerSim</AssemblyName>
|
||||
<Product>Chiller SIM implementation</Product>
|
||||
<Description>Chiller SIM implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.Chiller.Contracts" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new ChillerSim(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new ChillerSim(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivatelassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~CommDeviceGeuSdlc()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Some HSS corrections
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="numDWords"></param>
|
||||
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();
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor. Does not initialize anything. Use Initialize() to create the handle to the hardware
|
||||
/// </summary>
|
||||
/// <param name="resourceName"></param>
|
||||
/// <param name="idQuery"></param>
|
||||
/// <param name="reset"></param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IInstrument.ClearErrors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DetailedStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return "This is a HSS GEU SDLC Device called " + _resourceName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
_logger.Error(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a handle to the hardware
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _resourceName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
SelfTestResult IInstrument.PerformSelfTest()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dataRead"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void IInstrument.Reset()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
_guidanceElectronicsUnit.Close();
|
||||
_state = State.Uninitialized;
|
||||
Thread.Sleep(500);
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SelfTestResult SelfTestResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selfTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs"></param>
|
||||
void ICommDevice.SetReadTimeout(uint timeoutMs)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void IInstrument.Shutdown()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
if (_guidanceElectronicsUnit != null)
|
||||
{
|
||||
_guidanceElectronicsUnit.LowLevel.HSSub9100.EnableIO = ControlState.Disabled;
|
||||
|
||||
_guidanceElectronicsUnit.Close();
|
||||
_guidanceElectronicsUnit.Dispose();
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public State Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="numBytesToWrite"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceGeuSdlc</AssemblyName>
|
||||
<Product>CommDevice GeuSdlc implementation</Product>
|
||||
<Description>CommDevice GeuSdlc implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommDevice.Contracts" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommDeviceSim\CommDeviceSim.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="netfscc">
|
||||
<HintPath>..\..\Common\COTS\FSCC\netfscc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Raytheon.GuidedElectronicsUnit.Fx46">
|
||||
<HintPath>..\..\Common\COTS\Teradyne_SDLC\Raytheon.GuidedElectronicsUnit.Fx46.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceGeuSdlc(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// A sim communication device
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
_logger.Error(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
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<uint>("CommDeviceSerialAsync", "ReadTimeout", 25);
|
||||
_defaultSendTimeout = _configuration.GetConfigurationValue<uint>("CommDeviceSerialAsync", "SendTimeout", 5000);
|
||||
_defaultReadBufferSize = _configuration.GetConfigurationValue<uint>("CommDeviceSerialAsync", "BufferSize", 1024);
|
||||
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize instrument
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens COM serial port for communications
|
||||
/// </summary>
|
||||
public void Open()
|
||||
{
|
||||
try
|
||||
{
|
||||
_serialPort.Open();
|
||||
_state = State.Ready;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// shuts down the device
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
_logger.Debug("Shutting down");
|
||||
|
||||
_serialPort.Close();
|
||||
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<uint> ReadAsync(byte[] dataRead, CancellationToken token = default)
|
||||
{
|
||||
var bytesRead = await _serialPort.BaseStream.ReadAsync(dataRead, 0, dataRead.Length, token);
|
||||
return (uint)bytesRead;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read string from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<string> ReadAsync(CancellationToken token = default)
|
||||
{
|
||||
var data = await ReadLineAsync(token);
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the read timeout
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs"></param>
|
||||
public void SetReadTimeout(uint timeoutMs)
|
||||
{
|
||||
if (_serialPort == null)
|
||||
return;
|
||||
|
||||
_logger.Trace($"Setting Reader Timeout: {timeoutMs} Ms");
|
||||
_serialPort.ReadTimeout = (int)timeoutMs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="dataToSend"></param>
|
||||
/// <param name="numBytesToWrite"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<uint> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write string data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send Command and Get Response asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="timeoutInMs"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send Command and Get Response asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="timeoutInMs"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<byte[]> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keeps reading until canceled via token,
|
||||
/// received messages sent to dataReceived function
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="dataReceived"></param>
|
||||
/// <returns></returns>
|
||||
public async Task KeepReadingAsync(CancellationToken cancellationToken, Action<string> 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} ...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keeps reading until canceled via token,
|
||||
/// received messages sent to dataReceived function
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="dataReceived"></param>
|
||||
/// <returns></returns>
|
||||
public async Task KeepReadingAsync(CancellationToken cancellationToken, Action<byte[]> 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
|
||||
/// <summary>
|
||||
/// reads line async
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// writes line async
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceSerialAsync</AssemblyName>
|
||||
<Product>CommDevice Serial Asynchronous implementation</Product>
|
||||
<Description>CommDevice Serial COM Asynchronous implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommAsync.Contracts" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceSerialAsync(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new CommDeviceSerialAsync(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// A sim communication device
|
||||
/// </summary>
|
||||
public class CommDeviceSim : ICommDevice
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private static object _syncObj = new Object();
|
||||
private readonly string _name;
|
||||
private SelfTestResult _selfTestResult;
|
||||
private State _state;
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateFunctions
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~CommDeviceSim()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PublicFuctions
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public CommDeviceSim(string name, IConfigurationManager configurationManager, ILogger logger)
|
||||
{
|
||||
_name = name;
|
||||
_selfTestResult = SelfTestResult.Unknown;
|
||||
_state = State.Uninitialized;
|
||||
|
||||
_logger = logger;
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public CommDeviceSim(string name)
|
||||
{
|
||||
_name = name;
|
||||
_selfTestResult = SelfTestResult.Unknown;
|
||||
_state = State.Uninitialized;
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ClearErrors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool DisplayEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DetailedStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return "This is a Comm Device Sim called " + _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool FrontPanelEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public InstrumentMetadata Info
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/*public void Open()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
}
|
||||
}*/
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
_selfTestResult = SelfTestResult.Pass;
|
||||
return _selfTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public uint Read(ref byte[] dataRead)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
return (uint)dataRead.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the read timeout
|
||||
/// </summary>
|
||||
/// <param name="timeout"></param>
|
||||
public void SetReadTimeout(uint timeout)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SelfTestResult SelfTestResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selfTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public State Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device
|
||||
/// </summary>
|
||||
/// <param name="dataToSend">The data to write</param>
|
||||
/// <param name="numBytesToWrite">The number of bytes to write</param>
|
||||
/// <returns>THe number of bytes that were written</returns>
|
||||
public uint Write(byte[] dataToSend, uint numBytesToWrite)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
return numBytesToWrite;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceSim</AssemblyName>
|
||||
<Product>CommDevice SIM implementation</Product>
|
||||
<Description>CommDevice SIM implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommDevice.Contracts" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceSim(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new CommDeviceSim(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for controlling a Commtech SUPERFSCC/4-PCIE-11
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateFuctions
|
||||
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~CommDeviceSuperFscc422()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
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<uint>("SuperFscc422", "PortNum", 0);
|
||||
_clockFreq = _configuration.GetConfigurationValue<uint>("SuperFscc422", "ClockFreq", 0);
|
||||
_shallWeReceiveMultiple = _configuration.GetConfigurationValue("SuperFscc422", "ShallWeReceiveMultiple", false);
|
||||
_shallWeAppendStatus = _configuration.GetConfigurationValue("SuperFscc422", "ShallWeAppendStatus", false);
|
||||
_bgrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "BgrRegister", 0);
|
||||
_ccr0Register = _configuration.GetConfigurationValue<uint>("SuperFscc422", "Ccr0Register", 0);
|
||||
_ccr0SofResetValue = _configuration.GetConfigurationValue<uint>("SuperFscc422", "Ccr0SofResetValue", 0);
|
||||
_ccr1Register = _configuration.GetConfigurationValue<uint>("SuperFscc422", "Ccr1Register", 0);
|
||||
_ccr2Register = _configuration.GetConfigurationValue<uint>("SuperFscc422", "Ccr2Register", 0);
|
||||
_dpllrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "DpllrRegister", 0);
|
||||
_fcrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "FcrRegister", 0);
|
||||
_fifotRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "FifotRegister", 0);
|
||||
_imrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "ImrRegister", 0);
|
||||
_pprRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "PprRegister", 0);
|
||||
_ramrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "RamrRegister", 0);
|
||||
_rarRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "RarRegister", 0);
|
||||
_smrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "SmrRegister", 0);
|
||||
_ssrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "SsrRegister", 0);
|
||||
_tcrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "TcrRegister", 0);
|
||||
_tmrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "TmrRegister", 0);
|
||||
_tsrRegister = _configuration.GetConfigurationValue<uint>("SuperFscc422", "TsrRegister", 0);
|
||||
|
||||
_readTimeout = _DEFAULT_READ_TIMEOUT;
|
||||
|
||||
// created in Initialize()
|
||||
_fscc = null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Opens the port and initializes the registers
|
||||
/// </summary>
|
||||
/// <param name="portNum"></param>
|
||||
/// <param name="clockFreq"></param>
|
||||
/// <param name="shallWeReceiveMultiple"></param>
|
||||
/// <param name="shallWeAppendStatus"></param>
|
||||
/// <param name="bgrRegister"></param>
|
||||
/// <param name="ccr0Register"></param>
|
||||
/// <param name="ccr0SofResetValue"></param>
|
||||
/// <param name="ccr1Register"></param>
|
||||
/// <param name="ccr2Register"></param>
|
||||
/// <param name="dpllrRegister"></param>
|
||||
/// <param name="fcrRegister"></param>
|
||||
/// <param name="fifotRegister"></param>
|
||||
/// <param name="imrRegister"></param>
|
||||
/// <param name="pprRegister"></param>
|
||||
/// <param name="ramrRegister"></param>
|
||||
/// <param name="rarRegister"></param>
|
||||
/// <param name="smrRegister"></param>
|
||||
/// <param name="ssrRegister"></param>
|
||||
/// <param name="tcrRegister"></param>
|
||||
/// <param name="tmrRegister"></param>
|
||||
/// <param name="tsrRegister"></param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ClearErrors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool DisplayEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DetailedStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return "This is a FSCC 422 Device called " + _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool FrontPanelEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public InstrumentMetadata Info
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public uint Read(ref byte[] dataRead)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
uint numBytesRead = _fscc.Read(dataRead, (uint)dataRead.Length, _readTimeout);
|
||||
|
||||
return numBytesRead;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Soft reset procedure as suggested by the vendor
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
_fscc.Registers.CCR0 = _ccr0SofResetValue;
|
||||
|
||||
_fscc.Purge(true, true);
|
||||
|
||||
_fscc.Registers.CCR0 = _ccr0Register;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs"></param>
|
||||
public void SetReadTimeout(uint timeoutMs)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
_readTimeout = timeoutMs;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SelfTestResult SelfTestResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selfTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public State Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
if (_state == State.Ready)
|
||||
{
|
||||
_fscc.Dispose();
|
||||
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device
|
||||
/// </summary>
|
||||
/// <param name="dataToSend">The data to write</param>
|
||||
/// <param name="numBytesToWrite">The number of bytes to write</param>
|
||||
/// <returns>THe number of bytes that were written</returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceSuperFscc422</AssemblyName>
|
||||
<Product>CommDevice SuperFscc422 implementation</Product>
|
||||
<Description>CommDevice SuperFscc422 implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommDeviceSim\CommDeviceSim.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="netfscc">
|
||||
<HintPath>..\..\Common\COTS\FSCC\netfscc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Raytheon.GuidedElectronicsUnit.Fx46">
|
||||
<HintPath>..\..\Common\COTS\Teradyne_SDLC\Raytheon.GuidedElectronicsUnit.Fx46.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceSuperFscc422(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="instrumentDefFile"></param>
|
||||
/// <param name="iniSectionName"></param>
|
||||
/// <param name="isThereHardware"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// A sim communication device
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
_logger.Error(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize instrument
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
if (_state != State.Uninitialized)
|
||||
{
|
||||
_logger.Warn("Reinitialization of existing TCP Async Connection. Attempting to call Shutdown.");
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
_defaultReadTimeout = _configuration.GetConfigurationValue<uint>("TcpClient", "ReadTimeout", 25);
|
||||
_defaultSendTimeout = _configuration.GetConfigurationValue<uint>("TcpClient", "SendTimeout", 5000);
|
||||
_defaultReadBufferSize = _configuration.GetConfigurationValue<uint>("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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// shuts down the device
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
_logger.Debug("Shutting down");
|
||||
_tcpClient?.Dispose();
|
||||
_tcpClient = null;
|
||||
|
||||
_tcpListener?.Stop();
|
||||
_tcpListener = null;
|
||||
|
||||
_tcpIpStream?.Dispose();
|
||||
_tcpIpStream = null;
|
||||
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<uint> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read string from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<string> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the read timeout
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs"></param>
|
||||
public void SetReadTimeout(uint timeoutMs)
|
||||
{
|
||||
_logger.Trace($"Setting Reader Timeout: {timeoutMs} Ms");
|
||||
|
||||
_tcpClient.Client.ReceiveTimeout = (int)timeoutMs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="dataToSend"></param>
|
||||
/// <param name="numBytesToWrite"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<uint> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write string data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send Command and Get Response asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="timeoutInMs"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send Command and Get Response asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="timeoutInMs"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<byte[]> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keeps reading until canceled via token,
|
||||
/// received messages sent to dataReceived function
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="dataReceived"></param>
|
||||
/// <returns></returns>
|
||||
public async Task KeepReadingAsync(CancellationToken cancellationToken, Action<string> 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} ...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keeps reading until canceled via token,
|
||||
/// received messages sent to dataReceived function
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="dataReceived"></param>
|
||||
/// <returns></returns>
|
||||
public async Task KeepReadingAsync(CancellationToken cancellationToken, Action<byte[]> 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceTcpAsync</AssemblyName>
|
||||
<Product>CommDevice TCP Asynchronous implementation</Product>
|
||||
<Description>CommDevice TCP Asynchronous implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommAsync.Contracts" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceTcpAsync(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new CommDeviceTcpAsync(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for controlling a TCP client communication device
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
_logger.Error(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// legacy constructor
|
||||
/// </summary>
|
||||
/// <param name="name">The name of this device</param>
|
||||
/// <param name="remoteAddress">The address of the server</param>
|
||||
/// <param name="remotePort">The port that the server is listening on</param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize instrument
|
||||
/// </summary>
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// shuts down the device
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
if (_state == State.Ready)
|
||||
{
|
||||
_tcpIpStream.Dispose();
|
||||
_tcpClient.Dispose();
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<uint> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read string from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<string> 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the read timeout
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs"></param>
|
||||
public void SetReadTimeout(uint timeoutMs)
|
||||
{
|
||||
_tcpClient.Client.ReceiveTimeout = (int)timeoutMs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device
|
||||
/// </summary>
|
||||
/// <param name="dataToSend">The data to write</param>
|
||||
/// <param name="numBytesToWrite">The number of bytes to write</param>
|
||||
/// <returns>The number of bytes that were written</returns>
|
||||
public uint Write(byte[] dataToSend, uint numBytesToWrite)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
_state = State.Busy;
|
||||
_tcpIpStream.Write(dataToSend, 0, (int)numBytesToWrite);
|
||||
_state = State.Ready;
|
||||
return numBytesToWrite;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="dataToSend"></param>
|
||||
/// <param name="numBytesToWrite"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<uint> WriteAsync(byte[] dataToSend, uint numBytesToWrite)
|
||||
{
|
||||
_state = State.Busy;
|
||||
await _tcpIpStream.WriteAsync(dataToSend, 0, (int)numBytesToWrite);
|
||||
_state = State.Ready;
|
||||
return numBytesToWrite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write string data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send Command and Get Response asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="timeoutInMs"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keeps reading until canceled via token,
|
||||
/// received messages sent to dataReceived function
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="dataReceived"></param>
|
||||
/// <returns></returns>
|
||||
public async Task KeepReadingAsync(CancellationToken cancellationToken, Action<string> 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceTcpClient</AssemblyName>
|
||||
<Product>CommDevice TCP implementation</Product>
|
||||
<Description>CommDevice TCP implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommDevice.Contracts" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceTcpClient(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new CommDeviceTcpClient(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for controlling a UDP communication device
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateFunctions
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~CommDeviceUdp()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name">The name of this instance</param>
|
||||
/// <param name="localPort">the port on the local computer to use</param>
|
||||
/// <param name="remotePort">the port on the remote computer to send to</param>
|
||||
/// <param name="remoteAddress">the address to send to</param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ClearErrors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool DisplayEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DetailedStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return "This is a UDP Device called " + _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool FrontPanelEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public InstrumentMetadata Info
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SelfTestResult SelfTestResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selfTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public State Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs"></param>
|
||||
public void SetReadTimeout(uint timeoutMs)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
_udpClient.Client.ReceiveTimeout = (int)timeoutMs;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
if (_state == State.Ready)
|
||||
{
|
||||
_udpClient.Close();
|
||||
|
||||
_udpClient.Dispose();
|
||||
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device
|
||||
/// </summary>
|
||||
/// <param name="dataToSend">The data to write</param>
|
||||
/// <param name="numBytesToWrite">The number of bytes to write</param>
|
||||
/// <returns>THe number of bytes that were written</returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceUdp</AssemblyName>
|
||||
<RootNamespace>Raytheon.Instruments</RootNamespace>
|
||||
<Product>CommDevice UDP implementation</Product>
|
||||
<Description>CommDevice UDP implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommDevice.Contracts" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceUdp(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new CommDeviceUdp(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// A sim communication device
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
_logger.Error(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the resources contained by this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// CommDevice factory constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public CommDeviceUdpAsync(string name, IConfigurationManager configurationManager, ILogger logger)
|
||||
{
|
||||
_name = name;
|
||||
|
||||
_state = State.Uninitialized;
|
||||
|
||||
_logger = logger;
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize instrument
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
if (_state != State.Uninitialized)
|
||||
{
|
||||
_logger.Warn("Reinitialization of existing UDP Async Connection. Attempting to call Shutdown.");
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
_defaultReadTimeout = _configuration.GetConfigurationValue<uint>("UdpClient", "ReadTimeout", 25);
|
||||
_defaultSendTimeout = _configuration.GetConfigurationValue<uint>("UdpClient", "SendTimeout", 5000);
|
||||
_defaultReadBufferSize = _configuration.GetConfigurationValue<uint>("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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// shuts down the device
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
_logger.Debug("Shutting Down...");
|
||||
_state = State.Uninitialized;
|
||||
_udpClient?.Dispose();
|
||||
_udpClient = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<uint> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read string from the device asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The buffer to put the data in</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
public async Task<string> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the read timeout
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs"></param>
|
||||
public void SetReadTimeout(uint timeoutMs)
|
||||
{
|
||||
if (_udpClient == null)
|
||||
return;
|
||||
|
||||
_logger.Trace($"Setting Reader Timeout: {timeoutMs} Ms");
|
||||
|
||||
_udpClient.Client.ReceiveTimeout = (int)timeoutMs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="dataToSend"></param>
|
||||
/// <param name="numBytesToWrite"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<uint> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write string data to the device asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send Command and Get Response asynchronously
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="timeoutInMs"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send Command and Get Response asynchronously
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="timeoutInMs"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<byte[]> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keeps reading until canceled via token,
|
||||
/// received messages sent to dataReceived function
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="dataReceived"></param>
|
||||
/// <returns></returns>
|
||||
public async Task KeepReadingAsync(CancellationToken cancellationToken, Action<string> 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} ...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// keeps reading until canceled via token,
|
||||
/// received messages sent to dataReceived function
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="dataReceived"></param>
|
||||
/// <returns></returns>
|
||||
public async Task KeepReadingAsync(CancellationToken cancellationToken, Action<byte[]> 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
|
||||
/// <summary>
|
||||
/// Update client information for logging
|
||||
/// </summary>
|
||||
/// <param name="remoteEndPoint"></param>
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ReceiveAsyc with cancellation token implementation
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="breakToken"></param>
|
||||
/// <returns></returns>
|
||||
private Task<UdpReceiveResult> ReceiveAsync(UdpClient client, CancellationToken breakToken) => breakToken.IsCancellationRequested
|
||||
? Task.Run(() => new UdpReceiveResult())
|
||||
: Task<UdpReceiveResult>.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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.CommDeviceUdpAsync</AssemblyName>
|
||||
<RootNamespace>Raytheon.Instruments</RootNamespace>
|
||||
<Product>CommDevice UDP Asynchronous implementation</Product>
|
||||
<Description>CommDevice UDP Asynchronous implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.CommAsync.Contracts" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The supported interfaces
|
||||
/// </summary>
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CommDeviceUdpAsyncFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new CommDeviceUdpAsync(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
return new CommDeviceUdpAsync(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
BIN
Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/cfscc.dll
Normal file
BIN
Source/TSRealLib/HAL/Implementations/Common/COTS/FSCC/cfscc.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,367 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Ivi.DCPwr</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Ivi.DCPwr.Errors">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.Errors.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.Errors.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.IIviDCPwr">
|
||||
<summary>
|
||||
IviDCPwr class-compliant root interface
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwr.Outputs">
|
||||
<summary>
|
||||
A reference to the IIviDCPwrOutputs interface
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwr.Trigger">
|
||||
<summary>
|
||||
A reference to the IIviDCPwrTrigger interface
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.IIviDCPwrOutput">
|
||||
<summary>
|
||||
IviDCPwr class-compliant IIviDCPwrOutputs collection interface
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.ConfigureCurrentLimit(Ivi.DCPwr.CurrentLimitBehavior,System.Double)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="behavior">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.</param>
|
||||
<param name="limit">The power supply's output current limit. Refer to the CurrentLimit property for
|
||||
details.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.ConfigureRange(Ivi.DCPwr.RangeType,System.Double)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="rangeType">The kind of range to be configured, either Current or Voltage.</param>
|
||||
<param name="range">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.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.ConfigureOvp(System.Boolean,System.Double)">
|
||||
<summary>
|
||||
Configures the over-voltage limit and the behavior of the power supply when the output voltage is greater
|
||||
than or equal to the limit.
|
||||
</summary>
|
||||
<param name="enabled">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.</param>
|
||||
<param name="limit">The power supply's over-voltage protection limit. Refer to the OVPLimit property.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.Measure(Ivi.DCPwr.MeasurementType)">
|
||||
<summary>
|
||||
Takes a measurement on the output signal and returns the measured value.
|
||||
</summary>
|
||||
<param name="measurementType">The type of measurement to take, either Current or Volatge</param>
|
||||
<returns>The measured value.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.QueryCurrentLimitMax(System.Double)">
|
||||
<summary>
|
||||
Returns the maximum programmable current limit that the power supply accepts for a particular voltage
|
||||
level on an output.
|
||||
</summary>
|
||||
<param name="voltageLevel">The voltage level for which to determine the maximum programmable current limit.</param>
|
||||
<returns>The maximum programmable current limit for the specified voltage level.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.QueryState(Ivi.DCPwr.OutputState)">
|
||||
<summary>
|
||||
Returns true if the power supply is in the state indicated by the outputState parameter.
|
||||
</summary>
|
||||
<param name="outputState">The output state for which to query.</param>
|
||||
<returns>Returns true if the power supply is in the state indicated by the outputState parameter,
|
||||
and False if it is not.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.QueryVoltageLevelMax(System.Double)">
|
||||
<summary>
|
||||
Returns the maximum programmable voltage level that the power supply accepts for a particular current limit
|
||||
on an output.
|
||||
</summary>
|
||||
<param name="currentLimit">The current limit for which to determine the maximum programmable voltage level.</param>
|
||||
<returns>Returns the maximum programmable voltage level for the specified current limit.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrOutput.ResetOutputProtection">
|
||||
<summary>
|
||||
Resets the power supply's output protection after an over-voltage or over-current condition occurs.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.CurrentLimit">
|
||||
<summary>
|
||||
The output current limit, in Amps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.CurrentLimitBehavior">
|
||||
<summary>
|
||||
The behavior of the power supply when the output current is equal to or greater than the value of
|
||||
the CurrentLimit property.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.Enabled">
|
||||
<summary>
|
||||
If true, the signal the power supply produces appears at the output connector.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.OvpLimit">
|
||||
<summary>
|
||||
The voltage the power supply allows, in Volts.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.OvpEnabled">
|
||||
<summary>
|
||||
If True, the power supply disables the output when the output voltage is greater than or equal to the OVP limit.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.TriggerSource">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.TriggeredCurrentLimit">
|
||||
<summary>
|
||||
The value to which the power supply sets the current limit after a trigger event occurs, in Amps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.TriggeredVoltageLevel">
|
||||
<summary>
|
||||
The value to which the power supply sets the voltage level after a trigger event occurs, in Volts.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.DCPwr.IIviDCPwrOutput.VoltageLevel">
|
||||
<summary>
|
||||
The voltage level the DC power supply attempts to generate, in Volts.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.IIviDCPwrOutputCollection">
|
||||
<summary>
|
||||
IviDCPwr class-compliant IIviDCPwrOutputs collection interface
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.IIviDCPwrTrigger">
|
||||
<summary>
|
||||
IviDCPwr class-compliant IIviDCPwrTrigger interface
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrTrigger.Abort">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrTrigger.Initiate">
|
||||
<summary>
|
||||
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
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IIviDCPwrTrigger.SendSoftwareTrigger">
|
||||
<summary>
|
||||
Supplies a trigger signal when the IIviDCPwrOutput.TriggerSource property is set to a software trigger.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.CurrentLimitBehavior">
|
||||
<summary>
|
||||
IviDCPwr class-compliant values for current limit behavior.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.CurrentLimitBehavior.Regulate">
|
||||
<summary>
|
||||
Output voltage is restricted such that the output current is not greater than the value of the Current Limit property.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.CurrentLimitBehavior.Trip">
|
||||
<summary>
|
||||
When the output current is equal to or greater than the value of the Current Limit property, the output is disabled.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.IviDCPwr">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IviDCPwr.Create(System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDCPwr driver to be created.</param>
|
||||
<returns>
|
||||
An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IviDCPwr.Create(System.String,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDCPwr driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<returns>
|
||||
An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IviDCPwr.Create(System.String,System.Boolean,System.Boolean,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDCPwr driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Ivi.DCPwr.IviDCPwr.Create(System.String,System.Boolean,System.Boolean,Ivi.Driver.LockType,System.String,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDCPwr driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="lockType">Specifies whether to use .NET AppDomain-wide locking or machine-wide locking.</param>
|
||||
<param name="accessKey">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. </param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviDCPwr interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.MeasurementType">
|
||||
<summary>
|
||||
IviDCPwr class-compliant values measurement type.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.MeasurementType.Current">
|
||||
<summary>
|
||||
Current is measured.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.MeasurementType.Voltage">
|
||||
<summary>
|
||||
Voltage is measured.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.OutputState">
|
||||
<summary>
|
||||
IviDCPwr class-compliant values for output state.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.OutputState.ConstantVoltage">
|
||||
<summary>
|
||||
A constant voltage condition.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.OutputState.ConstantCurrent">
|
||||
<summary>
|
||||
A constant current condition.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.OutputState.OverVoltage">
|
||||
<summary>
|
||||
An over-voltage condition.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.OutputState.OverCurrent">
|
||||
<summary>
|
||||
An over-current condition.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.OutputState.Unregulated">
|
||||
<summary>
|
||||
An unregulated condition.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.DCPwr.RangeType">
|
||||
<summary>
|
||||
IviDCPwr class-compliant values for the range type.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.RangeType.Current">
|
||||
<summary>
|
||||
Current range.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.DCPwr.RangeType.Voltage">
|
||||
<summary>
|
||||
Voltage range.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,606 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Ivi.Dmm</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Ivi.Dmm.Auto">
|
||||
<summary>IVI Dmm values for automatic mode of operation.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.Auto.Off">
|
||||
<summary>
|
||||
Specifies that the Dmm set automatic value selection off.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.Auto.On">
|
||||
<summary>
|
||||
Specifies that the Dmm set automatic value selection on.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.Auto.Once">
|
||||
<summary>
|
||||
Specifies that the Dmm automatically select the value once, and then set automatic value selection off.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.ApertureTimeUnits">
|
||||
<summary>IVI DMM class-compliant values for aperture time units.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ApertureTimeUnits.Seconds">
|
||||
<summary>Specifies seconds for aperture time units.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ApertureTimeUnits.PowerlineCycles">
|
||||
<summary>Specifies powerline cycles for aperture time units.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.Errors">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.Errors.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.Errors.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IviDmm">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IviDmm.Create(System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDmm driver to be created.</param>
|
||||
<returns>
|
||||
An IIviDmm interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IviDmm.Create(System.String,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDmm driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<returns>
|
||||
An IIviDmm interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IviDmm.Create(System.String,System.Boolean,System.Boolean,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDmm driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviDmm interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IviDmm.Create(System.String,System.Boolean,System.Boolean,Ivi.Driver.LockType,System.String,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDmm driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="lockType">Specifies whether to use .NET AppDomain-wide locking or machine-wide locking.</param>
|
||||
<param name="accessKey">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. </param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviDmm interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.MeasurementFunction">
|
||||
<summary>IVI DMM class-compliant values for Function</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.DCVolts">
|
||||
<summary>Specifies that the Dmm measure DC voltage.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.ACVolts">
|
||||
<summary>Specifies that the Dmm measure AC voltage.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.DCCurrent">
|
||||
<summary>Specifies that the Dmm measure DC current.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.ACCurrent">
|
||||
<summary>Specifies that the Dmm measure AC current.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.TwoWireResistance">
|
||||
<summary>Specifies that the Dmm measure 2-wire resistance.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.FourWireResistance">
|
||||
<summary>Specifies that the Dmm measure 4-wire resistance.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.ACPlusDCVolts">
|
||||
<summary>Specifies that the Dmm measure AC plus DC voltage.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.ACPlusDCCurrent">
|
||||
<summary>Specifies that the Dmm measure AC plus DC current.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.Frequency">
|
||||
<summary>Specifies that the Dmm measure frequency.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.Period">
|
||||
<summary>Specifies that the Dmm measure period.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.MeasurementFunction.Temperature">
|
||||
<summary>Specifies that the Dmm measure temperature.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmm">
|
||||
<summary>IVI DMM class-compliant root interface</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmm.Configure(Ivi.Dmm.MeasurementFunction,System.Double,System.Double)">
|
||||
<summary>Configures the Function, Range, and Resolution properties.</summary>
|
||||
<param name="measurementFunction">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.</param>
|
||||
<param name="range">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.</param>
|
||||
<param name="resolution">Specifies the Resolution property. Units are determined by Function.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmm.Configure(Ivi.Dmm.MeasurementFunction,Ivi.Dmm.Auto,System.Double)">
|
||||
<summary>Configures the Function, AutoRange, and Resolution properties. If the value of the Auto Range parameter is
|
||||
'On', then the Resolution parameter is ignored.</summary>
|
||||
<param name="measurementFunction">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.</param>
|
||||
<param name="autoRange">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.</param>
|
||||
<param name="resolution">Specifies the Resolution property. Units are determined by Function.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.MeasurementFunction">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.Range">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.AutoRange">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.Resolution">
|
||||
<summary>The measurement resolution in absolute units. Units are determined by Function.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.AC">
|
||||
<summary>Reference to the class-compliant IIviDmmAc interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.Advanced">
|
||||
<summary>Reference to the class-compliant IIviDmmAdvanced interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.Frequency">
|
||||
<summary>Reference to the class-compliant IIviDmmFrequency interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.Measurement">
|
||||
<summary>Reference to the class-compliant IIviDmmMeasurement interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.Temperature">
|
||||
<summary>Reference to the class-compliant IIviDmmTemperature interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmm.Trigger">
|
||||
<summary>Reference to the class-compliant IIviDmmTrigger interface</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmAC">
|
||||
<summary>IVI DMM class-compliant AC interface</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmAC.ConfigureBandwidth(System.Double,System.Double)">
|
||||
<summary>Configures the FrequencyMax and FrequencyMin properties for DMMs that take AC voltage or AC current
|
||||
measurements.</summary>
|
||||
<param name="minFreq">Specifies the FrequencyMin property. It is the minimum frequency component of the input signal for AC measurements.</param>
|
||||
<param name="maxFreq">Specifies the FrequencyMax property. It is the maximum frequency component of the input signal for AC measurements.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmAC.FrequencyMax">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmAC.FrequencyMin">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmAdvanced">
|
||||
<summary>IVI DMM class-compliant advanced features interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmAdvanced.ApertureTime">
|
||||
<summary>The measurement aperture time (also known as integration time) based on the present configuration.
|
||||
Units are specified by the property ApertureTimeUnits.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmAdvanced.ApertureTimeUnits">
|
||||
<summary>Specifies whether the aperture time is express in seconds or powerline cycles.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmAdvanced.AutoZero">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmAdvanced.PowerlineFrequency">
|
||||
<summary>The power line frequency in Hertz. This property is used when ApertureTimeUnits is PowerlineCycles.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmFrequency">
|
||||
<summary>IVI DMM class-compliant frequency interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmFrequency.VoltageRange">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmFrequency.VoltageAutoRange">
|
||||
<summary>Indicates whether the frequency voltage range is set automatically by the instrument.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmMeasurement">
|
||||
<summary>IVI DMM class-compliant measurement interface</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.Abort">
|
||||
<summary>Aborts a previously initiated measurement and returns the DMM to the idle state.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.Fetch(Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>Returns the measured value from a measurement that the Initiate method initiates.</summary>
|
||||
<param name="maximumTime">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.</param>
|
||||
<returns>The measured value. Out of range testing may be performed by using the IsOutOfRange,
|
||||
IsOverRange, or IsUnderRange methods.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.FetchMultiPoint(Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>Returns an array of values from a measurement that the Initiate method initiates.</summary>
|
||||
<param name="maximumTime">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.</param>
|
||||
<returns>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>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.FetchMultiPoint(Ivi.Driver.PrecisionTimeSpan,System.Int32)">
|
||||
<summary>Returns an array of values from a measurement that the Initiate method initiates.</summary>
|
||||
<param name="maximumTime">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.</param>
|
||||
<param name="numberOfMeasurements">The number of measurements to return, starting with the first measurement
|
||||
from the instrument.</param>
|
||||
<returns>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.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.Initiate">
|
||||
<summary>Initiates a measurement. When this method executes, the DMM leaves the idle state and waits for a
|
||||
trigger.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.IsOutOfRange(System.Double)">
|
||||
<summary>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.</summary>
|
||||
<param name="measurementValue">Pass the measurement value you obtain from one of the Read or Fetch functions.</param>
|
||||
<returns>True if the value is out of range, otherwise false.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.IsOverRange(System.Double)">
|
||||
<summary>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.</summary>
|
||||
<param name="measurementValue">Pass the measurement value you obtain from one of the Read or Fetch functions.</param>
|
||||
<returns>True if the value is over range, otherwise false.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.IsUnderRange(System.Double)">
|
||||
<summary>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.</summary>
|
||||
<param name="measurementValue">Pass the measurement value you obtain from one of the Read or Fetch functions.</param>
|
||||
<returns>True if the value is under range, otherwise false.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.Read(Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>Initiates a measurement, waits for the DMM to return to the idle state, and returns the measured
|
||||
value.</summary>
|
||||
<param name="maximumTime">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.</param>
|
||||
<returns>The measured value. Out of range testing may be performed by using the IsOutOfRange, IsOverRange,
|
||||
or IsUnderRange methods.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.ReadMultiPoint(Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>Initiates a measurement, waits for the DMM to return to the idle state, and returns an array of
|
||||
values.</summary>
|
||||
<param name="maximumTime">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.</param>
|
||||
<returns>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>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.ReadMultiPoint(Ivi.Driver.PrecisionTimeSpan,System.Int32)">
|
||||
<summary>Initiates a measurement, waits for the DMM to return to the idle state, and returns an array of
|
||||
values.</summary>
|
||||
<param name="maximumTime">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.</param>
|
||||
<param name="numberOfMeasurements">The number of measurements to return, starting with the first measurement
|
||||
from the instrument.</param>
|
||||
<returns>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.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMeasurement.SendSoftwareTrigger">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmMultiPoint">
|
||||
<summary>IVI DMM class-compliant multipoint interface</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmMultiPoint.Configure(System.Int32,System.Int32,System.String,Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>Configures multipoint TriggerCount, SampleCount, SampleTrigger and SampleInterval properties.</summary>
|
||||
<param name="triggerCount">Specifies the TriggerCount property. It is the number of triggers the DMM accepts before it returns to the idle state.</param>
|
||||
<param name="sampleCount">Specifies the SampleCount property. It is the number of measurements the DMM takes each time it receives a trigger.</param>
|
||||
<param name="sampleTrigger">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.</param>
|
||||
<param name="sampleInterval">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.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmMultiPoint.TriggerCount">
|
||||
<summary>The number of triggers the DMM accepts before it returns to the idle state.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmMultiPoint.SampleCount">
|
||||
<summary>The number of measurements the DMM takes each time it receives a trigger.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmMultiPoint.SampleInterval">
|
||||
<summary>The interval between samples in seconds. Applies only when Sample Count is greater than 1 and Sample
|
||||
Trigger is Interval.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmMultiPoint.SampleTrigger">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmRtd">
|
||||
<summary>IVI DMM class-compliant RTD interface</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmRtd.Configure(System.Double,System.Double)">
|
||||
<summary>Configures the Alpha and Resistance parameters for a resistance temperature device.</summary>
|
||||
<param name="alpha">Specifies the Alpha property. It is the alpha parameter for a resistance temperature device (RTD).</param>
|
||||
<param name="resistance">Specifies the Resistance property. It is the R0 parameter (resistance) for a resistance temperature device (RTD) also known as
|
||||
the RTD reference value.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmRtd.Alpha">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmRtd.Resistance">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmTemperature">
|
||||
<summary>IVI DMM class-compliant temperature interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTemperature.TransducerType">
|
||||
<summary>The type of device used to measure the temperature. This property affects instrument behavior only when
|
||||
Function is set to a temperature measurement.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTemperature.Rtd">
|
||||
<summary>Reference to the class-compliant IIviDmmRtd interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTemperature.Thermocouple">
|
||||
<summary>Reference to the class-compliant IIviDmmThermocouple interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTemperature.Thermistor">
|
||||
<summary>Reference to the class-compliant IIviDmmThermistor interface</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmThermistor">
|
||||
<summary>IVI DMM class-compliant thermistor interface</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmThermistor.Resistance">
|
||||
<summary>The resistance of the thermistor in Ohms. Applies only when the IIviDmmTemperature.TransducerType property
|
||||
is Thermistor.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmThermocouple">
|
||||
<summary>IVI DMM class-compliant thermocouple interface</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmThermocouple.Configure(Ivi.Dmm.ThermocoupleType,Ivi.Dmm.ReferenceJunctionType)">
|
||||
<summary>Configures the thermocouple Type and ReferenceJunctionType properties of a thermocouple. Applies only when
|
||||
the IIviDmmTemperature.TransducerType is Thermocouple.</summary>
|
||||
<param name="type">Specifies the Type property. It is the type of thermocouple used to measure the temperature.</param>
|
||||
<param name="referenceJunctionType">Specifies the ReferenceJunctionType property. It is the type of reference junction used in the reference junction compensation.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmThermocouple.FixedReferenceJunction">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmThermocouple.ReferenceJunctionType">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmThermocouple.Type">
|
||||
<summary>The type of thermocouple used to measure the temperature. Applies only when the IIviDmmTemperature.TransducerType
|
||||
is Thermocouple.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.IIviDmmTrigger">
|
||||
<summary>IVI DMM class-compliant trigger interface</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmTrigger.Configure(System.String,Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>Configures the trigger Source and Delay properties.</summary>
|
||||
<param name="triggerSource">Specifies the Source property.</param>
|
||||
<param name="triggerDelay">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.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Dmm.IIviDmmTrigger.Configure(System.String,System.Boolean)">
|
||||
<summary>Configures the trigger Source and AutoDelay properties.</summary>
|
||||
<param name="triggerSource">Specifies the Source property.</param>
|
||||
<param name="autoTriggerDelay">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.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTrigger.Slope">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTrigger.Delay">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTrigger.DelayAuto">
|
||||
<summary>Indicates whether the trigger delay is set automatically by the instrument.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTrigger.Source">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTrigger.MeasurementCompleteDestination">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Dmm.IIviDmmTrigger.MultiPoint">
|
||||
<summary>Reference to the class-compliant IIviDmmMultipoint interface</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.ReferenceJunctionType">
|
||||
<summary>IVI DMM class-compliant values for thermocouple ReferenceJunctionType</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ReferenceJunctionType.Fixed">
|
||||
<summary>Specifies that the Dmm use a user-determined fixed value for the junction compensation.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ReferenceJunctionType.Internal">
|
||||
<summary>Specifies that the Dmm use an internal sensor for the junction compensation.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.ThermocoupleType">
|
||||
<summary>IVI DMM class-compliant values for thermocouple Type</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.B">
|
||||
<summary>Specifies that the Dmm measure temperature using a type B thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.C">
|
||||
<summary>Specifies that the Dmm measure temperature using a type C thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.D">
|
||||
<summary>Specifies that the Dmm measure temperature using a type D thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.E">
|
||||
<summary>Specifies that the Dmm measure temperature using a type E thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.G">
|
||||
<summary>Specifies that the Dmm measure temperature using a type G thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.J">
|
||||
<summary>Specifies that the Dmm measure temperature using a type J thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.K">
|
||||
<summary>Specifies that the Dmm measure temperature using a type K thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.N">
|
||||
<summary>Specifies that the Dmm measure temperature using a type N thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.R">
|
||||
<summary>Specifies that the Dmm measure temperature using a type R thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.S">
|
||||
<summary>Specifies that the Dmm measure temperature using a type S thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.T">
|
||||
<summary>Specifies that the Dmm measure temperature using a type T thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.U">
|
||||
<summary>Specifies that the Dmm measure temperature using a type U thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.ThermocoupleType.V">
|
||||
<summary>Specifies that the Dmm measure temperature using a type V thermocouple.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.TransducerType">
|
||||
<summary>IVI DMM class-compliant values for temperature TransducerType</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.TransducerType.Thermocouple">
|
||||
<summary>Specifies that the Dmm measure temperature using a thermocouple.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.TransducerType.Thermistor">
|
||||
<summary>Specifies that the Dmm measure temperature using a thermistor.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.TransducerType.TwoWireRtd">
|
||||
<summary>Specifies that the Dmm measure temperature using a 2-wire resistive temperature device.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.TransducerType.FourWireRtd">
|
||||
<summary>Specifies that the Dmm measure temperature using a 4-wire resistive temperature device.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Dmm.Slope">
|
||||
<summary>IVI Driver values for Slope.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.Slope.Positive">
|
||||
<summary>
|
||||
Specifies positive slope.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Dmm.Slope.Negative">
|
||||
<summary>
|
||||
Specifies negative slope.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
@@ -0,0 +1,865 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Ivi.Downconverter</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Ivi.Downconverter.Band">
|
||||
<summary>
|
||||
Matched arrays of band crossing start and stop frequencies.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.Band.#ctor(System.Double,System.Double)">
|
||||
<summary>
|
||||
Constructs a band crossing start and stop frequency pair.
|
||||
</summary>
|
||||
<param name="startFrequency">The start frequency of the band. The units are Hertz. </param>
|
||||
<param name="stopFrequency">The stop frequency of the band. The units are Hertz.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.Band.StartFrequencies">
|
||||
<summary>
|
||||
The start frequency of the band.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.Band.StopFrequency">
|
||||
<summary>
|
||||
The stop frequency of the band.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.CalibratedStatus">
|
||||
<summary>
|
||||
Defined values indicating whether the instrument is currently in a valid self-calibrated state or whether it
|
||||
needs to be calibrated.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.CalibratedStatus.Calibrated">
|
||||
<summary>
|
||||
The downconverter is calibrated.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.CalibratedStatus.Uncalibrated">
|
||||
<summary>
|
||||
The downconverter requires further calibration.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.CalibratedStatus.Unknown">
|
||||
<summary>
|
||||
The downconverter cannot determine the status of the calibration.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.CalibrationStatus">
|
||||
<summary>
|
||||
Defined values for the downconverter calibration status.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.CalibrationStatus.Complete">
|
||||
<summary>
|
||||
The downconverter has completed the calibration.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.CalibrationStatus.InProgress">
|
||||
<summary>
|
||||
The downconverter is still performing the calibration.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.CalibrationStatus.Unknown">
|
||||
<summary>
|
||||
The downconverter cannot determine the status of the calibration.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.CalibrationStatus.Failed">
|
||||
<summary>
|
||||
The downconverter calibration failed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.Errors">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.Errors.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.Errors.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.Errors.FrequencyListUnknown">
|
||||
<summary>
|
||||
Looks up a localized string similar to The selected frequency list is not defined..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.Errors.List">
|
||||
<summary>
|
||||
Looks up a localized string similar to List name: .
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.FrequencyListUnknownException">
|
||||
<summary>
|
||||
Frequency list is unknown.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.FrequencyListUnknownException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message and frequency list name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="list">The name of the unknown frequency list.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.FrequencyListUnknownException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.FrequencyListUnknownException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.FrequencyListUnknownException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.FrequencyListUnknownException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.FrequencyListUnknownException.List">
|
||||
<summary>
|
||||
The name of the unknown frequency list.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.FrequencyListUnknownException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.FrequencyStepScaling">
|
||||
<summary>
|
||||
Defined values for selecting the step size scaling for RF input frequency stepped sweeps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.FrequencyStepScaling.Linear">
|
||||
<summary>
|
||||
Indicates linear scaling for step sizes in stepped sweeps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.FrequencyStepScaling.Logarithmic">
|
||||
<summary>
|
||||
Indicates logarithmic scaling for step sizes in stepped sweeps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.FrequencySweepMode">
|
||||
<summary>
|
||||
Defined values for the RF input frequency sweep mode.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.FrequencySweepMode.None">
|
||||
<summary>
|
||||
The RF input of the downconverter is a non-swept signal (continuous wave). Frequency settings from the base
|
||||
capability group are used.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.FrequencySweepMode.Sweep">
|
||||
<summary>
|
||||
The downconverter sweeps the RF input signal's frequency in analog form (non-stepped). Refer to the
|
||||
IviDownconverterAnalogyFrequencySweep extension group.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.FrequencySweepMode.Step">
|
||||
<summary>
|
||||
The downconverter sweeps the RF input signal's frequency in steps. Refer to the IviDownconverterFrequencyStep
|
||||
extension group.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.FrequencySweepMode.List">
|
||||
<summary>
|
||||
The downconverter uses a list to sweep the RF input signal frequency. Refer to the
|
||||
IviDownconverterFrequencySweepList extension group.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverter">
|
||||
<summary>
|
||||
IviDownconverter class-compliant root interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverter.Calibration">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterCalibration interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverter.ExternalLO">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterExternalLO interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverter.ExternalMixer">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterExternalMixer interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverter.IFOutput">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterIFOutput interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverter.ReferenceOscillator">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterReferenceOscillator interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverter.RFInput">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterRFInput interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterCalibration">
|
||||
<summary>
|
||||
IviDownconverter class-compliant Calibration interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterCalibration.Calibrate">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterCalibration.GetCalibratedStatus">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<returns>The calibrated status of the device.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterCalibration.GetCalibrationStatus">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<returns>The calibration status of the device.</returns>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterExternalLO">
|
||||
<summary>
|
||||
IviDownconverter class-compliant external local oscillator interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalLO.Enabled">
|
||||
<summary>
|
||||
True if the external LO is enabled, otherwise false.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalLO.Frequency">
|
||||
<summary>
|
||||
Specifies the frequency of the external LO. The units are Hertz.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterExternalMixer">
|
||||
<summary>
|
||||
IviDownconverter class-compliant external mixer interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalMixer.Bias">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterExternalMixerBias interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalMixer.Enabled">
|
||||
<summary>
|
||||
True if the external mixer is enabled, otherwise false.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalMixer.Harmonic">
|
||||
<summary>
|
||||
Specifies the harmonic number, that is, the order of the harmonic used for conversion.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalMixer.NumberOfPorts">
|
||||
<summary>
|
||||
Specifies the number of ports.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterExternalMixerBias">
|
||||
<summary>
|
||||
IviDownconverter class-compliant external mixer bias interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterExternalMixerBias.Configure(System.Double,System.Double)">
|
||||
<summary>
|
||||
This method configures the external mixer bias and the external mixer bias limit.
|
||||
</summary>
|
||||
<param name="bias">Specifies the bias current. The driver uses this value to set the External Mixer Bias
|
||||
Level property.</param>
|
||||
<param name="biasLimit">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.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalMixerBias.Enabled">
|
||||
<summary>
|
||||
True if the external mixer's bias is enabled, otherwise false.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalMixerBias.Level">
|
||||
<summary>
|
||||
Specifies the external mixer bias current. The units are Amps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterExternalMixerBias.Limit">
|
||||
<summary>
|
||||
Specifies the external mixer bias current limit. The units are Amps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterFrequencyStep">
|
||||
<summary>
|
||||
IviDownconverter class-compliant frequency step interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencyStep.ConfigureDwell(System.Boolean,Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>
|
||||
Configures the properties that control frequency stepping dwell.
|
||||
</summary>
|
||||
<param name="singleStepEnabled">Specifies whether the trigger initiates the next step. The driver uses this
|
||||
value to set the Frequency Step Single Step Enabled property. </param>
|
||||
<param name="dwell">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.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencyStep.ConfigureStartStop(System.Double,System.Double,Ivi.Downconverter.FrequencyStepScaling,System.Double)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="start">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.</param>
|
||||
<param name="stop">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.</param>
|
||||
<param name="scaling">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.</param>
|
||||
<param name="stepSize">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.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencyStep.Reset">
|
||||
<summary>
|
||||
Resets the current frequency step to the frequency step start value
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencyStep.Dwell">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencyStep.Scaling">
|
||||
<summary>
|
||||
Specifies the spacing of the steps.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencyStep.SingleStepEnabled">
|
||||
<summary>
|
||||
True if single step mode is enabled, otherwise false.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencyStep.Size">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencyStep.Start">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencyStep.Stop">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterFrequencySweep">
|
||||
<summary>
|
||||
IviDownconverter class-compliant frequency sweep interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweep.Configure(Ivi.Downconverter.FrequencySweepMode,System.String)">
|
||||
<summary>
|
||||
Configures the whether the downconverter's RF input frequency is fixed, swept, or stepped.
|
||||
</summary>
|
||||
<param name="mode">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.</param>
|
||||
<param name="triggerSource">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.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweep.GetBandInformation">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<returns>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.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweep.WaitUntilComplete(Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="maxTime">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.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweep.Analog">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterRFInputFrequencySweepNormal interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweep.IsSweeping">
|
||||
<summary>
|
||||
If true, the downconverter is currently sweeping the RF input signal.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweep.List">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterRFInputFrequencySweepList interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweep.Mode">
|
||||
<summary>
|
||||
The sweep mode of the RF input signal.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweep.NumberOfBands">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweep.Step">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterRFInputFrequencySweepStep interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweep.TriggerSource">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterFrequencySweepAnalog">
|
||||
<summary>
|
||||
IviDownconverter class-compliant frequency sweep analog interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweepAnalog.ConfigureStartStop(System.Double,System.Double)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="start">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.</param>
|
||||
<param name="stop">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.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweepAnalog.Start">
|
||||
<summary>
|
||||
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
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweepAnalog.Stop">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweepAnalog.Time">
|
||||
<summary>
|
||||
Specifies the duration of one LO sweep from start to stop frequency.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterFrequencySweepList">
|
||||
<summary>
|
||||
IviDownconverter class-compliant frequency sweep list interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweepList.ClearAll">
|
||||
<summary>
|
||||
Deletes all lists from the pool of defined lists.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweepList.ConfigureDwell(System.Boolean,Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>
|
||||
Configures the properties that control frequency list stepping.
|
||||
</summary>
|
||||
<param name="singleStepEnabled">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.</param>
|
||||
<param name="dwell">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.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweepList.CreateList(System.String,System.Double[])">
|
||||
<summary>
|
||||
Creates a named list of frequency for a list sweep
|
||||
</summary>
|
||||
<param name="name">Specifies the name of the frequency list to be created.</param>
|
||||
<param name="frequencyList">Specifies the array of frequency values to become elements of the list. The
|
||||
units are Hertz.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterFrequencySweepList.Reset">
|
||||
<summary>
|
||||
Resets the current list to the first entry value.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweepList.Dwell">
|
||||
<summary>
|
||||
Specifies the duration of one step. This property is ignored if the Frequency Sweep List Single Step
|
||||
Enabled property is set to True.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweepList.SelectedName">
|
||||
<summary>
|
||||
Selects the list to be active using the name specified with CreateList
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterFrequencySweepList.SingleStepEnabled">
|
||||
<summary>
|
||||
Enables single step mode.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterIFOutput">
|
||||
<summary>
|
||||
IviDownconverter class-compliant IF output interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterIFOutput.GetName(System.Int32)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="index">An index to the IF Output repeated capability between zero and the value of the IF
|
||||
Output Count property minus one</param>
|
||||
<returns>A physical repeated capability identifier defined by the specific driver.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterIFOutput.WaitUntilSettled(Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="maxTime">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.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.ActiveIFOutput">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.Count">
|
||||
<summary>
|
||||
Returns the number of IF Outputs available on the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.Enabled">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.FilterBandwidth">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.Frequency">
|
||||
<summary>
|
||||
Returns the frequency of the IF output. The units are Hertz.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.Gain">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.IsSettled">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterIFOutput.VideoDetectorBandwidth">
|
||||
<summary>
|
||||
Specifies the bandwidth of the IF output video detection filter. The units are Hertz.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterReferenceOscillator">
|
||||
<summary>
|
||||
IviDownconverter class-compliant reference oscillator interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterReferenceOscillator.Configure(System.String,System.Double)">
|
||||
<summary>
|
||||
Configures the downconverters reference oscillator.
|
||||
</summary>
|
||||
<param name="source">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.</param>
|
||||
<param name="frequency">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.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterReferenceOscillator.ExternalFrequency">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterReferenceOscillator.OutputEnabled">
|
||||
<summary>
|
||||
If True, the Reference output is enabled. If False, the Reference output is disabled.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterReferenceOscillator.Source">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IIviDownconverterRFInput">
|
||||
<summary>
|
||||
IviDownconverter class-compliant RF output interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterRFInput.GetName(System.Int32)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="index">An index to the RF Output repeated capability between zero and the value of the RF
|
||||
Output Count property minus one</param>
|
||||
<returns>A physical repeated capability identifier defined by the specific driver.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IIviDownconverterRFInput.SendSoftwareTrigger">
|
||||
<summary>
|
||||
Refer to IVI-3.3: Standard Cross Class Capabilities, Section 2 Software Triggering Capability for the
|
||||
prototype and complete description of this method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.ActiveRFInput">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.Attenuation">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.Bypass">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.CorrectionsEnabled">
|
||||
<summary>
|
||||
If true, automatic global corrections on the device is enabled, otherwisw false.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.Count">
|
||||
<summary>
|
||||
Returns the number of RF Inputs available on the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.Coupling">
|
||||
<summary>
|
||||
Specifies the coupling applied to RF input.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.Frequency">
|
||||
<summary>
|
||||
Specifies the frequency of the RF input. The units are Hertz.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.FrequencySweep">
|
||||
<summary>
|
||||
Reference to the class-compliant IIviDownconverterRFInputFrequencySweep interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.Downconverter.IIviDownconverterRFInput.PreselectorEnabled">
|
||||
<summary>
|
||||
Enables or disables bypassing the downconverter's pre-selection filter.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.InputCoupling">
|
||||
<summary>
|
||||
Defined values for the type of RF input coupling.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.InputCoupling.AC">
|
||||
<summary>
|
||||
The downconverter AC couples the RF input signal.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.Downconverter.InputCoupling.DC">
|
||||
<summary>
|
||||
The downconverter DC couples the RF input signal.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.Downconverter.IviDownconverter">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IviDownconverter.Create(System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDownconverter driver to be created.</param>
|
||||
<returns>
|
||||
An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IviDownconverter.Create(System.String,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDownconverter driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<returns>
|
||||
An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IviDownconverter.Create(System.String,System.Boolean,System.Boolean,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDownconverter driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Ivi.Downconverter.IviDownconverter.Create(System.String,System.Boolean,System.Boolean,Ivi.Driver.LockType,System.String,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviDownconverter driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="lockType">Specifies whether to use .NET AppDomain-wide locking or machine-wide locking.</param>
|
||||
<param name="accessKey">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. </param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviDownconverter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,968 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Ivi.LxiSync</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Ivi.LxiSync.Errors">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.AlarmDoesNotExist">
|
||||
<summary>
|
||||
Looks up a localized string similar to The specified alarm has not been defined..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.AlarmExists">
|
||||
<summary>
|
||||
Looks up a localized string similar to The specified alarm already exists..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.AlarmName">
|
||||
<summary>
|
||||
Looks up a localized string similar to Alarm name: .
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.AlarmTime">
|
||||
<summary>
|
||||
Looks up a localized string similar to Alarm time: .
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.AlarmTimeInvalid">
|
||||
<summary>
|
||||
Looks up a localized string similar to The alarm time is invalid..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.CannotRemoveReservedRepeatedCapability">
|
||||
<summary>
|
||||
Looks up a localized string similar to The reserved repeated capability cannot be removed from the collection..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.EventSourceDoesNotExist">
|
||||
<summary>
|
||||
Looks up a localized string similar to The specified event source has not been defined..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.EventSourceExists">
|
||||
<summary>
|
||||
Looks up a localized string similar to The specified event source already exists..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.EventSourceName">
|
||||
<summary>
|
||||
Looks up a localized string similar to Event source name: .
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.EventSourceNotSet">
|
||||
<summary>
|
||||
Looks up a localized string similar to The event source has not been specified..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.InvalidEventSource">
|
||||
<summary>
|
||||
Looks up a localized string similar to The specified event source is not valid..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.OutOfEventResources">
|
||||
<summary>
|
||||
Looks up a localized string similar to Out of event resources..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.RepeatedCapability">
|
||||
<summary>
|
||||
Looks up a localized string similar to Repeated capability: .
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.RepeatedCapabilityInstance">
|
||||
<summary>
|
||||
Looks up a localized string similar to Repeated capability instance: .
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.Errors.WiredOrModeInvalid">
|
||||
<summary>
|
||||
Looks up a localized string similar to The event source cannot operate in driven mode while serving as the wired-OR bias..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.AlarmDoesNotExistException">
|
||||
<summary>
|
||||
A specified alarm has not been defined.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmDoesNotExistException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message and alarm name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="alarmName">The alarm name.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmDoesNotExistException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmDoesNotExistException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmDoesNotExistException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmDoesNotExistException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.AlarmDoesNotExistException.AlarmName">
|
||||
<summary>
|
||||
The alarm name.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.AlarmDoesNotExistException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.AlarmExistsException">
|
||||
<summary>
|
||||
A specified alarm already exists.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmExistsException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message and alarm name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="alarmName">The alarm name.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmExistsException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmExistsException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmExistsException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmExistsException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.AlarmExistsException.AlarmName">
|
||||
<summary>
|
||||
The alarm name.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.AlarmExistsException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.AlarmTimeInvalidException">
|
||||
<summary>
|
||||
An alarm time is invalid.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmTimeInvalidException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="alarmName">The alarm name.</param>
|
||||
<param name="alarmTime">The specified (invalid) time.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmTimeInvalidException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmTimeInvalidException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmTimeInvalidException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.AlarmTimeInvalidException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.AlarmTimeInvalidException.AlarmName">
|
||||
<summary>
|
||||
The alarm name.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.AlarmTimeInvalidException.AlarmTime">
|
||||
<summary>
|
||||
The specified (invalid) time.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.AlarmTimeInvalidException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.ArmSourceDetection">
|
||||
<summary>Defined values for the style of arm source detection.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.ArmSourceDetection.Rise">
|
||||
<summary>The LXI device will arm on the rising edge of the arm source.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.ArmSourceDetection.Fall">
|
||||
<summary>The LXI device will arm on the falling edge of the arm source.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.ArmSourceDetection.High">
|
||||
<summary>The LXI device will arm while the arm source is high, that is, while it remains true.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.ArmSourceDetection.Low">
|
||||
<summary>The LXI device will arm while the arm source is low, that is, while it remains false.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException">
|
||||
<summary>
|
||||
A reserved repeated capability cannot be removed from one of the IviLxiSync collections.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified repeated capability and repeated capability
|
||||
instance.
|
||||
</summary>
|
||||
<param name="repeatedCapability">The name of the repeated capability.</param>
|
||||
<param name="repeatedCapabilityInstance">The repeated capability instance that is reserved.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.RepeatedCapability">
|
||||
<summary>
|
||||
The name of the repeated capability..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.RepeatedCapabilityInstance">
|
||||
<summary>
|
||||
The repeated capability instance that is reserved.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.CannotRemoveReservedRepeatedCapabilityException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.EventDriveMode">
|
||||
<summary>Event driver mode.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.EventDriveMode.Driven">
|
||||
<summary>Events are enabled in driven mode.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.EventDriveMode.Off">
|
||||
<summary>Events are not enabled in any mode.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.EventDriveMode.WiredOr">
|
||||
<summary>Events are enabled in wired-OR mode.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.EventSourceDoesNotExistException">
|
||||
<summary>
|
||||
A specified event source is not defined.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceDoesNotExistException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message and event source name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="eventSourceName">The name of the event source.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceDoesNotExistException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceDoesNotExistException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceDoesNotExistException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceDoesNotExistException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.EventSourceDoesNotExistException.EventSourceName">
|
||||
<summary>
|
||||
The name of the event source.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.EventSourceDoesNotExistException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.EventSourceExistsException">
|
||||
<summary>
|
||||
A specified event source already exists.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceExistsException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message and event source name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="eventSourceName">The name of the event source.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceExistsException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceExistsException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceExistsException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceExistsException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.EventSourceExistsException.EventSourceName">
|
||||
<summary>
|
||||
The name of the event source.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.EventSourceExistsException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.EventSourceNotSetException">
|
||||
<summary>
|
||||
The event source has not been specified.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceNotSetException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceNotSetException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceNotSetException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.EventSourceNotSetException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.EventSourceNotSetException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSync">
|
||||
<summary>LxiSync root interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSync.Arm">
|
||||
<summary>Reference to the ILxiSyncArm interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSync.EventLog">
|
||||
<summary>Reference to the ILxiSyncEventLog interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSync.Events">
|
||||
<summary>Reference to the ILxiSyncEvents interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSync.Time">
|
||||
<summary>Reference to the ILxiSyncTime interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSync.Trigger">
|
||||
<summary>Reference to the ILxiSyncTrigger interface.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncArm">
|
||||
<summary>LxiSync arm interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArm.Sources">
|
||||
<summary>Reference to the ILxiSyncArmSources interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArm.ArmCount">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArm.Delay">
|
||||
<summary>Specifies the delay from when the arm logic satisfied until the waiting for trigger state is entered.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArm.Alarms">
|
||||
<summary>Reference to the ILxiSyncArmAlarms interface.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncArmAlarm">
|
||||
<summary>LxiSync arm alarm interface.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmAlarm.Configure(System.Boolean,Ivi.Driver.PrecisionDateTime,Ivi.Driver.PrecisionTimeSpan,System.Int32)">
|
||||
<summary>Configures the most commonly configured properties of the arm alarm sub-system.</summary>
|
||||
<param name="enabled">If true, the arm alarm is enabled. Refer to the Enabled property.</param>
|
||||
<param name="time">Specifies the 1588 time. </param>
|
||||
<param name="period">The period of the arm alarm. Refer to the Period property for details.</param>
|
||||
<param name="repeatCount">The number of times to repeat the trigger. Refer to the RepeatCount property
|
||||
for details.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmAlarm.Time">
|
||||
<summary>The 1588 time at which the alarm will go off.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmAlarm.Period">
|
||||
<summary>The period of the arm alarm; that is, the amount of time that transpires before the alarm
|
||||
repeats.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmAlarm.RepeatCount">
|
||||
<summary>The number of times to repeat the trigger at the period specified by the Period
|
||||
property.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmAlarm.Enabled">
|
||||
<summary>If true, the arm alarm is enabled.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncArmAlarmCollection">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmAlarmCollection.DisableAll">
|
||||
<summary>Disables all arm alarms.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmAlarmCollection.Add(System.String)">
|
||||
<summary>Creates a new arm alarm</summary>
|
||||
<param name="alarmName">
|
||||
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.]
|
||||
</param>
|
||||
<returns>A reference to the new arm alarm object.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmAlarmCollection.Remove(System.String)">
|
||||
<summary>Removes an arm alarm.</summary>
|
||||
<param name="alarmName">Specifies the name of the arm alarm to remove.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmAlarmCollection.RemoveAllCustomArmAlarms">
|
||||
<summary>Removes all of the custom arm alarms that were added using the Add method.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncArmSource">
|
||||
<summary>LxiSync arm source interface.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmSource.Configure(System.Boolean,Ivi.LxiSync.ArmSourceDetection)">
|
||||
<summary>Configures the most commonly configured properties of the arm source sub-system.</summary>
|
||||
<param name="enabled">Enables or disables the arm source. Refer to the Enabled property.</param>
|
||||
<param name="detection">The style of arm source detection. Refer to the Detection property.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmSource.Enabled">
|
||||
<summary>If true, the arm source is enabled.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmSource.Detection">
|
||||
<summary>The style of arm source detection.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmSource.Filter">
|
||||
<summary>A filter for restricting arm sources.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmSource.EventId">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncArmSourceCollection">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmSourceCollection.Add(System.String)">
|
||||
<summary>Creates a new arm source.</summary>
|
||||
<param name="sourceName">
|
||||
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.]
|
||||
</param>
|
||||
<returns>A reference to the new arm source object.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmSourceCollection.Remove(System.String)">
|
||||
<summary>Removes an arm source.</summary>
|
||||
<param name="sourceName">The name of the arm source to remove.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmSourceCollection.DisableAll">
|
||||
<summary>Disables all arm sources.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncArmSourceCollection.RemoveAllCustomArmSources">
|
||||
<summary>Removes all of the custom arm sources that were added using the Add method.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncArmSourceCollection.OrEnabled">
|
||||
<summary>If true, OR-summing of the arm sources is enabled.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncEvent">
|
||||
<summary>LxiSync event interface.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncEvent.Configure(Ivi.LxiSync.EventDriveMode,System.String,System.String,Ivi.LxiSync.Slope)">
|
||||
<summary>Configures the most commonly configured properties of the event sub-system.</summary>
|
||||
<param name="driveMode">The event mode. Refer to the DriveMode property for details.</param>
|
||||
<param name="source">The signal which causes an event to be transmitted. Refer to the Source property.</param>
|
||||
<param name="destinationPath">The list of places to send the event. Refer to the DestinationPath property.</param>
|
||||
<param name="slope">The slope of the event signal. Refer to the Slope property for details.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncEvent.Source">
|
||||
<summary>The signal which causes an event to be transmitted.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncEvent.DestinationPath">
|
||||
<summary>The list of places to send the event.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncEvent.Slope">
|
||||
<summary>The slope of the inbound event that will cause the generation of an outbound event.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncEvent.DriveMode">
|
||||
<summary>The event mode - that is, how the event is transmitted.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncEventLog">
|
||||
<summary>LxiSync event log interface.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncEventLog.Clear">
|
||||
<summary>Removes all existing entries from the event log.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncEventLog.GetNextEntry">
|
||||
<summary>Retrieves and clears the oldest event log entry for the IVI session. </summary>
|
||||
<returns />
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncEventLog.EntryCount">
|
||||
<summary>Returns the number of event log entries available.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncEventLog.Enabled">
|
||||
<summary>if true, the event logging feature is enabled.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncEventCollection">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncEventCollection.DisableAll">
|
||||
<summary>Disables all events.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncEventCollection.Add(System.String)">
|
||||
<summary>Creates a new event.</summary>
|
||||
<param name="eventName">The name of the event to create.</param>
|
||||
<returns>A reference to the new event object.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncEventCollection.Remove(System.String)">
|
||||
<summary>Removes an event.</summary>
|
||||
<param name="eventName">The name of the event to remove.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncEventCollection.RemoveAllCustomEvents">
|
||||
<summary>Removes all of the custom events that were added using the Add function.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncEventCollection.WiredOrBiasMode">
|
||||
<summary>The Wired-Or Bias Mode interface lines for which the LXI device will serve as the wired-OR bias. </summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncTime">
|
||||
<summary>LxiSync time interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTime.SystemTime">
|
||||
<summary>The current 1588 time.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTime.IsMaster">
|
||||
<summary>Indicates if this device is the 1588 master.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTime.IsSynchronized">
|
||||
<summary>Indicates if the device is synchronized.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncTrigger">
|
||||
<summary>LxiSync trigger interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTrigger.Sources">
|
||||
<summary>Reference to the ILxiSyncTriggerSources interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTrigger.TriggerCount">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTrigger.Alarms">
|
||||
<summary>Reference to the ILxiSyncTriggerAlarms interface.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTrigger.TriggerSource">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncTriggerAlarm">
|
||||
<summary>LxiSync trigger alarm interface.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerAlarm.Configure(Ivi.Driver.PrecisionDateTime,Ivi.Driver.PrecisionTimeSpan,System.Int32)">
|
||||
<summary>Configures the most commonly configured properties of the trigger alarm sub-system.</summary>
|
||||
<param name="time">The 1588 time of the trigger alarm. Refer to the Time parameter for details.</param>
|
||||
<param name="period">The period of the trigger alarm. Refer to the Period parameter for details.</param>
|
||||
<param name="repeatCount">The number of times to repeat the trigger at the period specified by the
|
||||
period parameter. Refer to the RepeatCount property.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerAlarm.Period">
|
||||
<summary>The period of the trigger alarm; that is, the amount of time that transpires before the alarm
|
||||
repeats.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerAlarm.RepeatCount">
|
||||
<summary>The number of times to repeat the trigger at the period specified by the Period property.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerAlarm.Time">
|
||||
<summary>The time at which the alarm will go off.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerAlarm.Enabled">
|
||||
<summary>If true, the trigger alarm is enabled.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncTriggerAlarmCollection">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerAlarmCollection.Add(System.String)">
|
||||
<summary>This function creates a new trigger alarm</summary>
|
||||
<param name="alarmName">
|
||||
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.]
|
||||
</param>
|
||||
<returns>A reference to the new trigger alarm object.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerAlarmCollection.DisableAll">
|
||||
<summary>This function disables all trigger alarms.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerAlarmCollection.Remove(System.String)">
|
||||
<summary>This function removes a trigger alarm.</summary>
|
||||
<param name="alarmName">Specifies the name of the trigger alarm to remove.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerAlarmCollection.RemoveAllTriggerAlarms">
|
||||
<summary>This function removes all of the trigger alarms that were added using the Add Trigger Alarm function.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncTriggerSource">
|
||||
<summary>LxiSync trigger source interface.</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerSource.Configure(Ivi.Driver.PrecisionTimeSpan,Ivi.LxiSync.Slope)">
|
||||
<summary>Configures the most commonly configured properties of the trigger source sub-system.</summary>
|
||||
<param name="delay">The trigger source delay. Refer to the Delay property for details.</param>
|
||||
<param name="detection">The slope of the trigger source. Refer to the Detection property.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerSource.Delay">
|
||||
<summary>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.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerSource.Detection">
|
||||
<summary>The slope of the trigger source.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerSource.EventId">
|
||||
<summary>The LAN event identifier that is associated with this trigger source.</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.IIviLxiSyncTriggerSource.Filter">
|
||||
<summary>The filter for restricting trigger sources.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.IIviLxiSyncTriggerSourceCollection">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerSourceCollection.Add(System.String)">
|
||||
<summary>
|
||||
This function creates a new trigger source.
|
||||
</summary>
|
||||
<param name="sourceName">
|
||||
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.]
|
||||
</param>
|
||||
<returns>A reference to the new trigger source object.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerSourceCollection.Remove(System.String)">
|
||||
<summary>This function removes a trigger source.</summary>
|
||||
<param name="sourceName">Specifies the name of the trigger source to remove.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.IIviLxiSyncTriggerSourceCollection.RemoveAllCustomTriggerSources">
|
||||
<summary>This function removes all of the custom trigger sources that were added using the Add Trigger Source
|
||||
function.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.InvalidEventSourceException">
|
||||
<summary>
|
||||
A specified event source is not valid.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.InvalidEventSourceException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message and event source name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="eventSourceName">The name of the event source.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.InvalidEventSourceException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.InvalidEventSourceException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.InvalidEventSourceException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.InvalidEventSourceException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.InvalidEventSourceException.EventSourceName">
|
||||
<summary>
|
||||
The name of the event source.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.InvalidEventSourceException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.WiredOrBiasModeLines">
|
||||
<summary>Defined values for the Wired-Or Bias Mode interface lines.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.None">
|
||||
<summary>No LXI lines.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi0">
|
||||
<summary>Line LXI0.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi1">
|
||||
<summary>Line LXI1.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi2">
|
||||
<summary>Line LXI2.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi3">
|
||||
<summary>Line LXI3.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi4">
|
||||
<summary>Line LXI4.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi5">
|
||||
<summary>Line LXI5.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi6">
|
||||
<summary>Line LXI6.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.WiredOrBiasModeLines.Lxi7">
|
||||
<summary>Line LXI7.</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.WiredOrModeInvalidException">
|
||||
<summary>
|
||||
The event source cannot operate in driven mode while serving as the wired-OR bias.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.WiredOrModeInvalidException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.WiredOrModeInvalidException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.WiredOrModeInvalidException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.WiredOrModeInvalidException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.WiredOrModeInvalidException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.OutOfEventResourcesException">
|
||||
<summary>
|
||||
The channel is not enabled.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.OutOfEventResourcesException.#ctor">
|
||||
<summary>
|
||||
The driver is out of event resources.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.OutOfEventResourcesException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.OutOfEventResourcesException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.LxiSync.OutOfEventResourcesException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.LxiSync.OutOfEventResourcesException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.LxiSync.Slope">
|
||||
<summary>IVI LxiSync values for Slope.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.Slope.Positive">
|
||||
<summary>
|
||||
Positive slope.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.LxiSync.Slope.Negative">
|
||||
<summary>
|
||||
Negative slope.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
@@ -0,0 +1,626 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Ivi.PwrMeter</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Ivi.PwrMeter.Errors">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.Errors.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.Errors.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.Errors.ChannelName">
|
||||
<summary>
|
||||
Looks up a localized string similar to Channel name: .
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.Errors.ChannelNotEnabled">
|
||||
<summary>
|
||||
Looks up a localized string similar to The channel is not enabled for measurement..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeter">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant root interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeter.Channels">
|
||||
<summary>
|
||||
A reference to the IIviPwrMeterChannels interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeter.Measurement">
|
||||
<summary>
|
||||
A reference to the IIviPwrMeterMeasurement interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeter.ReferenceOscillator">
|
||||
<summary>
|
||||
A reference to the IIviPwrReferenceOscillator interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeter.Trigger">
|
||||
<summary>
|
||||
A reference to the IIviPwrMeterTrigger interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterAveraging">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant averaging interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterAveraging.CountAuto">
|
||||
<summary>
|
||||
If true, auto-averaging is enabled for a particular input channel, otherwise it is disabled.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterAveraging.Count">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterChannel">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant channel interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterChannel.Calibrate">
|
||||
<summary>
|
||||
Performs a calibration on a particular channel and sensor. This method returns only after calibration is
|
||||
complete.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterChannel.Zero">
|
||||
<summary>
|
||||
Performs a zero operation on a particular channel.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannel.Averaging">
|
||||
<summary>
|
||||
A reference to the IIviPwrMeterAveraging interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannel.CorrectionFrequency">
|
||||
<summary>
|
||||
The frequency of the input signal in Hertz. The instrument uses this value to determine the appropriate
|
||||
correction factor for the sensor.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannel.DutyCycle">
|
||||
<summary>
|
||||
A reference to the IIviPwrMeterDutyCycleCorrection interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannel.Enabled">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannel.MeasurementState">
|
||||
<summary>
|
||||
The status of the measurement initiated by the Initiate function. The driver returns OperationState.Complete
|
||||
only when measurements are complete on all enabled channels.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannel.Offset">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannel.Range">
|
||||
<summary>
|
||||
A reference to the IIviPwrMeterRange interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterChannelCollection">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant channels interface. A particular channel can be referenced using the indexer.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterChannelCollection.Zero">
|
||||
<summary>
|
||||
Performs a zero operation on all enabled channels
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannelCollection.CalibrationState">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<remarks>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.</remarks>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannelCollection.ZeroState">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<remarks>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.</remarks>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterChannelCollection.Units">
|
||||
<summary>
|
||||
Specifies the unit to which the RF power is converted after measurement
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterDutyCycleCorrection">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant duty cycle correction interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterDutyCycleCorrection.Configure(System.Boolean,System.Double)">
|
||||
<summary>
|
||||
Enables or disables duty cycle correction and sets the duty cycle for pulse power measurements
|
||||
</summary>
|
||||
<param name="enabled">If true, duty cycle correction is enabled. Refer to the Enabled property for
|
||||
details.</param>
|
||||
<param name="correction">The duty cycle correction value. Refer to the Value property for details.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterDutyCycleCorrection.Enabled">
|
||||
<summary>
|
||||
If true, duty cycle correction is enabled for the particular channel.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterDutyCycleCorrection.Value">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterInternalTrigger">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant internal trigger interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterInternalTrigger.Configure(System.String,Ivi.PwrMeter.Slope)">
|
||||
<summary>
|
||||
Configures the internal trigger event source and slope.
|
||||
</summary>
|
||||
<param name="eventSource">The name of the channel to use as the internal trigger event source. Refer to
|
||||
the EventSource property for details.</param>
|
||||
<param name="slope">The internal trigger slope. Refer to the Slope property for details.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterInternalTrigger.EventSource">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterInternalTrigger.Level">
|
||||
<summary>
|
||||
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
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterInternalTrigger.Slope">
|
||||
<summary>
|
||||
The trigger slope. The power meter may trigger on the rising or falling edge of the measurement signal.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterMeasurement">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant measurement interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.Abort">
|
||||
<summary>
|
||||
Aborts all previously initiated measurements and returns the power meter to the Idle state.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.Configure(Ivi.PwrMeter.MeasurementOperator,System.String,System.String)">
|
||||
<summary>
|
||||
Configures the instrument to take single or dual channel measurements
|
||||
</summary>
|
||||
<param name="measurementOperator">The math function applied to the operands.</param>
|
||||
<param name="operand1">The name of the channel from which the value for the first operand of the math
|
||||
function is measured.</param>
|
||||
<param name="operand2">The name of the channel from which the value for the second operand of the math
|
||||
function is measured.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.Fetch">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<returns>Measured value</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.FetchChannel(System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="channelName">The name of the channel from which to fetch the measurement.</param>
|
||||
<returns>Measured value</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.Initiate">
|
||||
<summary>
|
||||
Initiates a measurement on all enabled channels. When this method executes, the power meter leaves the
|
||||
Idle state
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.GetMeasurementComplete">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.Read(Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="maximumTime">The maximum time to wait for a return value.</param>
|
||||
<returns>Measured value.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.ReadChannel(System.String,Ivi.Driver.PrecisionTimeSpan)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="channelName">The name of the channel from which to take the measurement.</param>
|
||||
<param name="maxTime">The maximum time to wait for a return value.</param>
|
||||
<returns>Measured value.</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterMeasurement.SendSoftwareTrigger">
|
||||
<summary>
|
||||
Sends a software trigger to the instrument
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterRange">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant meter and sensor range selection interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterRange.Configure(System.Double,System.Double)">
|
||||
<summary>
|
||||
Configures the lower and upper range values for a particular channel
|
||||
</summary>
|
||||
<param name="lower">The lower limit of the expected value of the measurement. Refer to the Lower
|
||||
property for details.</param>
|
||||
<param name="upper">The upper limit of the expected value of the measurement. Refer to the Upper
|
||||
property for details.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterRange.Configure(System.Boolean)">
|
||||
<summary>
|
||||
Configures the lower and upper range values for a particular channel
|
||||
</summary>
|
||||
<param name="rangeAuto">If True, the instrument automatically sets the best range for the measurement. If
|
||||
False, the range is set using the Upper and Lower properties.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterRange.Auto">
|
||||
<summary>
|
||||
If True, the instrument automatically sets the best range for the measurement. If False, the range is
|
||||
set using the Upper and Lower properties.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterRange.Lower">
|
||||
<summary>
|
||||
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
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterRange.Upper">
|
||||
<summary>
|
||||
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
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterReferenceOscillator">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant reference oscillator interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IIviPwrMeterReferenceOscillator.Configure(System.Double,System.Double)">
|
||||
<summary>
|
||||
Configures the frequency and power level of the signal generated by the reference oscillator.
|
||||
</summary>
|
||||
<param name="frequency">The frequency of the reference oscillator. Refer to the Frequency property for
|
||||
details.</param>
|
||||
<param name="level">The power level of the reference oscillator. Refer to the Level property for details.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterReferenceOscillator.Enabled">
|
||||
<summary>
|
||||
If true, the internal reference oscillator is enabled, otherwise it is not enabled.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterReferenceOscillator.Frequency">
|
||||
<summary>
|
||||
The frequency of the signal generated by the reference oscillator in Hertz.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterReferenceOscillator.Level">
|
||||
<summary>
|
||||
The power level of the signal generated by the reference oscillator in dBm.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IIviPwrMeterTrigger">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant trigger interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterTrigger.Source">
|
||||
<summary>
|
||||
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.]
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.IIviPwrMeterTrigger.Internal">
|
||||
<summary>
|
||||
A reference to the IIviPwrMeterInternalTrigger interface.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.ChannelNotEnabledException">
|
||||
<summary>
|
||||
The channel is not enabled.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.ChannelNotEnabledException.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified channel name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="channelName">The channel name.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.ChannelNotEnabledException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.ChannelNotEnabledException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with a specified channel name.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.ChannelNotEnabledException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="message">The message that describes the error.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference
|
||||
if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.ChannelNotEnabledException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the class with serialized data.
|
||||
</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the
|
||||
exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the
|
||||
source or destination.</param>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.ChannelNotEnabledException.ChannelName">
|
||||
<summary>
|
||||
The channel name.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ivi.PwrMeter.ChannelNotEnabledException.Message">
|
||||
<summary>
|
||||
Gets the error message.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.IviPwrMeter">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IviPwrMeter.Create(System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviPwrMeter driver to be created.</param>
|
||||
<returns>
|
||||
An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IviPwrMeter.Create(System.String,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviPwrMeter driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<returns>
|
||||
An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IviPwrMeter.Create(System.String,System.Boolean,System.Boolean,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviPwrMeter driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Ivi.PwrMeter.IviPwrMeter.Create(System.String,System.Boolean,System.Boolean,Ivi.Driver.LockType,System.String,System.String)">
|
||||
<summary>
|
||||
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.
|
||||
</summary>
|
||||
<param name="name">An IVI configuration store logical name or driver session name that refers to the
|
||||
IVI.NET class-compliant IviPwrMeter driver to be created.</param>
|
||||
<param name="idQuery">If true, verify the ID of the instrument.</param>
|
||||
<param name="reset">If true, reset the instrument.</param>
|
||||
<param name="lockType">Specifies whether to use .NET AppDomain-wide locking or machine-wide locking.</param>
|
||||
<param name="accessKey">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. </param>
|
||||
<param name="options">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.
|
||||
</param>
|
||||
<returns>
|
||||
An IIviPwrMeter interface reference for the specific driver that is referred to by the provided IVI
|
||||
configuration store logical name or driver session name.
|
||||
</returns>
|
||||
<remarks>
|
||||
Examples of legal values for the options parameter are:
|
||||
<para>* ""</para>
|
||||
<para>* "Simulate=true"</para>
|
||||
<para>* "Simulate=true,Cache=false,QueryInstrStatus=false"</para>
|
||||
<para>* "Simulate=true,Cache=false,DriverSetup=Trace=false"</para>
|
||||
<para>Note that 'Simulate', 'Cache', and 'QueryInstrStatus' are standard IVI features, while
|
||||
'Trace=false' is meaningful only to the specific driver being instantiated.</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.MeasurementOperator">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant values for measurement operator
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.MeasurementOperator.None">
|
||||
<summary>
|
||||
No operation - the measurement returns the first operand.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.MeasurementOperator.Difference">
|
||||
<summary>
|
||||
Subtraction - the measurement returns the difference between the first operand and the second operand.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.MeasurementOperator.Sum">
|
||||
<summary>
|
||||
Addition - the measurement returns the sum of the first operand and the second operand.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.MeasurementOperator.Quotient">
|
||||
<summary>
|
||||
Division - the measurement returns first operand divided by the second operand
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.OperationState">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant values for operation state
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.OperationState.InProgress">
|
||||
<summary>
|
||||
The power meter is still performing the operation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.OperationState.Complete">
|
||||
<summary>
|
||||
The power meter has completed the operation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.OperationState.Unknown">
|
||||
<summary>
|
||||
The power meter cannot determine the status of the operation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.Units">
|
||||
<summary>
|
||||
IVI PwrMeter class-compliant values for units
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.Units.dBm">
|
||||
<summary>
|
||||
dBm.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.Units.dBmV">
|
||||
<summary>
|
||||
dB millivolts.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.Units.dBuV">
|
||||
<summary>
|
||||
dB microvolts.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.Units.Watts">
|
||||
<summary>
|
||||
Watts.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ivi.PwrMeter.Slope">
|
||||
<summary>IviPwrMeter class defined values for slope.</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.Slope.Positive">
|
||||
<summary>
|
||||
A positive (rising edge) slope.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ivi.PwrMeter.Slope.Negative">
|
||||
<summary>
|
||||
A negative (falling edge) slope.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user