ReSharper: -WaterMeterCore

This commit is contained in:
Thomas Wiedebusch
2022-09-09 18:53:03 +02:00
parent 725b004355
commit 621537cd93
6 changed files with 76 additions and 12 deletions
@@ -24,6 +24,11 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
/// <inheritdoc />
public virtual event EventHandler<BasePortDataEventArgs> OnRawRecordReceived;
/// <summary>
/// The port is not assigned.
/// </summary>
public const String PortNotAssigned = "NA";
/// <inheritdoc />
public virtual event EventHandler<BasePortDataEventArgs> OnRawRecordSendOut;
@@ -662,7 +662,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </summary>
public void ConnectMeter()
{
if (RequestPort != null)
if (RequestPort != null && RequestPort.GetPortName() != BaseSerialPort.PortNotAssigned)
{
LinkPortToProtocol(RequestPort, RequestProtocol);
_logger.Trace($"Slot:{Slot} - RequestPort and RequestProtocol linked");
@@ -670,7 +670,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
RequestProtocol.OnRecordIsDecoded += RequestProtocol_ApplyDecodedRecord;
RequestProtocol.OnAuthorizationGrant += RequestProtocol_AuthorizationGrant;
}
if (StreamingPort != null)
if (StreamingPort != null && StreamingPort.GetPortName() != BaseSerialPort.PortNotAssigned)
{
LinkPortToProtocol(StreamingPort, StreamingProtocol);
_logger.Trace($"Slot:{Slot} - StreamingPort and StreamingProtocol linked");
@@ -1,40 +1,100 @@
namespace Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts
{
/// <summary>
/// Display codes to keep the user informed about the production and processing step.
/// This is useful as the user doesn't need to connect the device to a PC, he can
/// immediately inspect the status of the device.
/// </summary>
public enum DisplayCodes
{
//general
//general information
/// <summary>
/// Status not set
/// </summary>
None = 0x0000,
/// <summary>
/// Error state
/// </summary>
Error = 0xFFFF,
//Production proccess
//Production process
//assembly line
//Picking
/// <summary>
/// Picking in progress
/// </summary>
PickingStarted = 0x7700,
/// <summary>
/// Picking succeeded, next step can be initiated
/// </summary>
PickingTested = 0x7777,
/// <summary>
/// Picking failed
/// </summary>
PickingFailed = 0xFF77,
//Pressure
/// <summary>
/// Pressure testing succeeded, next step can be initiated
/// </summary>
PressureTested = 0x1111,
/// <summary>
/// Pressure test failed
/// </summary>
PressureTestedFailed = 0xFF11,
//Marriage
/// <summary>
/// Connection between PCBID, Serial Number and Order number done
/// </summary>
Mounted = 0x2222,
//Testbench
//Test bench
/// <summary>
/// Zero flow test succeeded, next step can be initiated
/// </summary>
ZeroFlow = 0x3333,
/// <summary>
/// Zero flow test failed
/// </summary>
ZeroFlowFailed = 0xFF33,
/// <summary>
/// Flow calibration succeeded, next step can be initiated
/// </summary>
FlowCalibrated = 0x4444,
/// <summary>
/// Flow calibration failed
/// </summary>
FlowCalibrationOurOfRange = 0xFF44,
/// <summary>
/// Flow test succeeded, next step can be initiated
/// </summary>
FlowTested = 0x5555,
/// <summary>
/// Flow test failed
/// </summary>
FlowTestFailed = 0xFF55,
//End of line / final test
/// <summary>
/// Final test failed, else the display will be switched to operational mode,
/// showing the actual accumulated volume
/// </summary>
FinalTestFailed = 0xFF66,
//FWUpdate
/// <summary>
/// FW update is ongoing
/// </summary>
FwUpdateActive = 0x8888,
/// <summary>
/// FW update failed
/// </summary>
FwUpdateFailed = 0xFF88,
/// <summary>
/// FW update succeeded
/// </summary>
FwUpToDate = 0x9999,
}
}
@@ -24,14 +24,14 @@ namespace Xylem.Common.Hardware.WaterMeter.WaterMeterCore
{
private readonly List<MeterTypeRegisters> _meterTypeRegistersCollection = new List<MeterTypeRegisters>();
private readonly ILogger _logger;
private readonly string _sourceLocation;
private readonly String _sourceLocation;
/// <summary>
/// ctor
/// </summary>
public MeterBatch(String SourceLocation = "")
public MeterBatch(String sourceLocation = "")
{
SourceLocation = _sourceLocation;
_sourceLocation = sourceLocation;
_logger = NLogHelper.CreateOrGetLogger("MeterBatch");
_logger.Info("Meter batch created");
@@ -27,7 +27,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
public partial class FrmStreamingQuality : Form
{
private GenesisMeterStreamingQuality _currentGenesis;
private MeterBatch _meterBatch = new MeterBatch("C:\\Users\\drabesch_ro\\Downloads\\ReleaseV1.1.2.6\\");
private MeterBatch _meterBatch = new MeterBatch();
private readonly ILogger _logger;
private const Int32 SampleRateHz = 16;
private Int32 _channels;
+2 -3
View File
@@ -7,7 +7,6 @@ using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Windows.Forms;
using System.Xml.Linq;
@@ -281,11 +280,11 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
if (portList.All(pl => pl != (String)row[StreamingPortString]))
{
ret.Rows.Add(row[StreamingPortString].ToString(), "NA");
ret.Rows.Add(row[StreamingPortString].ToString(), BaseSerialPort.PortNotAssigned);
}
if (portList.All(pl => pl != (String)row[RequestPortString]))
{
ret.Rows.Add(row[RequestPortString].ToString(), "NA");
ret.Rows.Add(row[RequestPortString].ToString(), BaseSerialPort.PortNotAssigned);
}
}