Files
PlantBox/PlantBox.Shared/Communication/Commands/CaptorValue.cs

46 lines
1.0 KiB
C#

using PlantBox.Shared.Extensions;
using System;
using System.Collections.Generic;
using System.Text;
namespace PlantBox.Shared.Communication.Commands
{
public class CaptorValue
{
public const char ValueSeparator = '/';
public double Min { get; set; }
public double Max { get; set; }
public double Value { get; set; }
public CaptorValue()
{
}
public CaptorValue(string argument)
{
string[] arguments = argument.Split(ValueSeparator);
Min = arguments[0].ToDouble();
Max = arguments[1].ToDouble();
Value = arguments[2].ToDouble();
}
public CaptorValue(double min, double max, double value)
{
Min = min;
Max = max;
Value = value;
}
public string ToArgument()
{
return $"{Min}{ValueSeparator}{Max}{ValueSeparator}{Value}";
}
public override string ToString()
{
return ToArgument();
}
}
}