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 /> /// <inheritdoc />
public virtual event EventHandler<BasePortDataEventArgs> OnRawRecordReceived; public virtual event EventHandler<BasePortDataEventArgs> OnRawRecordReceived;
/// <summary>
/// The port is not assigned.
/// </summary>
public const String PortNotAssigned = "NA";
/// <inheritdoc /> /// <inheritdoc />
public virtual event EventHandler<BasePortDataEventArgs> OnRawRecordSendOut; public virtual event EventHandler<BasePortDataEventArgs> OnRawRecordSendOut;
@@ -662,7 +662,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </summary> /// </summary>
public void ConnectMeter() public void ConnectMeter()
{ {
if (RequestPort != null) if (RequestPort != null && RequestPort.GetPortName() != BaseSerialPort.PortNotAssigned)
{ {
LinkPortToProtocol(RequestPort, RequestProtocol); LinkPortToProtocol(RequestPort, RequestProtocol);
_logger.Trace($"Slot:{Slot} - RequestPort and RequestProtocol linked"); _logger.Trace($"Slot:{Slot} - RequestPort and RequestProtocol linked");
@@ -670,7 +670,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
RequestProtocol.OnRecordIsDecoded += RequestProtocol_ApplyDecodedRecord; RequestProtocol.OnRecordIsDecoded += RequestProtocol_ApplyDecodedRecord;
RequestProtocol.OnAuthorizationGrant += RequestProtocol_AuthorizationGrant; RequestProtocol.OnAuthorizationGrant += RequestProtocol_AuthorizationGrant;
} }
if (StreamingPort != null) if (StreamingPort != null && StreamingPort.GetPortName() != BaseSerialPort.PortNotAssigned)
{ {
LinkPortToProtocol(StreamingPort, StreamingProtocol); LinkPortToProtocol(StreamingPort, StreamingProtocol);
_logger.Trace($"Slot:{Slot} - StreamingPort and StreamingProtocol linked"); _logger.Trace($"Slot:{Slot} - StreamingPort and StreamingProtocol linked");
@@ -1,40 +1,100 @@
namespace Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts 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 public enum DisplayCodes
{ {
//general //general information
/// <summary>
/// Status not set
/// </summary>
None = 0x0000, None = 0x0000,
/// <summary>
/// Error state
/// </summary>
Error = 0xFFFF, Error = 0xFFFF,
//Production proccess //Production process
//assembly line //assembly line
//Picking //Picking
/// <summary>
/// Picking in progress
/// </summary>
PickingStarted = 0x7700, PickingStarted = 0x7700,
/// <summary>
/// Picking succeeded, next step can be initiated
/// </summary>
PickingTested = 0x7777, PickingTested = 0x7777,
/// <summary>
/// Picking failed
/// </summary>
PickingFailed = 0xFF77, PickingFailed = 0xFF77,
//Pressure //Pressure
/// <summary>
/// Pressure testing succeeded, next step can be initiated
/// </summary>
PressureTested = 0x1111, PressureTested = 0x1111,
/// <summary>
/// Pressure test failed
/// </summary>
PressureTestedFailed = 0xFF11, PressureTestedFailed = 0xFF11,
//Marriage //Marriage
/// <summary>
/// Connection between PCBID, Serial Number and Order number done
/// </summary>
Mounted = 0x2222, Mounted = 0x2222,
//Testbench //Test bench
/// <summary>
/// Zero flow test succeeded, next step can be initiated
/// </summary>
ZeroFlow = 0x3333, ZeroFlow = 0x3333,
/// <summary>
/// Zero flow test failed
/// </summary>
ZeroFlowFailed = 0xFF33, ZeroFlowFailed = 0xFF33,
/// <summary>
/// Flow calibration succeeded, next step can be initiated
/// </summary>
FlowCalibrated = 0x4444, FlowCalibrated = 0x4444,
/// <summary>
/// Flow calibration failed
/// </summary>
FlowCalibrationOurOfRange = 0xFF44, FlowCalibrationOurOfRange = 0xFF44,
/// <summary>
/// Flow test succeeded, next step can be initiated
/// </summary>
FlowTested = 0x5555, FlowTested = 0x5555,
/// <summary>
/// Flow test failed
/// </summary>
FlowTestFailed = 0xFF55, FlowTestFailed = 0xFF55,
//End of line / final test //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, FinalTestFailed = 0xFF66,
//FWUpdate //FWUpdate
/// <summary>
/// FW update is ongoing
/// </summary>
FwUpdateActive = 0x8888, FwUpdateActive = 0x8888,
/// <summary>
/// FW update failed
/// </summary>
FwUpdateFailed = 0xFF88, FwUpdateFailed = 0xFF88,
/// <summary>
/// FW update succeeded
/// </summary>
FwUpToDate = 0x9999, FwUpToDate = 0x9999,
} }
} }
@@ -24,14 +24,14 @@ namespace Xylem.Common.Hardware.WaterMeter.WaterMeterCore
{ {
private readonly List<MeterTypeRegisters> _meterTypeRegistersCollection = new List<MeterTypeRegisters>(); private readonly List<MeterTypeRegisters> _meterTypeRegistersCollection = new List<MeterTypeRegisters>();
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly string _sourceLocation; private readonly String _sourceLocation;
/// <summary> /// <summary>
/// ctor /// ctor
/// </summary> /// </summary>
public MeterBatch(String SourceLocation = "") public MeterBatch(String sourceLocation = "")
{ {
SourceLocation = _sourceLocation; _sourceLocation = sourceLocation;
_logger = NLogHelper.CreateOrGetLogger("MeterBatch"); _logger = NLogHelper.CreateOrGetLogger("MeterBatch");
_logger.Info("Meter batch created"); _logger.Info("Meter batch created");
@@ -27,7 +27,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
public partial class FrmStreamingQuality : Form public partial class FrmStreamingQuality : Form
{ {
private GenesisMeterStreamingQuality _currentGenesis; 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 readonly ILogger _logger;
private const Int32 SampleRateHz = 16; private const Int32 SampleRateHz = 16;
private Int32 _channels; private Int32 _channels;
+2 -3
View File
@@ -7,7 +7,6 @@ using System.Drawing;
using System.IO; using System.IO;
using System.IO.Ports; using System.IO.Ports;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq; using System.Xml.Linq;
@@ -281,11 +280,11 @@ namespace Xylem.Common.Ui.GenesisToolBox
{ {
if (portList.All(pl => pl != (String)row[StreamingPortString])) 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])) if (portList.All(pl => pl != (String)row[RequestPortString]))
{ {
ret.Rows.Add(row[RequestPortString].ToString(), "NA"); ret.Rows.Add(row[RequestPortString].ToString(), BaseSerialPort.PortNotAssigned);
} }
} }