Compare commits

..

No commits in common. "837f10037dd67c7ed568728781609c606139da0a" and "c85047a57da0a79444beb92271c0a8206ef1fb1e" have entirely different histories.

3 changed files with 10 additions and 15 deletions

View File

@ -22,7 +22,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="MQTTnet" Version="5.0.1.1416" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

View File

@ -1,6 +1,7 @@
using Api.DBAccess;
using Api.Models;
using MQTTnet;
using MQTTnet.Extensions.TopicTemplate;
using System.Text;
using System.Text.Json;
@ -52,11 +53,9 @@ namespace Api.MQTTReciever
string refernceId = mqttMessageReceive.device_id;
var device = _dbAccess.ReadDevice(refernceId);
if (device == null) { return Task.CompletedTask; }
newLog.Temperature = mqttMessageReceive.temperature;
newLog.Date = DateTimeOffset.FromUnixTimeSeconds(mqttMessageReceive.timestamp).DateTime;
newLog.TempHigh = device.TempHigh;
newLog.TempHigh= device.TempHigh;
newLog.TempLow = device.TempLow;
_dbAccess.CreateLog(newLog, refernceId);

View File

@ -10,21 +10,18 @@ class Program
{
var app = CreateWebHostBuilder(args).Build();
RunMigrations(app);
Task.Run(() =>
using (var scope = app.Services.CreateScope())
{
using (var scope = app.Services.CreateScope())
{
var services = scope.ServiceProvider;
var configuration = services.GetRequiredService<IConfiguration>();
var dbAccess = services.GetRequiredService<DbAccess>();
var services = scope.ServiceProvider;
var configuration = services.GetRequiredService<IConfiguration>();
var dbAccess = services.GetRequiredService<DbAccess>();
MQTTReciever mqtt = new MQTTReciever(configuration, dbAccess);
mqtt.Handle_Received_Application_Message().Wait();
}
});
MQTTReciever mqtt = new MQTTReciever(configuration, dbAccess);
mqtt.Handle_Received_Application_Message();
}
RunMigrations(app);
app.Run();
}