// UNCLASSIFIED /*------------------------------------------------------------------------- RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON COMPANY. THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT. UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. -------------------------------------------------------------------------*/ using System; using System.Threading; using NLog; using Raytheon.Common; namespace Raytheon.Instruments { /// /// Flow Meter Sim Class /// public class FlowMeterSim : IFlowMeter { #region PrivateMembers private static object _sync = new object(); public string DetailedStatus => throw new NotImplementedException(); public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public InstrumentMetadata Info => throw new NotImplementedException(); public string Name { get; set; } public SelfTestResult SelfTestResult => throw new NotImplementedException(); public State Status => throw new NotImplementedException(); /// /// Destructor /// ~FlowMeterSim() { Dispose(false); } private readonly ILogger _logger; private readonly IConfigurationManager _configurationManager; private readonly IConfiguration _configuration; #endregion #region PrivateFunctions /// /// Dispose of this object's resources /// /// Currently disposing protected virtual void Dispose(bool disposing) { } #endregion #region PublicFunctions /// /// FlowMeterOmegaDPF20 factory constructor /// /// /// public FlowMeterSim(string deviceName, IConfigurationManager configurationManager) { Name = deviceName; _logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}"); _configurationManager = configurationManager; _configuration = _configurationManager.GetConfiguration(Name); } /// /// /// /// public FlowMeterSim(string name) { Name = name; _logger = LogManager.GetCurrentClassLogger(); } // This code added to correctly implement the disposable pattern. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] public void Dispose() { lock (_sync) { Dispose(true); GC.SuppressFinalize(this); } } /// /// Query the flow rate from the flow meter /// /// the flow rate. public double ReadFlow() { lock (_sync) { double max = 0.15; double min = .35; Random rnd = new Random(); double seed = rnd.NextDouble(); double dataToReturn = (seed * (max - min)) + min; Thread.Sleep(100); return dataToReturn; } } public bool ClearErrors() { throw new NotImplementedException(); } public void Initialize() { throw new NotImplementedException(); } public SelfTestResult PerformSelfTest() { throw new NotImplementedException(); } public void Reset() { throw new NotImplementedException(); } public void Shutdown() { throw new NotImplementedException(); } #endregion } }