Innovenergy_trunk/csharp/app/VenusLogger/Parsers/Generator.cs

26 lines
703 B
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
using InnovEnergy.Lib.Utils;
using InnovEnergy.Lib.Victron.VeDBus;
using InnovEnergy.WireFormat.VictronV1;
namespace InnovEnergy.VenusLogger.Parsers;
public static class Generator
{
public static Maybe<Device> GetGenerator(this IEnumerable<ServiceProperties> services)
{
return services
.Where(VeService.IsGeneratorService)
.Select(GetGeneratorDevice)
.SingleOrDefault()
.Maybe();
}
private static Device GetGeneratorDevice(ServiceProperties serviceProps)
{
return new Device
{
Type = DeviceType.Generator,
Phases = { serviceProps.Properties.GetAcPhases() }
};
}
}