diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
index 07d02ca0..1e262705 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
@@ -35,11 +35,10 @@
using System;
using System.Globalization;
using System.IO.Ports;
-using System.Threading;
using System.Threading.Tasks;
using Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Consts;
using Xylem.Common.CommonCore.Consts;
-using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments;
+using Xylem.Common.Utils.ProcessExec.EventArguments;
namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
@@ -50,12 +49,12 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{
#region events
///
- public virtual event EventHandler OnRawRecordReceived;
+ public virtual event EventHandler OnRawRecordReceived;
#endregion
#region properties
- const Char _eos = FM2014CmdDef.END_OF_STRING;
+ private const Char _eos = FM2014CmdDef.END_OF_STRING;
///
public Boolean ReceiveTaskIsActive
@@ -94,7 +93,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
///
- public Int32? Address
+ public Int32 Address
{
get;
set;
@@ -156,6 +155,30 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
private set;
}
+ ///
+ /// Number of processing steps for this actual process progress
+ ///
+ private Int32 MaxActualProcessProgress { get; set; }
+
+ ///
+ /// Progress of actual process
+ ///
+ private Int32 _actualProcessProgress;
+ ///
+ /// Actual process progress of subroutine
+ ///
+ private Int32 ActualProcessProgress
+ {
+ get => _actualProcessProgress;
+ set
+ {
+ _actualProcessProgress = value;
+ if (_actualProcessProgress > MaxActualProcessProgress)
+ _actualProcessProgress = MaxActualProcessProgress;
+ }
+ }
+
+
#endregion
#region methods
@@ -189,6 +212,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// - Manual input of volume.
///
///
+ ///
+ /// - Initial.
+ ///
public Boolean ManualRefCalibration()
{
if (SerialPort == null || !SerialPort.IsOpen)
@@ -218,6 +244,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Measurement Loop
Task.Run(() =>
{
+ // Get the process information
+ var info = FM2014CmdDef.GetCmdInfo(FM2014CmdDef.CmdDef.CMD_REF_GET_PLS_CTR);
var cmdCode = FM2014CmdDef.GetCmdChar(FM2014CmdDef.CmdDef.CMD_REF_GET_PLS_CTR);
do
{
@@ -227,7 +255,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
var refPulseStr = SerialPort.ReadTo($"{_eos}");
if (int.TryParse(refPulseStr, NumberStyles.HexNumber, new CultureInfo("en"), out var refPulses))
- OnRawRecordReceived?.Invoke(this, new StringPortDataEventArgs($"{refPulses:D}"));
+ {
+ var response = new FM2014CmdDef.CmdResponse(FM2014CmdDef.CmdDef.CMD_REF_GET_PLS_CTR, "",
+ refPulses);
+ OnRawRecordReceived?.Invoke(this, new ProcessExecEventArgs(info, specificInfoObj: response));
+ }
}
catch (Exception e)
{
@@ -241,7 +273,14 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
return true;
}
+ ///
+ /// Login to individual address.
+ ///
+ ///
///
+ ///
+ /// - Initial.
+ ///
public Boolean Login()
{
if (SerialPort == null)
diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj
index 55565179..b60f2f2f 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj
@@ -314,6 +314,10 @@
{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}
CommonCore
+
+ {2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB}
+ ProcessExec
+
{2e139f63-b6fe-4ea9-a098-85364fe9b26c}
PortCore
diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/IFM2014.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/IFM2014.cs
index ce7308dc..2579ce9c 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/IFM2014.cs
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/IFM2014.cs
@@ -35,7 +35,7 @@ using System;
using System.IO.Ports;
//using NLog;
using Xylem.Common.CommonCore.Consts;
-using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments;
+using Xylem.Common.Utils.ProcessExec.EventArguments;
namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{
@@ -51,7 +51,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
///
/// String data feedback
///
- event EventHandler OnRawRecordReceived;
+ event EventHandler OnRawRecordReceived;
#endregion
#region properties
@@ -89,7 +89,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
///
/// FM2014 address string
///
- Int32? Address
+ Int32 Address
{
get;
}
diff --git a/MiniPrf/Ui/FrmMainMiniPrf.cs b/MiniPrf/Ui/FrmMainMiniPrf.cs
index c12af601..652ea1e5 100644
--- a/MiniPrf/Ui/FrmMainMiniPrf.cs
+++ b/MiniPrf/Ui/FrmMainMiniPrf.cs
@@ -44,7 +44,8 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
-using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments;
+using Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Consts;
+using Xylem.Common.Utils.ProcessExec.EventArguments;
namespace Sensus.MiniPrf.Ui
{
@@ -430,10 +431,6 @@ namespace Sensus.MiniPrf.Ui
}
}
- private void _fm2014_OnRawRecordReceived(Object sender, StringPortDataEventArgs e)
- {
- throw new NotImplementedException();
- }
#endregion BoardControls
#region ProcessControls
@@ -652,9 +649,12 @@ namespace Sensus.MiniPrf.Ui
#region Event handler
- private void DataReceived_Handler(Object sender, BasePortDataEventArgs e)
+ private void DataReceived_Handler(Object sender, ProcessExecEventArgs e)
{
- LogText(e.GetData().ToString());
+
+ var resp = (FM2014CmdDef.CmdResponse)e.SpecificInfoObj;
+ if (resp.IntValue != null)
+ LogText(resp.IntValue.ToString());
// Return to standby
if (!_fm2014.ReceiveTaskIsActive)
diff --git a/MiniPrf/Ui/MiniPrf.csproj b/MiniPrf/Ui/MiniPrf.csproj
index 7425c76b..8d93be23 100644
--- a/MiniPrf/Ui/MiniPrf.csproj
+++ b/MiniPrf/Ui/MiniPrf.csproj
@@ -125,6 +125,10 @@
{4B88B0D3-E791-4774-9521-EABEACDC420E}
Logging
+
+ {2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB}
+ ProcessExec
+