From 97ce601d318632d76ebb2685fee4df7f9a49d1bd Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Fri, 28 Aug 2020 18:38:27 +0200 Subject: [PATCH] DataStreamInterfaceTest and DataStreamMeter projects added --- .gitignore | 4 + Config/Units.cs | 2 +- DataStreamInterface/DataFrame.cs | 4 +- .../DataStreamInterface.csproj | 5 +- ...interface for datastream water meters.docx | Bin 20551 -> 20594 bytes DataStreamInterface/Enums.cs | 2 +- DataStreamInterface/IDataStreamMeter.cs | 18 +- DataStreamInterfaceTest/ActivityLog.cs | 36 ++ DataStreamInterfaceTest/App.config | 6 + .../DataStreamInterfaceTest.csproj | 134 +++++++ .../DemoMainWnd.Designer.cs | 379 ++++++++++++++++++ DataStreamInterfaceTest/DemoMainWnd.cs | 284 +++++++++++++ DataStreamInterfaceTest/DemoMainWnd.resx | 120 ++++++ .../GetDblValueDlg.Designer.cs | 88 ++++ DataStreamInterfaceTest/GetDblValueDlg.cs | 59 +++ DataStreamInterfaceTest/GetDblValueDlg.resx | 120 ++++++ .../GetFrameBoundariesDlg.Designer.cs | 126 ++++++ .../GetFrameBoundariesDlg.cs | 88 ++++ .../GetFrameBoundariesDlg.resx | 120 ++++++ .../GetIntegerNumberDlg.Designer.cs | 90 +++++ .../GetIntegerNumberDlg.cs | 83 ++++ .../GetIntegerNumberDlg.resx | 120 ++++++ .../GetStateDlg.Designer.cs | 126 ++++++ DataStreamInterfaceTest/GetStateDlg.cs | 85 ++++ DataStreamInterfaceTest/GetStateDlg.resx | 120 ++++++ DataStreamInterfaceTest/LviIDComparer.cs | 39 ++ DataStreamInterfaceTest/Program.cs | 55 +++ .../Properties/AssemblyInfo.cs | 36 ++ .../Properties/Resources.Designer.cs | 71 ++++ .../Properties/Resources.resx | 117 ++++++ .../Properties/Settings.Designer.cs | 30 ++ .../Properties/Settings.settings | 7 + DataStreamMeter/DataStreamMeter.csproj | 85 ++++ DataStreamMeter/GetDblValueDlg.Designer.cs | 88 ++++ DataStreamMeter/GetDblValueDlg.cs | 59 +++ DataStreamMeter/GetDblValueDlg.resx | 120 ++++++ DataStreamMeter/MeterDataEventArgs.cs | 20 + DataStreamMeter/MeterSimulation.cs | 319 +++++++++++++++ .../MeterSimulationDlg.Designer.cs | 323 +++++++++++++++ DataStreamMeter/MeterSimulationDlg.cs | 91 +++++ DataStreamMeter/MeterSimulationDlg.resx | 123 ++++++ DataStreamMeter/Properties/AssemblyInfo.cs | 36 ++ DataStreamMeter/Sample.cs | 23 ++ TBF.sln | 28 ++ clean.bat | 4 + 45 files changed, 3877 insertions(+), 16 deletions(-) create mode 100644 DataStreamInterfaceTest/ActivityLog.cs create mode 100644 DataStreamInterfaceTest/App.config create mode 100644 DataStreamInterfaceTest/DataStreamInterfaceTest.csproj create mode 100644 DataStreamInterfaceTest/DemoMainWnd.Designer.cs create mode 100644 DataStreamInterfaceTest/DemoMainWnd.cs create mode 100644 DataStreamInterfaceTest/DemoMainWnd.resx create mode 100644 DataStreamInterfaceTest/GetDblValueDlg.Designer.cs create mode 100644 DataStreamInterfaceTest/GetDblValueDlg.cs create mode 100644 DataStreamInterfaceTest/GetDblValueDlg.resx create mode 100644 DataStreamInterfaceTest/GetFrameBoundariesDlg.Designer.cs create mode 100644 DataStreamInterfaceTest/GetFrameBoundariesDlg.cs create mode 100644 DataStreamInterfaceTest/GetFrameBoundariesDlg.resx create mode 100644 DataStreamInterfaceTest/GetIntegerNumberDlg.Designer.cs create mode 100644 DataStreamInterfaceTest/GetIntegerNumberDlg.cs create mode 100644 DataStreamInterfaceTest/GetIntegerNumberDlg.resx create mode 100644 DataStreamInterfaceTest/GetStateDlg.Designer.cs create mode 100644 DataStreamInterfaceTest/GetStateDlg.cs create mode 100644 DataStreamInterfaceTest/GetStateDlg.resx create mode 100644 DataStreamInterfaceTest/LviIDComparer.cs create mode 100644 DataStreamInterfaceTest/Program.cs create mode 100644 DataStreamInterfaceTest/Properties/AssemblyInfo.cs create mode 100644 DataStreamInterfaceTest/Properties/Resources.Designer.cs create mode 100644 DataStreamInterfaceTest/Properties/Resources.resx create mode 100644 DataStreamInterfaceTest/Properties/Settings.Designer.cs create mode 100644 DataStreamInterfaceTest/Properties/Settings.settings create mode 100644 DataStreamMeter/DataStreamMeter.csproj create mode 100644 DataStreamMeter/GetDblValueDlg.Designer.cs create mode 100644 DataStreamMeter/GetDblValueDlg.cs create mode 100644 DataStreamMeter/GetDblValueDlg.resx create mode 100644 DataStreamMeter/MeterDataEventArgs.cs create mode 100644 DataStreamMeter/MeterSimulation.cs create mode 100644 DataStreamMeter/MeterSimulationDlg.Designer.cs create mode 100644 DataStreamMeter/MeterSimulationDlg.cs create mode 100644 DataStreamMeter/MeterSimulationDlg.resx create mode 100644 DataStreamMeter/Properties/AssemblyInfo.cs create mode 100644 DataStreamMeter/Sample.cs diff --git a/.gitignore b/.gitignore index 753dd6452..aa8441b67 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ Config/bin/ Config/obj/ DataStreamInterface/bin/ DataStreamInterface/obj/ +DataStreamInterfaceTest/bin/ +DataStreamInterfaceTest/obj/ +DataStreamMeter/bin/ +DataStreamMeter/obj/ Decrypt/bin/ Decrypt/obj/ DeviceTest/bin/ diff --git a/Config/Units.cs b/Config/Units.cs index 429be1ad0..0ae42b165 100644 --- a/Config/Units.cs +++ b/Config/Units.cs @@ -385,7 +385,7 @@ namespace Config case Unit.lph: return 1000 * v; /// 1 l/h case Unit.lpm: return v / 0.06; /// 1 l/m case Unit.lps: return v / 3.6; /// 1 l/s - case Unit.USgalps: return 0.733811257326 * v; /// 1 US gallon per second + case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second case Unit.m3pm: return v / 60; /// 1 m3/m case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second diff --git a/DataStreamInterface/DataFrame.cs b/DataStreamInterface/DataFrame.cs index 6338df650..2f5835223 100644 --- a/DataStreamInterface/DataFrame.cs +++ b/DataStreamInterface/DataFrame.cs @@ -7,12 +7,12 @@ namespace DataStreamInterface { public class DataFrame { - public readonly UInt64 ID; /// Frame ID + public readonly Int64 ID; /// Frame ID public readonly double Time; /// Time stamp in units of time public readonly double Volume; /// Volume in units of volume public readonly double[] Quantity; /// An array of optional quantities in their respective units - public DataFrame(UInt64 id, double time, double volume, double[] quantity) + public DataFrame(Int64 id, double time, double volume, double[] quantity) { ID = id; Time = time; diff --git a/DataStreamInterface/DataStreamInterface.csproj b/DataStreamInterface/DataStreamInterface.csproj index 49ae9f254..df67cc35b 100644 --- a/DataStreamInterface/DataStreamInterface.csproj +++ b/DataStreamInterface/DataStreamInterface.csproj @@ -9,7 +9,7 @@ Properties DataStreamInterface DataStreamInterface - v4.0 + v4.7.2 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,9 +30,11 @@ TRACE prompt 4 + false + diff --git a/DataStreamInterface/Doc/Software interface for datastream water meters.docx b/DataStreamInterface/Doc/Software interface for datastream water meters.docx index 09770fbc19d565aefb51f5dadbd9c01f5cf65905..2fdd60f8654cc73b54ed74ec89c0339db84619c2 100644 GIT binary patch delta 9874 zcmZ9ybyOZr@Fk1|0tENq7Ti5JJh)465AN^y%rTd+VOA8O(;f%!aI{fJgZDgqq(>00ALC2xf%G2e!FgU$aWvp+~h7PbwXc z_I_BKl{0A9dg*Zd-md@6)-YVCjQT-psZf#we&ytW&A~^DYguGh2>hLURG*eo<^&BHiKlADA@^z~<`;gwu zzva%zzu}eJ1FY+7y*(=k@@3xe@e(K{Yv+FC;`Sm~-S-lm7&M!=G(b5BgGofI^IF;A>2 z(f5WPy%9b$7*xmTgbSdXEJjoHyYGADoMrZlwWo1P0s@ZM9MrEr`8K=q*Z;=JuR)g% zlqwKT!%iZFSU=MbSjk{;g@Q$h7T_PvWiJ?TL7w;a) zlrQS}h0z;5_Q|BimOIVFqZyt$^;aFHrc6{2+o%bB@ASJMA>=;uVImMr9+*jV-S$mM zqGa$21Zs_9&BPFAIQDEM2Yx|G+%AuI-+0fsfPTO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wleh{rnBl$d+# zCbZf<5GSPH%GJ$(rQARfhvSp6bz(!h2(8O@b*;+z^Fr=w%m|A+S-vnWB6VZ*H8GFF zPK5{X7r|w99Ibc~n`<%gpGvM7KuQxO*#2@rQS-J2Rdec`)tGFZT|aTinc&9g!Luf2 zrp~RcRSYDx2NpAZ;!$E7AnNO6V~%&%T0DY>j~XkgLiTK6gnY^2f1ct~<+0}d_2ixp z3O<;AXgu=Z-^kQeonfgh@ePVr9_EwlH&gI+ISw(CEmXyj2=bkUMtf53dg1K=_k}74 zEa9!8M`mQNPF|!GzDpUz+Z!~5iaaz776cpw0%(H+wnk9G3l_GDg&69zrb(6q5?Ib3 zg_7!xF*z`{h3>H*PgS7pGLwx_&pTZ|(Y-UxJMH~apRqT+P5JjmLe1&#)KRH8X*}0) zYdW@fu+)-H%3pqjP#serv%^nRgnh6Ly#Yuj)Xf@> z9U}uM!VlipCg(o|U_7^bJF332}JDreaC>! z75p5`g8Q~vuds?nB2^KZF{87186l$1Q}5oT622Hz)VtmlSaPBWCI_c_$(yqfOg}^D5A2i zo74woP^ZH3|NcR%P*E9j8FZ&eNBIByn)gEapF - /// ID of the last date frame + /// Number of stored date frames /// true when successful - bool StopMeasurement(out UInt64 lastFrameID); + bool StopMeasurement(out Int64 storedFramesCount); ///------------------------------------------------ /// Units of time, volume and optional quantities @@ -70,7 +66,7 @@ namespace DataStreamInterface Unit GetVolumeUnits(); ///----------------------------------------------- - /// Ooptional quantities: count, units, captions + /// Optional quantities: count, units, captions ///----------------------------------------------- /// @@ -83,13 +79,13 @@ namespace DataStreamInterface /// Returns units of the specified quantity /// /// Zero based quantity number 0 .. quantites count-1 - Unit GetQuantityUnits(int quanityNr); + Unit GetQuantityUnits(int quantityNr); /// /// Returns caption of the specified quantity /// /// Zero based quantity number 0 .. quantites count-1 - string GetQuantityCaption(int quanityNr); + string GetQuantityCaption(int quantityNr); ///--------------------------- /// Datastream data exchange @@ -101,7 +97,7 @@ namespace DataStreamInterface /// First frame ID /// Frames count /// Selected data frames - DataFrame[] GetFrames(UInt64 id, int count); + DataFrame[] GetFrames(Int64 id, int count); /// /// Returns ID of the data frame where time equals or exceeds the specified time. @@ -109,6 +105,6 @@ namespace DataStreamInterface /// /// Time /// ID of the data frame at or after the pecified time - UInt64 GetID(double time); + Int64 GetID(double time); } } diff --git a/DataStreamInterfaceTest/ActivityLog.cs b/DataStreamInterfaceTest/ActivityLog.cs new file mode 100644 index 000000000..fe9e0c701 --- /dev/null +++ b/DataStreamInterfaceTest/ActivityLog.cs @@ -0,0 +1,36 @@ +using System; +using System.Text; +using System.Windows.Forms; + +namespace DataStreamInterfaceTest +{ + public class ActivityLog + { + const int LinesCount = 50; + + TextBox textBox; + string[] lines; + string activity; + + public ActivityLog(TextBox textBox) + { + this.textBox = textBox; + lines = new string[LinesCount]; + for (int i = 0; i < LinesCount; i++) lines[i] = string.Empty; + } + + public void Print(string log) + { + for (int i = LinesCount - 1; i > 0; i--) lines[i] = lines[i - 1]; + lines[0] = log; + DisplayLines(); + } + + private void DisplayLines() + { + StringBuilder sb = new StringBuilder(); + foreach (var line in lines) sb.AppendLine(line); + textBox.Text = sb.ToString(); + } + } +} diff --git a/DataStreamInterfaceTest/App.config b/DataStreamInterfaceTest/App.config new file mode 100644 index 000000000..56efbc7b5 --- /dev/null +++ b/DataStreamInterfaceTest/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/DataStreamInterfaceTest.csproj b/DataStreamInterfaceTest/DataStreamInterfaceTest.csproj new file mode 100644 index 000000000..2335e07f1 --- /dev/null +++ b/DataStreamInterfaceTest/DataStreamInterfaceTest.csproj @@ -0,0 +1,134 @@ + + + + + Debug + AnyCPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23} + WinExe + Properties + DataStreamInterfaceTest + DataStreamInterfaceTest + v4.7.2 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + DemoMainWnd.cs + + + Form + + + GetDblValueDlg.cs + + + Form + + + GetFrameBoundariesDlg.cs + + + Form + + + GetIntegerNumberDlg.cs + + + Form + + + GetStateDlg.cs + + + + + + DemoMainWnd.cs + Designer + + + GetDblValueDlg.cs + + + GetFrameBoundariesDlg.cs + + + GetIntegerNumberDlg.cs + + + GetStateDlg.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + {7ebeea14-91c4-48d7-af0a-7a4bc3ff9a28} + DataStreamInterface + + + + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/DemoMainWnd.Designer.cs b/DataStreamInterfaceTest/DemoMainWnd.Designer.cs new file mode 100644 index 000000000..f87a15e46 --- /dev/null +++ b/DataStreamInterfaceTest/DemoMainWnd.Designer.cs @@ -0,0 +1,379 @@ +namespace DataStreamInterfaceTest +{ + partial class DemoMainWnd + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.getIDButton = new System.Windows.Forms.Button(); + this.getFramesButton = new System.Windows.Forms.Button(); + this.measurementLabel = new System.Windows.Forms.Label(); + this.stateLabel = new System.Windows.Forms.Label(); + this.capabilitiesLabel = new System.Windows.Forms.Label(); + this.getQuantityUnitsButton = new System.Windows.Forms.Button(); + this.getQuantityCaptionButton = new System.Windows.Forms.Button(); + this.getQuantitiesCountButton = new System.Windows.Forms.Button(); + this.getVolumeUnitsButton = new System.Windows.Forms.Button(); + this.getTimeUnitsButton = new System.Windows.Forms.Button(); + this.setStateButton = new System.Windows.Forms.Button(); + this.getStateButton = new System.Windows.Forms.Button(); + this.stopMeasurementButton = new System.Windows.Forms.Button(); + this.startMeasurementButton = new System.Windows.Forms.Button(); + this.closeConnectionButton = new System.Windows.Forms.Button(); + this.openConnectionButton = new System.Windows.Forms.Button(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.logsTextBox = new System.Windows.Forms.TextBox(); + this.dataTabControl = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.framesListView = new System.Windows.Forms.ListView(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + this.dataTabControl.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.IsSplitterFixed = true; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.getIDButton); + this.splitContainer1.Panel1.Controls.Add(this.getFramesButton); + this.splitContainer1.Panel1.Controls.Add(this.measurementLabel); + this.splitContainer1.Panel1.Controls.Add(this.stateLabel); + this.splitContainer1.Panel1.Controls.Add(this.capabilitiesLabel); + this.splitContainer1.Panel1.Controls.Add(this.getQuantityUnitsButton); + this.splitContainer1.Panel1.Controls.Add(this.getQuantityCaptionButton); + this.splitContainer1.Panel1.Controls.Add(this.getQuantitiesCountButton); + this.splitContainer1.Panel1.Controls.Add(this.getVolumeUnitsButton); + this.splitContainer1.Panel1.Controls.Add(this.getTimeUnitsButton); + this.splitContainer1.Panel1.Controls.Add(this.setStateButton); + this.splitContainer1.Panel1.Controls.Add(this.getStateButton); + this.splitContainer1.Panel1.Controls.Add(this.stopMeasurementButton); + this.splitContainer1.Panel1.Controls.Add(this.startMeasurementButton); + this.splitContainer1.Panel1.Controls.Add(this.closeConnectionButton); + this.splitContainer1.Panel1.Controls.Add(this.openConnectionButton); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Size = new System.Drawing.Size(826, 583); + this.splitContainer1.SplitterDistance = 150; + this.splitContainer1.TabIndex = 0; + // + // getIDButton + // + this.getIDButton.Location = new System.Drawing.Point(12, 480); + this.getIDButton.Name = "getIDButton"; + this.getIDButton.Size = new System.Drawing.Size(128, 24); + this.getIDButton.TabIndex = 12; + this.getIDButton.Text = "Get ID"; + this.getIDButton.UseVisualStyleBackColor = true; + this.getIDButton.Click += new System.EventHandler(this.getIDButton_Click); + // + // getFramesButton + // + this.getFramesButton.Location = new System.Drawing.Point(12, 450); + this.getFramesButton.Name = "getFramesButton"; + this.getFramesButton.Size = new System.Drawing.Size(128, 24); + this.getFramesButton.TabIndex = 11; + this.getFramesButton.Text = "Get frames"; + this.getFramesButton.UseVisualStyleBackColor = true; + this.getFramesButton.Click += new System.EventHandler(this.getFramesButton_Click); + // + // measurementLabel + // + this.measurementLabel.AutoSize = true; + this.measurementLabel.Location = new System.Drawing.Point(12, 374); + this.measurementLabel.Name = "measurementLabel"; + this.measurementLabel.Size = new System.Drawing.Size(74, 13); + this.measurementLabel.TabIndex = 15; + this.measurementLabel.Text = "Measurement:"; + // + // stateLabel + // + this.stateLabel.AutoSize = true; + this.stateLabel.Location = new System.Drawing.Point(12, 194); + this.stateLabel.Name = "stateLabel"; + this.stateLabel.Size = new System.Drawing.Size(112, 13); + this.stateLabel.TabIndex = 14; + this.stateLabel.Text = "State and connection:"; + // + // capabilitiesLabel + // + this.capabilitiesLabel.AutoSize = true; + this.capabilitiesLabel.Location = new System.Drawing.Point(12, 9); + this.capabilitiesLabel.Name = "capabilitiesLabel"; + this.capabilitiesLabel.Size = new System.Drawing.Size(63, 13); + this.capabilitiesLabel.TabIndex = 13; + this.capabilitiesLabel.Text = "Capabilities:"; + // + // getQuantityUnitsButton + // + this.getQuantityUnitsButton.Location = new System.Drawing.Point(12, 145); + this.getQuantityUnitsButton.Name = "getQuantityUnitsButton"; + this.getQuantityUnitsButton.Size = new System.Drawing.Size(128, 24); + this.getQuantityUnitsButton.TabIndex = 4; + this.getQuantityUnitsButton.Text = "Get quantity units"; + this.getQuantityUnitsButton.UseVisualStyleBackColor = true; + this.getQuantityUnitsButton.Click += new System.EventHandler(this.getQuantityUnitsButton_Click); + // + // getQuantityCaptionButton + // + this.getQuantityCaptionButton.Location = new System.Drawing.Point(12, 115); + this.getQuantityCaptionButton.Name = "getQuantityCaptionButton"; + this.getQuantityCaptionButton.Size = new System.Drawing.Size(128, 24); + this.getQuantityCaptionButton.TabIndex = 3; + this.getQuantityCaptionButton.Text = "Get quantity caption"; + this.getQuantityCaptionButton.UseVisualStyleBackColor = true; + this.getQuantityCaptionButton.Click += new System.EventHandler(this.getQuantityCaptionButton_Click); + // + // getQuantitiesCountButton + // + this.getQuantitiesCountButton.Location = new System.Drawing.Point(12, 85); + this.getQuantitiesCountButton.Name = "getQuantitiesCountButton"; + this.getQuantitiesCountButton.Size = new System.Drawing.Size(128, 24); + this.getQuantitiesCountButton.TabIndex = 2; + this.getQuantitiesCountButton.Text = "Get quantities count"; + this.getQuantitiesCountButton.UseVisualStyleBackColor = true; + this.getQuantitiesCountButton.Click += new System.EventHandler(this.getQuantitiesCountButton_Click); + // + // getVolumeUnitsButton + // + this.getVolumeUnitsButton.Location = new System.Drawing.Point(12, 55); + this.getVolumeUnitsButton.Name = "getVolumeUnitsButton"; + this.getVolumeUnitsButton.Size = new System.Drawing.Size(128, 24); + this.getVolumeUnitsButton.TabIndex = 1; + this.getVolumeUnitsButton.Text = "Get volume units"; + this.getVolumeUnitsButton.UseVisualStyleBackColor = true; + this.getVolumeUnitsButton.Click += new System.EventHandler(this.getVolumeUnitsButton_Click); + // + // getTimeUnitsButton + // + this.getTimeUnitsButton.Location = new System.Drawing.Point(12, 25); + this.getTimeUnitsButton.Name = "getTimeUnitsButton"; + this.getTimeUnitsButton.Size = new System.Drawing.Size(128, 24); + this.getTimeUnitsButton.TabIndex = 0; + this.getTimeUnitsButton.Text = "Get time units"; + this.getTimeUnitsButton.UseVisualStyleBackColor = true; + this.getTimeUnitsButton.Click += new System.EventHandler(this.getTimeUnitsButton_Click); + // + // setStateButton + // + this.setStateButton.Location = new System.Drawing.Point(12, 315); + this.setStateButton.Name = "setStateButton"; + this.setStateButton.Size = new System.Drawing.Size(128, 24); + this.setStateButton.TabIndex = 8; + this.setStateButton.Text = "Set state"; + this.setStateButton.UseVisualStyleBackColor = true; + this.setStateButton.Click += new System.EventHandler(this.setStateButton_Click); + // + // getStateButton + // + this.getStateButton.Location = new System.Drawing.Point(12, 285); + this.getStateButton.Name = "getStateButton"; + this.getStateButton.Size = new System.Drawing.Size(128, 24); + this.getStateButton.TabIndex = 7; + this.getStateButton.Text = "Get state"; + this.getStateButton.UseVisualStyleBackColor = true; + this.getStateButton.Click += new System.EventHandler(this.getStateButton_Click); + // + // stopMeasurementButton + // + this.stopMeasurementButton.Location = new System.Drawing.Point(12, 420); + this.stopMeasurementButton.Name = "stopMeasurementButton"; + this.stopMeasurementButton.Size = new System.Drawing.Size(128, 24); + this.stopMeasurementButton.TabIndex = 10; + this.stopMeasurementButton.Text = "Stop measurement"; + this.stopMeasurementButton.UseVisualStyleBackColor = true; + this.stopMeasurementButton.Click += new System.EventHandler(this.stopMeasurementButton_Click); + // + // startMeasurementButton + // + this.startMeasurementButton.Location = new System.Drawing.Point(12, 390); + this.startMeasurementButton.Name = "startMeasurementButton"; + this.startMeasurementButton.Size = new System.Drawing.Size(128, 24); + this.startMeasurementButton.TabIndex = 9; + this.startMeasurementButton.Text = "Start measurement"; + this.startMeasurementButton.UseVisualStyleBackColor = true; + this.startMeasurementButton.Click += new System.EventHandler(this.startMeasurementButton_Click); + // + // closeConnectionButton + // + this.closeConnectionButton.Location = new System.Drawing.Point(12, 240); + this.closeConnectionButton.Name = "closeConnectionButton"; + this.closeConnectionButton.Size = new System.Drawing.Size(128, 24); + this.closeConnectionButton.TabIndex = 6; + this.closeConnectionButton.Text = "Close connection"; + this.closeConnectionButton.UseVisualStyleBackColor = true; + this.closeConnectionButton.Click += new System.EventHandler(this.closeConnectionButton_Click); + // + // openConnectionButton + // + this.openConnectionButton.Location = new System.Drawing.Point(12, 210); + this.openConnectionButton.Name = "openConnectionButton"; + this.openConnectionButton.Size = new System.Drawing.Size(128, 24); + this.openConnectionButton.TabIndex = 5; + this.openConnectionButton.Text = "Open connection"; + this.openConnectionButton.UseVisualStyleBackColor = true; + this.openConnectionButton.Click += new System.EventHandler(this.openConnectionButton_Click); + // + // splitContainer2 + // + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Name = "splitContainer2"; + this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.logsTextBox); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.dataTabControl); + this.splitContainer2.Size = new System.Drawing.Size(672, 583); + this.splitContainer2.SplitterDistance = 222; + this.splitContainer2.TabIndex = 0; + // + // logsTextBox + // + this.logsTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.logsTextBox.Location = new System.Drawing.Point(0, 0); + this.logsTextBox.Multiline = true; + this.logsTextBox.Name = "logsTextBox"; + this.logsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.logsTextBox.Size = new System.Drawing.Size(672, 222); + this.logsTextBox.TabIndex = 0; + // + // dataTabControl + // + this.dataTabControl.Controls.Add(this.tabPage1); + this.dataTabControl.Controls.Add(this.tabPage2); + this.dataTabControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataTabControl.Location = new System.Drawing.Point(0, 0); + this.dataTabControl.Name = "dataTabControl"; + this.dataTabControl.SelectedIndex = 0; + this.dataTabControl.Size = new System.Drawing.Size(672, 357); + this.dataTabControl.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.framesListView); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(664, 331); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Transferred frames"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(664, 331); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Graph"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // framesListView + // + this.framesListView.Dock = System.Windows.Forms.DockStyle.Fill; + this.framesListView.GridLines = true; + this.framesListView.Location = new System.Drawing.Point(3, 3); + this.framesListView.Name = "framesListView"; + this.framesListView.Size = new System.Drawing.Size(658, 325); + this.framesListView.TabIndex = 0; + this.framesListView.UseCompatibleStateImageBehavior = false; + this.framesListView.View = System.Windows.Forms.View.Details; + // + // DemoMainWnd + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(826, 583); + this.Controls.Add(this.splitContainer1); + this.Name = "DemoMainWnd"; + this.Text = "Datastream interface test"; + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel1.PerformLayout(); + this.splitContainer2.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); + this.splitContainer2.ResumeLayout(false); + this.dataTabControl.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Button openConnectionButton; + private System.Windows.Forms.Button closeConnectionButton; + private System.Windows.Forms.Button stopMeasurementButton; + private System.Windows.Forms.Button startMeasurementButton; + private System.Windows.Forms.Button setStateButton; + private System.Windows.Forms.Button getStateButton; + private System.Windows.Forms.Button getQuantityUnitsButton; + private System.Windows.Forms.Button getQuantityCaptionButton; + private System.Windows.Forms.Button getQuantitiesCountButton; + private System.Windows.Forms.Button getVolumeUnitsButton; + private System.Windows.Forms.Button getTimeUnitsButton; + private System.Windows.Forms.Label measurementLabel; + private System.Windows.Forms.Label stateLabel; + private System.Windows.Forms.Label capabilitiesLabel; + private System.Windows.Forms.Button getIDButton; + private System.Windows.Forms.Button getFramesButton; + private System.Windows.Forms.SplitContainer splitContainer2; + private System.Windows.Forms.TextBox logsTextBox; + private System.Windows.Forms.TabControl dataTabControl; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.ListView framesListView; + private System.Windows.Forms.TabPage tabPage2; + } +} + diff --git a/DataStreamInterfaceTest/DemoMainWnd.cs b/DataStreamInterfaceTest/DemoMainWnd.cs new file mode 100644 index 000000000..af1252f38 --- /dev/null +++ b/DataStreamInterfaceTest/DemoMainWnd.cs @@ -0,0 +1,284 @@ +using System; +using System.Text; +using System.Windows.Forms; +using DataStreamInterface; + +namespace DataStreamInterfaceTest +{ + public partial class DemoMainWnd : Form + { + IDataStreamMeter dataStreamMeter; + + ActivityLog activityLog; + + Unit timeUnits; + Unit volumeUnits; + int quantitiesCount; + string[] quantityCaption; + Unit[] quantityUnit; + + Int64 storedFramesCount; + DataFrame[] transferredFrames; + + public DemoMainWnd() : this(null) { } + + public DemoMainWnd(IDataStreamMeter dataStreamMeter) + { + InitializeComponent(); + this.dataStreamMeter = dataStreamMeter; + activityLog = new ActivityLog(logsTextBox); + + framesListView.Columns.Add("ID", 100); + framesListView.Columns.Add("Time", 100); + framesListView.Columns.Add("Volume", 100); + framesListView.Columns.Add("Additional quantities", 300); + framesListView.ListViewItemSorter = new LviIDComparer(); + } + + void ShowNoMeterInterfaceMessage() + { + MessageBox.Show("No datastream meter interface"); + } + + private void getTimeUnitsButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + timeUnits = dataStreamMeter.GetTimeUnits(); + activityLog.Print(string.Format("Time units are {0}", timeUnits)); + } + } + + private void getVolumeUnitsButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + volumeUnits = dataStreamMeter.GetVolumeUnits(); + activityLog.Print(string.Format("Volume units are {0}", volumeUnits)); + } + } + + private void getQuantitiesCountButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + int quantitesCountOri = quantitiesCount; + quantitiesCount = dataStreamMeter.GetQuantitiesCount(); + activityLog.Print(string.Format("There are {0} additional quantites", quantitiesCount)); + + if (quantitesCountOri == 0) + { + quantityUnit = new Unit[quantitiesCount]; + quantityCaption = new string[quantitiesCount]; + for (int i = 0; i < quantitiesCount; i++) quantityCaption[i] = string.Empty; + } + else if (quantitiesCount != quantitesCountOri) + { + quantityUnit = new Unit[quantitiesCount]; + quantityCaption = new string[quantitiesCount]; + for (int i = 0; i < quantitiesCount; i++) quantityCaption[i] = string.Empty; + + activityLog.Print(string.Format("Quantities count changed during operation")); + MessageBox.Show("Quantities count changed during operation", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + } + + private void getQuantityCaptionButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + GetIntegerNumberDlg dlg = new GetIntegerNumberDlg(string.Format("Enter index {0} .. {1}", 0, quantitiesCount - 1), 0, quantitiesCount - 1); + if (dlg.ShowDialog() == DialogResult.OK) + { + quantityCaption[dlg.Number] = dataStreamMeter.GetQuantityCaption(dlg.Number); + activityLog.Print(string.Format("Caption of quantity #{0} is {1}", dlg.Number, quantityCaption[dlg.Number])); + } + } + } + + private void getQuantityUnitsButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + GetIntegerNumberDlg dlg = new GetIntegerNumberDlg(string.Format("Enter index {0} .. {1}", 0, quantitiesCount - 1), 0, quantitiesCount - 1); + if (dlg.ShowDialog() == DialogResult.OK) + { + quantityUnit[dlg.Number] = dataStreamMeter.GetQuantityUnits(dlg.Number); + activityLog.Print(string.Format("Units of quantity #{0} are {1}", dlg.Number, quantityUnit[dlg.Number])); + } + } + } + + private void openConnectionButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + string meterId; + if (dataStreamMeter.OpenConnection("no connection parameters", out meterId)) + { + activityLog.Print(string.Format("Connection established, meter ID is {0}", meterId)); + } + else + { + activityLog.Print("Failed to establish a connection"); + } + } + } + + private void closeConnectionButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + if (dataStreamMeter.CloseConnection()) + { + framesListView.Items.Clear(); + activityLog.Print("Connection closed"); + } + else + { + activityLog.Print("Failed to close the connection"); + } + } + } + + private void getStateButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + int state; + string parameter; + if (dataStreamMeter.GetState(out state, out parameter)) + { + activityLog.Print(string.Format("Water meter state is {0} / {1}", state, parameter)); + } + else + { + activityLog.Print("Failed to obtain the water meter state"); + } + } + } + + private void setStateButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + GetStateDlg dlg = new GetStateDlg(); + if (dlg.ShowDialog() == DialogResult.OK) + { + if (dataStreamMeter.SetState(dlg.State, dlg.Parameter)) + { + activityLog.Print(string.Format("Water meter state set to {0} / {1}", dlg.State, dlg.Parameter)); + } + else + { + activityLog.Print(string.Format("Failed to set the water meter state to {0} / {1}", dlg.State, dlg.Parameter)); + } + } + } + } + + private void startMeasurementButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + if (dataStreamMeter.StartMeasurement()) + { + framesListView.Items.Clear(); + activityLog.Print(string.Format("Measurement started")); + } + else + { + activityLog.Print("Failed to start a measurement"); + } + } + } + + private void stopMeasurementButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + if (dataStreamMeter.StopMeasurement(out storedFramesCount)) + { + framesListView.Items.Clear(); + activityLog.Print(string.Format("Measurement sopped, {0} frames acquired", storedFramesCount)); + } + else + { + activityLog.Print("Failed to stop the measurement"); + } + } + } + + private void getFramesButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + GetFrameBoundariesDlg dlg = new GetFrameBoundariesDlg("Enter frames range boundaries", 0, storedFramesCount - 1); + if (dlg.ShowDialog() != DialogResult.OK) return; + DataFrame[] frames = dataStreamMeter.GetFrames(dlg.From, Convert.ToInt32(dlg.To - dlg.From + 1)); + { + foreach (var frame in frames) + { + if (frame != null) framesListView.Items.Add(GetListViewItem(frame)); + } + } + } + } + + private void getIDButton_Click(object sender, EventArgs e) + { + if (dataStreamMeter == null) + ShowNoMeterInterfaceMessage(); + else + { + GetDblValueDlg dlg = new GetDblValueDlg("Enter time in seconds"); + if (dlg.ShowDialog() == DialogResult.OK) + { + Int64 id = dataStreamMeter.GetID(dlg.DblValue); + activityLog.Print(string.Format("GetID({0}) returned {1}", dlg.DblValue, id)); + } + } + } + + ListViewItem GetListViewItem(DataFrame frame) + { + ListViewItem lvi = new ListViewItem(frame.ID.ToString()); + lvi.SubItems.Add(frame.Time.ToString()); + lvi.SubItems.Add(frame.Volume.ToString()); + StringBuilder sb = new StringBuilder(); + foreach (var quantity in frame.Quantity) + { + sb.Append(quantity.ToString()); + sb.Append(" "); + } + lvi.SubItems.Add(sb.ToString()); + lvi.Tag = frame; + return lvi; + } + } +} diff --git a/DataStreamInterfaceTest/DemoMainWnd.resx b/DataStreamInterfaceTest/DemoMainWnd.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/DataStreamInterfaceTest/DemoMainWnd.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetDblValueDlg.Designer.cs b/DataStreamInterfaceTest/GetDblValueDlg.Designer.cs new file mode 100644 index 000000000..500e93d0b --- /dev/null +++ b/DataStreamInterfaceTest/GetDblValueDlg.Designer.cs @@ -0,0 +1,88 @@ +namespace DataStreamInterfaceTest +{ + partial class GetDblValueDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.valueTextBox = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // valueTextBox + // + this.valueTextBox.Location = new System.Drawing.Point(35, 20); + this.valueTextBox.Name = "valueTextBox"; + this.valueTextBox.Size = new System.Drawing.Size(94, 20); + this.valueTextBox.TabIndex = 0; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.Location = new System.Drawing.Point(216, 16); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 29); + this.okButton.TabIndex = 1; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(306, 16); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 29); + this.cancelButton.TabIndex = 2; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // GetFlowDlg + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(396, 58); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.okButton); + this.Controls.Add(this.valueTextBox); + this.Name = "GetFlowDlg"; + this.Text = "Enter flow"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox valueTextBox; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Button cancelButton; + } +} \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetDblValueDlg.cs b/DataStreamInterfaceTest/GetDblValueDlg.cs new file mode 100644 index 000000000..2ca605b97 --- /dev/null +++ b/DataStreamInterfaceTest/GetDblValueDlg.cs @@ -0,0 +1,59 @@ +using System; +using System.Globalization; +using System.Windows.Forms; + +namespace DataStreamInterfaceTest +{ + public partial class GetDblValueDlg : Form + { + public double DblValue; + + double lowerLimit; + double upperLimit; + + + public GetDblValueDlg() + : this("Enter flow in [m3/h] please") + { + } + + public GetDblValueDlg(string title) + : this(title, 0, 100.0) + { + } + + public GetDblValueDlg(string title, double lowerLimit, double upperLimit) + { + InitializeComponent(); + this.Text = title; + this.lowerLimit = lowerLimit; + this.upperLimit = upperLimit; + } + + + private void okButton_Click(object sender, EventArgs e) + { + double val; + if (TryParseUDouble(valueTextBox.Text, out val)) + { + DblValue = val; + DialogResult = DialogResult.OK; + Close(); + } + else + { + MessageBox.Show("Invalid value"); + DialogResult = DialogResult.None; + } + } + + /// + /// Parse an unsigned double number + /// + bool TryParseUDouble(string text, out double result) + { + return double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out result) || + double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result); + } + } +} diff --git a/DataStreamInterfaceTest/GetDblValueDlg.resx b/DataStreamInterfaceTest/GetDblValueDlg.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/DataStreamInterfaceTest/GetDblValueDlg.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetFrameBoundariesDlg.Designer.cs b/DataStreamInterfaceTest/GetFrameBoundariesDlg.Designer.cs new file mode 100644 index 000000000..3a54bf6b4 --- /dev/null +++ b/DataStreamInterfaceTest/GetFrameBoundariesDlg.Designer.cs @@ -0,0 +1,126 @@ +namespace DataStreamInterfaceTest +{ + partial class GetFrameBoundariesDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.fromTextBox = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.toTextBox = new System.Windows.Forms.TextBox(); + this.fromLabel = new System.Windows.Forms.Label(); + this.toLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // fromTextBox + // + this.fromTextBox.Location = new System.Drawing.Point(89, 16); + this.fromTextBox.Name = "fromTextBox"; + this.fromTextBox.Size = new System.Drawing.Size(100, 20); + this.fromTextBox.TabIndex = 0; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.Location = new System.Drawing.Point(225, 24); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 36); + this.okButton.TabIndex = 1; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(316, 24); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 36); + this.cancelButton.TabIndex = 2; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // toTextBox + // + this.toTextBox.Location = new System.Drawing.Point(89, 46); + this.toTextBox.Name = "toTextBox"; + this.toTextBox.Size = new System.Drawing.Size(100, 20); + this.toTextBox.TabIndex = 3; + // + // fromLabel + // + this.fromLabel.AutoSize = true; + this.fromLabel.Location = new System.Drawing.Point(12, 19); + this.fromLabel.Name = "fromLabel"; + this.fromLabel.Size = new System.Drawing.Size(30, 13); + this.fromLabel.TabIndex = 4; + this.fromLabel.Text = "From"; + // + // toLabel + // + this.toLabel.AutoSize = true; + this.toLabel.Location = new System.Drawing.Point(12, 49); + this.toLabel.Name = "toLabel"; + this.toLabel.Size = new System.Drawing.Size(20, 13); + this.toLabel.TabIndex = 5; + this.toLabel.Text = "To"; + // + // GetFrameBoundariesDlg + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(419, 79); + this.ControlBox = false; + this.Controls.Add(this.toLabel); + this.Controls.Add(this.fromLabel); + this.Controls.Add(this.toTextBox); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.okButton); + this.Controls.Add(this.fromTextBox); + this.Name = "GetFrameBoundariesDlg"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Enter frames range boundaries"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox fromTextBox; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.TextBox toTextBox; + private System.Windows.Forms.Label fromLabel; + private System.Windows.Forms.Label toLabel; + } +} \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetFrameBoundariesDlg.cs b/DataStreamInterfaceTest/GetFrameBoundariesDlg.cs new file mode 100644 index 000000000..91d47f87e --- /dev/null +++ b/DataStreamInterfaceTest/GetFrameBoundariesDlg.cs @@ -0,0 +1,88 @@ +using System; +using System.Windows.Forms; + +namespace DataStreamInterfaceTest +{ + public partial class GetFrameBoundariesDlg : Form + { + /// + /// Integer number entered in this form + /// + public Int64 From; + public Int64 To; + + Int64 lowerLimit; + Int64 upperLimit; + + + /// + /// Default constructor + /// + public GetFrameBoundariesDlg() + : this("Enter state please") + { + } + + /// + /// Constructor with a custom window title. + /// + /// Window title + public GetFrameBoundariesDlg(string title) + : this(title, Int64.MinValue, Int64.MaxValue) + { + } + + /// + /// Constructor with a custom window title, limits and non-empty initial value. + /// + /// Window title + /// Lower limit + /// Upper limit + /// Initial value + public GetFrameBoundariesDlg(string title, Int64 lowerLimit, Int64 upperLimit, int initialValue) + : this(title, lowerLimit, upperLimit) + { + fromTextBox.Text = initialValue.ToString(); + } + + /// + /// Constructor with a custom window title and lower/upper limits. + /// + /// Window title + /// Lower limit + /// Upper limit + public GetFrameBoundariesDlg(string title, Int64 lowerLimit, Int64 upperLimit) + { + InitializeComponent(); + this.Text = title; + this.lowerLimit = lowerLimit; + this.upperLimit = upperLimit; + } + + + /// + /// OK button handler that verifies validity of the entered value. + /// + private void okButton_Click(object sender, EventArgs e) + { + Int64 from; + Int64 to; + if (Int64.TryParse(fromTextBox.Text, out from) && from >= lowerLimit && from <= upperLimit && + Int64.TryParse(toTextBox.Text, out to) && to >= lowerLimit && to <= upperLimit && + to >= from && to < from + Int32.MaxValue) + { + From = from; + To = to; + DialogResult = DialogResult.OK; + } + else + { + string message = (lowerLimit != 0 || upperLimit != Int32.MaxValue) + ? string.Format("Invalid boundaries ({0}..{1})", lowerLimit, upperLimit) + : "Invalid boundaries"; + MessageBox.Show(message); + DialogResult = DialogResult.None; /// Prevent closing this window + } + } + } +} diff --git a/DataStreamInterfaceTest/GetFrameBoundariesDlg.resx b/DataStreamInterfaceTest/GetFrameBoundariesDlg.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/DataStreamInterfaceTest/GetFrameBoundariesDlg.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetIntegerNumberDlg.Designer.cs b/DataStreamInterfaceTest/GetIntegerNumberDlg.Designer.cs new file mode 100644 index 000000000..8e77c8cb4 --- /dev/null +++ b/DataStreamInterfaceTest/GetIntegerNumberDlg.Designer.cs @@ -0,0 +1,90 @@ +namespace DataStreamInterfaceTest +{ + partial class GetIntegerNumberDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.numberTextBox = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // numberTextBox + // + this.numberTextBox.Location = new System.Drawing.Point(36, 16); + this.numberTextBox.Name = "numberTextBox"; + this.numberTextBox.Size = new System.Drawing.Size(100, 20); + this.numberTextBox.TabIndex = 0; + // + // okButton + // + this.okButton.Location = new System.Drawing.Point(174, 7); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 36); + this.okButton.TabIndex = 1; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // cancelButton + // + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(265, 7); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 36); + this.cancelButton.TabIndex = 2; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // GetIntegerNumberDlg + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(363, 50); + this.ControlBox = false; + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.okButton); + this.Controls.Add(this.numberTextBox); + this.Name = "GetIntegerNumberDlg"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Enter integer number please"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox numberTextBox; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Button cancelButton; + } +} \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetIntegerNumberDlg.cs b/DataStreamInterfaceTest/GetIntegerNumberDlg.cs new file mode 100644 index 000000000..155c3d3f2 --- /dev/null +++ b/DataStreamInterfaceTest/GetIntegerNumberDlg.cs @@ -0,0 +1,83 @@ +using System; +using System.Windows.Forms; + +namespace DataStreamInterfaceTest +{ + public partial class GetIntegerNumberDlg : Form + { + /// + /// Integer number entered in this form + /// + public int Number; + + int lowerLimit; + int upperLimit; + + + /// + /// Default constructor + /// + public GetIntegerNumberDlg() + : this("Enter integer number please") + { + } + + /// + /// Constructor with a custom window title. + /// + /// Window title + public GetIntegerNumberDlg(string title) + : this(title, Int32.MinValue, Int32.MaxValue) + { + } + + /// + /// Constructor with a custom window title, limits and non-empty initial value. + /// + /// Window title + /// Lower limit + /// Upper limit + /// Initial value + public GetIntegerNumberDlg(string title, int lowerLimit, int upperLimit, int initialValue) + : this(title, lowerLimit, upperLimit) + { + numberTextBox.Text = initialValue.ToString(); + } + + /// + /// Constructor with a custom window title and lower/upper limits. + /// + /// Window title + /// Lower limit + /// Upper limit + public GetIntegerNumberDlg(string title, int lowerLimit, int upperLimit) + { + InitializeComponent(); + this.Text = title; + this.lowerLimit = lowerLimit; + this.upperLimit = upperLimit; + } + + + /// + /// OK button handler that verifies validity of the entered value. + /// + private void okButton_Click(object sender, EventArgs e) + { + int number; + if (int.TryParse(numberTextBox.Text, out number) && number >= lowerLimit && number <= upperLimit) + { + Number = number; + DialogResult = DialogResult.OK; + } + else + { + string message = (lowerLimit != Int32.MinValue || upperLimit != Int32.MaxValue) + ? string.Format("Invalid integer number ({0}..{1})", lowerLimit, upperLimit) + : "Invalid integer number"; + MessageBox.Show(message); + DialogResult = DialogResult.None; /// Prevent closing this window + } + } + } +} diff --git a/DataStreamInterfaceTest/GetIntegerNumberDlg.resx b/DataStreamInterfaceTest/GetIntegerNumberDlg.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/DataStreamInterfaceTest/GetIntegerNumberDlg.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetStateDlg.Designer.cs b/DataStreamInterfaceTest/GetStateDlg.Designer.cs new file mode 100644 index 000000000..6dc14c2c4 --- /dev/null +++ b/DataStreamInterfaceTest/GetStateDlg.Designer.cs @@ -0,0 +1,126 @@ +namespace DataStreamInterfaceTest +{ + partial class GetStateDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.stateTextBox = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.parameterTextBox = new System.Windows.Forms.TextBox(); + this.stateLabel = new System.Windows.Forms.Label(); + this.parameterLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // stateTextBox + // + this.stateTextBox.Location = new System.Drawing.Point(89, 16); + this.stateTextBox.Name = "stateTextBox"; + this.stateTextBox.Size = new System.Drawing.Size(100, 20); + this.stateTextBox.TabIndex = 0; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.Location = new System.Drawing.Point(225, 24); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 36); + this.okButton.TabIndex = 1; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(316, 24); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 36); + this.cancelButton.TabIndex = 2; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // parameterTextBox + // + this.parameterTextBox.Location = new System.Drawing.Point(89, 46); + this.parameterTextBox.Name = "parameterTextBox"; + this.parameterTextBox.Size = new System.Drawing.Size(100, 20); + this.parameterTextBox.TabIndex = 3; + // + // stateLabel + // + this.stateLabel.AutoSize = true; + this.stateLabel.Location = new System.Drawing.Point(12, 19); + this.stateLabel.Name = "stateLabel"; + this.stateLabel.Size = new System.Drawing.Size(32, 13); + this.stateLabel.TabIndex = 4; + this.stateLabel.Text = "State"; + // + // parameterLabel + // + this.parameterLabel.AutoSize = true; + this.parameterLabel.Location = new System.Drawing.Point(12, 49); + this.parameterLabel.Name = "parameterLabel"; + this.parameterLabel.Size = new System.Drawing.Size(55, 13); + this.parameterLabel.TabIndex = 5; + this.parameterLabel.Text = "Parameter"; + // + // GetStateDlg + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(419, 79); + this.ControlBox = false; + this.Controls.Add(this.parameterLabel); + this.Controls.Add(this.stateLabel); + this.Controls.Add(this.parameterTextBox); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.okButton); + this.Controls.Add(this.stateTextBox); + this.Name = "GetStateDlg"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Enter state please"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox stateTextBox; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.TextBox parameterTextBox; + private System.Windows.Forms.Label stateLabel; + private System.Windows.Forms.Label parameterLabel; + } +} \ No newline at end of file diff --git a/DataStreamInterfaceTest/GetStateDlg.cs b/DataStreamInterfaceTest/GetStateDlg.cs new file mode 100644 index 000000000..04589c91e --- /dev/null +++ b/DataStreamInterfaceTest/GetStateDlg.cs @@ -0,0 +1,85 @@ +using System; +using System.Windows.Forms; + +namespace DataStreamInterfaceTest +{ + public partial class GetStateDlg : Form + { + /// + /// Integer number entered in this form + /// + public int State; + public string Parameter; + + int lowerLimit; + int upperLimit; + + + /// + /// Default constructor + /// + public GetStateDlg() + : this("Enter state please") + { + } + + /// + /// Constructor with a custom window title. + /// + /// Window title + public GetStateDlg(string title) + : this(title, Int32.MinValue, Int32.MaxValue) + { + } + + /// + /// Constructor with a custom window title, limits and non-empty initial value. + /// + /// Window title + /// Lower limit + /// Upper limit + /// Initial value + public GetStateDlg(string title, int lowerLimit, int upperLimit, int initialValue) + : this(title, lowerLimit, upperLimit) + { + stateTextBox.Text = initialValue.ToString(); + } + + /// + /// Constructor with a custom window title and lower/upper limits. + /// + /// Window title + /// Lower limit + /// Upper limit + public GetStateDlg(string title, int lowerLimit, int upperLimit) + { + InitializeComponent(); + this.Text = title; + this.lowerLimit = lowerLimit; + this.upperLimit = upperLimit; + } + + + /// + /// OK button handler that verifies validity of the entered value. + /// + private void okButton_Click(object sender, EventArgs e) + { + int number; + if (int.TryParse(stateTextBox.Text, out number) && number >= lowerLimit && number <= upperLimit) + { + State = number; + Parameter = parameterTextBox.Text; + DialogResult = DialogResult.OK; + } + else + { + string message = (lowerLimit != Int32.MinValue || upperLimit != Int32.MaxValue) + ? string.Format("Invalid state ({0}..{1})", lowerLimit, upperLimit) + : "Invalid state"; + MessageBox.Show(message); + DialogResult = DialogResult.None; /// Prevent closing this window + } + } + } +} diff --git a/DataStreamInterfaceTest/GetStateDlg.resx b/DataStreamInterfaceTest/GetStateDlg.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/DataStreamInterfaceTest/GetStateDlg.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/LviIDComparer.cs b/DataStreamInterfaceTest/LviIDComparer.cs new file mode 100644 index 000000000..93f3c1613 --- /dev/null +++ b/DataStreamInterfaceTest/LviIDComparer.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using System.Windows.Forms; + +namespace DataStreamInterfaceTest +{ + public class LviIDComparer : IComparer + { + int column; + SortOrder order; + + public LviIDComparer() + { + column = 0; + order = SortOrder.Ascending; + } + + public LviIDComparer(int column, SortOrder order) + { + this.column = column; + this.order = order; + } + + public int Compare(object x, object y) + { + Int64 valX = Int64.Parse(((ListViewItem)x).SubItems[column].Text); + Int64 valY = Int64.Parse(((ListViewItem)y).SubItems[column].Text); + + if (order == SortOrder.Ascending) + { + return valX > valY ? 1 : valX == valY ? 0 : -1; + } + else + { + return valX < valY ? 1 : valX == valY ? 0 : -1; + } + } + } +} diff --git a/DataStreamInterfaceTest/Program.cs b/DataStreamInterfaceTest/Program.cs new file mode 100644 index 000000000..b027b1729 --- /dev/null +++ b/DataStreamInterfaceTest/Program.cs @@ -0,0 +1,55 @@ +using System; +using System.IO; +using System.ComponentModel.Composition; +using System.ComponentModel.Composition.Hosting; +using System.Windows.Forms; +using DataStreamInterface; + +namespace DataStreamInterfaceTest +{ + class Program + { +#if DEBUG + const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Debug"; +#else + const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Release"; +#endif + + [Import(typeof(IDataStreamMeter))] + IDataStreamMeter dataStreamMeter; + + private Program() + { + Console.WriteLine("Components found:"); + foreach (var file in Directory.EnumerateFiles(CatalogDir)) + { + Console.WriteLine(file); + } + + try + { + var catalog = new AggregateCatalog(); + catalog.Catalogs.Add(new AssemblyCatalog(typeof(DataStreamInterface.IDataStreamMeter).Assembly)); + catalog.Catalogs.Add(new DirectoryCatalog(CatalogDir)); + (new CompositionContainer(catalog)).ComposeParts(this); + } + catch (CompositionException compositionException) + { + Console.WriteLine(compositionException.ToString()); + } + } + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Program p = new Program(); + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new DemoMainWnd(p.dataStreamMeter)); + } + } +} diff --git a/DataStreamInterfaceTest/Properties/AssemblyInfo.cs b/DataStreamInterfaceTest/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..faac7b59f --- /dev/null +++ b/DataStreamInterfaceTest/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DataStreamInterfaceTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DataStreamInterfaceTest")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("429fdea9-ec3a-47d8-88b3-5df11de8b4c8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DataStreamInterfaceTest/Properties/Resources.Designer.cs b/DataStreamInterfaceTest/Properties/Resources.Designer.cs new file mode 100644 index 000000000..b9b484555 --- /dev/null +++ b/DataStreamInterfaceTest/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DataStreamInterfaceTest.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataStreamMainDemo.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/DataStreamInterfaceTest/Properties/Resources.resx b/DataStreamInterfaceTest/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/DataStreamInterfaceTest/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DataStreamInterfaceTest/Properties/Settings.Designer.cs b/DataStreamInterfaceTest/Properties/Settings.Designer.cs new file mode 100644 index 000000000..09d23c23a --- /dev/null +++ b/DataStreamInterfaceTest/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DataStreamInterfaceTest.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/DataStreamInterfaceTest/Properties/Settings.settings b/DataStreamInterfaceTest/Properties/Settings.settings new file mode 100644 index 000000000..39645652a --- /dev/null +++ b/DataStreamInterfaceTest/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/DataStreamMeter/DataStreamMeter.csproj b/DataStreamMeter/DataStreamMeter.csproj new file mode 100644 index 000000000..b0abf9878 --- /dev/null +++ b/DataStreamMeter/DataStreamMeter.csproj @@ -0,0 +1,85 @@ + + + + + Debug + AnyCPU + {E6925701-57A6-4167-B5C4-BF670F1DE310} + Library + Properties + DataStreamMeter + DataStreamMeter + v4.7.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Form + + + GetDblValueDlg.cs + + + + Form + + + MeterSimulationDlg.cs + + + + + + + + {7ebeea14-91c4-48d7-af0a-7a4bc3ff9a28} + DataStreamInterface + + + + + GetDblValueDlg.cs + + + MeterSimulationDlg.cs + Designer + + + + + \ No newline at end of file diff --git a/DataStreamMeter/GetDblValueDlg.Designer.cs b/DataStreamMeter/GetDblValueDlg.Designer.cs new file mode 100644 index 000000000..0d8c565f1 --- /dev/null +++ b/DataStreamMeter/GetDblValueDlg.Designer.cs @@ -0,0 +1,88 @@ +namespace DataStreamMeter +{ + partial class GetDblValueDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.valueTextBox = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // valueTextBox + // + this.valueTextBox.Location = new System.Drawing.Point(35, 20); + this.valueTextBox.Name = "valueTextBox"; + this.valueTextBox.Size = new System.Drawing.Size(94, 20); + this.valueTextBox.TabIndex = 0; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.Location = new System.Drawing.Point(216, 16); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 29); + this.okButton.TabIndex = 1; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(306, 16); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 29); + this.cancelButton.TabIndex = 2; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // GetFlowDlg + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(396, 58); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.okButton); + this.Controls.Add(this.valueTextBox); + this.Name = "GetFlowDlg"; + this.Text = "Enter flow"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox valueTextBox; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Button cancelButton; + } +} \ No newline at end of file diff --git a/DataStreamMeter/GetDblValueDlg.cs b/DataStreamMeter/GetDblValueDlg.cs new file mode 100644 index 000000000..408a4fcb6 --- /dev/null +++ b/DataStreamMeter/GetDblValueDlg.cs @@ -0,0 +1,59 @@ +using System; +using System.Globalization; +using System.Windows.Forms; + +namespace DataStreamMeter +{ + public partial class GetDblValueDlg : Form + { + public double DblValue; + + double lowerLimit; + double upperLimit; + + + public GetDblValueDlg() + : this("Enter flow in [m3/h] please") + { + } + + public GetDblValueDlg(string title) + : this(title, 0, 100.0) + { + } + + public GetDblValueDlg(string title, double lowerLimit, double upperLimit) + { + InitializeComponent(); + this.Text = title; + this.lowerLimit = lowerLimit; + this.upperLimit = upperLimit; + } + + + private void okButton_Click(object sender, EventArgs e) + { + double val; + if (TryParseUDouble(valueTextBox.Text, out val)) + { + DblValue = val; + DialogResult = DialogResult.OK; + Close(); + } + else + { + MessageBox.Show("Invalid value"); + DialogResult = DialogResult.None; + } + } + + /// + /// Parse an unsigned double number + /// + bool TryParseUDouble(string text, out double result) + { + return double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out result) || + double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result); + } + } +} diff --git a/DataStreamMeter/GetDblValueDlg.resx b/DataStreamMeter/GetDblValueDlg.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/DataStreamMeter/GetDblValueDlg.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DataStreamMeter/MeterDataEventArgs.cs b/DataStreamMeter/MeterDataEventArgs.cs new file mode 100644 index 000000000..fdd0aa6de --- /dev/null +++ b/DataStreamMeter/MeterDataEventArgs.cs @@ -0,0 +1,20 @@ +using System; + +namespace DataStreamMeter +{ + public class MeterDataEventArgs : EventArgs + { + public State State; + public double Time; + public double Volume; + public double Flow; + + public MeterDataEventArgs(State state, double time, double volume, double flow) + { + State = state; + Time = time; + Volume = volume; + Flow = flow; + } + } +} diff --git a/DataStreamMeter/MeterSimulation.cs b/DataStreamMeter/MeterSimulation.cs new file mode 100644 index 000000000..81b023bde --- /dev/null +++ b/DataStreamMeter/MeterSimulation.cs @@ -0,0 +1,319 @@ +using System; +using System.ComponentModel.Composition; +using DataStreamInterface; + +namespace DataStreamMeter +{ + [Export(typeof(IDataStreamMeter))] + public class MeterSimulation : IDataStreamMeter + { + MeterSimulationDlg modelessDlg; + + /// Water meter specification + public readonly string MeterID = "3141592653"; + public const Unit TimeUnits = Unit.s; /// Unit.s, Unit.ms, ... + public const Unit VolumeUnits = Unit.l; /// Unit.l, Unit.USgal, ... + public const Unit FlowUnits = Unit.m3ph; /// Unit.m3ph, Unit.USgalps, Unit.cfs, ... + public const double SamplingPeriodSec = 0.125; /// Sampling period in seconds (here 125 ms, 8 Hz) + public readonly double SamplingPeriod; + + + public const Int64 MaxSamplesCount = 40000; /// Maximal test time is SamplingPeriod * MaxSamplesCount + Sample[] samples = new Sample[MaxSamplesCount]; + Int64 storedSamplesCount; + + + readonly object stateChangeAndTimerTickLock = new object(); + public State State; + string connectionParameters; + + /// initialTime is time when simulation started + /// (lastSampleTime - initialTime).TotalSeconds is multiple of Sampling Period + DateTime initialTime; + + /// Last user interface tick info + bool lastTickValid; + State lastTickState; + + /// Values incrementally updated on each timer tick + double currentTime; + double currentVolume; + double currentFlow; + double currentFlow_m3ph; + + DateTime startTimeStamp; /// Measurement start DateTime + double startTime; /// Measurement start time in seconds + DateTime stopTimeStamp; /// Measurement end DateTime + double stopTime; /// Measurement end time in seconds + + + public MeterSimulation() + { + modelessDlg = null; + State = State.Disconnected; + SamplingPeriod = DataStreamInterface.Units.ConvertTo(TimeUnits, SamplingPeriodSec); + lastTickValid = false; + initialTime = DateTime.Now.Date; /// An arbitrary initial time (in this case the last midnight) + } + + public Unit GetTimeUnits() + { + return TimeUnits; + } + + public Unit GetVolumeUnits() + { + return VolumeUnits; + } + + public int GetQuantitiesCount() + { + return 1; + } + + public string GetQuantityCaption(int quantityNr) + { + if (quantityNr == 0) return "Flow"; + return string.Empty; + } + + public Unit GetQuantityUnits(int quantityNr) + { + if (quantityNr == 0) return FlowUnits; + return Unit.None; + } + + public bool OpenConnection(string connectionParameters, out string meterID) + { + lock (stateChangeAndTimerTickLock) + { + if (State != State.Disconnected) + { + /// Meter is already connected + meterID = MeterID; + return true; + } + + /// Connect the meter + meterID = MeterID; + this.connectionParameters = connectionParameters; + lastTickValid = false; + State = State.Connected; + } + + /// Open modeless form + modelessDlg = new MeterSimulationDlg(this, MeterID); + modelessDlg.Show(); + return true; + } + + public bool CloseConnection() + { + bool closeModelessDlg = false; + + lock (stateChangeAndTimerTickLock) + { + if (State != State.Disconnected) + { + State = State.Disconnected; + storedSamplesCount = 0; + closeModelessDlg = true; + } + } + + if (closeModelessDlg) + { + if (modelessDlg != null) modelessDlg.Close(); + modelessDlg = null; + } + return true; + } + + public bool GetState(out int state, out string parameter) + { + state = (int)this.State; + parameter = this.connectionParameters; + return true; + } + + public bool SetState(int state, string parameter) + { + /// It's not allowed to change the satate in this demo + return false; + } + + public bool StartMeasurement() + { + lock (stateChangeAndTimerTickLock) + { + if (State == State.Connected) + { + startTimeStamp = DateTime.Now; + startTime = TimeInSecondsFromDateTime(startTimeStamp, initialTime, SamplingPeriodSec); + storedSamplesCount = 0; + State = State.MeasurementInProgress; + return true; + } + else + { + return false; + } + } + } + + public bool StopMeasurement(out Int64 storedFramesCount) + { + lock (stateChangeAndTimerTickLock) + { + if (State == State.MeasurementInProgress) + { + stopTimeStamp = DateTime.Now; + stopTime = TimeInSecondsFromDateTime(stopTimeStamp, initialTime, SamplingPeriodSec); + + int newSamplesCount = Convert.ToInt32(Math.Round((stopTime - currentTime) / SamplingPeriodSec)); + double time = Units.ConvertTo(TimeUnits, currentTime); + double volume = currentVolume; + double volumeIncrement = Units.ConvertTo(VolumeUnits, currentFlow_m3ph * (SamplingPeriodSec / 3.6)); + for (int i = 0; i < newSamplesCount; i++) + { + time += SamplingPeriod; + volume += volumeIncrement; + if (storedSamplesCount < MaxSamplesCount) + { + samples[storedSamplesCount++] = new Sample(time, volume, currentFlow); + } + } + + State = State.Connected; + storedFramesCount = storedSamplesCount; + return true; + } + else + { + storedFramesCount = 0; + return false; + } + } + } + + public void TimerTick(double flow_m3ph) + { + lock (stateChangeAndTimerTickLock) + { + double lastSampleTime = TimeInSecondsFromDateTime(DateTime.Now, initialTime, SamplingPeriodSec); + currentFlow_m3ph = flow_m3ph; + currentFlow = Units.ConvertTo(FlowUnits, flow_m3ph); + + if (!lastTickValid) + { + currentTime = lastSampleTime; + currentVolume = 0; + lastTickValid = true; + lastTickState = State; + return; + } + else + { + int newSamplesCount = Convert.ToInt32(Math.Round((lastSampleTime - currentTime) / SamplingPeriodSec)); + double volumeIncrement = Units.ConvertTo(VolumeUnits, currentFlow_m3ph * (SamplingPeriodSec / 3.6)); + for (int i = 0; i < newSamplesCount; i++) + { + currentTime += SamplingPeriodSec; + currentVolume += volumeIncrement; + + if (State == State.MeasurementInProgress && currentTime > startTime && storedSamplesCount < MaxSamplesCount) + { + samples[storedSamplesCount++] = new Sample(Units.ConvertTo(TimeUnits, currentTime), currentVolume, currentFlow); + } + } + currentTime = lastSampleTime; /// Rectify, prevent error propagation + lastTickState = State; + } + } + + modelessDlg.OnMeterdata(new MeterDataEventArgs(State, currentTime, currentVolume, currentFlow)); + } + + + /// + /// Obtain the last time instance before 'DateTime time' which is multiple of samplingPeriod-s after 'DateTime initialTime'. + /// + /// Time to be converted to seconds and rounded to samplingPeriod-s + /// Initial time + /// Sampling period in seconds + /// + double TimeInSecondsFromDateTime(DateTime time, DateTime initialTime, double samplingPeriod) + { + TimeSpan span = time - initialTime; + return samplingPeriod * Math.Floor(span.TotalSeconds / samplingPeriod); + } + + + ///--------------------------- + /// Datastream data exchange + ///--------------------------- + + /// + /// Retuns 'count' data frames starting with data frame with ID = 'id' + /// + /// First frame ID + /// Frames count + /// Selected data frames + public DataFrame[] GetFrames(Int64 startID, int count) + { + DataFrame[] frames = new DataFrame[count]; + + if (State != State.MeasurementInProgress) + { + for (int j = 0; j < count; j++) + { + Int64 id = startID + j; + if (id < storedSamplesCount) + { + frames[j] = new DataFrame(id, samples[id].Time, samples[id].Volume, new double[1] { samples[id].Flow }); + } + } + } + + return frames; + } + + /// + /// Returns ID of the data frame where time equals or exceeds the specified time. + /// When time of the first frame (ID=0) is larger then specified time, function returns 0. + /// + /// Time + /// ID of the data frame at or after the pecified time + public Int64 GetID(double time) + { + if (storedSamplesCount == 0) return -1; + + Int64 lo = 0; + Int64 hi = storedSamplesCount - 1; + + if (samples[hi].Time < time) return -1; + + while (lo < hi) + { + Int64 mid = (lo + hi) / 2; + if (samples[mid].Time < time) + { + lo = mid + 1; + } + else + { + hi = mid; + } + } + + return lo; + } + } + + public enum State + { + Disconnected = 0, + Connected = 1, + MeasurementInProgress = 2, + } +} diff --git a/DataStreamMeter/MeterSimulationDlg.Designer.cs b/DataStreamMeter/MeterSimulationDlg.Designer.cs new file mode 100644 index 000000000..aac135031 --- /dev/null +++ b/DataStreamMeter/MeterSimulationDlg.Designer.cs @@ -0,0 +1,323 @@ +namespace DataStreamMeter +{ + partial class MeterSimulationDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.meterIDGroupBox = new System.Windows.Forms.GroupBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.volumeUnitsTextBox = new System.Windows.Forms.TextBox(); + this.timeUnitsTextBox = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.meterIDTextBox = new System.Windows.Forms.TextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.setFlowButton = new System.Windows.Forms.Button(); + this.flowm3phTextBox = new System.Windows.Forms.TextBox(); + this.flowTrackBar = new System.Windows.Forms.TrackBar(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.flowTextBox = new System.Windows.Forms.TextBox(); + this.volumeTextBox = new System.Windows.Forms.TextBox(); + this.timeTextBox = new System.Windows.Forms.TextBox(); + this.stateTextBox = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.lastUITickTextBox = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.meterIDGroupBox.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.flowTrackBar)).BeginInit(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // meterIDGroupBox + // + this.meterIDGroupBox.Controls.Add(this.label3); + this.meterIDGroupBox.Controls.Add(this.label2); + this.meterIDGroupBox.Controls.Add(this.volumeUnitsTextBox); + this.meterIDGroupBox.Controls.Add(this.timeUnitsTextBox); + this.meterIDGroupBox.Controls.Add(this.label1); + this.meterIDGroupBox.Controls.Add(this.meterIDTextBox); + this.meterIDGroupBox.Location = new System.Drawing.Point(12, 12); + this.meterIDGroupBox.Name = "meterIDGroupBox"; + this.meterIDGroupBox.Size = new System.Drawing.Size(453, 105); + this.meterIDGroupBox.TabIndex = 0; + this.meterIDGroupBox.TabStop = false; + this.meterIDGroupBox.Text = "Water meter info"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(18, 76); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(67, 13); + this.label3.TabIndex = 5; + this.label3.Text = "Volume units"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(18, 50); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(55, 13); + this.label2.TabIndex = 4; + this.label2.Text = "Time units"; + // + // volumeUnitsTextBox + // + this.volumeUnitsTextBox.Enabled = false; + this.volumeUnitsTextBox.Location = new System.Drawing.Point(122, 73); + this.volumeUnitsTextBox.Name = "volumeUnitsTextBox"; + this.volumeUnitsTextBox.Size = new System.Drawing.Size(52, 20); + this.volumeUnitsTextBox.TabIndex = 3; + // + // timeUnitsTextBox + // + this.timeUnitsTextBox.Enabled = false; + this.timeUnitsTextBox.Location = new System.Drawing.Point(122, 47); + this.timeUnitsTextBox.Name = "timeUnitsTextBox"; + this.timeUnitsTextBox.Size = new System.Drawing.Size(52, 20); + this.timeUnitsTextBox.TabIndex = 2; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(18, 24); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(73, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Meter ID (s/n)"; + // + // meterIDTextBox + // + this.meterIDTextBox.Enabled = false; + this.meterIDTextBox.Location = new System.Drawing.Point(122, 21); + this.meterIDTextBox.Name = "meterIDTextBox"; + this.meterIDTextBox.Size = new System.Drawing.Size(145, 20); + this.meterIDTextBox.TabIndex = 0; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.setFlowButton); + this.groupBox1.Controls.Add(this.flowm3phTextBox); + this.groupBox1.Controls.Add(this.flowTrackBar); + this.groupBox1.Location = new System.Drawing.Point(12, 123); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(453, 96); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Flow"; + // + // setFlowButton + // + this.setFlowButton.Location = new System.Drawing.Point(289, 17); + this.setFlowButton.Name = "setFlowButton"; + this.setFlowButton.Size = new System.Drawing.Size(75, 23); + this.setFlowButton.TabIndex = 4; + this.setFlowButton.Text = "Set value"; + this.setFlowButton.UseVisualStyleBackColor = true; + this.setFlowButton.Click += new System.EventHandler(this.setFlowButton_Click); + // + // flowm3phTextBox + // + this.flowm3phTextBox.Enabled = false; + this.flowm3phTextBox.Location = new System.Drawing.Point(122, 19); + this.flowm3phTextBox.Name = "flowm3phTextBox"; + this.flowm3phTextBox.Size = new System.Drawing.Size(145, 20); + this.flowm3phTextBox.TabIndex = 3; + // + // flowTrackBar + // + this.flowTrackBar.LargeChange = 1; + this.flowTrackBar.Location = new System.Drawing.Point(0, 43); + this.flowTrackBar.Maximum = 25; + this.flowTrackBar.Name = "flowTrackBar"; + this.flowTrackBar.Size = new System.Drawing.Size(447, 45); + this.flowTrackBar.TabIndex = 2; + this.flowTrackBar.Scroll += new System.EventHandler(this.flowTrackBar_Scroll); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.flowTextBox); + this.groupBox2.Controls.Add(this.volumeTextBox); + this.groupBox2.Controls.Add(this.timeTextBox); + this.groupBox2.Controls.Add(this.stateTextBox); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Controls.Add(this.label7); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.lastUITickTextBox); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Location = new System.Drawing.Point(12, 225); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(453, 150); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "State"; + // + // flowTextBox + // + this.flowTextBox.Enabled = false; + this.flowTextBox.Location = new System.Drawing.Point(122, 121); + this.flowTextBox.Name = "flowTextBox"; + this.flowTextBox.Size = new System.Drawing.Size(99, 20); + this.flowTextBox.TabIndex = 9; + // + // volumeTextBox + // + this.volumeTextBox.Enabled = false; + this.volumeTextBox.Location = new System.Drawing.Point(122, 95); + this.volumeTextBox.Name = "volumeTextBox"; + this.volumeTextBox.Size = new System.Drawing.Size(99, 20); + this.volumeTextBox.TabIndex = 8; + // + // timeTextBox + // + this.timeTextBox.Enabled = false; + this.timeTextBox.Location = new System.Drawing.Point(122, 68); + this.timeTextBox.Name = "timeTextBox"; + this.timeTextBox.Size = new System.Drawing.Size(99, 20); + this.timeTextBox.TabIndex = 7; + // + // stateTextBox + // + this.stateTextBox.Enabled = false; + this.stateTextBox.Location = new System.Drawing.Point(122, 42); + this.stateTextBox.Name = "stateTextBox"; + this.stateTextBox.Size = new System.Drawing.Size(99, 20); + this.stateTextBox.TabIndex = 6; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(18, 124); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(29, 13); + this.label8.TabIndex = 5; + this.label8.Text = "Flow"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(18, 98); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(42, 13); + this.label7.TabIndex = 4; + this.label7.Text = "Volume"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(18, 71); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(30, 13); + this.label6.TabIndex = 3; + this.label6.Text = "Time"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(18, 45); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(32, 13); + this.label5.TabIndex = 2; + this.label5.Text = "State"; + // + // lastUITickTextBox + // + this.lastUITickTextBox.Enabled = false; + this.lastUITickTextBox.Location = new System.Drawing.Point(122, 13); + this.lastUITickTextBox.Name = "lastUITickTextBox"; + this.lastUITickTextBox.Size = new System.Drawing.Size(145, 20); + this.lastUITickTextBox.TabIndex = 1; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(18, 16); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(61, 13); + this.label4.TabIndex = 0; + this.label4.Text = "Last UI tick"; + // + // timer1 + // + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // MeterSimulationDlg + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(477, 387); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.meterIDGroupBox); + this.Name = "MeterSimulationDlg"; + this.Text = "MeterDialog"; + this.meterIDGroupBox.ResumeLayout(false); + this.meterIDGroupBox.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.flowTrackBar)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox meterIDGroupBox; + private System.Windows.Forms.TextBox meterIDTextBox; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox volumeUnitsTextBox; + private System.Windows.Forms.TextBox timeUnitsTextBox; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox flowm3phTextBox; + private System.Windows.Forms.TrackBar flowTrackBar; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Button setFlowButton; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.TextBox lastUITickTextBox; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox flowTextBox; + private System.Windows.Forms.TextBox volumeTextBox; + private System.Windows.Forms.TextBox timeTextBox; + private System.Windows.Forms.TextBox stateTextBox; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + } +} \ No newline at end of file diff --git a/DataStreamMeter/MeterSimulationDlg.cs b/DataStreamMeter/MeterSimulationDlg.cs new file mode 100644 index 000000000..f0e4ac49d --- /dev/null +++ b/DataStreamMeter/MeterSimulationDlg.cs @@ -0,0 +1,91 @@ +using System; +using System.Windows.Forms; + +namespace DataStreamMeter +{ + public partial class MeterSimulationDlg : Form + { + MeterSimulation meterSimulation; + double currentFlow; + + + public string MeterID; + + + public void OnMeterdata(MeterDataEventArgs args) + { + if (MeterDataHandler == null) return; + MeterDataHandler(null, args); + } + public event EventHandler MeterDataHandler; + + + /// + /// Default constructor with no meter + /// + public MeterSimulationDlg() + : this(null, string.Empty) + { + } + + public MeterSimulationDlg(MeterSimulation meterSimulation, string meterID) + { + InitializeComponent(); + this.meterSimulation = meterSimulation; + meterIDTextBox.Text = meterID; + + currentFlow = 0; + flowm3phTextBox.Text = currentFlow.ToString(); + flowTrackBar.Value = Convert.ToInt32(currentFlow); + + MeterDataHandler += delegate(object sender, MeterDataEventArgs args) + { + if (InvokeRequired) + { + Invoke(new EventHandler(DisplayMeterData), sender, args); + } + else + { + DisplayMeterData(sender, args); + } + }; + + if (meterSimulation != null) + { + timer1.Enabled = true; + timer1.Start(); + } + } + + private void flowTrackBar_Scroll(object sender, EventArgs e) + { + currentFlow = flowTrackBar.Value; + flowm3phTextBox.Text = currentFlow.ToString("F2"); + } + + private void setFlowButton_Click(object sender, EventArgs e) + { + GetDblValueDlg dlg = new GetDblValueDlg("Enter flow in [m3/h] please", 0, 25.0); + if (dlg.ShowDialog() == DialogResult.OK) + { + currentFlow = dlg.DblValue; + flowm3phTextBox.Text = currentFlow.ToString(); + flowTrackBar.Value = Convert.ToInt32(currentFlow); + } + } + + private void timer1_Tick(object sender, EventArgs e) + { + lastUITickTextBox.Text = DateTime.Now.ToString("HH:mm:ss fff"); + meterSimulation.TimerTick(currentFlow); + } + + void DisplayMeterData(object sender, MeterDataEventArgs args) + { + stateTextBox.Text = args.State.ToString(); + timeTextBox.Text = args.Time.ToString(); + volumeTextBox.Text = args.Volume.ToString(); + flowTextBox.Text = args.Flow.ToString(); + } + } +} diff --git a/DataStreamMeter/MeterSimulationDlg.resx b/DataStreamMeter/MeterSimulationDlg.resx new file mode 100644 index 000000000..1f666f268 --- /dev/null +++ b/DataStreamMeter/MeterSimulationDlg.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/DataStreamMeter/Properties/AssemblyInfo.cs b/DataStreamMeter/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..0822cd36a --- /dev/null +++ b/DataStreamMeter/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DataStreamMeter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DataStreamMeter")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8acd46eb-c84d-4199-9f40-7420b7ebabc2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DataStreamMeter/Sample.cs b/DataStreamMeter/Sample.cs new file mode 100644 index 000000000..3bd8b2966 --- /dev/null +++ b/DataStreamMeter/Sample.cs @@ -0,0 +1,23 @@ +using System; + +namespace DataStreamMeter +{ + public class Sample + { + public readonly double Time; /// In water meter time units + public readonly double Volume; /// In water meter colume units + public readonly double Flow; /// In water meter flow units + + public Sample(double time, double volume, double flow) + { + Time = time; + Volume = volume; + Flow = flow; + } + + public override string ToString() + { + return string.Format("time={0} volume={1} flow={2}", Time, Volume, Flow); + } + } +} diff --git a/TBF.sln b/TBF.sln index 86de24e4a..4c5262117 100644 --- a/TBF.sln +++ b/TBF.sln @@ -71,6 +71,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamInterface", "Data EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResetBatchNr", "ResetBatchNr\ResetBatchNr.csproj", "{D7F5A111-B2DF-4761-9574-AB730DF573A6}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamInterfaceTest", "DataStreamInterfaceTest\DataStreamInterfaceTest.csproj", "{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}" + ProjectSection(ProjectDependencies) = postProject + {E6925701-57A6-4167-B5C4-BF670F1DE310} = {E6925701-57A6-4167-B5C4-BF670F1DE310} + {7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28} = {7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamMeter", "DataStreamMeter\DataStreamMeter.csproj", "{E6925701-57A6-4167-B5C4-BF670F1DE310}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -315,6 +323,26 @@ Global {D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.Build.0 = Release|Any CPU {D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|x86.ActiveCfg = Release|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|x86.ActiveCfg = Debug|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Any CPU.Build.0 = Release|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|x86.ActiveCfg = Release|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|x86.ActiveCfg = Debug|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Any CPU.Build.0 = Release|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/clean.bat b/clean.bat index 435cc083e..cafdc074f 100644 --- a/clean.bat +++ b/clean.bat @@ -4,6 +4,10 @@ rmdir /s /q Config\bin rmdir /s /q Config\obj rmdir /s /q DataStreamInterface\bin rmdir /s /q DataStreamInterface\obj +rmdir /s /q DataStreamInterfaceTest\bin +rmdir /s /q DataStreamInterfaceTest\obj +rmdir /s /q DataStreamMeter\bin +rmdir /s /q DataStreamMeter\obj rmdir /s /q Decrypt\bin rmdir /s /q Decrypt\obj rmdir /s /q DeviceTest\bin