Innovenergy_trunk/csharp/lib/StatusApi/AcPhase.cs

24 lines
608 B
C#

using System.Text.Json.Nodes;
namespace InnovEnergy.Lib.StatusApi;
public record AcPhase : IAcPhase
{
// Note: only inherit from interfaces in order to make JSON serialization work
public Double Phi { get; init;}
public Double Voltage { get; init;}
public Double Current { get; init;}
public JsonNode ToJson()
{
var jsonDict = new Dictionary<String, JsonNode>();
jsonDict[nameof(Phi)] = Phi;
jsonDict[nameof(Voltage)] = Voltage;
jsonDict[nameof(Current)] = Current;
return new JsonObject(jsonDict!);
}
}