Added Console for Task
Added PDF file of the presentation Added contributors in README.mdmain
parent
cd75933513
commit
5dbfe7bec3
|
@ -58,7 +58,7 @@
|
||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.411/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.410/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Async_Await")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Async_Await")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4da955ac721d824c4df4ad42acf0ae911ae167d1")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd7593351362efbc0ee81bbfb2c1c49fb0d4a4d1")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Async_Await")]
|
[assembly: System.Reflection.AssemblyProductAttribute("Async_Await")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Async_Await")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Async_Await")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
98ce089cd7e71c6006d86b916e9ec71a58ea1eeca75009d9cab046ac25ea77c5
|
445627bd860633fe081918fd049f41b1231fc74fc9d98398e02e01b85ee36027
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
f56eca8a218035aaee0739bd26bba4d23e0f75fd08331f478a25b9179244fa4b
|
f56eca8a218035aaee0739bd26bba4d23e0f75fd08331f478a25b9179244fa4b
|
||||||
|
|
|
@ -1,14 +1,28 @@
|
||||||
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await
|
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await
|
||||||
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.deps.json
|
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.deps.json
|
||||||
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.runtimeconfig.json
|
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.runtimeconfig.json
|
||||||
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.dll
|
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.dll
|
||||||
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.pdb
|
/workspaces/CSharp/Async_Await/bin/Debug/net8.0/Async_Await.pdb
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.GeneratedMSBuildEditorConfig.editorconfig
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.AssemblyInfoInputs.cache
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.AssemblyInfoInputs.cache
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.AssemblyInfo.cs
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.AssemblyInfo.cs
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.csproj.CoreCompileInputs.cache
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.csproj.CoreCompileInputs.cache
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.dll
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.dll
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/refint/Async_Await.dll
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/refint/Async_Await.dll
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.pdb
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.pdb
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.genruntimeconfig.cache
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/Async_Await.genruntimeconfig.cache
|
||||||
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/ref/Async_Await.dll
|
/workspaces/CSharp/Async_Await/obj/Debug/net8.0/ref/Async_Await.dll
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/bin/Debug/net8.0/Async_Await
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/bin/Debug/net8.0/Async_Await.deps.json
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/bin/Debug/net8.0/Async_Await.runtimeconfig.json
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/bin/Debug/net8.0/Async_Await.dll
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/bin/Debug/net8.0/Async_Await.pdb
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/Async_Await.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/Async_Await.AssemblyInfoInputs.cache
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/Async_Await.AssemblyInfo.cs
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/Async_Await.csproj.CoreCompileInputs.cache
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/Async_Await.dll
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/refint/Async_Await.dll
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/Async_Await.pdb
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/Async_Await.genruntimeconfig.cache
|
||||||
|
/workspaces/CSharpProjekt/Async_Await/obj/Debug/net8.0/ref/Async_Await.dll
|
||||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
||||||
735e7f2d774271d1780a96fe641c2f5ec6cf42f9b6bbfa8ed546e26d04a0fe35
|
5e790f0d1b03a5f5093b7d5892a37e2a027e6814cb7daf8584b26f45bc87a335
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -64,7 +64,7 @@
|
||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.411/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.410/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "aGThoJrW9e4=",
|
"dgSpecHash": "D3gTvPK0/Io=",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "/workspaces/CSharpProjekt/Async_Await/Async_Await.csproj",
|
"projectFilePath": "/workspaces/CSharpProjekt/Async_Await/Async_Await.csproj",
|
||||||
"expectedPackageFiles": [],
|
"expectedPackageFiles": [],
|
||||||
|
|
Binary file not shown.
|
@ -1,2 +1,11 @@
|
||||||
# CSharpProjekt
|
# CSharpProjekt
|
||||||
|
|
||||||
|
Devcontainer und Repository: Obai Albek (3009594)
|
||||||
|
Überblick: Bohdana Illiuk (3013009)
|
||||||
|
Tooling: Devran Cakici (3009694)
|
||||||
|
Basics: David Werner (2121694)
|
||||||
|
Standard Library: Antonio Junakovic (3006354)
|
||||||
|
Asynchrone Programmierung: Florin Küppers (3015901)
|
||||||
|
Spezielle Konzepte: Lennart Streveld (3011294)
|
||||||
|
|
||||||
|
Folien überarbeiten: Florin Küppers (3015901)
|
|
@ -68,7 +68,7 @@
|
||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.411/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.410/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("BeispielTasks")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("BeispielTasks")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4da955ac721d824c4df4ad42acf0ae911ae167d1")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd7593351362efbc0ee81bbfb2c1c49fb0d4a4d1")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("BeispielTasks")]
|
[assembly: System.Reflection.AssemblyProductAttribute("BeispielTasks")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("BeispielTasks")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("BeispielTasks")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
620d207c41d80e36530c3c7988f0445044b33e4be22ae5f8eed29fa6c84257b0
|
43bee51014acdb8b04a0b500e4b24fda6a5ca7028c80fd13f6ccae844bad65aa
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
b04f23883cc95a305a38b87f5e338daa9d9a70aa391889b1c3b47713a68c2033
|
6c522ee2758e63ae92db243f9519a8207ef0cfe0064c0f5f62889a36444a5977
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -275,7 +275,7 @@
|
||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.411/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.410/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "+DKi8TX5UxE=",
|
"dgSpecHash": "n7Bg6jO44+4=",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "/workspaces/CSharpProjekt/Solution/BeispielTasks.csproj",
|
"projectFilePath": "/workspaces/CSharpProjekt/Solution/BeispielTasks.csproj",
|
||||||
"expectedPackageFiles": [
|
"expectedPackageFiles": [
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MQTTnet" Version="4.*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -1,151 +1,151 @@
|
||||||
using MQTTnet;
|
using MQTTnet;
|
||||||
using MQTTnet.Client;
|
using MQTTnet.Client;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace MqttSensorApp
|
namespace MqttSensorApp
|
||||||
{
|
{
|
||||||
// TODO: Aufgabe 3: Implementieren Sie die SensorData-Klasse
|
// TODO: Aufgabe 3: Implementieren Sie die SensorData-Klasse
|
||||||
public class SensorData
|
public class SensorData
|
||||||
{
|
{
|
||||||
// TODO: Ergänzen Sie Properties für Temperature, Humidity und Location
|
// TODO: Ergänzen Sie Properties für Temperature, Humidity und Location
|
||||||
// Nutzen Sie JsonPropertyName-Attribute für die JSON-Deserialisierung
|
// Nutzen Sie JsonPropertyName-Attribute für die JSON-Deserialisierung
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
private static List<double> receivedTemperatures = new List<double>();
|
private static List<double> receivedTemperatures = new List<double>();
|
||||||
|
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("MQTT Sensor Data Processor gestartet...");
|
Console.WriteLine("MQTT Sensor Data Processor gestartet...");
|
||||||
|
|
||||||
// MQTT Client Setup (bereits implementiert)
|
// MQTT Client Setup (bereits implementiert)
|
||||||
var factory = new MqttFactory();
|
var factory = new MqttFactory();
|
||||||
var client = factory.CreateMqttClient();
|
var client = factory.CreateMqttClient();
|
||||||
|
|
||||||
// Event Handler für empfangene Nachrichten
|
// Event Handler für empfangene Nachrichten
|
||||||
client.ApplicationMessageReceivedAsync += async e =>
|
client.ApplicationMessageReceivedAsync += async e =>
|
||||||
{
|
{
|
||||||
var payload = System.Text.Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
|
var payload = System.Text.Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
|
||||||
await ProcessMessage(payload);
|
await ProcessMessage(payload);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Verbindungsoptionen
|
// Verbindungsoptionen
|
||||||
var options = new MqttClientOptionsBuilder()
|
var options = new MqttClientOptionsBuilder()
|
||||||
.WithTcpServer("broker.hivemq.com", 1883)
|
.WithTcpServer("broker.hivemq.com", 1883)
|
||||||
.WithClientId($"SensorClient_{Guid.NewGuid()}")
|
.WithClientId($"SensorClient_{Guid.NewGuid()}")
|
||||||
.WithCleanSession()
|
.WithCleanSession()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Verbindung aufbauen
|
// Verbindung aufbauen
|
||||||
await client.ConnectAsync(options);
|
await client.ConnectAsync(options);
|
||||||
Console.WriteLine("Mit MQTT Broker verbunden");
|
Console.WriteLine("Mit MQTT Broker verbunden");
|
||||||
|
|
||||||
// Topic abonnieren
|
// Topic abonnieren
|
||||||
await client.SubscribeAsync("sensor/data/room1");
|
await client.SubscribeAsync("sensor/data/room1");
|
||||||
Console.WriteLine("Topic 'sensor/data/room1' abonniert");
|
Console.WriteLine("Topic 'sensor/data/room1' abonniert");
|
||||||
|
|
||||||
// Simulierte Sensordaten senden (für Testing)
|
// Simulierte Sensordaten senden (für Testing)
|
||||||
await SendTestData(client);
|
await SendTestData(client);
|
||||||
|
|
||||||
// Programm laufen lassen
|
// Programm laufen lassen
|
||||||
Console.WriteLine("Drücken Sie eine Taste zum Beenden...");
|
Console.WriteLine("Drücken Sie eine Taste zum Beenden...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
|
|
||||||
// Verbindung trennen
|
// Verbindung trennen
|
||||||
await client.DisconnectAsync();
|
await client.DisconnectAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Fehler: {ex.Message}");
|
Console.WriteLine($"Fehler: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task ProcessMessage(string jsonPayload)
|
private static async Task ProcessMessage(string jsonPayload)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Empfangen: {jsonPayload}");
|
Console.WriteLine($"Empfangen: {jsonPayload}");
|
||||||
|
|
||||||
// TODO: Aufgabe 3: Deserialisieren Sie den JSON zu SensorData
|
// TODO: Aufgabe 3: Deserialisieren Sie den JSON zu SensorData
|
||||||
// var sensorData = JsonSerializer.Deserialize<SensorData>(jsonPayload);
|
// var sensorData = JsonSerializer.Deserialize<SensorData>(jsonPayload);
|
||||||
|
|
||||||
// Temporäre Lösung für Aufgabe 1 und 2
|
// Temporäre Lösung für Aufgabe 1 und 2
|
||||||
var data = JsonSerializer.Deserialize<Dictionary<string, object>>(jsonPayload);
|
var data = JsonSerializer.Deserialize<Dictionary<string, object>>(jsonPayload);
|
||||||
|
|
||||||
if (data != null && data.ContainsKey("temperature"))
|
if (data != null && data.ContainsKey("temperature"))
|
||||||
{
|
{
|
||||||
var temp = Convert.ToDouble(data["temperature"].ToString());
|
var temp = Convert.ToDouble(data["temperature"].ToString());
|
||||||
receivedTemperatures.Add(temp);
|
receivedTemperatures.Add(temp);
|
||||||
|
|
||||||
// Nachricht analysieren
|
// Nachricht analysieren
|
||||||
var analysis = AnalyzeMessage(temp);
|
var analysis = AnalyzeMessage(temp);
|
||||||
Console.WriteLine($"Analyse: {analysis}");
|
Console.WriteLine($"Analyse: {analysis}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alle 5 Nachrichten: Hohe Temperaturen anzeigen
|
// Alle 5 Nachrichten: Hohe Temperaturen anzeigen
|
||||||
if (receivedTemperatures.Count % 5 == 0)
|
if (receivedTemperatures.Count % 5 == 0)
|
||||||
{
|
{
|
||||||
var highTemps = FilterHighTemperatures(receivedTemperatures);
|
var highTemps = FilterHighTemperatures(receivedTemperatures);
|
||||||
Console.WriteLine($"Hohe Temperaturen (>25°C): {string.Join(", ", highTemps.Select(t => $"{t:F1}°C"))}");
|
Console.WriteLine($"Hohe Temperaturen (>25°C): {string.Join(", ", highTemps.Select(t => $"{t:F1}°C"))}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Fehler beim Verarbeiten der Nachricht: {ex.Message}");
|
Console.WriteLine($"Fehler beim Verarbeiten der Nachricht: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Aufgabe 1: LINQ-Abfrage implementieren
|
// TODO: Aufgabe 1: LINQ-Abfrage implementieren
|
||||||
private static IEnumerable<double> FilterHighTemperatures(List<double> temperatures)
|
private static IEnumerable<double> FilterHighTemperatures(List<double> temperatures)
|
||||||
{
|
{
|
||||||
// TODO: Verwenden Sie LINQ (Where-Klausel), um alle Temperaturen > 25°C zu filtern
|
// TODO: Verwenden Sie LINQ (Where-Klausel), um alle Temperaturen > 25°C zu filtern
|
||||||
// Beispiel: return temperatures.Where(...);
|
// Beispiel: return temperatures.Where(...);
|
||||||
|
|
||||||
return new List<double>(); // Platzhalter, ersetzen Sie diese Zeile
|
return new List<double>(); // Platzhalter, ersetzen Sie diese Zeile
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Aufgabe 2: Pattern Matching implementieren
|
// TODO: Aufgabe 2: Pattern Matching implementieren
|
||||||
private static string AnalyzeMessage(object value)
|
private static string AnalyzeMessage(object value)
|
||||||
{
|
{
|
||||||
// TODO: Implementieren Sie Pattern Matching mit switch expression
|
// TODO: Implementieren Sie Pattern Matching mit switch expression
|
||||||
// Behandeln Sie folgende Fälle:
|
// Behandeln Sie folgende Fälle:
|
||||||
// - double über 30: "WARNUNG: Sehr hohe Temperatur!"
|
// - double über 30: "WARNUNG: Sehr hohe Temperatur!"
|
||||||
// - double zwischen 25-30: "Hohe Temperatur"
|
// - double zwischen 25-30: "Hohe Temperatur"
|
||||||
// - double unter 25: "Normale Temperatur"
|
// - double unter 25: "Normale Temperatur"
|
||||||
// - string: "Text-Nachricht erhalten"
|
// - string: "Text-Nachricht erhalten"
|
||||||
// - null: "Keine Daten"
|
// - null: "Keine Daten"
|
||||||
// - default: "Unbekannter Datentyp"
|
// - default: "Unbekannter Datentyp"
|
||||||
|
|
||||||
return "TODO: Pattern Matching implementieren"; // Platzhalter
|
return "TODO: Pattern Matching implementieren"; // Platzhalter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hilfsmethode: Testnachrichten senden
|
// Hilfsmethode: Testnachrichten senden
|
||||||
private static async Task SendTestData(IMqttClient client)
|
private static async Task SendTestData(IMqttClient client)
|
||||||
{
|
{
|
||||||
var testData = new[]
|
var testData = new[]
|
||||||
{
|
{
|
||||||
new { temperature = 22.5, humidity = 65.0, location = "Room1" },
|
new { temperature = 22.5, humidity = 65.0, location = "Room1" },
|
||||||
new { temperature = 28.3, humidity = 58.2, location = "Room1" },
|
new { temperature = 28.3, humidity = 58.2, location = "Room1" },
|
||||||
new { temperature = 19.8, humidity = 72.1, location = "Room1" },
|
new { temperature = 19.8, humidity = 72.1, location = "Room1" },
|
||||||
new { temperature = 31.2, humidity = 45.3, location = "Room1" },
|
new { temperature = 31.2, humidity = 45.3, location = "Room1" },
|
||||||
new { temperature = 26.7, humidity = 62.8, location = "Room1" }
|
new { temperature = 26.7, humidity = 62.8, location = "Room1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var data in testData)
|
foreach (var data in testData)
|
||||||
{
|
{
|
||||||
var json = JsonSerializer.Serialize(data);
|
var json = JsonSerializer.Serialize(data);
|
||||||
var message = new MqttApplicationMessageBuilder()
|
var message = new MqttApplicationMessageBuilder()
|
||||||
.WithTopic("sensor/data/room1")
|
.WithTopic("sensor/data/room1")
|
||||||
.WithPayload(json)
|
.WithPayload(json)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
await client.PublishAsync(message);
|
await client.PublishAsync(message);
|
||||||
await Task.Delay(2000); // 2 Sekunden Pause
|
await Task.Delay(2000); // 2 Sekunden Pause
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
|
@ -0,0 +1,22 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Task")]
|
||||||
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd7593351362efbc0ee81bbfb2c1c49fb0d4a4d1")]
|
||||||
|
[assembly: System.Reflection.AssemblyProductAttribute("Task")]
|
||||||
|
[assembly: System.Reflection.AssemblyTitleAttribute("Task")]
|
||||||
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
|
// Generated by the MSBuild WriteCodeFragment class.
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
31b55a850cac75ab4034ec174f82920fdaa49a7335913764ad2b66b48a4490d3
|
|
@ -0,0 +1,13 @@
|
||||||
|
is_global = true
|
||||||
|
build_property.TargetFramework = net8.0
|
||||||
|
build_property.TargetPlatformMinVersion =
|
||||||
|
build_property.UsingMicrosoftNETSdkWeb =
|
||||||
|
build_property.ProjectTypeGuids =
|
||||||
|
build_property.InvariantGlobalization =
|
||||||
|
build_property.PlatformNeutralAssembly =
|
||||||
|
build_property.EnforceExtendedAnalyzerRules =
|
||||||
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
|
build_property.RootNamespace = Task
|
||||||
|
build_property.ProjectDir = /workspaces/CSharpProjekt/Task/
|
||||||
|
build_property.EnableComHosting =
|
||||||
|
build_property.EnableGeneratedComInterfaceComImportInterop =
|
|
@ -0,0 +1,8 @@
|
||||||
|
// <auto-generated/>
|
||||||
|
global using global::System;
|
||||||
|
global using global::System.Collections.Generic;
|
||||||
|
global using global::System.IO;
|
||||||
|
global using global::System.Linq;
|
||||||
|
global using global::System.Net.Http;
|
||||||
|
global using global::System.Threading;
|
||||||
|
global using global::System.Threading.Tasks;
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
d29642cf35b28a758071260be4d61fce4bf86363728ef9dd4f8fe3a44e585bfc
|
|
@ -0,0 +1,17 @@
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.AssemblyInfoInputs.cache
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.AssemblyInfo.cs
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.csproj.CoreCompileInputs.cache
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.csproj.AssemblyReference.cache
|
||||||
|
/workspaces/CSharpProjekt/Task/bin/Debug/net8.0/Task
|
||||||
|
/workspaces/CSharpProjekt/Task/bin/Debug/net8.0/Task.deps.json
|
||||||
|
/workspaces/CSharpProjekt/Task/bin/Debug/net8.0/Task.runtimeconfig.json
|
||||||
|
/workspaces/CSharpProjekt/Task/bin/Debug/net8.0/Task.dll
|
||||||
|
/workspaces/CSharpProjekt/Task/bin/Debug/net8.0/Task.pdb
|
||||||
|
/workspaces/CSharpProjekt/Task/bin/Debug/net8.0/MQTTnet.dll
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.csproj.Up2Date
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.dll
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/refint/Task.dll
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.pdb
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/Task.genruntimeconfig.cache
|
||||||
|
/workspaces/CSharpProjekt/Task/obj/Debug/net8.0/ref/Task.dll
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
3d0da4a8604357aef0ae0dd967df15ba5ad639f3c048513f32eb6b0be41bc94a
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"/workspaces/CSharpProjekt/Task/Task.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"/workspaces/CSharpProjekt/Task/Task.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/workspaces/CSharpProjekt/Task/Task.csproj",
|
||||||
|
"projectName": "Task",
|
||||||
|
"projectPath": "/workspaces/CSharpProjekt/Task/Task.csproj",
|
||||||
|
"packagesPath": "/root/.nuget/packages/",
|
||||||
|
"outputPath": "/workspaces/CSharpProjekt/Task/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/root/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net8.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"dependencies": {
|
||||||
|
"MQTTnet": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[4.*, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.410/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/root/.nuget/packages/</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/root/.nuget/packages/</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.1</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="/root/.nuget/packages/" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
@ -0,0 +1,114 @@
|
||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"targets": {
|
||||||
|
"net8.0": {
|
||||||
|
"MQTTnet/4.3.7.1207": {
|
||||||
|
"type": "package",
|
||||||
|
"compile": {
|
||||||
|
"lib/net7.0/MQTTnet.dll": {}
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/net7.0/MQTTnet.dll": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"MQTTnet/4.3.7.1207": {
|
||||||
|
"sha512": "ah7aHXoedWp5m5a4zy2u4phOEVj0QFYzOb5tFKQeV8RRBrxp+1QREF4ymZuG8D+hzB2dhtrrG81WxTFv0PzOeQ==",
|
||||||
|
"type": "package",
|
||||||
|
"path": "mqttnet/4.3.7.1207",
|
||||||
|
"files": [
|
||||||
|
".nupkg.metadata",
|
||||||
|
".signature.p7s",
|
||||||
|
"lib/net452/MQTTnet.dll",
|
||||||
|
"lib/net461/MQTTnet.dll",
|
||||||
|
"lib/net48/MQTTnet.dll",
|
||||||
|
"lib/net5.0/MQTTnet.dll",
|
||||||
|
"lib/net6.0/MQTTnet.dll",
|
||||||
|
"lib/net7.0/MQTTnet.dll",
|
||||||
|
"lib/netcoreapp3.1/MQTTnet.dll",
|
||||||
|
"lib/netstandard1.3/MQTTnet.dll",
|
||||||
|
"lib/netstandard2.0/MQTTnet.dll",
|
||||||
|
"lib/netstandard2.1/MQTTnet.dll",
|
||||||
|
"lib/uap10.0.10240/MQTTnet.dll",
|
||||||
|
"lib/uap10.0.10240/MQTTnet.pri",
|
||||||
|
"mqttnet.4.3.7.1207.nupkg.sha512",
|
||||||
|
"mqttnet.nuspec",
|
||||||
|
"nuget.png"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"projectFileDependencyGroups": {
|
||||||
|
"net8.0": [
|
||||||
|
"MQTTnet >= 4.*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"packageFolders": {
|
||||||
|
"/root/.nuget/packages/": {}
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/workspaces/CSharpProjekt/Task/Task.csproj",
|
||||||
|
"projectName": "Task",
|
||||||
|
"projectPath": "/workspaces/CSharpProjekt/Task/Task.csproj",
|
||||||
|
"packagesPath": "/root/.nuget/packages/",
|
||||||
|
"outputPath": "/workspaces/CSharpProjekt/Task/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/root/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net8.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"dependencies": {
|
||||||
|
"MQTTnet": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[4.*, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.410/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"dgSpecHash": "XnxQkDuwRFU=",
|
||||||
|
"success": true,
|
||||||
|
"projectFilePath": "/workspaces/CSharpProjekt/Task/Task.csproj",
|
||||||
|
"expectedPackageFiles": [
|
||||||
|
"/root/.nuget/packages/mqttnet/4.3.7.1207/mqttnet.4.3.7.1207.nupkg.sha512"
|
||||||
|
],
|
||||||
|
"logs": []
|
||||||
|
}
|
Loading…
Reference in New Issue