31 lines
714 B
C#
31 lines
714 B
C#
|
using InnovEnergy.Lib.Utils;
|
||
|
|
||
|
namespace InnovEnergy.Lib.Devices.Battery48TL;
|
||
|
|
||
|
public class Battery48TlDevices
|
||
|
{
|
||
|
private readonly IReadOnlyList<Battery48TlDevice> _Devices;
|
||
|
|
||
|
public Battery48TlDevices(IReadOnlyList<Battery48TlDevice> devices) => _Devices = devices;
|
||
|
|
||
|
public Battery48TlRecords Read()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
var records = _Devices
|
||
|
.Select(d => d.Read())
|
||
|
.ToArray(_Devices.Count);
|
||
|
|
||
|
return new Battery48TlRecords(records);
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
Console.WriteLine(e);
|
||
|
// TODO: log
|
||
|
|
||
|
return Battery48TlRecords.Null;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|