diff --git a/PlantBox.Client/PlantBox.Client.Android/Properties/AndroidManifest.xml b/PlantBox.Client/PlantBox.Client.Android/Properties/AndroidManifest.xml
index 417cadb..673323c 100644
--- a/PlantBox.Client/PlantBox.Client.Android/Properties/AndroidManifest.xml
+++ b/PlantBox.Client/PlantBox.Client.Android/Properties/AndroidManifest.xml
@@ -2,6 +2,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/PlantBox.Client/PlantBox.Client/ViewModels/PlantViewModel.cs b/PlantBox.Client/PlantBox.Client/ViewModels/PlantViewModel.cs
index 40346ca..6eb5fbb 100644
--- a/PlantBox.Client/PlantBox.Client/ViewModels/PlantViewModel.cs
+++ b/PlantBox.Client/PlantBox.Client/ViewModels/PlantViewModel.cs
@@ -7,6 +7,7 @@ using System.ComponentModel;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
namespace PlantBox.Client.ViewModels
@@ -122,38 +123,54 @@ namespace PlantBox.Client.ViewModels
private void LoadValues()
{
+ CaptorValue humidityCaptor;
+ CaptorValue luminosityCaptor;
+ CaptorValue temperatureCaptor;
+ double tankValue;
+ HistoricResponse minutelyHistoric;
+ HistoricResponse hourlyHistoric;
+ HistoricResponse dailyHistoric;
+ HistoricResponse monthlyHistoric;
+
using (var client = new TcpClient(App.Settings.BrokerIP, Connection.TCP_CLIENT_PORT))
using (var stream = new CommandStream(client.GetStream()))
{
-
// Captors info
stream.Send(new CaptorsRequest().ToCommandPacket(PlantInfo.ID));
(_, var captorsReponse) = stream.Receive();
- HumidityCaptor = new CaptorValue(PlantInfo.HumidityMin, PlantInfo.HumidityMax, captorsReponse.Humidity);
- LuminosityCaptor = new CaptorValue(PlantInfo.LuminosityMin, PlantInfo.LuminosityMax, captorsReponse.Luminosity);
- TemperatureCaptor = new CaptorValue(PlantInfo.TemperatureMin, PlantInfo.TemperatureMax, captorsReponse.Temperature);
- TankValue = captorsReponse.Tank;
+ humidityCaptor = new CaptorValue(PlantInfo.HumidityMin, PlantInfo.HumidityMax, captorsReponse.Humidity);
+ luminosityCaptor = new CaptorValue(PlantInfo.LuminosityMin, PlantInfo.LuminosityMax, captorsReponse.Luminosity);
+ temperatureCaptor = new CaptorValue(PlantInfo.TemperatureMin, PlantInfo.TemperatureMax, captorsReponse.Temperature);
+ tankValue = captorsReponse.Tank;
// Historic
stream.Send(new HistoricRequest(HistoricInterval.Minutely, 12).ToCommandPacket(PlantInfo.ID));
- (_, var minutelyHistoric) = stream.Receive();
- stream.Send(new HistoricRequest(HistoricInterval.Hourly, 48).ToCommandPacket(PlantInfo.ID));
- (_, var hourlyHistoric) = stream.Receive();
- stream.Send(new HistoricRequest(HistoricInterval.Daily, 186).ToCommandPacket(PlantInfo.ID));
- (_, var dailyHistoric) = stream.Receive();
- stream.Send(new HistoricRequest(HistoricInterval.Monthly, 36).ToCommandPacket(PlantInfo.ID));
- (_, var monthlyHistoric) = stream.Receive();
+ (_, minutelyHistoric) = stream.Receive();
- var historic = new Historic
- (
- new HistoricEntries(minutelyHistoric, TimeSpan.FromMinutes(5)),
- new HistoricEntries(hourlyHistoric, TimeSpan.FromHours(1)),
- new HistoricEntries(dailyHistoric, TimeSpan.FromDays(1)),
- new HistoricEntries(monthlyHistoric, TimeSpan.FromDays(31))
- );
- Historic = historic;
+ stream.Send(new HistoricRequest(HistoricInterval.Hourly, 48).ToCommandPacket(PlantInfo.ID));
+ (_, hourlyHistoric) = stream.Receive();
+
+ stream.Send(new HistoricRequest(HistoricInterval.Daily, 186).ToCommandPacket(PlantInfo.ID));
+ (_, dailyHistoric) = stream.Receive();
+
+ stream.Send(new HistoricRequest(HistoricInterval.Monthly, 36).ToCommandPacket(PlantInfo.ID));
+ (_, monthlyHistoric) = stream.Receive();
}
+
+ HumidityCaptor = humidityCaptor;
+ LuminosityCaptor = luminosityCaptor;
+ TemperatureCaptor = temperatureCaptor;
+ TankValue = tankValue;
+
+ var historic = new Historic
+ (
+ new HistoricEntries(minutelyHistoric, TimeSpan.FromMinutes(5)),
+ new HistoricEntries(hourlyHistoric, TimeSpan.FromHours(1)),
+ new HistoricEntries(dailyHistoric, TimeSpan.FromDays(1)),
+ new HistoricEntries(monthlyHistoric, TimeSpan.FromDays(31))
+ );
+ Historic = historic;
}
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)