2023-02-16 12:57:06 +00:00
|
|
|
using InnovEnergy.Lib.Devices.EmuMeter;
|
|
|
|
using InnovEnergy.Lib.Protocols.DBus.Protocol.DataTypes;
|
|
|
|
using InnovEnergy.Lib.Victron.VeDBus;
|
|
|
|
|
2023-02-25 14:53:58 +00:00
|
|
|
namespace InnovEnergy.App.EmuMeterDriver;
|
2023-02-16 12:57:06 +00:00
|
|
|
|
2023-06-20 07:30:21 +00:00
|
|
|
|
|
|
|
// TODO: Does not compile
|
2024-11-26 10:20:34 +00:00
|
|
|
public record Signal(Func<EmuMeterRegisters, Object> Source, ObjectPath Path, String Format = "")
|
2023-02-16 12:57:06 +00:00
|
|
|
{
|
2024-11-26 10:20:34 +00:00
|
|
|
public VeProperty ToVeProperty(EmuMeterRegisters status)
|
2023-02-16 12:57:06 +00:00
|
|
|
{
|
|
|
|
var value = Source(status);
|
|
|
|
return new VeProperty(Path, value, String.Format($"{{0:{Format}}}", value));
|
|
|
|
}
|
|
|
|
}
|