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

@ -5,4 +5,5 @@ namespace InnovEnergy.Lib.StatusApi.Connections;
public interface IAc1Connection public interface IAc1Connection
{ {
Ac1Bus Ac { get; } Ac1Bus Ac { get; }
} }

View File

@ -5,4 +5,5 @@ namespace InnovEnergy.Lib.StatusApi.Connections;
public interface IAc3Connection public interface IAc3Connection
{ {
Ac3Bus Ac { get; } Ac3Bus Ac { get; }
} }

View File

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

View File

@ -5,4 +5,9 @@ namespace InnovEnergy.Lib.StatusApi.Connections;
public interface IPvConnection public interface IPvConnection
{ {
IReadOnlyList<DcBus> Strings { get; } IReadOnlyList<DcBus> Strings { get; }
}
public interface IPvConnection<out T> where T : IReadOnlyList<DcBus>
{
T Strings { get; }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,11 +4,9 @@ namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
#pragma warning disable CS8618 #pragma warning disable CS8618
public interface IDcDc public interface IDcDc
{ {
public DcBus Left { get; init; } DcBus DcLeft { get; }
public DcBus Right { get; init; } DcBus DcRight { get; }
} }

View File

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

View File

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

View File

@ -1,8 +1,9 @@
using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes; namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IPvAc3 : IAc3Connection, IPvConnection 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; }
}