2023-06-13 10:53:52 +00:00
|
|
|
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);
|
|
|
|
}
|
2023-07-03 13:57:49 +00:00
|
|
|
catch
|
2023-06-13 10:53:52 +00:00
|
|
|
{
|
2023-07-03 13:57:49 +00:00
|
|
|
//Console.WriteLine(e);
|
2023-06-13 10:53:52 +00:00
|
|
|
// TODO: log
|
|
|
|
|
2023-07-03 13:57:49 +00:00
|
|
|
"Failed to read Battery data".WriteLine();
|
|
|
|
|
2023-06-13 10:53:52 +00:00
|
|
|
return Battery48TlRecords.Null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|