Innovenergy_trunk/csharp/App/EmuMeterDriver/Signal.cs

16 lines
501 B
C#

using InnovEnergy.Lib.Devices.EmuMeter;
using InnovEnergy.Lib.Protocols.DBus.Protocol.DataTypes;
using InnovEnergy.Lib.Victron.VeDBus;
namespace InnovEnergy.App.EmuMeterDriver;
// TODO: Does not compile
public record Signal(Func<EmuMeterRegisters, Object> Source, ObjectPath Path, String Format = "")
{
public VeProperty ToVeProperty(EmuMeterRegisters status)
{
var value = Source(status);
return new VeProperty(Path, value, String.Format($"{{0:{Format}}}", value));
}
}