diff --git a/Dashboard.sln b/Dashboard.sln index ad124b7..531bddb 100644 --- a/Dashboard.sln +++ b/Dashboard.sln @@ -1,12 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.7 +VisualStudioVersion = 15.0.26730.16 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dashboard", "Mqtt-Dashboard\Dashboard.csproj", "{16AC0F61-0B60-4A1D-A827-B3BFDBA9AAC7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,8 +23,15 @@ Global {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1B2A7AC0-6D12-415F-89CF-9C5AFADDD227} + EndGlobalSection EndGlobal diff --git a/Mqtt-Dashboard/App.config b/Mqtt-Dashboard/App.config index d740e88..e89424b 100644 --- a/Mqtt-Dashboard/App.config +++ b/Mqtt-Dashboard/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Mqtt-Dashboard/Dashboard.csproj b/Mqtt-Dashboard/Dashboard.csproj index 72b5428..6788586 100644 --- a/Mqtt-Dashboard/Dashboard.csproj +++ b/Mqtt-Dashboard/Dashboard.csproj @@ -8,7 +8,7 @@ WinExe Dashboard Dashboard - v4.5.2 + v4.6.2 512 true publish\ @@ -26,6 +26,7 @@ false false true + AnyCPU @@ -50,12 +51,6 @@ - - ..\packages\LitJson.0.9.0\lib\LitJson.dll - - - ..\packages\M2Mqtt.4.3.0.0\lib\net45\M2Mqtt.Net.dll - ..\packages\OxyPlot.Core.1.0.0\lib\net45\OxyPlot.dll @@ -67,7 +62,6 @@ - @@ -76,9 +70,6 @@ - - - Form @@ -87,11 +78,6 @@ - - - - - @@ -128,6 +114,10 @@ + + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC} + Utils-IoT + {fac8ce64-bf13-4ece-8097-aeb5dd060098} Utils diff --git a/Mqtt-Dashboard/Form1.cs b/Mqtt-Dashboard/Form1.cs index 7626208..062f342 100644 --- a/Mqtt-Dashboard/Form1.cs +++ b/Mqtt-Dashboard/Form1.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Windows.Forms; using BlubbFish.Utils; -using IoTBot.Connector; -using IoTBot.Sensor; using Dashboard.Tracings; +using BlubbFish.Utils.IoT.Sensor; +using BlubbFish.Utils.IoT.Connector; namespace Dashboard { public partial class Dashboard : Form { diff --git a/Mqtt-Dashboard/Properties/Resources.Designer.cs b/Mqtt-Dashboard/Properties/Resources.Designer.cs index 90cab43..18837ca 100644 --- a/Mqtt-Dashboard/Properties/Resources.Designer.cs +++ b/Mqtt-Dashboard/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Dashboard.Properties { // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/Mqtt-Dashboard/Properties/Settings.Designer.cs b/Mqtt-Dashboard/Properties/Settings.Designer.cs index deec467..da15663 100644 --- a/Mqtt-Dashboard/Properties/Settings.Designer.cs +++ b/Mqtt-Dashboard/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Dashboard.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/Mqtt-Dashboard/Tracings/ATracings.cs b/Mqtt-Dashboard/Tracings/ATracings.cs index 04ef659..87d7aa1 100644 --- a/Mqtt-Dashboard/Tracings/ATracings.cs +++ b/Mqtt-Dashboard/Tracings/ATracings.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; -using IoTBot.Sensor; +using BlubbFish.Utils.IoT.Sensor; namespace Dashboard.Tracings { public abstract class ATracings { @@ -22,8 +22,8 @@ namespace Dashboard.Tracings { this.settings = settings; } - protected abstract void SensorsUpdate(ASensor sender, EventArgs e); - protected abstract void SensorUpdate(ASensor sender, EventArgs e); + protected abstract void SensorsUpdate(Object sender, EventArgs e); + protected abstract void SensorUpdate(Object sender, EventArgs e); public abstract Panel GetPanel(); internal static ATracings GetInstance(String v, Dictionary sensorList, Dictionary dictionary) { String object_sensor = "Dashboard.Tracings." + Char.ToUpper(v[0]) + v.Substring(1); diff --git a/Mqtt-Dashboard/Tracings/Graph.cs b/Mqtt-Dashboard/Tracings/Graph.cs index 90ef239..595e57d 100644 --- a/Mqtt-Dashboard/Tracings/Graph.cs +++ b/Mqtt-Dashboard/Tracings/Graph.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; -using IoTBot.Sensor; +using BlubbFish.Utils.IoT.Sensor; using OxyPlot; using OxyPlot.Axes; using OxyPlot.Series; @@ -68,14 +68,14 @@ namespace Dashboard.Tracings { panel.Size = new System.Drawing.Size(fieldWidth, 200); return panel; } - protected override void SensorUpdate(ASensor sender, EventArgs e) { + protected override void SensorUpdate(Object sender, EventArgs e) { Single v = 0; - switch (sender.Datatypes) { - case ASensor.Types.Bool: v = sender.GetBool ? 1 : 0; break; - case ASensor.Types.Int: v = sender.GetInt; break; - case ASensor.Types.Float: v = sender.GetFloat; break; + switch (((ASensor)sender).Datatypes) { + case ASensor.Types.Bool: v = ((ASensor)sender).GetBool ? 1 : 0; break; + case ASensor.Types.Int: v = ((ASensor)sender).GetInt; break; + case ASensor.Types.Float: v = ((ASensor)sender).GetFloat; break; } - this.hist.Enqueue(new Tuple(sender.Timestamp, v)); + this.hist.Enqueue(new Tuple(((ASensor)sender).Timestamp, v)); if (this.MaximumDrawn < v) { this.MaximumDrawn = v; } @@ -86,7 +86,7 @@ namespace Dashboard.Tracings { this.plot.BeginInvoke((MethodInvoker)delegate { this.Model.Axes[1].Maximum = this.MaximumDrawn * 1.1; this.Model.Axes[1].AbsoluteMaximum = this.MaximumDrawn * 1.1; - this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(sender.Timestamp); + this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(((ASensor)sender).Timestamp); ((LineSeries)this.Model.Series[0]).Points.Clear(); try { foreach(Tuple temp in this.hist) { @@ -98,26 +98,26 @@ namespace Dashboard.Tracings { } } - protected override void SensorsUpdate(ASensor sender, EventArgs e) { + protected override void SensorsUpdate(Object sender, EventArgs e) { Single v = 0; - if (!this.hists.ContainsKey(sender.Name)) { - this.hists.Add(sender.Name, new Queue>()); - this.hists_last.Add(sender.Name, 0); + if (!this.hists.ContainsKey(((ASensor)sender).Name)) { + this.hists.Add(((ASensor)sender).Name, new Queue>()); + this.hists_last.Add(((ASensor)sender).Name, 0); } - switch (sender.Datatypes) { + switch (((ASensor)sender).Datatypes) { case ASensor.Types.Bool: - v = sender.GetBool ? 1 : 0; + v = ((ASensor)sender).GetBool ? 1 : 0; break; case ASensor.Types.Int: - v = sender.GetInt; + v = ((ASensor)sender).GetInt; break; case ASensor.Types.Float: - v = sender.GetFloat; + v = ((ASensor)sender).GetFloat; break; } - this.hists_last[sender.Name] = v; + this.hists_last[((ASensor)sender).Name] = v; foreach (KeyValuePair>> item in this.hists) { - item.Value.Enqueue(new Tuple(sender.Timestamp, this.hists_last[item.Key])); + item.Value.Enqueue(new Tuple(((ASensor)sender).Timestamp, this.hists_last[item.Key])); if (this.MaximumDrawn < this.hists_last[item.Key]) { this.MaximumDrawn = this.hists_last[item.Key]; } @@ -131,7 +131,7 @@ namespace Dashboard.Tracings { try { this.Model.Axes[1].Maximum = this.MaximumDrawn * 1.1; this.Model.Axes[1].AbsoluteMaximum = this.MaximumDrawn * 1.1; - this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(sender.Timestamp); + this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(((ASensor)sender).Timestamp); ((LineSeries)item).Points.Clear(); foreach (Tuple temp in this.hists[item.TrackerKey]) { ((LineSeries)item).Points.Add(new DataPoint(DateTimeAxis.ToDouble(temp.Item1), temp.Item2)); diff --git a/Mqtt-Dashboard/Tracings/Meter.cs b/Mqtt-Dashboard/Tracings/Meter.cs index 23a944e..446af3a 100644 --- a/Mqtt-Dashboard/Tracings/Meter.cs +++ b/Mqtt-Dashboard/Tracings/Meter.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; -using IoTBot.Sensor; using System; using System.Windows.Forms; using System.Linq; using System.Globalization; +using BlubbFish.Utils.IoT.Sensor; namespace Dashboard.Tracings { class Meter : ATracings { @@ -45,16 +45,16 @@ namespace Dashboard.Tracings { return panel; } - protected override void SensorsUpdate(ASensor sender, EventArgs e) { + protected override void SensorsUpdate(Object sender, EventArgs e) { throw new NotImplementedException(); } - protected override void SensorUpdate(ASensor sender, EventArgs e) { + protected override void SensorUpdate(Object sender, EventArgs e) { String value = ""; - switch(sender.Datatypes) { - case ASensor.Types.Bool: this.DisplayAverage.Enqueue((sender.GetBool) ? 1 : 0); value = sender.GetBool.ToString(new CultureInfo("de-DE")); break; - case ASensor.Types.Int: this.DisplayAverage.Enqueue(sender.GetInt); value = sender.GetInt.ToString(); break; - case ASensor.Types.Float: this.DisplayAverage.Enqueue(sender.GetFloat); value = sender.GetFloat.ToString(new CultureInfo("de-DE")); break; + switch(((ASensor)sender).Datatypes) { + case ASensor.Types.Bool: this.DisplayAverage.Enqueue((((ASensor)sender).GetBool) ? 1 : 0); value = ((ASensor)sender).GetBool.ToString(new CultureInfo("de-DE")); break; + case ASensor.Types.Int: this.DisplayAverage.Enqueue(((ASensor)sender).GetInt); value = ((ASensor)sender).GetInt.ToString(); break; + case ASensor.Types.Float: this.DisplayAverage.Enqueue(((ASensor)sender).GetFloat); value = ((ASensor)sender).GetFloat.ToString(new CultureInfo("de-DE")); break; } if(this.DisplayAverage.Count > this.DisplayItems) { this.DisplayAverage.Dequeue(); diff --git a/Mqtt-Dashboard/Tracings/PowerMeter.cs b/Mqtt-Dashboard/Tracings/PowerMeter.cs index 047654f..4446468 100644 --- a/Mqtt-Dashboard/Tracings/PowerMeter.cs +++ b/Mqtt-Dashboard/Tracings/PowerMeter.cs @@ -3,26 +3,26 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Windows.Forms; -using IoTBot.Sensor; +using BlubbFish.Utils.IoT.Sensor; namespace Dashboard.Tracings { class Powermeter : Meter { public Powermeter(ASensor sensor, Dictionary settings) : base(sensor, settings) { } - protected override void SensorUpdate(ASensor sender, EventArgs e) { + protected override void SensorUpdate(Object sender, EventArgs e) { String value = ""; - switch (sender.Datatypes) { + switch (((ASensor)sender).Datatypes) { case ASensor.Types.Bool: - this.DisplayAverage.Enqueue((sender.GetBool) ? 1 : 0); - value = sender.GetBool.ToString(new CultureInfo("de-DE")); + this.DisplayAverage.Enqueue((((ASensor)sender).GetBool) ? 1 : 0); + value = ((ASensor)sender).GetBool.ToString(new CultureInfo("de-DE")); break; case ASensor.Types.Int: - this.DisplayAverage.Enqueue(sender.GetInt); - value = sender.GetInt.ToString(); + this.DisplayAverage.Enqueue(((ASensor)sender).GetInt); + value = ((ASensor)sender).GetInt.ToString(); break; case ASensor.Types.Float: - this.DisplayAverage.Enqueue(sender.GetFloat); - value = sender.GetFloat.ToString(new CultureInfo("de-DE")); + this.DisplayAverage.Enqueue(((ASensor)sender).GetFloat); + value = ((ASensor)sender).GetFloat.ToString(new CultureInfo("de-DE")); break; } if (this.DisplayAverage.Count > this.DisplayItems) { diff --git a/Mqtt-Dashboard/Tracings/Switcher.cs b/Mqtt-Dashboard/Tracings/Switcher.cs index 376c314..cd5c9e1 100644 --- a/Mqtt-Dashboard/Tracings/Switcher.cs +++ b/Mqtt-Dashboard/Tracings/Switcher.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Windows.Forms; -using IoTBot.Connector; -using IoTBot.Sensor; +using BlubbFish.Utils.IoT.Sensor; namespace Dashboard.Tracings { class Switcher : ATracings { @@ -65,19 +63,19 @@ namespace Dashboard.Tracings { } } - protected override void SensorUpdate(ASensor sender, EventArgs e) { + protected override void SensorUpdate(Object sender, EventArgs e) { this.label.BeginInvoke((MethodInvoker)delegate { - this.label.Text = sender.GetBool?"Eingeschaltet":"Ausgeschaltet"; + this.label.Text = ((ASensor)sender).GetBool?"Eingeschaltet":"Ausgeschaltet"; }); this.button1.BeginInvoke((MethodInvoker)delegate { - this.button1.Enabled = !sender.GetBool; + this.button1.Enabled = !((ASensor)sender).GetBool; }); this.button2.BeginInvoke((MethodInvoker)delegate { - this.button2.Enabled = sender.GetBool; + this.button2.Enabled = ((ASensor)sender).GetBool; }); } - protected override void SensorsUpdate(ASensor sender, EventArgs e) { + protected override void SensorsUpdate(Object sender, EventArgs e) { throw new NotImplementedException(); } } diff --git a/Mqtt-Dashboard/bin/Release/Dashboard.exe b/Mqtt-Dashboard/bin/Release/Dashboard.exe index 54577af..0bd647c 100644 Binary files a/Mqtt-Dashboard/bin/Release/Dashboard.exe and b/Mqtt-Dashboard/bin/Release/Dashboard.exe differ diff --git a/Mqtt-Dashboard/bin/Release/Newtonsoft.Json.dll b/Mqtt-Dashboard/bin/Release/Newtonsoft.Json.dll new file mode 100644 index 0000000..77a5d89 Binary files /dev/null and b/Mqtt-Dashboard/bin/Release/Newtonsoft.Json.dll differ diff --git a/Mqtt-Dashboard/bin/Release/Telegram.Bot.dll b/Mqtt-Dashboard/bin/Release/Telegram.Bot.dll new file mode 100644 index 0000000..b69c7bd Binary files /dev/null and b/Mqtt-Dashboard/bin/Release/Telegram.Bot.dll differ diff --git a/Mqtt-Dashboard/bin/Release/Utils-IoT.dll b/Mqtt-Dashboard/bin/Release/Utils-IoT.dll new file mode 100644 index 0000000..e0255a5 Binary files /dev/null and b/Mqtt-Dashboard/bin/Release/Utils-IoT.dll differ diff --git a/Mqtt-Dashboard/bin/Release/Utils.dll b/Mqtt-Dashboard/bin/Release/Utils.dll index dfb96ce..742ea40 100644 Binary files a/Mqtt-Dashboard/bin/Release/Utils.dll and b/Mqtt-Dashboard/bin/Release/Utils.dll differ