Update commands accorded to doc

Update Captors and Info commands
This commit is contained in:
2019-04-22 16:54:16 +02:00
parent 25891c6c9d
commit 9e78307541
3 changed files with 43 additions and 17 deletions

View File

@@ -11,19 +11,21 @@ namespace PlantBox.Shared.Communication.Commands
{
public override Command Command => Command.Captors;
public CaptorValue Humidity { get; set; }
public CaptorValue Luminosity { get; set; }
public CaptorValue Temperature { get; set; }
public double Humidity { get; set; }
public double Luminosity { get; set; }
public double Temperature { get; set; }
public double Tank { get; set; }
public CaptorsResponse()
{
}
public CaptorsResponse(CaptorValue humidity, CaptorValue luminosity, CaptorValue temperature)
public CaptorsResponse(double humidity, double luminosity, double temperature, double tank)
{
Humidity = humidity;
Luminosity = luminosity;
Temperature = temperature;
Tank = tank;
}
public override CaptorsResponse Deserialize(string[] arguments)
@@ -32,14 +34,15 @@ namespace PlantBox.Shared.Communication.Commands
{
throw new ArgumentNullException(nameof(arguments));
}
if (arguments.Length < 3)
if (arguments.Length < 4)
{
throw new ArgumentException($"Excepted 3 arguments, got {arguments.Length}");
throw new ArgumentException($"Excepted 4 arguments, got {arguments.Length}");
}
Humidity = new CaptorValue(arguments[0]);
Luminosity = new CaptorValue(arguments[1]);
Temperature = new CaptorValue(arguments[2]);
Humidity = arguments[0].ToDouble();
Luminosity = arguments[1].ToDouble();
Temperature = arguments[2].ToDouble();
Tank = arguments[3].ToDouble();
return this;
}
@@ -50,7 +53,8 @@ namespace PlantBox.Shared.Communication.Commands
{
Humidity.ToArgument(),
Luminosity.ToArgument(),
Temperature.ToArgument()
Temperature.ToArgument(),
Tank.ToArgument()
};
}
}