diff --git a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs
index 943b65ef..11614711 100644
--- a/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs
+++ b/Common/Hardware/WaterMeter/MagFlux/MagFluxCore/MagFluxMeter.cs
@@ -22,6 +22,7 @@ using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Metrology.Measurements;
using Xylem.Common.Metrology.Measurements.Consts;
using Xylem.Common.Utils.Logging;
+using XYLEM.Device;
namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
@@ -34,7 +35,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
public class MagFluxMeter : IMeter, IMeterEvents
{
#region Variables and Properties
-
+
///
/// Mark the streaming catcher as active
///
@@ -43,7 +44,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
///
/// Streaming decoder
///
- private StreamingDecoder _streamingDecoder;
+ //private StreamingDecoder _streamingDecoder;
///
/// Enable raw record logging, if set every incoming package will be logged
@@ -112,6 +113,14 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
get; private set;
}
+ ///
+ /// Represent unique id
+ ///
+ public String UniqueId
+ {
+ get; private set;
+ }
+
private String _currentActionText = "";
///
/// Hold the current process name e.g. FlowTest, Preadjustemtn for logging
@@ -229,7 +238,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
private set;
get;
}
-
+
///
public ErrorState ErrorStatus
{
@@ -398,14 +407,13 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
{
return;
}
- _streamingDecoder = new StreamingDecoder(false);
if (!(StreamingPort is LedSerialPort))
{
throw new ApplicationException("No valid streaming port");
}
SyncStreamingBuffer(SyncMarkRecord.DecodeEveryPackage);
- ((LedSerialPort)StreamingPort).OnRawRecordReceived += StreamingCatcher_OnRawRecordReceived;
+ StreamingProtocol.OnRecordIsDecoded += StreamingCatcher_OnRawRecordReceived;
LogRawData(true);
_streamingCatcherIsActive = true;
}
@@ -415,16 +423,9 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
///
///
///
- private void StreamingCatcher_OnRawRecordReceived(Object sender, BasePortDataEventArgs e)
+ private void StreamingCatcher_OnRawRecordReceived(Object sender, BaseDataEventArgs e)
{
- var data = (String)e.GetData();
-
- if (_streamingDecoder.DecodeMsg(data))
- {
- // Fire event for listener
- OnStreamingRecordDecoded?.Invoke(this,
- new MagFluxFlowDataEventArgs{ NewData = _streamingDecoder.DataMagFlux, RawData = data });
- }
+ OnStreamingRecordDecoded?.Invoke(this, (MagFluxFlowDataEventArgs)e);
}
///
@@ -438,7 +439,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
throw new ApplicationException("No valid streaming port");
}
LogRawData(false);
- ((LedSerialPort)StreamingPort).OnRawRecordReceived -= StreamingCatcher_OnRawRecordReceived;
+ StreamingProtocol.OnRecordIsDecoded -= StreamingCatcher_OnRawRecordReceived;
SyncStreamingBuffer(SyncMarkRecord.SkipDecoding);
_streamingCatcherIsActive = false;
}
@@ -728,7 +729,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
{
SetupMagFluxMeter(slot, slotConfig.Request, slotConfig.Streaming, ignoreCorruptedData);
}
- SetLogger();
+ SetLogger();
_logger.Debug($"Slot:{slot} - Configuration loaded");
}
@@ -741,9 +742,14 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
}
///
+ ///
+ /// - Unique Id introduced,
+ /// - Sensor Serial number mapped as PcbId.
+ ///
public Boolean Login()
{
- if (!RequestProtocol.Connect(RequestPort.GetPortName())) return IsLoggedOn;
+ if (!RequestProtocol.Connect(RequestPort.GetPortName()))
+ return IsLoggedOn;
IsLoggedOn = true;
if (RequestProtocol.GetFirmwareVersion(out var fwVersion))
@@ -762,15 +768,16 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
{
FwGitHash = gitHash;
}
- if (RequestProtocol.GetSensorSerialNo(out var serialNumber))
+ if (RequestProtocol.GetUniqueId(out var uniqueId))
{
- SerialNumber = serialNumber;
+ UniqueId = uniqueId;
}
- if (RequestProtocol.GetUniqueId(out var pcbId))
+ if (RequestProtocol.GetSensorSerialNo(out var pcbId))
{
PcbId = pcbId;
}
+ StreamingProtocol?.SetDecodingMask(pcbId, uniqueId);
return IsLoggedOn;
}
@@ -941,11 +948,36 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
return ret.HasValue ? ret.Value : false;
}
+ private CalibrationPoints calibPoints;
+
+ ///
+ /// Write calibration values to MagFlux
+ ///
+ public void WriteCalibration()
+ {
+ _logger.Info($"Slot:{Slot} - Write calibration values to MagFlux");
+ RequestProtocol?.SetCalibrationPoints(calibPoints);
+ }
+ ///
+ /// Write calibration values to MagFlux
+ ///
+ public void ReadCalibration()
+ {
+ _logger.Info($"Slot:{Slot} - Read calibration values from MagFlux");
+ RequestProtocol?.GetCalibrationPoints(out calibPoints);
+ }
///
public void InitCalibration()
{
_logger.Info($"Slot:{Slot} - Init calibration and set calibration values of all channels to default");
- PreMeasurement();
+ if (RequestProtocol == null)
+ return;
+ // first read out the current calibration points
+ RequestProtocol.GetCalibrationPoints(out calibPoints);
+ if (RequestProtocol.PrepareDeviceForCalibration())
+ PreMeasurement();
+ RequestProtocol.GetCalibrationPoints(out calibPoints);
+
}
///
@@ -958,6 +990,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
public void StopCalibration()
{
StopMeasurement();
+ RequestProtocol?.AbortDeviceForCalibration();
}
///
@@ -1129,7 +1162,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
void IMeter.SetupFromConfigFile(Int32 slot, Boolean ignoreCorruptedData, Boolean useRequest, Boolean useStreaming)
{
SetupFromConfigFile(slot, ignoreCorruptedData);
-
+
}
#endregion
}
diff --git a/Common/Hardware/WaterMeter/MagFlux/Protocols/RequestProtocol/RequestProtocol.cs b/Common/Hardware/WaterMeter/MagFlux/Protocols/RequestProtocol/RequestProtocol.cs
index a04becee..55bf292f 100644
--- a/Common/Hardware/WaterMeter/MagFlux/Protocols/RequestProtocol/RequestProtocol.cs
+++ b/Common/Hardware/WaterMeter/MagFlux/Protocols/RequestProtocol/RequestProtocol.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading;
using NLog;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments;
using Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore;
@@ -60,6 +61,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.IsConnected();
_logger.Debug(retVal ? $"{_ident} Connection established: true" : $"{_ident} Connection check request failed!");
+ Thread.Sleep(100);
return retVal;
}
@@ -77,6 +79,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
var retVal = _magFluxRequestProtocol.Connect(portName);
_logger.Debug(retVal ? $"{_ident} Connection established to {portName}" :
$"{_ident} Connection to {portName} failed!");
+ Thread.Sleep(100);
return retVal;
}
@@ -100,6 +103,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
var retVal = _magFluxRequestProtocol.SetLogLocation(path, fileName);
if (string.IsNullOrEmpty(fileName)) fileName = "?";
_logger.Debug(retVal ? $"{_ident} Logging set to: {path}\\{fileName}" : $"{_ident} Logging path setup failed!");
+ Thread.Sleep(100);
return retVal;
}
@@ -122,6 +126,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.GetSensorSerialNo(out serialNumber);
_logger.Debug(retVal ? $"{_ident} SensorId: {serialNumber}" : $"{_ident} SensorId request failed!");
+ Thread.Sleep(100);
return retVal;
}
///
@@ -138,6 +143,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.GetUniqueId(out pcbId);
_logger.Debug(retVal ? $"{_ident} UniqueId: {pcbId}" : $"{_ident} UniqueId request failed!");
+ Thread.Sleep(100);
return retVal;
}
@@ -155,6 +161,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.GetFirmwareVersion(out fwVersion);
_logger.Debug(retVal ? $"{_ident} FW Version: {fwVersion}" : $"{_ident} FW Version request failed!");
+ Thread.Sleep(100);
return retVal;
}
///
@@ -171,6 +178,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.GetFwBuildDate(out fwBuildDate);
_logger.Debug(retVal ? $"{_ident} FW Build Date: {fwBuildDate}" : $"{_ident} FW Build Date request failed!");
+ Thread.Sleep(100);
return retVal;
}
@@ -188,6 +196,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.GetFwGitHash(out fwGitHash);
_logger.Debug(retVal ? $"{_ident} FW GIT Hash: {fwGitHash}" : $"{_ident} FW GIT Hash request failed!");
+ Thread.Sleep(100);
return retVal;
}
@@ -210,6 +219,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.GetDn_mm(out meterSize);
_logger.Debug(retVal ? $"{_ident} MeterSize DN: {meterSize}" : $"{_ident} MeterSize request failed!");
+ Thread.Sleep(100);
return retVal;
}
@@ -225,12 +235,22 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
public Boolean PrepareDeviceForCalibration()
{
- throw new NotImplementedException();
+ if (_magFluxRequestProtocol == null) return false;
+ var retVal = _magFluxRequestProtocol.PrepareDeviceForCalibration();
+ _logger.Debug(retVal ? $"{_ident} MagFlux successfully prepared for calibration" :
+ $"{_ident} MagFlux preparation for calibration failed!");
+ Thread.Sleep(100);
+ return retVal;
}
public Boolean AbortDeviceForCalibration()
{
- throw new NotImplementedException();
+ if (_magFluxRequestProtocol == null) return false;
+ var retVal = _magFluxRequestProtocol.AbortDeviceForCalibration();
+ _logger.Debug(retVal ? $"{_ident} MagFlux calibration successfully aborted" :
+ $"{_ident} MagFlux abortion of calibration failed!");
+ Thread.Sleep(100);
+ return retVal;
}
///
@@ -246,14 +266,28 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
calibPoints = null;
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.GetCalibrationPoints(out calibPoints);
- _logger.Debug(retVal ? $"{_ident} Calibration successfully read from MagFlux" :
- $"{_ident} Calibration read failed!");
+ _logger.Debug(retVal ? $"{_ident} MagFlux calibration successfully read" :
+ $"{_ident} MagFlux calibration read failed!");
+ Thread.Sleep(100);
return retVal;
}
- public Boolean SetCalibrationPoints(CalibrationPoints new_calibration_points)
+ ///
+ /// Wrapper to set the calibration points from MagFlux
+ ///
+ ///
+ ///
+ ///
+ /// - Initial
+ ///
+ public Boolean SetCalibrationPoints(CalibrationPoints calibPoints)
{
- throw new NotImplementedException();
+ if (_magFluxRequestProtocol == null) return false;
+ var retVal = _magFluxRequestProtocol.SetCalibrationPoints(calibPoints);
+ _logger.Debug(retVal ? $"{_ident} MagFlux calibration successfully set" :
+ $"{_ident} MagFlux calibration setup failed!");
+ Thread.Sleep(100);
+ return retVal;
}
@@ -269,6 +303,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol
if (_magFluxRequestProtocol == null) return false;
var retVal = _magFluxRequestProtocol.CloseConnection();
_logger.Debug(retVal ? $"{_ident} Connection closed" : $"{_ident} Close connection request failed!");
+ Thread.Sleep(100);
return retVal;
}
}
diff --git a/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingDecoder.cs b/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingDecoder.cs
index 81eae79c..c016c18c 100644
--- a/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingDecoder.cs
+++ b/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingDecoder.cs
@@ -49,6 +49,8 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
private MagFluxRecord _dataMagFluxRec;
private readonly Boolean _ignoreCorruptedData;
+ private String _pcbIdMask;
+ private String _uniqueIdMask;
///
/// Constructor initializes all decoded members with default values
@@ -67,6 +69,23 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
get; private set;
}
+ ///
+ /// Set decoding mask for streaming protocol, wipes out all not matching records:
+ /// - PcbIdMask equals the sensor serial no
+ /// - UniqueIdMask
+ ///
+ ///
+ ///
+ /// true if decoding was successful and data has been validated
+ ///
+ /// - Initial.
+ ///
+ public void SetDecodingMask(String pcbIdMask, String uniqueIdMask)
+ {
+ // the pcbId equals the sensorSn
+ _pcbIdMask = pcbIdMask;
+ _uniqueIdMask = uniqueIdMask;
+ }
///
/// Decoding the raw message
///
@@ -126,11 +145,15 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
switch (rawMsgFields[0])
{
case "@l":
- _dataMagFluxRec.IsValid = rawRecordIsValid;
if (rawRecordIsValid || !_ignoreCorruptedData)
{
DecodeProtocolL(ref _dataMagFluxRec, rawMsgFields);
- DataMagFlux = _dataMagFluxRec;
+ if (string.Equals(_uniqueIdMask, _dataMagFluxRec.UniqueId) &&
+ string.Equals(_pcbIdMask, _dataMagFluxRec.SensorId))
+ {
+ DataMagFlux = _dataMagFluxRec;
+ _dataMagFluxRec.IsValid = rawRecordIsValid;
+ }
}
break;
diff --git a/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingProtocol.cs b/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingProtocol.cs
index 98279ce0..cb15fbae 100644
--- a/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingProtocol.cs
+++ b/Common/Hardware/WaterMeter/MagFlux/Protocols/StreamingProtocol/StreamingProtocol.cs
@@ -19,10 +19,29 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
///
private StreamingDecoder _streamingDecode;
private readonly Boolean _ignoreCorruptedData;
+ private String _pcbIdMask;
+ private String _uniqueIdMask;
///
public override event EventHandler OnRecordIsDecoded;
+ ///
+ /// Set decoding mask for streaming protocol, wipes out all not matching records:
+ /// - PcbIdMask equals the sensor serial no
+ /// - UniqueIdMask
+ ///
+ ///
+ ///
+ /// true if decoding was successful and data has been validated
+ ///
+ /// - Initial.
+ ///
+ public void SetDecodingMask(String pcbIdMask, String uniqueIdMask)
+ {
+ // the pcbId equals the sensorSn
+ _pcbIdMask = pcbIdMask;
+ _uniqueIdMask = uniqueIdMask;
+ }
///
protected override void DecodeRecord(IPortDataEventArgs dataArgs)
{
@@ -30,6 +49,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
//Data decoding
_streamingDecode = new StreamingDecoder(_ignoreCorruptedData);
+ _streamingDecode.SetDecodingMask(_pcbIdMask, _uniqueIdMask);
_streamingDecode.DecodeMsg(data);
//Event for new data
diff --git a/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs b/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs
index 18286c80..21ef3bcd 100644
--- a/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs
+++ b/Common/Ui/MagFluxToolBox/FrmTest.Designer.cs
@@ -49,6 +49,8 @@
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.picLogo = new System.Windows.Forms.PictureBox();
this.grpMeasurements = new System.Windows.Forms.GroupBox();
+ this.tbxRevVolume = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
this.tbxStatus = new System.Windows.Forms.TextBox();
this.lblStatus = new System.Windows.Forms.Label();
this.tbxVolume = new System.Windows.Forms.TextBox();
@@ -67,13 +69,17 @@
this.lblFwVersion = new System.Windows.Forms.Label();
this.tbxFwVersion = new System.Windows.Forms.TextBox();
this.lblSensorId = new System.Windows.Forms.Label();
- this.tbxRevVolume = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
+ this.btnPrepareCalibration = new System.Windows.Forms.Button();
+ this.btnReadCalibration = new System.Windows.Forms.Button();
+ this.btnWriteCalibration = new System.Windows.Forms.Button();
+ this.btnAbortCalibration = new System.Windows.Forms.Button();
+ this.grpCalibration = new System.Windows.Forms.GroupBox();
this.grpSetup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picLogo)).BeginInit();
this.grpMeasurements.SuspendLayout();
this.grpInfo.SuspendLayout();
+ this.grpCalibration.SuspendLayout();
this.SuspendLayout();
//
// grpSetup
@@ -279,6 +285,23 @@
this.grpMeasurements.TabStop = false;
this.grpMeasurements.Text = "Measurements";
//
+ // tbxRevVolume
+ //
+ this.tbxRevVolume.Location = new System.Drawing.Point(114, 45);
+ this.tbxRevVolume.Name = "tbxRevVolume";
+ this.tbxRevVolume.ReadOnly = true;
+ this.tbxRevVolume.Size = new System.Drawing.Size(68, 20);
+ this.tbxRevVolume.TabIndex = 35;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(6, 48);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(108, 13);
+ this.label1.TabIndex = 34;
+ this.label1.Text = "Reverse Volume [m²]:";
+ //
// tbxStatus
//
this.tbxStatus.Location = new System.Drawing.Point(114, 95);
@@ -445,22 +468,58 @@
this.lblSensorId.TabIndex = 36;
this.lblSensorId.Text = "Sensor ID:";
//
- // tbxRevVolume
+ // btnPrepareCalibration
//
- this.tbxRevVolume.Location = new System.Drawing.Point(114, 45);
- this.tbxRevVolume.Name = "tbxRevVolume";
- this.tbxRevVolume.ReadOnly = true;
- this.tbxRevVolume.Size = new System.Drawing.Size(68, 20);
- this.tbxRevVolume.TabIndex = 35;
+ this.btnPrepareCalibration.Location = new System.Drawing.Point(269, 56);
+ this.btnPrepareCalibration.Name = "btnPrepareCalibration";
+ this.btnPrepareCalibration.Size = new System.Drawing.Size(116, 25);
+ this.btnPrepareCalibration.TabIndex = 38;
+ this.btnPrepareCalibration.Text = "Prepare Calibration";
+ this.btnPrepareCalibration.UseVisualStyleBackColor = true;
+ this.btnPrepareCalibration.Click += new System.EventHandler(this.btnPrepareCalibration_Click);
//
- // label1
+ // btnReadCalibration
//
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(6, 48);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(108, 13);
- this.label1.TabIndex = 34;
- this.label1.Text = "Reverse Volume [m²]:";
+ this.btnReadCalibration.Location = new System.Drawing.Point(269, 87);
+ this.btnReadCalibration.Name = "btnReadCalibration";
+ this.btnReadCalibration.Size = new System.Drawing.Size(116, 25);
+ this.btnReadCalibration.TabIndex = 39;
+ this.btnReadCalibration.Text = "Read Calibration";
+ this.btnReadCalibration.UseVisualStyleBackColor = true;
+ this.btnReadCalibration.Click += new System.EventHandler(this.btnReadCalibration_Click);
+ //
+ // btnWriteCalibration
+ //
+ this.btnWriteCalibration.Location = new System.Drawing.Point(269, 118);
+ this.btnWriteCalibration.Name = "btnWriteCalibration";
+ this.btnWriteCalibration.Size = new System.Drawing.Size(116, 25);
+ this.btnWriteCalibration.TabIndex = 40;
+ this.btnWriteCalibration.Text = "Write Calibration";
+ this.btnWriteCalibration.UseVisualStyleBackColor = true;
+ this.btnWriteCalibration.Click += new System.EventHandler(this.btnWriteCalibration_Click);
+ //
+ // btnAbortCalibration
+ //
+ this.btnAbortCalibration.Location = new System.Drawing.Point(269, 146);
+ this.btnAbortCalibration.Name = "btnAbortCalibration";
+ this.btnAbortCalibration.Size = new System.Drawing.Size(116, 25);
+ this.btnAbortCalibration.TabIndex = 41;
+ this.btnAbortCalibration.Text = "Abort Calibration";
+ this.btnAbortCalibration.UseVisualStyleBackColor = true;
+ this.btnAbortCalibration.Click += new System.EventHandler(this.btnAbortCalibration_Click);
+ //
+ // grpCalibration
+ //
+ this.grpCalibration.Controls.Add(this.btnAbortCalibration);
+ this.grpCalibration.Controls.Add(this.btnPrepareCalibration);
+ this.grpCalibration.Controls.Add(this.btnReadCalibration);
+ this.grpCalibration.Controls.Add(this.btnWriteCalibration);
+ this.grpCalibration.Location = new System.Drawing.Point(320, 162);
+ this.grpCalibration.Name = "grpCalibration";
+ this.grpCalibration.Size = new System.Drawing.Size(391, 177);
+ this.grpCalibration.TabIndex = 42;
+ this.grpCalibration.TabStop = false;
+ this.grpCalibration.Text = "Calibration";
//
// FrmTest
//
@@ -468,6 +527,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(723, 432);
+ this.Controls.Add(this.grpCalibration);
this.Controls.Add(this.grpInfo);
this.Controls.Add(this.grpMeasurements);
this.Controls.Add(this.picLogo);
@@ -497,6 +557,7 @@
this.grpMeasurements.PerformLayout();
this.grpInfo.ResumeLayout(false);
this.grpInfo.PerformLayout();
+ this.grpCalibration.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -544,5 +605,10 @@
private System.Windows.Forms.TextBox tbxFwVersion;
private System.Windows.Forms.TextBox tbxRevVolume;
private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button btnPrepareCalibration;
+ private System.Windows.Forms.Button btnReadCalibration;
+ private System.Windows.Forms.Button btnWriteCalibration;
+ private System.Windows.Forms.Button btnAbortCalibration;
+ private System.Windows.Forms.GroupBox grpCalibration;
}
}
\ No newline at end of file
diff --git a/Common/Ui/MagFluxToolBox/FrmTest.cs b/Common/Ui/MagFluxToolBox/FrmTest.cs
index fe5c376a..f3e260a7 100644
--- a/Common/Ui/MagFluxToolBox/FrmTest.cs
+++ b/Common/Ui/MagFluxToolBox/FrmTest.cs
@@ -75,6 +75,12 @@ namespace Xylem.Common.Ui.MagFluxToolBox
ProcessViewControl(false);
lblSensorNo.Text = StrNotConnected;
lblSensorNo.ForeColor = Color.Red;
+ tbxUniqueId.Text = "";
+ tbxSensorNo.Text = "";
+ tbxFwVersion.Text = "";
+ tbxFwBuildDate.Text = "";
+ tbxFwGitHash.Text = "";
+ tbxMeterSize.Text = "";
lblWaitingForMeterResponse.Visible = false;
btnConnect.Enabled = true;
SetControlDownloadsLocked();
@@ -118,20 +124,36 @@ namespace Xylem.Common.Ui.MagFluxToolBox
private void SetControlDownloadsLocked()
{
btnConnect.Enabled = true;
+ btnAbortCalibration.Enabled = false;
+ btnPrepareCalibration.Enabled = false;
+ btnReadCalibration.Enabled = false;
+ btnWriteCalibration.Enabled = false;
}
private void SetControlsDownloadIsOngoing()
{
btnConnect.Enabled = false;
+ btnAbortCalibration.Enabled = false;
+ btnPrepareCalibration.Enabled = false;
+ btnReadCalibration.Enabled = false;
+ btnWriteCalibration.Enabled = false;
}
private void SetControlsDownloadIsFinished()
{
btnConnect.Enabled = true;
+ btnAbortCalibration.Enabled = false;
+ btnPrepareCalibration.Enabled = true;
+ btnReadCalibration.Enabled = true;
+ btnWriteCalibration.Enabled = true;
}
private void SetControlsDownloadEnabled()
{
btnConnect.Enabled = true;
+ btnAbortCalibration.Enabled = false;
+ btnPrepareCalibration.Enabled = true;
+ btnReadCalibration.Enabled = true;
+ btnWriteCalibration.Enabled = true;
}
#endregion
@@ -196,8 +218,8 @@ namespace Xylem.Common.Ui.MagFluxToolBox
if (_magFluxMeter != null && _magFluxMeter.IsLoggedOn)
{
lblSensorNo.Text = "";
- tbxUniqueId.Text = _magFluxMeter.PcbId;
- tbxSensorNo.Text = _magFluxMeter.SerialNumber;
+ tbxUniqueId.Text = _magFluxMeter.UniqueId;
+ tbxSensorNo.Text = _magFluxMeter.PcbId;
tbxFwVersion.Text = _magFluxMeter.FwVersion;
tbxFwBuildDate.Text = _magFluxMeter.FwBuildDate;
tbxFwGitHash.Text = _magFluxMeter.FwGitHash;
@@ -500,6 +522,27 @@ namespace Xylem.Common.Ui.MagFluxToolBox
}
#endregion
#region Buttons
+ private void btnPrepareCalibration_Click(Object sender, EventArgs e)
+ {
+ _magFluxMeter?.InitCalibration();
+ btnAbortCalibration.Enabled = true;
+ }
+
+ private void btnReadCalibration_Click(Object sender, EventArgs e)
+ {
+ _magFluxMeter?.ReadCalibration();
+ }
+
+ private void btnWriteCalibration_Click(Object sender, EventArgs e)
+ {
+ _magFluxMeter?.WriteCalibration();
+ }
+
+ private void btnAbortCalibration_Click(Object sender, EventArgs e)
+ {
+ _magFluxMeter?.StopCalibration();
+ }
+
private void btnConnect_Click(Object sender, EventArgs e)
{
if (_resetTimeMeasurement)
@@ -576,6 +619,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox
}
#endregion
+
}
}
diff --git a/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs b/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs
index 40e49c03..bc73649a 100644
--- a/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs
+++ b/Common/Ui/MagFluxToolBox/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0.0")]
-[assembly: AssemblyFileVersion("1.1.0.0")]
+[assembly: AssemblyVersion("1.2.0.0")]
+[assembly: AssemblyFileVersion("1.2.0.0")]