Major upgrade
This commit is contained in:
@@ -24,264 +24,245 @@ using Raytheon.Common;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// Flow Meter class used to interact with flow meter.
|
||||
/// It supports the Omega DPF20 when configured to slave mode (where data is pulled as opposed to pushed).
|
||||
/// Set to slave mode on the front panel
|
||||
/// </summary>
|
||||
public class FlowMeterOmegaDPF20 : IFlowMeter
|
||||
{
|
||||
#region PublicMembers
|
||||
public enum FlowMeterMode
|
||||
{
|
||||
MASTER,
|
||||
SLAVE
|
||||
};
|
||||
#endregion
|
||||
#region PrivateMembers
|
||||
/// <summary>
|
||||
/// Flow Meter class used to interact with flow meter.
|
||||
/// It supports the Omega DPF20 when configured to slave mode (where data is pulled as opposed to pushed).
|
||||
/// Set to slave mode on the front panel
|
||||
/// </summary>
|
||||
public class FlowMeterOmegaDPF20 : IFlowMeter
|
||||
{
|
||||
#region PublicMembers
|
||||
public enum FlowMeterMode
|
||||
{
|
||||
MASTER,
|
||||
SLAVE
|
||||
};
|
||||
#endregion
|
||||
#region PrivateMembers
|
||||
|
||||
//Prevent Collisions
|
||||
private static object _sync = new object();
|
||||
//Prevent Collisions
|
||||
private static object _sync = new object();
|
||||
|
||||
//Ethernet Communication
|
||||
private readonly string _ipAddr;
|
||||
private readonly int _port;
|
||||
private readonly byte _flowMeterAddress;
|
||||
private readonly FlowMeterOmegaDPF20.FlowMeterMode _mode;
|
||||
private const int _READ_BUFFER_SIZE = 1024;
|
||||
private const int _READ_TIMEOUT = 5500;
|
||||
private byte[] _readBuffer;
|
||||
private NetworkStream _tcpStream;
|
||||
TcpClient _flowSocket;
|
||||
//Ethernet Communication
|
||||
private readonly string _ipAddr;
|
||||
private readonly int _port;
|
||||
private readonly byte _flowMeterAddress;
|
||||
private readonly FlowMeterOmegaDPF20.FlowMeterMode _mode;
|
||||
private const int _READ_BUFFER_SIZE = 1024;
|
||||
private const int _READ_TIMEOUT = 5500;
|
||||
private byte[] _readBuffer;
|
||||
private NetworkStream _tcpStream;
|
||||
TcpClient _flowSocket;
|
||||
|
||||
/// <summary>
|
||||
/// NLog logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Raytheon configuration
|
||||
/// </summary>
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public string DetailedStatus => throw new NotImplementedException();
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public bool DisplayEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public bool FrontPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public string DetailedStatus => throw new NotImplementedException();
|
||||
|
||||
public InstrumentMetadata Info => 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 string Name {get; set;}
|
||||
public InstrumentMetadata Info => throw new NotImplementedException();
|
||||
|
||||
public SelfTestResult SelfTestResult => throw new NotImplementedException();
|
||||
public string Name { get; set; }
|
||||
|
||||
public State Status => throw new NotImplementedException();
|
||||
public SelfTestResult SelfTestResult => throw new NotImplementedException();
|
||||
|
||||
#endregion
|
||||
public State Status => throw new NotImplementedException();
|
||||
|
||||
#region PrivateFunctions
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~FlowMeterOmegaDPF20()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of this object's resources
|
||||
/// </summary>
|
||||
/// <param name="disposing">Currently disposing</param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
//Close Connection (if available)
|
||||
_tcpStream?.Close();
|
||||
_flowSocket?.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
//ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
}
|
||||
#region PrivateFunctions
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~FlowMeterOmegaDPF20()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Dispose of this object's resources
|
||||
/// </summary>
|
||||
/// <param name="disposing">Currently disposing</param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
//Close Connection (if available)
|
||||
_tcpStream?.Close();
|
||||
_flowSocket?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#region PublicFunctions
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// FlowMeterOmegaDPF20 factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public FlowMeterOmegaDPF20(string deviceName, IConfigurationManager configurationManager, ILogger logger)
|
||||
{
|
||||
Name = deviceName;
|
||||
#region PublicFunctions
|
||||
|
||||
_logger = logger;
|
||||
/// <summary>
|
||||
/// FlowMeterOmegaDPF20 factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public FlowMeterOmegaDPF20(string deviceName, IConfigurationManager configurationManager)
|
||||
{
|
||||
Name = deviceName;
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
_logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}");
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
|
||||
|
||||
_ipAddr = _configuration.GetConfigurationValue("FlowMeterOmegaDPF20", "IpAddr", "");
|
||||
_port = _configuration.GetConfigurationValue("FlowMeterOmegaDPF20", "Port", 0);
|
||||
_ipAddr = _configuration.GetConfigurationValue("FlowMeterOmegaDPF20", "IpAddr", "");
|
||||
_port = _configuration.GetConfigurationValue("FlowMeterOmegaDPF20", "Port", 0);
|
||||
|
||||
_readBuffer = new byte[_READ_BUFFER_SIZE];
|
||||
_readBuffer = new byte[_READ_BUFFER_SIZE];
|
||||
|
||||
//Create and open a socket to flow meter
|
||||
_flowSocket = new TcpClient(_ipAddr, _port);
|
||||
_tcpStream = _flowSocket.GetStream();
|
||||
_tcpStream.ReadTimeout = _READ_TIMEOUT;
|
||||
}
|
||||
//Create and open a socket to flow meter
|
||||
_flowSocket = new TcpClient(_ipAddr, _port);
|
||||
_tcpStream = _flowSocket.GetStream();
|
||||
_tcpStream.ReadTimeout = _READ_TIMEOUT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for the DPF20 flow meter. It makes a socket connection upon construction
|
||||
/// </summary>
|
||||
/// <param name="name">The name. Anything the hosts wants it to be</param>
|
||||
/// <param name="ipAddress">IP Address of the flow meter server</param>
|
||||
/// <param name="port">Port of the flow meter server</param>
|
||||
/// <param name="flowMeterAddress">The address on the front display of the flow meter</param>
|
||||
/// <param name="mode">The mode on the front display of the flow meter</param>
|
||||
public FlowMeterOmegaDPF20(string name, string ipAddress, int port, byte flowMeterAddress, FlowMeterOmegaDPF20.FlowMeterMode mode)
|
||||
{
|
||||
Name = name;
|
||||
_logger = LogManager.GetCurrentClassLogger();
|
||||
/// <summary>
|
||||
/// Constructor for the DPF20 flow meter. It makes a socket connection upon construction
|
||||
/// </summary>
|
||||
/// <param name="deviceName">The name. Anything the hosts wants it to be</param>
|
||||
/// <param name="ipAddress">IP Address of the flow meter server</param>
|
||||
/// <param name="port">Port of the flow meter server</param>
|
||||
/// <param name="flowMeterAddress">The address on the front display of the flow meter</param>
|
||||
/// <param name="mode">The mode on the front display of the flow meter</param>
|
||||
public FlowMeterOmegaDPF20(string deviceName, string ipAddress, int port, byte flowMeterAddress, FlowMeterOmegaDPF20.FlowMeterMode mode)
|
||||
{
|
||||
Name = deviceName;
|
||||
_logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}");
|
||||
|
||||
_ipAddr = ipAddress;
|
||||
_port = port;
|
||||
_flowMeterAddress = flowMeterAddress;
|
||||
_mode = mode;
|
||||
_ipAddr = ipAddress;
|
||||
_port = port;
|
||||
_flowMeterAddress = flowMeterAddress;
|
||||
_mode = mode;
|
||||
|
||||
//Initialize read buffer
|
||||
_readBuffer = new byte[_READ_BUFFER_SIZE];
|
||||
//Initialize read buffer
|
||||
_readBuffer = new byte[_READ_BUFFER_SIZE];
|
||||
|
||||
//Create and open a socket to flow meter
|
||||
_flowSocket = new TcpClient(_ipAddr, _port);
|
||||
_tcpStream = _flowSocket.GetStream();
|
||||
_tcpStream.ReadTimeout = _READ_TIMEOUT;
|
||||
}
|
||||
//Create and open a socket to flow meter
|
||||
_flowSocket = new TcpClient(_ipAddr, _port);
|
||||
_tcpStream = _flowSocket.GetStream();
|
||||
_tcpStream.ReadTimeout = _READ_TIMEOUT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="comPortName"></param>
|
||||
/// <param name="delayBeforeReadMs"></param>
|
||||
/// <param name="baudRate"></param>
|
||||
/// <param name="parity"></param>
|
||||
/// <param name="dataBits"></param>
|
||||
/// <param name="stopBits"></param>
|
||||
/// <param name="flowMeterAddress">The address on the front display of the flow meter</param>
|
||||
/// <param name="mode">The mode on the front display of the flow meter</param>
|
||||
public FlowMeterOmegaDPF20(string name, string comPortName, uint delayBeforeReadMs, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One, byte flowMeterAddress = 128, FlowMeterOmegaDPF20.FlowMeterMode mode = FlowMeterMode.SLAVE)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="comPortName"></param>
|
||||
/// <param name="delayBeforeReadMs"></param>
|
||||
/// <param name="baudRate"></param>
|
||||
/// <param name="parity"></param>
|
||||
/// <param name="dataBits"></param>
|
||||
/// <param name="stopBits"></param>
|
||||
/// <param name="flowMeterAddress">The address on the front display of the flow meter</param>
|
||||
/// <param name="mode">The mode on the front display of the flow meter</param>
|
||||
public FlowMeterOmegaDPF20(string name, string comPortName, uint delayBeforeReadMs, int baudRate = 115200, Parity parity = Parity.None, int dataBits = 8, StopBits stopBits = StopBits.One, byte flowMeterAddress = 128, FlowMeterOmegaDPF20.FlowMeterMode mode = FlowMeterMode.SLAVE)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// This code added to correctly implement the disposable pattern.
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
Dispose(true);
|
||||
// This code added to correctly implement the disposable pattern.
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message);
|
||||
}
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the flow rate from the flow meter
|
||||
/// </summary>
|
||||
/// <returns>the flow rate.</returns>
|
||||
public double ReadFlow()
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
if (_mode == FlowMeterMode.SLAVE)
|
||||
{
|
||||
byte[] cmd = FlowMeterOmegaDPF20DataParser.CreateReadFlowCmd(_flowMeterAddress);
|
||||
/// <summary>
|
||||
/// Query the flow rate from the flow meter
|
||||
/// </summary>
|
||||
/// <returns>the flow rate.</returns>
|
||||
public double ReadFlow()
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
if (_mode == FlowMeterMode.SLAVE)
|
||||
{
|
||||
byte[] cmd = FlowMeterOmegaDPF20DataParser.CreateReadFlowCmd(_flowMeterAddress);
|
||||
|
||||
_tcpStream.Write(cmd, 0, cmd.Length);
|
||||
_tcpStream.Write(cmd, 0, cmd.Length);
|
||||
|
||||
int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length);
|
||||
int numBytesRead = _tcpStream.Read(_readBuffer, 0, _readBuffer.Length);
|
||||
|
||||
double flow = FlowMeterOmegaDPF20DataParser.ParseReadFlowRsp(_readBuffer, numBytesRead);
|
||||
double flow = FlowMeterOmegaDPF20DataParser.ParseReadFlowRsp(_readBuffer, numBytesRead);
|
||||
|
||||
return flow;
|
||||
}
|
||||
else if (_mode == FlowMeterMode.MASTER)
|
||||
{
|
||||
const int EXPECTED_DATA_LEN = 18;
|
||||
return flow;
|
||||
}
|
||||
else if (_mode == FlowMeterMode.MASTER)
|
||||
{
|
||||
const int EXPECTED_DATA_LEN = 18;
|
||||
|
||||
// ensure we have at least one full message
|
||||
// need at least 35 bytes (worst case partial msg plus a full message)
|
||||
int numBytesAvailable = _flowSocket.Available;
|
||||
while (numBytesAvailable < (EXPECTED_DATA_LEN * 2) - 1)
|
||||
{
|
||||
Thread.Sleep(5);
|
||||
numBytesAvailable = _flowSocket.Available;
|
||||
}
|
||||
// ensure we have at least one full message
|
||||
// need at least 35 bytes (worst case partial msg plus a full message)
|
||||
int numBytesAvailable = _flowSocket.Available;
|
||||
while (numBytesAvailable < (EXPECTED_DATA_LEN * 2) - 1)
|
||||
{
|
||||
Thread.Sleep(5);
|
||||
numBytesAvailable = _flowSocket.Available;
|
||||
}
|
||||
|
||||
byte[] readBuf = new byte[numBytesAvailable];
|
||||
byte[] readBuf = new byte[numBytesAvailable];
|
||||
|
||||
int numBytesRead = _tcpStream.Read(readBuf, 0, readBuf.Length);
|
||||
int numBytesRead = _tcpStream.Read(readBuf, 0, readBuf.Length);
|
||||
|
||||
double flow = FlowMeterOmegaDPF20DataParser.ParseMasterFlowMsg(readBuf, numBytesRead);
|
||||
double flow = FlowMeterOmegaDPF20DataParser.ParseMasterFlowMsg(readBuf, numBytesRead);
|
||||
|
||||
return flow;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("unknown mode: " + _mode.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return flow;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("unknown mode: " + _mode.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ClearErrors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public bool ClearErrors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void Initialize()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void Reset()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void Shutdown()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,71 +30,64 @@
|
||||
// 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;
|
||||
using NLog;
|
||||
using Raytheon.Common;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
[ExportInstrumentFactory(ModelNumber = "FlowMeterOmegaDPF20Factory")]
|
||||
public class FlowMeterOmegaDPF20Factory : 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;
|
||||
[ExportInstrumentFactory(ModelNumber = "FlowMeterOmegaDPF20Factory")]
|
||||
public class FlowMeterOmegaDPF20Factory : IInstrumentFactory
|
||||
{
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
|
||||
public FlowMeterOmegaDPF20Factory(string defaultConfigPath = DefaultConfigPath)
|
||||
: this(null, defaultConfigPath)
|
||||
{
|
||||
}
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService";
|
||||
private static string DefaultPath;
|
||||
|
||||
/// <summary>
|
||||
/// COECommDeviceInstrumentFactory injection constructor
|
||||
/// </summary>
|
||||
/// <param name="configManager"></param>
|
||||
/// <param name="simEngine"></param>
|
||||
/// <param name="logger"></param>
|
||||
[ImportingConstructor]
|
||||
public FlowMeterOmegaDPF20Factory([Import(AllowDefault = false)] IConfigurationManager configManager,
|
||||
[Import(AllowDefault = true)] string defaultConfigPath = null)
|
||||
{
|
||||
DefaultPath = defaultConfigPath;
|
||||
public FlowMeterOmegaDPF20Factory(string defaultConfigPath = DefaultConfigPath)
|
||||
: this(null, defaultConfigPath)
|
||||
{
|
||||
}
|
||||
|
||||
if (LogManager.Configuration == null)
|
||||
{
|
||||
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
|
||||
}
|
||||
/// <summary>
|
||||
/// FlowMeterOmegaDPF20Factory injection constructor
|
||||
/// </summary>
|
||||
[ImportingConstructor]
|
||||
public FlowMeterOmegaDPF20Factory([Import(AllowDefault = false)] IConfigurationManager configManager,
|
||||
[Import(AllowDefault = true)] string defaultConfigPath = null)
|
||||
{
|
||||
DefaultPath = defaultConfigPath;
|
||||
|
||||
_configurationManager = configManager ?? GetConfigurationManager();
|
||||
_supportedInterfaces.Add(typeof(IFlowMeter));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
return new FlowMeterOmegaDPF20(name, _configurationManager, _logger);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
if (LogManager.Configuration == null)
|
||||
{
|
||||
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
|
||||
}
|
||||
|
||||
_configurationManager = configManager ?? GetConfigurationManager();
|
||||
_supportedInterfaces.Add(typeof(IFlowMeter));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new FlowMeterOmegaDPF20(name, _configurationManager);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
@@ -105,12 +98,10 @@ namespace Raytheon.Instruments
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = LogManager.GetLogger(name);
|
||||
|
||||
if (simulateHw)
|
||||
return new FlowMeterSim(name, _configurationManager, _logger);
|
||||
return new FlowMeterSim(name, _configurationManager);
|
||||
else
|
||||
return new FlowMeterOmegaDPF20(name, _configurationManager, _logger);
|
||||
return new FlowMeterOmegaDPF20(name, _configurationManager);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -123,17 +114,17 @@ namespace Raytheon.Instruments
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 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