Innovenergy_trunk/csharp/Lib/Victron/VictronVRM/Details.cs

23 lines
686 B
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
namespace InnovEnergy.Lib.Victron.VictronVRM;
public static class Details
{
public static String? MachineSerial (this IEnumerable<Detail> ds) => ds.GetDetail(556);
public static String? RemoteSupportIp (this IEnumerable<Detail> ds) => ds.GetDetail(543)?.Split(";").FirstOrDefault();
public static String? RemoteSupportPort(this IEnumerable<Detail> ds) => ds.GetDetail(543)?.Split(";").LastOrDefault();
private static String? GetDetail(this IEnumerable<Detail> details, Int32 code)
{
return details
.Where(r => r.IdDataAttribute == code)
.Select(r => r.FormattedValue)
.SingleOrDefault();
}
}