MagFluxToolbox: - Streaming catcher implemented, first version displaying values
This commit is contained in:
@@ -649,7 +649,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
{
|
{
|
||||||
var ledTransmit = new LedTransmitProtocol(streamingPort.Value.PortName);
|
var ledTransmit = new LedTransmitProtocol(streamingPort.Value.PortName);
|
||||||
|
|
||||||
var streamingIdent = $"Slot:{Slot}/{streamingPort.Value.PortName}-Protocol:LED";
|
var streamingIdent = $"Slot:{Slot}, Port:{streamingPort.Value.PortName}, Protocol:LED";
|
||||||
|
|
||||||
StreamingPort = new LedSerialPort(streamingIdent, streamingPort.Value.GetSerialPort(),
|
StreamingPort = new LedSerialPort(streamingIdent, streamingPort.Value.GetSerialPort(),
|
||||||
ledTransmit.GetTransmitPortSettings());
|
ledTransmit.GetTransmitPortSettings());
|
||||||
|
|||||||
@@ -87,12 +87,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
// ignored
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WriteRegister("GENESISFLOW_DisplayPow10", (new Byte[] { 0x00, 0x00, 0x00, 0xFA }).Reverse().ToArray());
|
WriteRegister("GENESISFLOW_DisplayPow10", (new Byte[] { 0x00, 0x00, 0x00, 0xFA }).Reverse().ToArray());
|
||||||
WriteRegister(Register.Genesisflow.StoreCalibration, 1);
|
WriteRegister(Register.Genesisflow.StoreCalibration, 1);
|
||||||
WriteRegister(Register.Genesisflow.StoreConfiguration, 1);
|
WriteRegister(Register.Genesisflow.StoreConfiguration, 1);
|
||||||
|
|||||||
@@ -104,10 +104,6 @@
|
|||||||
<Project>{63e0ac5e-b7c8-4363-a2fe-be489e648ff0}</Project>
|
<Project>{63e0ac5e-b7c8-4363-a2fe-be489e648ff0}</Project>
|
||||||
<Name>TransmitProtocol</Name>
|
<Name>TransmitProtocol</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\Genesis\Protocols\StreamingProtocol\StreamingProtocol.csproj">
|
|
||||||
<Project>{29617814-313e-409e-aa5d-59c78a9d4df1}</Project>
|
|
||||||
<Name>StreamingProtocol</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\WaterMeterCore\WaterMeterCore.csproj">
|
<ProjectReference Include="..\..\WaterMeterCore\WaterMeterCore.csproj">
|
||||||
<Project>{8203abb8-38e5-472e-a742-33f38b7a74a6}</Project>
|
<Project>{8203abb8-38e5-472e-a742-33f38b7a74a6}</Project>
|
||||||
<Name>WaterMeterCore</Name>
|
<Name>WaterMeterCore</Name>
|
||||||
@@ -128,6 +124,10 @@
|
|||||||
<Project>{00748F11-4B49-4D8B-93C4-4A11A210CCE2}</Project>
|
<Project>{00748F11-4B49-4D8B-93C4-4A11A210CCE2}</Project>
|
||||||
<Name>RequestProtocol</Name>
|
<Name>RequestProtocol</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Protocols\StreamingProtocol\StreamingProtocol.csproj">
|
||||||
|
<Project>{d6b81c60-2763-4c4d-989f-90822f53b01a}</Project>
|
||||||
|
<Name>StreamingProtocol</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using Xylem.Common.Hardware.Interfaces.Ports.SerialPorts;
|
|||||||
using Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore;
|
using Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore;
|
||||||
using Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore.EventArguments;
|
using Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore.EventArguments;
|
||||||
using Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol;
|
using Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol;
|
using Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol;
|
||||||
using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.EventArguments;
|
using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.EventArguments;
|
||||||
using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.MeasurementRecords;
|
using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.MeasurementRecords;
|
||||||
using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxConfig;
|
using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxConfig;
|
||||||
@@ -36,6 +36,16 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
|
|||||||
{
|
{
|
||||||
#region Variables and Properties
|
#region Variables and Properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mark the streaming catcher as active
|
||||||
|
/// </summary>
|
||||||
|
private Boolean _streamingCatcherIsActive;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Streaming decoder
|
||||||
|
/// </summary>
|
||||||
|
private StreamingDecoder _streamingDecoder;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable raw record logging, if set every incoming package will be logged
|
/// Enable raw record logging, if set every incoming package will be logged
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -261,6 +271,11 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<RequestResponseDataEventArgs> OnRequestRecordReceived;
|
public event EventHandler<RequestResponseDataEventArgs> OnRequestRecordReceived;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Streaming record is decoded
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<MagFluxFlowDataEventArgs> OnStreamingRecordDecoded;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// call this if session is expired and you need an re-authorization
|
/// call this if session is expired and you need an re-authorization
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -300,7 +315,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e">
|
/// <param name="e">
|
||||||
/// I should be <see cref="FlowTestRecord" /> or <see cref="CalibDataEventArgs" />
|
/// I should be <see cref="MagFluxRecord" />
|
||||||
/// otherwise this method does nothing
|
/// otherwise this method does nothing
|
||||||
/// </param>
|
/// </param>
|
||||||
private void StreamingProtocol_ApplyDecodedRecord(Object sender, BaseDataEventArgs e)
|
private void StreamingProtocol_ApplyDecodedRecord(Object sender, BaseDataEventArgs e)
|
||||||
@@ -333,6 +348,61 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
|
|||||||
OnRequestRecordReceived?.Invoke(sender, (RequestResponseDataEventArgs)e);
|
OnRequestRecordReceived?.Invoke(sender, (RequestResponseDataEventArgs)e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Kick off the streaming catcher.
|
||||||
|
/// </summary>
|
||||||
|
public void StartStreamingCatcher()
|
||||||
|
{
|
||||||
|
if (_streamingCatcherIsActive)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_streamingDecoder = new StreamingDecoder(false);
|
||||||
|
if (StreamingPort == null || !(StreamingPort is LedSerialPort))
|
||||||
|
{
|
||||||
|
throw new ApplicationException("No valid streaming port");
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncStreamingBuffer(SyncMarkRecord.DecodeEveryPackage);
|
||||||
|
((LedSerialPort)StreamingPort).OnRawRecordReceived += StreamingCatcher_OnRawRecordReceived;
|
||||||
|
LogRawData(true);
|
||||||
|
_streamingCatcherIsActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cyclic execution of catcher on incoming events.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void StreamingCatcher_OnRawRecordReceived(Object sender, BasePortDataEventArgs e)
|
||||||
|
{
|
||||||
|
var data = (String)e.GetData();
|
||||||
|
|
||||||
|
if (_streamingDecoder.DecodeMsg(data))
|
||||||
|
{
|
||||||
|
// Fire event for listener
|
||||||
|
OnStreamingRecordDecoded?.Invoke(this,
|
||||||
|
new MagFluxFlowDataEventArgs{ NewData = _streamingDecoder.DataMagFlux, RawData = data });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop the streaming catcher.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void StopStreamingCatcher()
|
||||||
|
{
|
||||||
|
if (StreamingPort == null || !(StreamingPort is LedSerialPort))
|
||||||
|
{
|
||||||
|
throw new ApplicationException("No valid streaming port");
|
||||||
|
}
|
||||||
|
LogRawData(false);
|
||||||
|
((LedSerialPort)StreamingPort).OnRawRecordReceived -= StreamingCatcher_OnRawRecordReceived;
|
||||||
|
SyncStreamingBuffer(SyncMarkRecord.SkipDecoding);
|
||||||
|
_streamingCatcherIsActive = false;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region class handling
|
#region class handling
|
||||||
@@ -447,24 +517,24 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
|
|||||||
|
|
||||||
if (requestPort != null)
|
if (requestPort != null)
|
||||||
{
|
{
|
||||||
if (requestPort.Value.Type == "Xylem.Common.Hardware.Interfaces.Ports.SerialPorts.UartSerialPort")
|
//if (requestPort.Value.Type == "Xylem.Common.Hardware.Interfaces.Ports.SerialPorts.UartSerialPort")
|
||||||
{
|
//{
|
||||||
var requestIdent = $"Slot:{Slot}, Port:{requestPort.Value.PortName}, Protocol:Request, Type:UART -";
|
// var requestIdent = $"Slot:{Slot}, Port:{requestPort.Value.PortName}, Protocol:Request, Type:UART -";
|
||||||
|
|
||||||
RequestProtocol = new RequestProtocol(requestIdent);
|
// RequestProtocol = new RequestProtocol(requestIdent);
|
||||||
TransmitProtocol = new UartTransmitProtocol(requestPort.Value.PortName);
|
// TransmitProtocol = new UartTransmitProtocol(requestPort.Value.PortName);
|
||||||
RequestProtocol.SetTransmitProtocol(TransmitProtocol);
|
// RequestProtocol.SetTransmitProtocol(TransmitProtocol);
|
||||||
|
|
||||||
RequestPort = new UartSerialPort(requestIdent, requestPort.Value.GetSerialPort(),
|
// RequestPort = new UartSerialPort(requestIdent, requestPort.Value.GetSerialPort(),
|
||||||
TransmitProtocol.GetTransmitPortSettings());
|
// TransmitProtocol.GetTransmitPortSettings());
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streamingPort != null)
|
if (streamingPort != null)
|
||||||
{
|
{
|
||||||
var ledTransmit = new LedTransmitProtocol(streamingPort.Value.PortName);
|
var ledTransmit = new LedTransmitProtocol(streamingPort.Value.PortName);
|
||||||
|
|
||||||
var streamingIdent = $"Slot:{Slot}/{streamingPort.Value.PortName}-Protocol:LED";
|
var streamingIdent = $"Slot:{Slot}, Port:{streamingPort.Value.PortName}, Protocol:LED";
|
||||||
|
|
||||||
StreamingPort = new LedSerialPort(streamingIdent, streamingPort.Value.GetSerialPort(),
|
StreamingPort = new LedSerialPort(streamingIdent, streamingPort.Value.GetSerialPort(),
|
||||||
ledTransmit.GetTransmitPortSettings());
|
ledTransmit.GetTransmitPortSettings());
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ using Newtonsoft.Json;
|
|||||||
using NLog;
|
using NLog;
|
||||||
using Xylem.Common.CommonCore.Consts;
|
using Xylem.Common.CommonCore.Consts;
|
||||||
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
|
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||||
|
|||||||
+32
-101
@@ -30,7 +30,7 @@
|
|||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.grpSetup = new System.Windows.Forms.GroupBox();
|
this.grpSetup = new System.Windows.Forms.GroupBox();
|
||||||
this.tbxPcbId = new System.Windows.Forms.TextBox();
|
this.tbxSensorNo = new System.Windows.Forms.TextBox();
|
||||||
this.btnConnect = new System.Windows.Forms.Button();
|
this.btnConnect = new System.Windows.Forms.Button();
|
||||||
this.lblConnectPcb = new System.Windows.Forms.Label();
|
this.lblConnectPcb = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
@@ -49,14 +49,8 @@
|
|||||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||||
this.picLogo = new System.Windows.Forms.PictureBox();
|
this.picLogo = new System.Windows.Forms.PictureBox();
|
||||||
this.grpBoxInfo = new System.Windows.Forms.GroupBox();
|
this.grpBoxInfo = new System.Windows.Forms.GroupBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.tbxVolume = new System.Windows.Forms.TextBox();
|
||||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
this.tbxFlowRate = new System.Windows.Forms.TextBox();
|
||||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.label7 = new System.Windows.Forms.Label();
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
this.label11 = new System.Windows.Forms.Label();
|
this.label11 = new System.Windows.Forms.Label();
|
||||||
this.grpSetup.SuspendLayout();
|
this.grpSetup.SuspendLayout();
|
||||||
@@ -67,7 +61,7 @@
|
|||||||
//
|
//
|
||||||
// grpSetup
|
// grpSetup
|
||||||
//
|
//
|
||||||
this.grpSetup.Controls.Add(this.tbxPcbId);
|
this.grpSetup.Controls.Add(this.tbxSensorNo);
|
||||||
this.grpSetup.Controls.Add(this.btnConnect);
|
this.grpSetup.Controls.Add(this.btnConnect);
|
||||||
this.grpSetup.Controls.Add(this.lblConnectPcb);
|
this.grpSetup.Controls.Add(this.lblConnectPcb);
|
||||||
this.grpSetup.Controls.Add(this.label2);
|
this.grpSetup.Controls.Add(this.label2);
|
||||||
@@ -79,13 +73,13 @@
|
|||||||
this.grpSetup.TabStop = false;
|
this.grpSetup.TabStop = false;
|
||||||
this.grpSetup.Text = "Setup";
|
this.grpSetup.Text = "Setup";
|
||||||
//
|
//
|
||||||
// tbxPcbId
|
// tbxSensorNo
|
||||||
//
|
//
|
||||||
this.tbxPcbId.Location = new System.Drawing.Point(128, 59);
|
this.tbxSensorNo.Location = new System.Drawing.Point(128, 59);
|
||||||
this.tbxPcbId.Name = "tbxPcbId";
|
this.tbxSensorNo.Name = "tbxSensorNo";
|
||||||
this.tbxPcbId.ReadOnly = true;
|
this.tbxSensorNo.ReadOnly = true;
|
||||||
this.tbxPcbId.Size = new System.Drawing.Size(68, 20);
|
this.tbxSensorNo.Size = new System.Drawing.Size(68, 20);
|
||||||
this.tbxPcbId.TabIndex = 32;
|
this.tbxSensorNo.TabIndex = 32;
|
||||||
//
|
//
|
||||||
// btnConnect
|
// btnConnect
|
||||||
//
|
//
|
||||||
@@ -254,14 +248,8 @@
|
|||||||
//
|
//
|
||||||
// grpBoxInfo
|
// grpBoxInfo
|
||||||
//
|
//
|
||||||
this.grpBoxInfo.Controls.Add(this.label1);
|
this.grpBoxInfo.Controls.Add(this.tbxVolume);
|
||||||
this.grpBoxInfo.Controls.Add(this.textBox1);
|
this.grpBoxInfo.Controls.Add(this.tbxFlowRate);
|
||||||
this.grpBoxInfo.Controls.Add(this.textBox2);
|
|
||||||
this.grpBoxInfo.Controls.Add(this.label3);
|
|
||||||
this.grpBoxInfo.Controls.Add(this.textBox4);
|
|
||||||
this.grpBoxInfo.Controls.Add(this.textBox5);
|
|
||||||
this.grpBoxInfo.Controls.Add(this.textBox6);
|
|
||||||
this.grpBoxInfo.Controls.Add(this.label4);
|
|
||||||
this.grpBoxInfo.Controls.Add(this.label7);
|
this.grpBoxInfo.Controls.Add(this.label7);
|
||||||
this.grpBoxInfo.Controls.Add(this.label11);
|
this.grpBoxInfo.Controls.Add(this.label11);
|
||||||
this.grpBoxInfo.Location = new System.Drawing.Point(9, 109);
|
this.grpBoxInfo.Location = new System.Drawing.Point(9, 109);
|
||||||
@@ -269,92 +257,41 @@
|
|||||||
this.grpBoxInfo.Size = new System.Drawing.Size(348, 228);
|
this.grpBoxInfo.Size = new System.Drawing.Size(348, 228);
|
||||||
this.grpBoxInfo.TabIndex = 37;
|
this.grpBoxInfo.TabIndex = 37;
|
||||||
this.grpBoxInfo.TabStop = false;
|
this.grpBoxInfo.TabStop = false;
|
||||||
this.grpBoxInfo.Text = "Info";
|
this.grpBoxInfo.Text = "Measurements";
|
||||||
//
|
//
|
||||||
// label1
|
// tbxVolume
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.tbxVolume.Location = new System.Drawing.Point(124, 22);
|
||||||
this.label1.Location = new System.Drawing.Point(6, 146);
|
this.tbxVolume.Name = "tbxVolume";
|
||||||
this.label1.Name = "label1";
|
this.tbxVolume.ReadOnly = true;
|
||||||
this.label1.Size = new System.Drawing.Size(116, 13);
|
this.tbxVolume.Size = new System.Drawing.Size(68, 20);
|
||||||
this.label1.TabIndex = 36;
|
this.tbxVolume.TabIndex = 31;
|
||||||
this.label1.Text = "Radio frequency[MHz]:";
|
|
||||||
//
|
//
|
||||||
// textBox1
|
// tbxFlowRate
|
||||||
//
|
//
|
||||||
this.textBox1.Location = new System.Drawing.Point(124, 142);
|
this.tbxFlowRate.Location = new System.Drawing.Point(124, 52);
|
||||||
this.textBox1.Name = "textBox1";
|
this.tbxFlowRate.Name = "tbxFlowRate";
|
||||||
this.textBox1.ReadOnly = true;
|
this.tbxFlowRate.ReadOnly = true;
|
||||||
this.textBox1.Size = new System.Drawing.Size(68, 20);
|
this.tbxFlowRate.Size = new System.Drawing.Size(68, 20);
|
||||||
this.textBox1.TabIndex = 35;
|
this.tbxFlowRate.TabIndex = 29;
|
||||||
//
|
|
||||||
// textBox2
|
|
||||||
//
|
|
||||||
this.textBox2.Location = new System.Drawing.Point(124, 112);
|
|
||||||
this.textBox2.Name = "textBox2";
|
|
||||||
this.textBox2.ReadOnly = true;
|
|
||||||
this.textBox2.Size = new System.Drawing.Size(68, 20);
|
|
||||||
this.textBox2.TabIndex = 34;
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(6, 116);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(44, 13);
|
|
||||||
this.label3.TabIndex = 33;
|
|
||||||
this.label3.Text = "Region:";
|
|
||||||
//
|
|
||||||
// textBox4
|
|
||||||
//
|
|
||||||
this.textBox4.Location = new System.Drawing.Point(124, 22);
|
|
||||||
this.textBox4.Name = "textBox4";
|
|
||||||
this.textBox4.ReadOnly = true;
|
|
||||||
this.textBox4.Size = new System.Drawing.Size(68, 20);
|
|
||||||
this.textBox4.TabIndex = 31;
|
|
||||||
//
|
|
||||||
// textBox5
|
|
||||||
//
|
|
||||||
this.textBox5.Location = new System.Drawing.Point(124, 82);
|
|
||||||
this.textBox5.Name = "textBox5";
|
|
||||||
this.textBox5.ReadOnly = true;
|
|
||||||
this.textBox5.Size = new System.Drawing.Size(68, 20);
|
|
||||||
this.textBox5.TabIndex = 30;
|
|
||||||
//
|
|
||||||
// textBox6
|
|
||||||
//
|
|
||||||
this.textBox6.Location = new System.Drawing.Point(124, 52);
|
|
||||||
this.textBox6.Name = "textBox6";
|
|
||||||
this.textBox6.ReadOnly = true;
|
|
||||||
this.textBox6.Size = new System.Drawing.Size(68, 20);
|
|
||||||
this.textBox6.TabIndex = 29;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Location = new System.Drawing.Point(6, 86);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(60, 13);
|
|
||||||
this.label4.TabIndex = 28;
|
|
||||||
this.label4.Text = "Meter Size:";
|
|
||||||
//
|
//
|
||||||
// label7
|
// label7
|
||||||
//
|
//
|
||||||
this.label7.AutoSize = true;
|
this.label7.AutoSize = true;
|
||||||
this.label7.Location = new System.Drawing.Point(6, 56);
|
this.label7.Location = new System.Drawing.Point(6, 56);
|
||||||
this.label7.Name = "label7";
|
this.label7.Name = "label7";
|
||||||
this.label7.Size = new System.Drawing.Size(86, 13);
|
this.label7.Size = new System.Drawing.Size(92, 13);
|
||||||
this.label7.TabIndex = 27;
|
this.label7.TabIndex = 27;
|
||||||
this.label7.Text = "Meter LUT CRC:";
|
this.label7.Text = "Flow Rate [cm/h]:";
|
||||||
//
|
//
|
||||||
// label11
|
// label11
|
||||||
//
|
//
|
||||||
this.label11.AutoSize = true;
|
this.label11.AutoSize = true;
|
||||||
this.label11.Location = new System.Drawing.Point(6, 26);
|
this.label11.Location = new System.Drawing.Point(6, 26);
|
||||||
this.label11.Name = "label11";
|
this.label11.Name = "label11";
|
||||||
this.label11.Size = new System.Drawing.Size(57, 13);
|
this.label11.Size = new System.Drawing.Size(68, 13);
|
||||||
this.label11.TabIndex = 25;
|
this.label11.TabIndex = 25;
|
||||||
this.label11.Text = "Meter FW:";
|
this.label11.Text = "Volume [cm]:";
|
||||||
//
|
//
|
||||||
// FrmTest
|
// FrmTest
|
||||||
//
|
//
|
||||||
@@ -411,18 +348,12 @@
|
|||||||
private System.Windows.Forms.Label lblWaitingForMeterResponse;
|
private System.Windows.Forms.Label lblWaitingForMeterResponse;
|
||||||
private System.Windows.Forms.Label label9;
|
private System.Windows.Forms.Label label9;
|
||||||
private System.Windows.Forms.Label lblUpdateTime;
|
private System.Windows.Forms.Label lblUpdateTime;
|
||||||
private System.Windows.Forms.TextBox tbxPcbId;
|
private System.Windows.Forms.TextBox tbxSensorNo;
|
||||||
private System.Windows.Forms.PictureBox pictureBox1;
|
private System.Windows.Forms.PictureBox pictureBox1;
|
||||||
private System.Windows.Forms.PictureBox picLogo;
|
private System.Windows.Forms.PictureBox picLogo;
|
||||||
private System.Windows.Forms.GroupBox grpBoxInfo;
|
private System.Windows.Forms.GroupBox grpBoxInfo;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.TextBox tbxVolume;
|
||||||
private System.Windows.Forms.TextBox textBox1;
|
private System.Windows.Forms.TextBox tbxFlowRate;
|
||||||
private System.Windows.Forms.TextBox textBox2;
|
|
||||||
private System.Windows.Forms.Label label3;
|
|
||||||
private System.Windows.Forms.TextBox textBox4;
|
|
||||||
private System.Windows.Forms.TextBox textBox5;
|
|
||||||
private System.Windows.Forms.TextBox textBox6;
|
|
||||||
private System.Windows.Forms.Label label4;
|
|
||||||
private System.Windows.Forms.Label label7;
|
private System.Windows.Forms.Label label7;
|
||||||
private System.Windows.Forms.Label label11;
|
private System.Windows.Forms.Label label11;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using System.Reflection;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments;
|
||||||
|
using Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.EventArguments;
|
||||||
using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore;
|
using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore;
|
||||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||||
using Xylem.Common.Utils.ProcessExec.EventArguments;
|
using Xylem.Common.Utils.ProcessExec.EventArguments;
|
||||||
@@ -75,7 +77,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
|||||||
lblWaitingForMeterResponse.Visible = false;
|
lblWaitingForMeterResponse.Visible = false;
|
||||||
btnConnect.Enabled = true;
|
btnConnect.Enabled = true;
|
||||||
SetControlDownloadsLocked();
|
SetControlDownloadsLocked();
|
||||||
tbxPcbId.Visible = false;
|
tbxSensorNo.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FrmTest_Load(Object sender, EventArgs e)
|
private void FrmTest_Load(Object sender, EventArgs e)
|
||||||
@@ -91,7 +93,9 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
|||||||
|
|
||||||
private void FrmTest_FormClosing(Object sender, FormClosingEventArgs e)
|
private void FrmTest_FormClosing(Object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
_magFluxMeter.OnStreamingRecordDecoded -= StreamingCatcher_OnStreamingRecordDecoded;
|
||||||
_magFluxMeter?.Logout();
|
_magFluxMeter?.Logout();
|
||||||
|
_magFluxMeter?.StopStreamingCatcher();
|
||||||
_meterBatch?.RemoveAllMeters();
|
_meterBatch?.RemoveAllMeters();
|
||||||
_meterBatch?.Dispose();
|
_meterBatch?.Dispose();
|
||||||
|
|
||||||
@@ -127,6 +131,24 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region BoardControls
|
#region BoardControls
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cyclic execution of catcher on incoming events.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void StreamingCatcher_OnStreamingRecordDecoded(Object sender, MagFluxFlowDataEventArgs e)
|
||||||
|
{
|
||||||
|
Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
tbxSensorNo.Text = e.NewData.SensorId;
|
||||||
|
tbxVolume.Text = $@"{e.NewData.VolumeCm:F3}";
|
||||||
|
tbxFlowRate.Text = $@"{e.NewData.FlowRateCmPh:F3}";
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Connect()
|
private void Connect()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -159,6 +181,8 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
|||||||
|
|
||||||
_magFluxMeter.Configuration.UseRegisterWatchService = false;
|
_magFluxMeter.Configuration.UseRegisterWatchService = false;
|
||||||
_magFluxMeter.Configuration.UseMinMaxCheck = false;
|
_magFluxMeter.Configuration.UseMinMaxCheck = false;
|
||||||
|
_magFluxMeter.OnStreamingRecordDecoded += StreamingCatcher_OnStreamingRecordDecoded;
|
||||||
|
|
||||||
_meterBatch.MetersLogin();
|
_meterBatch.MetersLogin();
|
||||||
|
|
||||||
//if (!_magFluxMeter.IsLoggedOn)
|
//if (!_magFluxMeter.IsLoggedOn)
|
||||||
@@ -194,6 +218,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
|||||||
|
|
||||||
lblConnectPcb.ForeColor = Color.Green;
|
lblConnectPcb.ForeColor = Color.Green;
|
||||||
CheckUpdateEnabled();
|
CheckUpdateEnabled();
|
||||||
|
_magFluxMeter.StartStreamingCatcher();
|
||||||
_magFluxMeter.Logout();
|
_magFluxMeter.Logout();
|
||||||
LogInstalledMeterFw();
|
LogInstalledMeterFw();
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -129,6 +129,10 @@
|
|||||||
<Project>{72037e89-4f63-4b3f-beff-4138e578ce99}</Project>
|
<Project>{72037e89-4f63-4b3f-beff-4138e578ce99}</Project>
|
||||||
<Name>SerialPorts</Name>
|
<Name>SerialPorts</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\Hardware\WaterMeter\MagFlux\DataPackages\DataPackages.csproj">
|
||||||
|
<Project>{BA17D20E-0CEB-4B27-9772-2392BD750ED5}</Project>
|
||||||
|
<Name>DataPackages</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\Hardware\WaterMeter\MagFlux\MagFluxConfig\MagFluxConfig.csproj">
|
<ProjectReference Include="..\..\Hardware\WaterMeter\MagFlux\MagFluxConfig\MagFluxConfig.csproj">
|
||||||
<Project>{70398b99-b134-4bbd-968b-7399b70c3ce2}</Project>
|
<Project>{70398b99-b134-4bbd-968b-7399b70c3ce2}</Project>
|
||||||
<Name>MagFluxConfig</Name>
|
<Name>MagFluxConfig</Name>
|
||||||
@@ -141,6 +145,10 @@
|
|||||||
<Project>{8203abb8-38e5-472e-a742-33f38b7a74a6}</Project>
|
<Project>{8203abb8-38e5-472e-a742-33f38b7a74a6}</Project>
|
||||||
<Name>WaterMeterCore</Name>
|
<Name>WaterMeterCore</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\Metrology\Measurements\Measurements.csproj">
|
||||||
|
<Project>{6CCDB656-C676-4360-BABA-C4596AAD175D}</Project>
|
||||||
|
<Name>Measurements</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
<ProjectReference Include="..\..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
||||||
<Project>{a33e3c6d-eaae-4a20-a0ee-f9e6922fd029}</Project>
|
<Project>{a33e3c6d-eaae-4a20-a0ee-f9e6922fd029}</Project>
|
||||||
<Name>SoftwareAccessHelper</Name>
|
<Name>SoftwareAccessHelper</Name>
|
||||||
|
|||||||
Reference in New Issue
Block a user