Status API V2

This commit is contained in:
ig 2023-06-13 13:03:26 +02:00
parent 62ff63c0bb
commit 045de6ac0d
15 changed files with 38 additions and 40 deletions

View File

@ -1,20 +0,0 @@
using System.Collections;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public class CombinedStatus<T> : IReadOnlyList<T>
{
public T? Combined { get; init; }
public IReadOnlyList<T> Stati { get; init; }
public Boolean Available => Stati.Count > 0;
public IEnumerator<T> GetEnumerator() => Stati.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public Int32 Count => Stati.Count;
public T this[Int32 index] => Stati[index];
}

View File

@ -6,3 +6,4 @@ public interface IAc1Connection
{
Ac1Bus Ac { get; }
}

View File

@ -6,3 +6,4 @@ public interface IAc3Connection
{
Ac3Bus Ac { get; }
}

View File

@ -2,8 +2,8 @@ using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.Connections;
public interface IDcConnection
{
DcBus Dc { get; }
}

View File

@ -6,3 +6,8 @@ public interface IPvConnection
{
IReadOnlyList<DcBus> Strings { get; }
}
public interface IPvConnection<out T> where T : IReadOnlyList<DcBus>
{
T Strings { get; }
}

View File

@ -1,4 +1,5 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;

View File

@ -1,7 +1,9 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IAc3Meter : IAc3Connection
{
}

View File

@ -1,8 +1,9 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IAcDc1 : IAc1Connection, IDcConnection
{
}

View File

@ -2,7 +2,6 @@ using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IAcDc3 : IAc3Connection, IDcConnection
{
}

View File

@ -1,9 +1,11 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IBattery : IDcConnection
{
public Percent Soc { get;}
Percent Soc { get; }
}

View File

@ -6,9 +6,7 @@ namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IDcDc
{
public DcBus Left { get; init; }
public DcBus Right { get; init; }
DcBus DcLeft { get; }
DcBus DcRight { get; }
}

View File

@ -1,10 +1,9 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IMppt : IDcConnection, IPvConnection
{
}

View File

@ -1,4 +1,5 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;

View File

@ -1,8 +1,9 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IPvAc3 : IAc3Connection, IPvConnection
{
}

View File

@ -0,0 +1,7 @@
namespace InnovEnergy.Lib.StatusApi;
public interface IDeviceRecord<out S, out C>
{
S Status { get; }
C Control { get; }
}