public static void Extract(FilteredResult fr, ref KnxPort port) { port.MetaData["Room"] = ""; try { var button = fr.ComObjects.FirstOrDefault(row => row.ParentDevice.Product.Text.Contains("Push-button")); port.MetaData["Room"] = button.ParentDevice.Building.Name; } catch (Exception) { port.MetaData["Room"] = fr.ComObjects.Where(row => row.ParentDevice != null && row.ParentDevice.Building != null).Select(row => row.ParentDevice.Building.Name).FirstOrDefault() ?? ""; } }
public KnxPort Extract(FilteredResult fr) { var port = new KnxPort() { GroupAddress = fr.GroupAddress.Ref.Value, MetaData = ConstructMetaData(fr), Type = fr.ComObjects.Any(row => row.Bits == 1) ? KnxType.Bool : KnxType.Int, MaxValue = fr.ComObjects.Select(row => 1 << row.Bits - 1 ).Min(), MinValue = 0 }; foreach (var extractor in Extractors.Where(row => !(row is ManualOverrideExtractor))) extractor.Extract(fr, ref port); DemoMeta.Extract(fr, ref port); foreach (var extractor in Extractors.Where(row => (row is ManualOverrideExtractor))) extractor.Extract(fr, ref port); return port; }
private KnxMetaData ConstructMetaData(FilteredResult result) { KnxMetaData meta = new KnxMetaData(); return meta; }
public abstract void Extract(FilteredResult fr, ref KnxPort meta);