Big changes
This commit is contained in:
@@ -0,0 +1,296 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using NLog;
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// A simulated video recorder
|
||||
/// </summary>
|
||||
public class VideoRecorderSim : IVideoRecorder
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private const string _SIM_VIDEO_FILE_NAME = "SimVideo";
|
||||
private string _lastGrabFileName;
|
||||
|
||||
public string DetailedStatus { get; protected set; }
|
||||
|
||||
public bool DisplayEnabled { get; set; }
|
||||
public bool FrontPanelEnabled { get; set; }
|
||||
|
||||
public InstrumentMetadata Info { get; set; }
|
||||
|
||||
public string Name { get; protected set; }
|
||||
|
||||
public SelfTestResult SelfTestResult => PerformSelfTest();
|
||||
|
||||
public State Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateClassFunctions
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~VideoRecorderSim()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PublicClassFunctions
|
||||
/// <summary>
|
||||
/// VideoRecorderSim factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public VideoRecorderSim(string deviceName, IConfigurationManager configurationManager, ILogger logger)
|
||||
{
|
||||
Name = deviceName;
|
||||
|
||||
_logger = logger;
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
}
|
||||
/// <summary>
|
||||
/// The sim constructor
|
||||
/// </summary>
|
||||
public VideoRecorderSim()
|
||||
{
|
||||
_lastGrabFileName = "";
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="videoFile"></param>
|
||||
/// <param name="attributeFile"></param>
|
||||
public void AddNcdfAttributes(string videoFile, string attributeFile)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Connect()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will create an empty video file in the user temp folder
|
||||
/// </summary>
|
||||
/// <param name="numberOfFrames"></param>
|
||||
/// <param name="format"></param>
|
||||
public void GrabVideoToDisk(uint numberOfFrames, VideoSaveFormat format)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
|
||||
// create a dummy file
|
||||
string tempDirectory = Path.GetTempPath();
|
||||
|
||||
string time = Util.GetTimeString();
|
||||
|
||||
if (format == VideoSaveFormat.BIN)
|
||||
{
|
||||
tempDirectory += time + _SIM_VIDEO_FILE_NAME + ".bin";
|
||||
}
|
||||
else if (format == VideoSaveFormat.NCDF)
|
||||
{
|
||||
tempDirectory += time + _SIM_VIDEO_FILE_NAME + ".ncdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("UnhandledExceptionEventArgs save format" + format);
|
||||
}
|
||||
|
||||
string simFileName = tempDirectory;
|
||||
|
||||
File.Create(simFileName);
|
||||
|
||||
_lastGrabFileName = simFileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="driveSpace1">The number of free Gigabytes</param>
|
||||
/// <param name="driveSpace2">The number of free Gigabytes</param>
|
||||
/// <param name="driveSpace3">The number of free Gigabytes</param>
|
||||
/// <param name="driveSpace4">The number of free Gigabytes</param>
|
||||
public void QueryHardDrive(ref float driveSpace1, ref float driveSpace2, ref float driveSpace3, ref float driveSpace4)
|
||||
{
|
||||
const float FREE_SPACE_IN_GB = 10.0f;
|
||||
const float FULL_IN_GB = 0.0f;
|
||||
|
||||
driveSpace1 = FREE_SPACE_IN_GB;
|
||||
driveSpace2 = FULL_IN_GB;
|
||||
driveSpace3 = FULL_IN_GB;
|
||||
driveSpace4 = FULL_IN_GB;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="fromFile"></param>
|
||||
/// <param name="toFile"></param>
|
||||
/// <param name="control"></param>
|
||||
public void MoveFile(string fromFile, string toFile, MoveControl control)
|
||||
{
|
||||
File.Move(fromFile, toFile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void ShowLiveVideo()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void StopLiveVideo()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will return the file created by GrabVideoToDisk()
|
||||
/// </summary>
|
||||
/// <param name="timeoutms"></param>
|
||||
/// <returns></returns>
|
||||
public string WaitForGrabToComplete(int timeoutms)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
|
||||
// return the last file that was created, and clear the last file name for the next time
|
||||
string lastFileName = _lastGrabFileName;
|
||||
_lastGrabFileName = "";
|
||||
return lastFileName;
|
||||
}
|
||||
|
||||
public bool ClearErrors()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
return SelfTestResult.Unknown;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Shutdown();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Disconnect();
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public byte[] GetSmallVideoFrame(string name, int nFrames, bool sensor, ref uint numBytesRead, bool deleteVideoFile)
|
||||
{
|
||||
return new byte[1024];
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.VideoRecorderSim</AssemblyName>
|
||||
<Product>Video Recorder Sim implementation</Product>
|
||||
<Description>Video Recorder 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.VideoRecorder.Contracts" Version="1.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,137 @@
|
||||
// **********************************************************************************************************
|
||||
// VideoRecorderSimFactory.cs
|
||||
// 2/20/2023
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
using NLog;
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
[ExportInstrumentFactory(ModelNumber = "VideoRecorderSimFactory")]
|
||||
public class VideoRecorderSimFactory : IInstrumentFactory
|
||||
{
|
||||
/// <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 VideoRecorderSimFactory(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 VideoRecorderSimFactory([Import(AllowDefault = false)] IConfigurationManager configManager,
|
||||
[Import(AllowDefault = true)] string defaultConfigPath = null)
|
||||
{
|
||||
DefaultPath = defaultConfigPath;
|
||||
|
||||
if (LogManager.Configuration == null)
|
||||
{
|
||||
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
|
||||
}
|
||||
|
||||
_configurationManager = configManager ?? GetConfigurationManager();
|
||||
_supportedInterfaces.Add(typeof(IVideoRecorder));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new VideoRecorderSim(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 VideoRecorderSim(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,371 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface to sending/receiving data over comm devices
|
||||
/// </summary>
|
||||
internal class CommDeviceNode : ICommDevice, IDisposable
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private ICommDevice _commDevice;
|
||||
private IWorkerInterface _socketReadWorker;
|
||||
private Thread _socketReadThread;
|
||||
private readonly string _name;
|
||||
private SelfTestResult _selfTestResult;
|
||||
private State _state;
|
||||
|
||||
private uint _commReadWorkerBufferSize;
|
||||
private uint _readWorkerRestTimeInMs;
|
||||
private MsgDevice _msgHandler;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateFuctions
|
||||
/// <summary>
|
||||
/// The finalizer. Necessary for quitting the read thread
|
||||
/// </summary>
|
||||
~CommDeviceNode()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Quit the threads associated with the node
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
State initialState = _state;
|
||||
|
||||
// close the socket and threads
|
||||
try
|
||||
{
|
||||
if (initialState == State.Ready)
|
||||
{
|
||||
Shutdown();
|
||||
_commDevice.Shutdown();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
|
||||
// dispose of the resources
|
||||
try
|
||||
{
|
||||
if (initialState == State.Ready)
|
||||
{
|
||||
_socketReadWorker.Dispose();
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PublicFuctions
|
||||
|
||||
/// <summary>
|
||||
/// The constructor
|
||||
/// </summary>
|
||||
/// <param name="name">The name of this instance</param>
|
||||
/// <param name="commDevice">The communication device</param>
|
||||
/// <param name="msgHandler">The message handler for this interface</param>
|
||||
/// <param name="commReadWorkerBufferSize">The number of bytes for the buffer internal to this class. Each individual read will read upto this buffer size (or until the timeout happens)</param>
|
||||
/// <param name="readWorkerRestTimeInMs">Number of ms to reset between read calls on the comm interface</param>
|
||||
public CommDeviceNode(string name, ICommDevice commDevice, MsgDevice msgHandler, uint commReadWorkerBufferSize = 100000, uint readWorkerRestTimeInMs = 10)
|
||||
{
|
||||
_name = name;
|
||||
_commDevice = commDevice;
|
||||
|
||||
_commReadWorkerBufferSize = commReadWorkerBufferSize;
|
||||
_readWorkerRestTimeInMs = readWorkerRestTimeInMs;
|
||||
_msgHandler = msgHandler;
|
||||
|
||||
Open();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts communication thread
|
||||
/// </summary>
|
||||
public void Open()
|
||||
{
|
||||
_socketReadWorker = new CommReadWorker(this, _msgHandler, _commReadWorkerBufferSize, _readWorkerRestTimeInMs);
|
||||
_socketReadThread = new Thread(_socketReadWorker.DoWork);
|
||||
|
||||
// start the read thread
|
||||
_socketReadThread.Start();
|
||||
|
||||
_selfTestResult = SelfTestResult.Unknown;
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// there is no error msg repository
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ClearErrors()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool DisplayEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DetailedStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return "This is a Comm Sim Device Node " + _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool FrontPanelEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public InstrumentMetadata Info
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
_commDevice.Initialize();
|
||||
_state = State.Ready;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the socket
|
||||
/// </summary>
|
||||
/// <param name="dataRead">The data that was read</param>
|
||||
/// <returns>the number of bytes read</returns>
|
||||
public uint Read(ref byte[] dataRead)
|
||||
{
|
||||
return _commDevice.Read(ref dataRead);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets communications
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
Close();
|
||||
Open();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="readTimeout"></param>
|
||||
public void SetReadTimeout(uint readTimeout)
|
||||
{
|
||||
_commDevice.SetReadTimeout(readTimeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SelfTestResult SelfTestResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selfTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public State Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close communications
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close communications
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
if (_state == State.Ready)
|
||||
{
|
||||
const int THREAD_QUIT_TIMEOUT_MS = 3000;
|
||||
|
||||
// tell the thread to quit
|
||||
_socketReadWorker.QuitWork();
|
||||
|
||||
// close the socket which the thread might be blocked on
|
||||
_commDevice.Shutdown();
|
||||
|
||||
if (_socketReadThread.IsAlive)
|
||||
{
|
||||
bool didThreadQuit = _socketReadThread.Join(THREAD_QUIT_TIMEOUT_MS);
|
||||
|
||||
if (didThreadQuit == false)
|
||||
{
|
||||
ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread did not quit as expected, aborting it");
|
||||
_socketReadThread.Abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread quit successfully after join", ErrorLogger.LogLevel.INFO);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLogger.Instance().Write("CommDeviceNode::Close() - Logging Thread quit successfully", ErrorLogger.LogLevel.INFO);
|
||||
}
|
||||
}
|
||||
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send data on the socket
|
||||
/// </summary>
|
||||
/// <param name="dataToSend">The data to send</param>
|
||||
/// <param name="numBytesToWrite">The number of bytes to write from the dataToSend buffer</param>
|
||||
/// <returns>The number of bytes sent</returns>
|
||||
public uint Write(byte[] dataToSend, uint numBytesToWrite)
|
||||
{
|
||||
return _commDevice.Write(dataToSend, numBytesToWrite);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Net.Sockets;
|
||||
using Raytheon.Instruments;
|
||||
using Raytheon.Common;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes raw data from an ICommDevice and throws it in a buffer
|
||||
/// </summary>
|
||||
internal class CommReadWorker : IWorkerInterface
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private ICommDevice _commNode;
|
||||
private MsgDevice _msgHandler;
|
||||
private bool _threadQuitControl;
|
||||
private AutoResetEvent _quitEvent;
|
||||
private byte[] _dataRead;
|
||||
private readonly uint _timeToRestBetweenReadsInMs;
|
||||
#endregion
|
||||
|
||||
#region PublicFuctions
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="commNode">The communication interface</param>
|
||||
/// <param name="msghandler">The message handler for received data</param>
|
||||
/// <param name="bufferSize">The number of bytes for the buffer internal to this class. Each individual read will read upto this buffer size (or until the timeout happens)</param>
|
||||
/// <param name="timeToRestBetweenReadsInMs">Number of ms to rest after a read call</param>
|
||||
public CommReadWorker(ICommDevice commNode, MsgDevice msghandler, uint bufferSize, uint timeToRestBetweenReadsInMs)
|
||||
{
|
||||
_commNode = commNode;
|
||||
_threadQuitControl = false;
|
||||
_msgHandler = msghandler;
|
||||
_quitEvent = new AutoResetEvent(false);
|
||||
_dataRead = new byte[bufferSize];
|
||||
_timeToRestBetweenReadsInMs = timeToRestBetweenReadsInMs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizer
|
||||
/// </summary>
|
||||
~CommReadWorker()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object. Needed for releasing thread/comm resources
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the socket and puts data into a buffer
|
||||
/// </summary>
|
||||
public void DoWork()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (_threadQuitControl == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
uint numBytesRead = _commNode.Read(ref _dataRead);
|
||||
|
||||
// add into buffer
|
||||
if (numBytesRead > 0)
|
||||
{
|
||||
_msgHandler.AddData(_dataRead, numBytesRead);
|
||||
}
|
||||
|
||||
// not using timeToRestBetweenReadsInMs. Just going to wait 1 ms and get back to the read
|
||||
if (_quitEvent.WaitOne(1))
|
||||
{
|
||||
ErrorLogger.Instance().Write("CommReadWorker::DoWork() - received signal to quit", ErrorLogger.LogLevel.INFO);
|
||||
_threadQuitControl = true;
|
||||
}
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
if (e.SocketErrorCode == SocketError.TimedOut)
|
||||
{
|
||||
//expected
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLogger.Instance().Write("CommReadWorker::DoWork() - " + e.Message, ErrorLogger.LogLevel.ERROR);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ErrorLogger.Instance().Write("CommReadWorker::DoWork() - " + e.Message, ErrorLogger.LogLevel.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
ErrorLogger.Instance().Write("CommReadWorker::DoWork() - exiting", ErrorLogger.LogLevel.INFO);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Commands the worker to stop
|
||||
/// </summary>
|
||||
public void QuitWork()
|
||||
{
|
||||
_quitEvent.Set();
|
||||
_threadQuitControl = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_quitEvent.Dispose();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// Singleton sending out messages
|
||||
/// </summary>
|
||||
internal class CommUtil
|
||||
{
|
||||
// class variables
|
||||
private static CommUtil _commUtilInstance;
|
||||
|
||||
/// <summary>
|
||||
/// Getter for this singleton
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
/// <returns>The instance of this class</returns>
|
||||
public static CommUtil Instance()
|
||||
{
|
||||
if (_commUtilInstance == null)
|
||||
{
|
||||
_commUtilInstance = new CommUtil();
|
||||
}
|
||||
return _commUtilInstance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a message and gets a response
|
||||
/// </summary>
|
||||
/// <param name="commNode">The communication interface</param>
|
||||
/// <param name="commandMsg">The message to send</param>
|
||||
/// <param name="rspMsg">The response that is received</param>
|
||||
/// <param name="timeoutInMs">The amount of time in ms to wait for the response</param>
|
||||
public void SendCommandGetResponse(ICommDevice commNode, AutomationMessage commandMsg, ref AutomationMessage rspMsg, int timeoutInMs = 5000)
|
||||
{
|
||||
// send the command
|
||||
byte[] dataToSend = new byte[commandMsg.GetEntireMsgLength()];
|
||||
|
||||
// format the data
|
||||
GCHandle pinnedArray = GCHandle.Alloc(dataToSend, GCHandleType.Pinned);
|
||||
IntPtr pByte = pinnedArray.AddrOfPinnedObject();
|
||||
commandMsg.Format(pByte);
|
||||
pinnedArray.Free();
|
||||
|
||||
uint numWritten = commNode.Write(dataToSend, (uint)dataToSend.Length);
|
||||
|
||||
|
||||
if (numWritten != (uint)dataToSend.Length)
|
||||
{
|
||||
throw new Exception("CommUtil::SendCommandGetResponse NumBytesWritten does not match: numWritten " + numWritten + " and dataToSend.Length " + dataToSend.Length);
|
||||
}
|
||||
|
||||
// wait for the response
|
||||
AutomationRxMsgBuffer rxBuffer = AutomationRxMsgBuffer.Instance();
|
||||
uint respMsgId = rspMsg.GetMessageId();
|
||||
bool didWeReceiveTheResponse = rxBuffer.WaitForRspMsg(respMsgId, timeoutInMs);
|
||||
|
||||
if (didWeReceiveTheResponse == false)
|
||||
{
|
||||
throw new Exception("did not receive " + rspMsg.GetDescription());
|
||||
}
|
||||
|
||||
rspMsg = rxBuffer.GetNewestMessage(respMsgId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="commNode"></param>
|
||||
/// <param name="commandMsg"></param>
|
||||
public void SendCommand(ICommDevice commNode, AutomationMessage commandMsg)
|
||||
{
|
||||
// send the command
|
||||
byte[] dataToSend = new byte[commandMsg.GetEntireMsgLength()];
|
||||
|
||||
// format the data
|
||||
GCHandle pinnedArray = GCHandle.Alloc(dataToSend, GCHandleType.Pinned);
|
||||
IntPtr pByte = pinnedArray.AddrOfPinnedObject();
|
||||
commandMsg.Format(pByte);
|
||||
pinnedArray.Free();
|
||||
commNode.Write(dataToSend, (uint)dataToSend.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles received messages from the remote VRS system
|
||||
/// </summary>
|
||||
internal class VrsClientMsgHandler : MsgDevice
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private Dictionary<uint, Func<IntPtr, bool>> _messageHandlerMap;
|
||||
private ICommDevice _commInterface;
|
||||
#endregion
|
||||
|
||||
#region PrivateClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// Handle the add attribute message
|
||||
/// </summary>
|
||||
/// <param name="pData">the handle attribute msg data</param>
|
||||
/// <returns></returns>
|
||||
private bool HandleAddAttributesRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleAddAttributesRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrsAddAttributesRspMessage msg = new VrsAddAttributesRspMessage(false);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the VRS_CONNECT_RSP
|
||||
/// </summary>
|
||||
/// <param name="pData">The data associated with VRS_CONNECT_RSP</param>
|
||||
private bool HandleConnectRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleConnectRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrsConnectRspMessage msg = new VrsConnectRspMessage(false);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the disconnect rsp msg
|
||||
/// </summary>
|
||||
/// <param name="pData"></param>
|
||||
/// <returns></returns>
|
||||
private bool HandleDisconnectRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleDisconnectRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrsDisconnectRspMessage msg = new VrsDisconnectRspMessage(false);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the VRS_GRAB_VIDEO_TO_DISK_RSP
|
||||
/// </summary>
|
||||
/// <param name="pData">The data associated with VRS_GRAB_VIDEO_TO_DISK_RSP</param>
|
||||
private bool HandleGrabToDiskRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleGrabToDiskRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrsGrabToDiskRspMessage msg = new VrsGrabToDiskRspMessage(false);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the VrsGrabToDiskCompleteRspMessage
|
||||
/// </summary>
|
||||
/// <param name="pData"></param>
|
||||
/// <returns></returns>
|
||||
private bool HandleGrabToDiskCompleteRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleGrabToDiskCompleteRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrsGrabToDiskCompleteRspMessage msg = new VrsGrabToDiskCompleteRspMessage(false, "");
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the VrsMoveFileRspMessage
|
||||
/// </summary>
|
||||
/// <param name="pData"></param>
|
||||
/// <returns></returns>
|
||||
private bool HandleMoveFileRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleMoveFileRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrsMoveFileRspMessage msg = new VrsMoveFileRspMessage(false);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the VrsQueryHardDriveRspMessage
|
||||
/// </summary>
|
||||
/// <param name="pData"></param>
|
||||
/// <returns></returns>
|
||||
private bool HandleQueryDiskRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleQueryDiskRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrsQueryHardDriveRspMessage msg = new VrsQueryHardDriveRspMessage(false, 0, 0, 0, 0);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the VrStopLiveVideoRspMessage
|
||||
/// </summary>
|
||||
/// <param name="pData"></param>
|
||||
/// <returns></returns>
|
||||
private bool HandleStopLiveVideoRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleStopLiveVideoRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrStopLiveVideoRspMessage msg = new VrStopLiveVideoRspMessage(false);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the VrShowLiveVideoRspMessage
|
||||
/// </summary>
|
||||
/// <param name="pData"></param>
|
||||
/// <returns></returns>
|
||||
private bool HandleShowLiveVideoRspMsg(IntPtr pData)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::HandleShowLiveVideoRspMsg() - beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
VrShowLiveVideoRspMessage msg = new VrShowLiveVideoRspMessage(false);
|
||||
msg.Parse(pData);
|
||||
msg.ExecuteMsg();
|
||||
AutomationRxMsgBuffer.Instance().AddMsg(msg);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PublicFuctions
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="bufferSize">The number of bytes for the buffer that holds onto incomming data</param>
|
||||
unsafe public VrsClientMsgHandler(uint bufferSize)
|
||||
: base(new VrsMsgParser(), bufferSize)
|
||||
{
|
||||
_commInterface = null;
|
||||
|
||||
// set the callback
|
||||
base.SetCompleteMessageCallback(this.OnCompleteMessage);
|
||||
|
||||
// set up function mapping for received messages
|
||||
_messageHandlerMap = new Dictionary<uint, Func<IntPtr, bool>>();
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_CONNECT_RSP] = HandleConnectRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_RSP] = HandleGrabToDiskRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_RSP] = HandleShowLiveVideoRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_RSP] = HandleStopLiveVideoRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_MOVE_FILE_RSP] = HandleMoveFileRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_RSP] = HandleQueryDiskRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_RSP] = HandleAddAttributesRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_DISCONNECT_RSP] = HandleDisconnectRspMsg;
|
||||
_messageHandlerMap[(uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP] = HandleGrabToDiskCompleteRspMsg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add data to the buffer
|
||||
/// </summary>
|
||||
/// <param name="data">The data to add</param>
|
||||
/// <param name="numBytes">The number of bytes in the data buffer</param>
|
||||
public override void AddData(byte[] data, uint numBytes)
|
||||
{
|
||||
AddToBuffer(data, numBytes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear all data from the buffer
|
||||
/// </summary>
|
||||
public void ClearData()
|
||||
{
|
||||
ClearBuffer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The callback function for when a complete message is received
|
||||
/// </summary>
|
||||
/// <param name="msgId">The id of the message received</param>
|
||||
/// <param name="pData">The data for the message received</param>
|
||||
/// <param name="numBytes">The number of bytes in pData</param>
|
||||
/// <param name="errorCode">The error code</param>
|
||||
unsafe public void OnCompleteMessage(uint msgId, IntPtr pData, uint numBytes, uint errorCode)
|
||||
{
|
||||
if (_messageHandlerMap.ContainsKey(msgId) == false)
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsClientMsgHandler::OnCompleteMessage() - detected unknown msg id: " + msgId.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
//call the message handler
|
||||
_messageHandlerMap[msgId](pData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the message handler
|
||||
/// </summary>
|
||||
public void QuitHandler()
|
||||
{
|
||||
base.QuitThread();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If this handler needs to send out data, this is the setter for the ICommNodeInterface object
|
||||
/// </summary>
|
||||
/// <param name="commInterface">The communication interface</param>
|
||||
public void SetCommInterface(ICommDevice commInterface)
|
||||
{
|
||||
_commInterface = commInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the log file name. Not supported for this handler. Will throw an expection if called
|
||||
/// </summary>
|
||||
/// <param name="fileName">The log file name</param>
|
||||
public void SetLogFileName(string fileName)
|
||||
{
|
||||
throw new Exception("This handler does not support this");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses out messages that go between the VRSUI and the Test Controller
|
||||
/// This class is meant to be used by both the test controller and the VRSUI, so it parses out messages that target either of those systems
|
||||
/// </summary>
|
||||
internal class VrsMsgParser : IMsgParser
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private List<uint> _messageList;
|
||||
private AutomationMessageHeader _header;
|
||||
#endregion
|
||||
|
||||
#region PublicClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// The constructor
|
||||
/// </summary>
|
||||
public VrsMsgParser()
|
||||
{
|
||||
_messageList = new List<uint>();
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_CONNECT_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_CONNECT_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_RSP);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_DISCONNECT_CMD);
|
||||
_messageList.Add((uint)VrsAutomationMsgIds.VRS_DISCONNECT_RSP);
|
||||
|
||||
_header = new AutomationMessageHeader();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search the data buffer for the next valid message
|
||||
/// </summary>
|
||||
/// <param name="pData">The data buffer to search</param>
|
||||
/// <param name="numBytesInPdata">The number of bytes in pData</param>
|
||||
/// <param name="bytesToRemove">The number of bytes to remove from the buffer</param>
|
||||
/// <param name="messageId">the msg id that this function finds</param>
|
||||
/// <param name="errorCode">The error that this functions finds</param>
|
||||
/// <returns></returns>
|
||||
public bool Run(IntPtr pData, uint numBytesInPdata, ref uint bytesToRemove, ref uint messageId, ref uint errorCode)
|
||||
{
|
||||
// default error code to 0. Not used in this parser
|
||||
errorCode = 0;
|
||||
|
||||
// check to see if we have enough data for at least a header
|
||||
if (numBytesInPdata < AutomationMessageHeader.HEADER_EXPECTED_SIZE)
|
||||
{
|
||||
ErrorLogger.Instance().Write("VrsMsgParser::run() - not enough data in the buffer to form a header. Buffer contained " + Convert.ToString(numBytesInPdata) + " bytes", ErrorLogger.LogLevel.INFO);
|
||||
bytesToRemove = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// create and parse header
|
||||
_header.Parse(pData);
|
||||
|
||||
uint totalMsgSize = _header.GetEntireMsgLength();
|
||||
|
||||
// do we have this message in our messageSizeMap_ dictionary?
|
||||
if (_messageList.Contains(_header.GetMessageId()) == false)
|
||||
{
|
||||
string msg = "VrsMsgParser::run() - unknown id received: " + Convert.ToString(_header.GetMessageId());
|
||||
ErrorLogger.Instance().Write(msg, ErrorLogger.LogLevel.ERROR);
|
||||
bytesToRemove = totalMsgSize; // move on to next message
|
||||
return false;
|
||||
}
|
||||
|
||||
// do we have enough data to make the complete message
|
||||
if (numBytesInPdata < totalMsgSize)
|
||||
{
|
||||
// need to wait for more data
|
||||
bytesToRemove = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// everything has checked out.
|
||||
bytesToRemove = totalMsgSize;
|
||||
messageId = _header.GetMessageId();
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message commands the vrs to display video on its UI
|
||||
/// </summary>
|
||||
internal class VrShowLiveVideoCmdMessage : AutomationMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrShowLiveVideoCmdMessage(VrShowLiveVideoCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
public VrShowLiveVideoCmdMessage()
|
||||
: base((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_CMD, "VRS_SHOW_LIVE_VIDEO_CMD", 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrShowLiveVideoCmdMessage msg = new VrShowLiveVideoCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// nothing to format
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
// nothing to parse
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from VrShowLiveVideoCmdMessage
|
||||
/// </summary>
|
||||
internal class VrShowLiveVideoRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_wasCommandSuccessful;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrShowLiveVideoRspMessage(VrShowLiveVideoRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrShowLiveVideoRspMessage(bool wasCommandSuccessful)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_SHOW_LIVE_VIDEO_RSP, "VRS_SHOW_LIVE_VIDEO_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n";
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrShowLiveVideoRspMessage msg = new VrShowLiveVideoRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message that commands the VRS to move a file
|
||||
/// </summary>
|
||||
internal class VrsAddAttributesCmdMessage : AutomationMessage
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public uint _videoFileNameStrLen;
|
||||
public uint m_attributeFileStrLen;
|
||||
};
|
||||
|
||||
private Data _dataStruct;
|
||||
|
||||
private string _videoFileName;
|
||||
private string _attributeFileName;
|
||||
#endregion
|
||||
|
||||
#region PrivateClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsAddAttributesCmdMessage msg = new VrsAddAttributesCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// put the struct to the ptr
|
||||
Marshal.StructureToPtr(_dataStruct, pData, true);
|
||||
pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))));
|
||||
|
||||
byte[] videoFileNameBytes = Encoding.ASCII.GetBytes(_videoFileName);
|
||||
Marshal.Copy(videoFileNameBytes, 0, pData, _videoFileName.Length);
|
||||
pData = IntPtr.Add(pData, _videoFileName.Length);
|
||||
|
||||
byte[] attributeFileNameBytes = Encoding.ASCII.GetBytes(_attributeFileName);
|
||||
Marshal.Copy(attributeFileNameBytes, 0, pData, attributeFileNameBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))));
|
||||
|
||||
byte[] videoFileNameArray = new byte[_dataStruct._videoFileNameStrLen];
|
||||
Marshal.Copy(pData, videoFileNameArray, 0, (int)_dataStruct._videoFileNameStrLen);
|
||||
_videoFileName = Encoding.ASCII.GetString(videoFileNameArray);
|
||||
pData = IntPtr.Add(pData, (int)_dataStruct._videoFileNameStrLen);
|
||||
|
||||
byte[] attributeFileNameArray = new byte[_dataStruct.m_attributeFileStrLen];
|
||||
Marshal.Copy(pData, attributeFileNameArray, 0, (int)_dataStruct.m_attributeFileStrLen);
|
||||
_attributeFileName = Encoding.ASCII.GetString(attributeFileNameArray);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PublicClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsAddAttributesCmdMessage(VrsAddAttributesCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
_dataStruct = rhs._dataStruct;
|
||||
_videoFileName = rhs._videoFileName;
|
||||
_attributeFileName = rhs._attributeFileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
public VrsAddAttributesCmdMessage(string videoFile, string attributeFile)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_CMD, "VRS_ADD_ATTRIBUTES_CMD", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))) + (uint)videoFile.Length + (uint)attributeFile.Length)
|
||||
{
|
||||
_dataStruct._videoFileNameStrLen = (uint)videoFile.Length;
|
||||
_videoFileName = videoFile;
|
||||
|
||||
_dataStruct.m_attributeFileStrLen = (uint)attributeFile.Length;
|
||||
_attributeFileName = attributeFile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override String ToString()
|
||||
{
|
||||
string msg = base.ToString();
|
||||
msg += " videoFileNameStrLen: " + _dataStruct._videoFileNameStrLen + "\r\n";
|
||||
msg += " videoFileName: " + _videoFileName + "\r\n";
|
||||
msg += " attributeFileStrLen: " + _dataStruct.m_attributeFileStrLen + "\r\n";
|
||||
msg += " attributeFileName: " + _attributeFileName + "\r\n\r\n";
|
||||
return msg;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from the VRS upon receiving a VrsMoveFileCmdMessage
|
||||
/// </summary>
|
||||
internal class VrsAddAttributesRspMessage : AutomationMessage
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private const uint COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const uint COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public uint m_wasCommandSuccessful;
|
||||
};
|
||||
|
||||
private Data _dataStruct;
|
||||
#endregion
|
||||
|
||||
#region PrivateClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsAddAttributesRspMessage msg = new VrsAddAttributesRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
byte[] successFlagBytes = BitConverter.GetBytes(_dataStruct.m_wasCommandSuccessful);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PublicClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsAddAttributesRspMessage(VrsAddAttributesRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
_dataStruct = rhs._dataStruct;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrsAddAttributesRspMessage(bool wasCommandSuccessful)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_ADD_ATTRIBUTES_RSP, "VRS_ADD_ATTRIBUTES_RSP", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
string msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + _dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n";
|
||||
|
||||
return msg;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The IDs for messages that go between applications
|
||||
/// </summary>
|
||||
public enum VrsAutomationMsgIds : uint
|
||||
{
|
||||
//VRS commands
|
||||
VRS_CONNECT_CMD = 0x00001001,
|
||||
VRS_GRAB_VIDEO_TO_DISK_CMD = 0x00001002,
|
||||
VRS_SHOW_LIVE_VIDEO_CMD = 0x00001003,
|
||||
VRS_STOP_LIVE_VIDEO_CMD = 0x00001004,
|
||||
VRS_MOVE_FILE_CMD = 0x00001005,
|
||||
VRS_QUERY_HARD_DRIVE_CMD = 0x00001006,
|
||||
VRS_ADD_ATTRIBUTES_CMD = 0x00001007,
|
||||
VRS_DISCONNECT_CMD = 0x00001008,
|
||||
|
||||
//VRS responses
|
||||
VRS_CONNECT_RSP = 0x00002001,
|
||||
VRS_GRAB_VIDEO_TO_DISK_RSP = 0x00002002,
|
||||
VRS_SHOW_LIVE_VIDEO_RSP = 0x00002003,
|
||||
VRS_STOP_LIVE_VIDEO_RSP = 0x00002004,
|
||||
VRS_MOVE_FILE_RSP = 0x00002005,
|
||||
VRS_QUERY_HARD_DRIVE_RSP = 0x00002006,
|
||||
VRS_ADD_ATTRIBUTES_RSP = 0x00002007,
|
||||
VRS_DISCONNECT_RSP = 0x00002008,
|
||||
VRS_GRAB_TO_DISK_COMPLETE_RSP = 0x00002009,
|
||||
|
||||
//NWL commands
|
||||
NWL_CONNECT_CMD = 0x00003001,
|
||||
NWL_READ_CMD = 0x00003002,
|
||||
NWL_READ_DMA_CMD = 0x00003003,
|
||||
NWL_READ_REG_CMD = 0x00003004,
|
||||
NWL_WRITE_CMD = 0x00003005,
|
||||
NWL_WRITE_DMA_CMD = 0x00003006,
|
||||
NWL_WRITE_REG_CMD = 0x00003007,
|
||||
NWL_START_SENSOR_READ_THREAD_CMD = 0x00003008,
|
||||
NWL_STOP_SENSOR_READ_THREAD_CMD = 0x00003009,
|
||||
NWL_START_IMU_READ_THREAD_CMD = 0x0000300A,
|
||||
NWL_STOP_IMU_READ_THREAD_CMD = 0x0000300B,
|
||||
NWL_DISCONNECT_CMD = 0x0000300C,
|
||||
NWL_START_IMU_WRITE_THREAD_CMD = 0x0000300D,
|
||||
NWL_STOP_IMU_WRITE_THREAD_CMD = 0x0000300E,
|
||||
|
||||
//NWL responses
|
||||
NWL_CONNECT_RSP = 0x00004001,
|
||||
NWL_READ_RSP = 0x00004002,
|
||||
NWL_READ_DMA_RSP = 0x00004003,
|
||||
NWL_READ_REG_RSP = 0x00004004,
|
||||
NWL_WRITE_RSP = 0x00004005,
|
||||
NWL_WRITE_DMA_RSP = 0x00004006,
|
||||
NWL_WRITE_REG_RSP = 0x00004007,
|
||||
NWL_START_SENSOR_READ_THREAD_RSP = 0x00004008,
|
||||
NWL_STOP_SENSOR_READ_THREAD_RSP = 0x00004009,
|
||||
NWL_START_IMU_READ_THREAD_RSP = 0X0000400A,
|
||||
NWL_STOP_IMU_READ_THREAD_RSP = 0X0000400B,
|
||||
NWL_DISCONNECT_RSP = 0x0000400C,
|
||||
NWL_START_IMU_WRITE_THREAD_RSP = 0x0000400D,
|
||||
NWL_STOP_IMU_WRITE_THREAD_RSP = 0x0000400E
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message that targets the VRS to make a connection
|
||||
/// </summary>
|
||||
internal class VrsConnectCmdMessage : AutomationMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsConnectCmdMessage(VrsConnectCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
public VrsConnectCmdMessage()
|
||||
: base((uint)VrsAutomationMsgIds.VRS_CONNECT_CMD, "VRS_CONNECT_CMD", 0)
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
string msg = base.ToString();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsConnectCmdMessage msg = new VrsConnectCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// nothing to format
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
// nothing to parse
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Raytheon.Common;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from the VRS upon receiving a VrsConnectCmdMessage
|
||||
/// </summary>
|
||||
internal class VrsConnectRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public uint m_wasCommandSuccessful;
|
||||
};
|
||||
|
||||
private Data _dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsConnectRspMessage(VrsConnectRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
_dataStruct = rhs._dataStruct;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrsConnectRspMessage(bool wasCommandSuccessful)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_CONNECT_RSP, "VRS Connect Response Message", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
string msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + _dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n";
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsConnectRspMessage msg = new VrsConnectRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
byte[] successFlagBytes = BitConverter.GetBytes(_dataStruct.m_wasCommandSuccessful);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message that targets the VRS to disconnect
|
||||
/// </summary>
|
||||
internal class VrsDisconnectCmdMessage : AutomationMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsDisconnectCmdMessage(VrsDisconnectCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
public VrsDisconnectCmdMessage()
|
||||
: base((uint)VrsAutomationMsgIds.VRS_DISCONNECT_CMD, "VRS_DISCONNECT_CMD", 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsDisconnectCmdMessage msg = new VrsDisconnectCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// nothing to format
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
// nothing to parse
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from the VRS upon receiving a VrsDisconnectCmdMessage
|
||||
/// </summary>
|
||||
internal class VrsDisconnectRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_wasCommandSuccessful;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsDisconnectRspMessage(VrsDisconnectRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrsDisconnectRspMessage(bool wasCommandSuccessful)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_DISCONNECT_RSP, "VRS_DISCONNECT_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n";
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsDisconnectRspMessage msg = new VrsDisconnectRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Instruments;
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message that targets the VRS to save video to disk
|
||||
/// </summary>
|
||||
internal class VrsGrabToDiskCmdMessage : AutomationMessage
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_numberOfFrames;
|
||||
public UInt32 m_fileFormat;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsGrabToDiskCmdMessage(VrsGrabToDiskCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="numberOfFrames">The number of frames to send</param>
|
||||
/// <param name="format">The resulting file format</param>
|
||||
public VrsGrabToDiskCmdMessage(uint numberOfFrames, VideoSaveFormat format)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_CMD, "VRS_GRAB_VIDEO_TO_DISK_CMD", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct.m_numberOfFrames = numberOfFrames;
|
||||
|
||||
if (format == VideoSaveFormat.BIN)
|
||||
{
|
||||
m_dataStruct.m_fileFormat = 0;
|
||||
}
|
||||
else if (format == VideoSaveFormat.NCDF)
|
||||
{
|
||||
m_dataStruct.m_fileFormat = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Unsupported format: " + format.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return the file format
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public UInt32 GetFileFormat()
|
||||
{
|
||||
return m_dataStruct.m_fileFormat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter for the number of frames
|
||||
/// </summary>
|
||||
/// <returns>The number of frames</returns>
|
||||
public UInt32 GetNumberOfFrames()
|
||||
{
|
||||
return m_dataStruct.m_numberOfFrames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
|
||||
msg += " numberOfFrames: " + m_dataStruct.m_numberOfFrames.ToString() + "\r\n";
|
||||
msg += " file format: " + m_dataStruct.m_fileFormat.ToString() + "\r\n\r\n";
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsGrabToDiskCmdMessage msg = new VrsGrabToDiskCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// put the struct to the ptr
|
||||
Marshal.StructureToPtr(m_dataStruct, pData, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from the VRS upon receiving a completing saving video to disk
|
||||
/// </summary>
|
||||
internal class VrsGrabToDiskCompleteRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_wasCommandSuccessful;
|
||||
public UInt32 m_fileNameLen;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
private String m_fileName;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsGrabToDiskCompleteRspMessage(VrsGrabToDiskCompleteRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrsGrabToDiskCompleteRspMessage(bool wasCommandSuccessful, String fileName)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP, "VRS Grab To Disk Complete Response Message", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))) + (uint)fileName.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
m_dataStruct.m_fileNameLen = (uint)fileName.Length;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public String GetFileName()
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n";
|
||||
msg += " fileNameLen: " + m_dataStruct.m_fileNameLen.ToString() + "\r\n";
|
||||
msg += " filename: " + m_fileName + "\r\n\r\n";
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsGrabToDiskCompleteRspMessage msg = new VrsGrabToDiskCompleteRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length);
|
||||
pData = IntPtr.Add(pData, successFlagBytes.Length);
|
||||
|
||||
byte[] fileNameLenBytes = BitConverter.GetBytes(m_dataStruct.m_fileNameLen);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, fileNameLenBytes.Length);
|
||||
pData = IntPtr.Add(pData, fileNameLenBytes.Length);
|
||||
|
||||
byte[] fileNameBytes = Encoding.ASCII.GetBytes(m_fileName);
|
||||
Marshal.Copy(fileNameBytes, 0, pData, m_fileName.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))));
|
||||
|
||||
byte[] fileNameArray = new byte[m_dataStruct.m_fileNameLen];
|
||||
Marshal.Copy(pData, fileNameArray, 0, (int)m_dataStruct.m_fileNameLen);
|
||||
m_fileName = Encoding.ASCII.GetString(fileNameArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from the VRS upon receiving a VrsGrabToDiskCmdMessage
|
||||
/// </summary>
|
||||
internal class VrsGrabToDiskRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_wasCommandSuccessful;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsGrabToDiskRspMessage(VrsGrabToDiskRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrsGrabToDiskRspMessage(bool wasCommandSuccessful):
|
||||
base((uint)VrsAutomationMsgIds.VRS_GRAB_VIDEO_TO_DISK_RSP, "VRS_GRAB_VIDEO_TO_DISK_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n";
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsGrabToDiskRspMessage msg = new VrsGrabToDiskRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
Marshal.StructureToPtr(m_dataStruct.m_wasCommandSuccessful, pData, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Instruments;
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message that commands the VRS to move a file
|
||||
/// </summary>
|
||||
internal class VrsMoveFileCmdMessage : AutomationMessage
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_fromStrLen;
|
||||
public UInt32 m_toStrLen;
|
||||
public UInt32 m_copyControl;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
private String m_fromFileName;
|
||||
private String m_toFileName;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsMoveFileCmdMessage(VrsMoveFileCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
m_fromFileName = rhs.m_fromFileName;
|
||||
m_toFileName = rhs.m_toFileName;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="fromFileName"></param>
|
||||
/// <param name="toFileName"></param>
|
||||
/// <param name="control"></param>
|
||||
public VrsMoveFileCmdMessage(string fromFileName, string toFileName, MoveControl control)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_CMD, "VRS_MOVE_FILE_CMD", (ushort)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))) + (uint)fromFileName.Length + (uint)toFileName.Length)
|
||||
{
|
||||
m_dataStruct.m_fromStrLen = (uint)fromFileName.Length;
|
||||
m_fromFileName = fromFileName;
|
||||
|
||||
m_dataStruct.m_toStrLen = (uint)toFileName.Length;
|
||||
m_toFileName = toFileName;
|
||||
|
||||
m_dataStruct.m_copyControl = (uint)control;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " fromLen: " + m_dataStruct.m_fromStrLen + "\r\n";
|
||||
msg += " from: " + m_fromFileName + "\r\n";
|
||||
msg += " toLen: " + m_dataStruct.m_toStrLen + "\r\n";
|
||||
msg += " to: " + m_toFileName + "\r\n";
|
||||
msg += " control: " + m_dataStruct.m_copyControl + "\r\n\r\n";
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsMoveFileCmdMessage msg = new VrsMoveFileCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// put the struct to the ptr
|
||||
Marshal.StructureToPtr(m_dataStruct, pData, true);
|
||||
pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))));
|
||||
|
||||
byte[] fromFileNameBytes = Encoding.ASCII.GetBytes(m_fromFileName);
|
||||
Marshal.Copy(fromFileNameBytes, 0, pData, m_fromFileName.Length);
|
||||
pData = IntPtr.Add(pData, m_fromFileName.Length);
|
||||
|
||||
byte[] toFileNameBytes = Encoding.ASCII.GetBytes(m_toFileName);
|
||||
Marshal.Copy(toFileNameBytes, 0, pData, toFileNameBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
pData = IntPtr.Add(pData, (System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))));
|
||||
|
||||
byte[] fromFileNameArray = new byte[m_dataStruct.m_fromStrLen];
|
||||
Marshal.Copy(pData, fromFileNameArray, 0, (int)m_dataStruct.m_fromStrLen);
|
||||
m_fromFileName = Encoding.ASCII.GetString(fromFileNameArray);
|
||||
pData = IntPtr.Add(pData, (int)m_dataStruct.m_fromStrLen);
|
||||
|
||||
byte[] toFileNameArray = new byte[m_dataStruct.m_toStrLen];
|
||||
Marshal.Copy(pData, toFileNameArray, 0, (int)m_dataStruct.m_toStrLen);
|
||||
m_toFileName = Encoding.ASCII.GetString(toFileNameArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from the VRS upon receiving a VrsMoveFileCmdMessage
|
||||
/// </summary>
|
||||
internal class VrsMoveFileRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_wasCommandSuccessful;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsMoveFileRspMessage(VrsMoveFileRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrsMoveFileRspMessage(bool wasCommandSuccessful)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_MOVE_FILE_RSP, "VRS_MOVE_FILE_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n";
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsMoveFileRspMessage msg = new VrsMoveFileRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message that commands the VRS to return the GBs free on each of its drives
|
||||
/// </summary>
|
||||
internal class VrsQueryHardDriveCmdMessage : AutomationMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsQueryHardDriveCmdMessage(VrsQueryHardDriveCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
public VrsQueryHardDriveCmdMessage()
|
||||
: base((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_CMD, "VRS_QUERY_HARD_DRIVE_CMD", 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsQueryHardDriveCmdMessage msg = new VrsQueryHardDriveCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// nothing to format
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
// nothing to parse
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from VrsQueryHardDriveCmdMessage
|
||||
/// </summary>
|
||||
internal class VrsQueryHardDriveRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_wasCommandSuccessful;
|
||||
public float m_drive1Space;
|
||||
public float m_drive2Space;
|
||||
public float m_drive3Space;
|
||||
public float m_drive4Space;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrsQueryHardDriveRspMessage(VrsQueryHardDriveRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrsQueryHardDriveRspMessage(bool wasCommandSuccessful, float drive1Space, float drive2Space, float drive3Space, float drive4Space)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_QUERY_HARD_DRIVE_RSP, "VRS_QUERY_HARD_DRIVE_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GEtter for the freee drive space
|
||||
/// </summary>
|
||||
/// <param name="drive1Space">GBs free for drive 1</param>
|
||||
/// <param name="drive2Space">GBs free for drive 2</param>
|
||||
/// <param name="drive3Space">GBs free for drive 3</param>
|
||||
/// <param name="drive4Space">GBs free for drive 4</param>
|
||||
public void GetDriveSpace(ref float drive1Space, ref float drive2Space, ref float drive3Space, ref float drive4Space)
|
||||
{
|
||||
drive1Space = m_dataStruct.m_drive1Space;
|
||||
drive2Space = m_dataStruct.m_drive2Space;
|
||||
drive3Space = m_dataStruct.m_drive3Space;
|
||||
drive4Space = m_dataStruct.m_drive4Space;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n";
|
||||
msg += " drive1space: " + m_dataStruct.m_drive1Space.ToString() + "\r\n";
|
||||
msg += " drive2space: " + m_dataStruct.m_drive2Space.ToString() + "\r\n";
|
||||
msg += " drive3space: " + m_dataStruct.m_drive3Space.ToString() + "\r\n";
|
||||
msg += " drive4space: " + m_dataStruct.m_drive4Space.ToString() + "\r\n\r\n";
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrsQueryHardDriveRspMessage msg = new VrsQueryHardDriveRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// put the struct to the ptr
|
||||
Marshal.StructureToPtr(m_dataStruct, pData, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The message commands the VRS to stop showing video on its UI
|
||||
/// </summary>
|
||||
internal class VrStopLiveVideoCmdMessage : AutomationMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrStopLiveVideoCmdMessage(VrStopLiveVideoCmdMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
public VrStopLiveVideoCmdMessage()
|
||||
: base((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_CMD, "VRS_STOP_LIVE_VIDEO_CMD", 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrStopLiveVideoCmdMessage msg = new VrStopLiveVideoCmdMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// nothing to format
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
// nothing to parse
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The response message from VrStopLiveVideoCmdMessage
|
||||
/// </summary>
|
||||
internal class VrStopLiveVideoRspMessage : AutomationMessage
|
||||
{
|
||||
private const UInt32 COMMAND_WAS_SUCCESSFUL = 1;
|
||||
private const UInt32 COMMAND_WAS_NOT_SUCCESSFUL = 0;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
private struct Data
|
||||
{
|
||||
public UInt32 m_wasCommandSuccessful;
|
||||
};
|
||||
|
||||
private Data m_dataStruct;
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor
|
||||
/// </summary>
|
||||
/// <param name="rhs">The object to copy</param>
|
||||
public VrStopLiveVideoRspMessage(VrStopLiveVideoRspMessage rhs)
|
||||
: base(rhs)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dataStruct = rhs.m_dataStruct;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The constructor for sending
|
||||
/// </summary>
|
||||
/// <param name="wasCommandSuccessful">flag for if the command was successful</param>
|
||||
public VrStopLiveVideoRspMessage(bool wasCommandSuccessful)
|
||||
: base((uint)VrsAutomationMsgIds.VRS_STOP_LIVE_VIDEO_RSP, "VRS_STOP_LIVE_VIDEO_RSP", (UInt16)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Data))))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wasCommandSuccessful == true)
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_SUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataStruct.m_wasCommandSuccessful = COMMAND_WAS_NOT_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the action associated with this message
|
||||
/// </summary>
|
||||
public override void ExecuteMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
// no action to take
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getter
|
||||
/// </summary>
|
||||
/// <returns>The success flag from the execution of the command</returns>
|
||||
public bool GetSuccessfulFlag()
|
||||
{
|
||||
if (m_dataStruct.m_wasCommandSuccessful == COMMAND_WAS_SUCCESSFUL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert this object into string form
|
||||
/// </summary>
|
||||
/// <returns>The string form of this object</returns>
|
||||
public override String ToString()
|
||||
{
|
||||
String msg = base.ToString();
|
||||
msg += " wasCommandSuccessful: " + m_dataStruct.m_wasCommandSuccessful.ToString() + "\r\n\r\n";
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of this object
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
protected override object CloneSelf()
|
||||
{
|
||||
VrStopLiveVideoRspMessage msg = new VrStopLiveVideoRspMessage(this);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode the message into a byte array for sending.
|
||||
/// </summary>
|
||||
/// <param name="pData">The buffer to put the message items</param>
|
||||
protected override void FormatData(IntPtr pData)
|
||||
{
|
||||
// copy data from our structure, info the buffer
|
||||
byte[] successFlagBytes = BitConverter.GetBytes(m_dataStruct.m_wasCommandSuccessful);
|
||||
Marshal.Copy(successFlagBytes, 0, pData, successFlagBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes an array of bytes and populates the message object
|
||||
/// </summary>
|
||||
/// <param name="pData">The message in byte form</param>
|
||||
protected override void ParseData(IntPtr pData)
|
||||
{
|
||||
m_dataStruct = (Data)Marshal.PtrToStructure(pData, typeof(Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// Ignore Spelling: Ncdf
|
||||
|
||||
using NLog;
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// The interface for the test controller to automate the VRS system
|
||||
/// </summary>
|
||||
public class VideoRecorderVrsClient : IVideoRecorder
|
||||
{
|
||||
#region PrivateClassMembers
|
||||
private readonly string _remoteAddress;
|
||||
private readonly int _remotePort;
|
||||
private readonly int _localPort;
|
||||
private readonly CommDeviceNode _udpNode;
|
||||
private readonly ICommDevice _commDevice;
|
||||
private readonly uint _parseBufferSize;
|
||||
private static readonly object _syncObj = new Object();
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public string DetailedStatus => throw new NotImplementedException();
|
||||
|
||||
public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public InstrumentMetadata Info => throw new NotImplementedException();
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public SelfTestResult SelfTestResult => throw new NotImplementedException();
|
||||
|
||||
public State Status => throw new NotImplementedException();
|
||||
#endregion
|
||||
|
||||
#region PrivateClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~VideoRecorderVrsClient()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
Disconnect();
|
||||
_commDevice.Shutdown();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_udpNode.Dispose();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PublicClassFunctions
|
||||
|
||||
/// <summary>
|
||||
/// The constructor
|
||||
/// </summary>
|
||||
/// <param name="remoteAddress">The remote computer address</param>
|
||||
/// <param name="remotePort">The remote computer port</param>
|
||||
/// <param name="localPort">the local computer port</param>
|
||||
/// <param name="parseBufferSize">the parse buffer size in bytes</param>
|
||||
public VideoRecorderVrsClient(string remoteAddress, int remotePort, int localPort, uint parseBufferSize)
|
||||
{
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
// init error logger singleton
|
||||
ErrorLogger.Instance().Write("beginning", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
_remoteAddress = remoteAddress;
|
||||
|
||||
_remotePort = remotePort;
|
||||
|
||||
_localPort = localPort;
|
||||
|
||||
_parseBufferSize = parseBufferSize;
|
||||
|
||||
List<uint> msgIds = new List<uint>();
|
||||
|
||||
foreach (uint id in Enum.GetValues(typeof(VrsAutomationMsgIds)))
|
||||
{
|
||||
msgIds.Add(id);
|
||||
}
|
||||
|
||||
AutomationRxMsgBuffer.Instance(msgIds);
|
||||
|
||||
VrsClientMsgHandler msghandler = new VrsClientMsgHandler(_parseBufferSize);
|
||||
|
||||
_commDevice = new CommDeviceUdp("CommDeviceUdp", _localPort, _remotePort, _remoteAddress);
|
||||
|
||||
_udpNode = new CommDeviceNode("CommDeviceNode", _commDevice, msghandler);
|
||||
|
||||
msghandler.SetCommInterface(_udpNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// updated constructor
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
/// <param name="logger"></param>
|
||||
public VideoRecorderVrsClient(string name, IConfigurationManager configurationManager, ILogger logger)
|
||||
{
|
||||
Name = name;
|
||||
_logger = logger;
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
|
||||
_remoteAddress = _configuration.GetConfigurationValue("VideoRecorderVrsClient", "RemoteAddress", "127.0.0.1");
|
||||
_remotePort = _configuration.GetConfigurationValue("VideoRecorderVrsClient", "RemotePort", 0);
|
||||
_localPort = _configuration.GetConfigurationValue("VideoRecorderVrsClient", "LocalPort", 0);
|
||||
_parseBufferSize = _configuration.GetConfigurationValue<uint>("VideoRecorderVrsClient", "LocalPort", 1024);
|
||||
|
||||
List<uint> msgIds = new List<uint>();
|
||||
foreach (uint id in Enum.GetValues(typeof(VrsAutomationMsgIds)))
|
||||
{
|
||||
msgIds.Add(id);
|
||||
}
|
||||
|
||||
AutomationRxMsgBuffer.Instance(msgIds);
|
||||
|
||||
VrsClientMsgHandler msghandler = new VrsClientMsgHandler(_parseBufferSize);
|
||||
|
||||
_commDevice = new CommDeviceUdp("CommDeviceUdp", _localPort, _remotePort, _remoteAddress);
|
||||
_udpNode = new CommDeviceNode("CommDeviceNode", _commDevice, msghandler);
|
||||
|
||||
msghandler.SetCommInterface(_udpNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a message to the VRS and command it to add ncdf attributes to a video file
|
||||
/// </summary>
|
||||
/// <param name="videoFile">The video file to add attributes to</param>
|
||||
/// <param name="attributeFile">The attribute file</param>
|
||||
public void AddNcdfAttributes(string videoFile, string attributeFile)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
AutomationMessage addAttributesMsg = new VrsAddAttributesCmdMessage(videoFile, attributeFile);
|
||||
|
||||
AutomationMessage addAttributesRspMsg = new VrsAddAttributesRspMessage(false);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, addAttributesMsg, ref addAttributesRspMsg);
|
||||
|
||||
VrsAddAttributesRspMessage tempRsp = (VrsAddAttributesRspMessage)addAttributesRspMsg;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrsAddAttributesRspMessage returned a successful flag of false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connect to the VRS system
|
||||
/// </summary>
|
||||
public void Connect()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
// send the vrs a message just to make sure the two apps are talking
|
||||
AutomationMessage connectMsg = new VrsConnectCmdMessage();
|
||||
|
||||
AutomationMessage connectRspMsg = new VrsConnectRspMessage(false);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, connectMsg, ref connectRspMsg);
|
||||
|
||||
VrsConnectRspMessage tempRsp = (VrsConnectRspMessage)connectRspMsg;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrsConnectRspMessage returned a successful flag of false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnect from the VRS
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
// send the vrs a message just to make sure the two apps are talking
|
||||
AutomationMessage disconnectMsg = new VrsDisconnectCmdMessage();
|
||||
|
||||
AutomationMessage disconnectRspMsg = new VrsDisconnectRspMessage(false);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, disconnectMsg, ref disconnectRspMsg);
|
||||
|
||||
VrsDisconnectRspMessage tempRsp = (VrsDisconnectRspMessage)disconnectRspMsg;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrsDisconnectRspMessage returned a successful flag of false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// record video to the VRS hard drive. This function returns once the grab has begun, Use WaitForGrabToComplete() to know when the grab is completed
|
||||
/// </summary>
|
||||
/// <param name="numberOfFrames">The number of frames to grab</param>
|
||||
/// <param name="format">The save file format</param>
|
||||
public void GrabVideoToDisk(uint numberOfFrames, VideoSaveFormat format)
|
||||
{
|
||||
const int RSP_TIMEOUT = 20000;
|
||||
|
||||
lock (_syncObj)
|
||||
{
|
||||
//reset the event for WaitForGrabComplete
|
||||
AutomationRxMsgBuffer.Instance().ResetRxEvent((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP);
|
||||
|
||||
// send the vrs a message just to make sure the two apps are talking
|
||||
AutomationMessage grabCmd = new VrsGrabToDiskCmdMessage(numberOfFrames, format);
|
||||
|
||||
AutomationMessage grabRsp = new VrsGrabToDiskRspMessage(false);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, grabCmd, ref grabRsp, RSP_TIMEOUT);
|
||||
|
||||
VrsGrabToDiskRspMessage tempRsp = (VrsGrabToDiskRspMessage)grabRsp;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrsGrabToDiskRspMessage returned a successful flag of false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the number of GB free on the VRS system.
|
||||
/// </summary>
|
||||
/// <param name="driveSpace1">Drive 1 free space in GBs</param>
|
||||
/// <param name="driveSpace2">Drive 2 free space in GBs</param>
|
||||
/// <param name="driveSpace3">Drive 3 free space in GBs</param>
|
||||
/// <param name="driveSpace4">Drive 4 free space in GBs</param>
|
||||
public void QueryHardDrive(ref float driveSpace1, ref float driveSpace2, ref float driveSpace3, ref float driveSpace4)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
// send the vrs a message just to make sure the two apps are talking
|
||||
AutomationMessage msg = new VrsQueryHardDriveCmdMessage();
|
||||
|
||||
AutomationMessage rsp = new VrsQueryHardDriveRspMessage(false, 0, 0, 0, 0);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, msg, ref rsp);
|
||||
|
||||
VrsQueryHardDriveRspMessage tempRsp = (VrsQueryHardDriveRspMessage)rsp;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrsQueryHardDriveRspMessage returned a successful flag of false");
|
||||
}
|
||||
|
||||
tempRsp.GetDriveSpace(ref driveSpace1, ref driveSpace2, ref driveSpace3, ref driveSpace4);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves a file from one location to another
|
||||
/// </summary>
|
||||
/// <param name="fromFile"></param>
|
||||
/// <param name="toFile"></param>
|
||||
/// <param name="control"></param>
|
||||
public void MoveFile(string fromFile, string toFile, MoveControl control)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
// send the vrs a message just to make sure the two apps are talking
|
||||
AutomationMessage cmd = new VrsMoveFileCmdMessage(fromFile, toFile, control);
|
||||
|
||||
AutomationMessage rsp = new VrsMoveFileRspMessage(false);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, cmd, ref rsp);
|
||||
|
||||
VrsMoveFileRspMessage tempRsp = (VrsMoveFileRspMessage)rsp;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrsMoveFileRspMessage returned a successful flag of false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start displaying live video on the VRS
|
||||
/// </summary>
|
||||
public void ShowLiveVideo()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
// send the vrs a message just to make sure the two apps are talking
|
||||
AutomationMessage cmd = new VrShowLiveVideoCmdMessage();
|
||||
|
||||
AutomationMessage rsp = new VrShowLiveVideoRspMessage(false);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, cmd, ref rsp);
|
||||
|
||||
VrShowLiveVideoRspMessage tempRsp = (VrShowLiveVideoRspMessage)rsp;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrShowLiveVideoRspMessage returned a successful flag of false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop displaying video on the VRS
|
||||
/// </summary>
|
||||
public void StopLiveVideo()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
// send the vrs a message just to make sure the two apps are talking
|
||||
AutomationMessage cmd = new VrStopLiveVideoCmdMessage();
|
||||
|
||||
AutomationMessage rsp = new VrStopLiveVideoRspMessage(false);
|
||||
|
||||
CommUtil.Instance().SendCommandGetResponse(_udpNode, cmd, ref rsp);
|
||||
|
||||
VrStopLiveVideoRspMessage tempRsp = (VrStopLiveVideoRspMessage)rsp;
|
||||
|
||||
bool wasConnectMsgSuccessful = tempRsp.GetSuccessfulFlag();
|
||||
|
||||
ErrorLogger.Instance().Write("init complete", ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (wasConnectMsgSuccessful == false)
|
||||
{
|
||||
throw new Exception("VrStopLiveVideoRspMessage returned a successful flag of false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A blocking function that waits for a video capture to complete
|
||||
/// </summary>
|
||||
/// <param name="timeoutms"></param>
|
||||
/// <returns></returns>
|
||||
public string WaitForGrabToComplete(int timeoutms)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
bool didWeGetRsp = AutomationRxMsgBuffer.Instance().WaitForRspMsg((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP, timeoutms);
|
||||
|
||||
if (didWeGetRsp == true)
|
||||
{
|
||||
VrsGrabToDiskCompleteRspMessage rsp = (VrsGrabToDiskCompleteRspMessage)AutomationRxMsgBuffer.Instance().GetNewestMessage((uint)VrsAutomationMsgIds.VRS_GRAB_TO_DISK_COMPLETE_RSP);
|
||||
|
||||
return rsp.GetFileName();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Timed out waiting for response");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ClearErrors()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
Disconnect();
|
||||
|
||||
Connect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public void Shutdown()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public byte[] GetSmallVideoFrame(string name, int nFrames, bool sensor, ref uint numBytesRead, bool deleteVideoFile)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.VideoRecorderVrsClient</AssemblyName>
|
||||
<Product>Video Recorder Vrs Client implementation</Product>
|
||||
<Description>Video Recorder Vrs Client 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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CommDevice\CommDeviceUdp\CommDeviceUdp.csproj" />
|
||||
<ProjectReference Include="..\VideoRecorderSim\VideoRecorderSim.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,140 @@
|
||||
// **********************************************************************************************************
|
||||
// VideoRecorderSimFactory.cs
|
||||
// 2/20/2023
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON
|
||||
// COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.
|
||||
// DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON
|
||||
// COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED
|
||||
// TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF
|
||||
// RAYTHEON COMPANY.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
using NLog;
|
||||
using Raytheon.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
[ExportInstrumentFactory(ModelNumber = "VideoRecorderVrsClientFactory")]
|
||||
public class VideoRecorderVrsClientFactory : IInstrumentFactory
|
||||
{
|
||||
/// <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 VideoRecorderVrsClientFactory(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 VideoRecorderVrsClientFactory([Import(AllowDefault = false)] IConfigurationManager configManager,
|
||||
[Import(AllowDefault = true)] string defaultConfigPath = null)
|
||||
{
|
||||
DefaultPath = defaultConfigPath;
|
||||
|
||||
if (LogManager.Configuration == null)
|
||||
{
|
||||
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
|
||||
}
|
||||
|
||||
_configurationManager = configManager ?? GetConfigurationManager();
|
||||
_supportedInterfaces.Add(typeof(ICommDevice));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new VideoRecorderVrsClient(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 VideoRecorderSim(name, _configurationManager, _logger);
|
||||
else
|
||||
return new VideoRecorderVrsClient(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user