diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-09-02 14:03:43 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-09-02 14:03:43 +0300 |
| commit | 2691cdb1dd27d3125c8f5bbd15c3e8fe1f4486dd (patch) | |
| tree | 42c2432b3c4ad127d94e16052b2cd0307881a290 /Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI | |
| parent | a4a0d4973c8eff2bbfe2c8e753f30626c9e9076d (diff) | |
| download | Tango-2691cdb1dd27d3125c8f5bbd15c3e8fe1f4486dd.tar.gz Tango-2691cdb1dd27d3125c8f5bbd15c3e8fe1f4486dd.zip | |
Added new ports list to DB.
Modified diagnostics to use DigitalInterfaceIOs.
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI')
| -rw-r--r-- | Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs index d9f4c690f..e7a1cead1 100644 --- a/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs @@ -53,6 +53,7 @@ namespace Tango.PMRGenerator.CLI GenerateDiagnosticsValueComponents(db, pmrFolder); GenerateDiagnosticsMonitors(db, pmrFolder); GenerateEventTypes(db, pmrFolder); + GenerateInterfaceIOs(db, pmrFolder); } Console.WriteLine("Done"); @@ -84,7 +85,7 @@ namespace Tango.PMRGenerator.CLI messageFile.Properties.Add(new ProtoProperty("HardwareMotorType", "HardwareMotorType")); - foreach (var prop in typeof(HardwareMotor).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in typeof(HardwareMotor).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive && x.Name != "Active")) { messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription<HardwareMotor>(prop))); } @@ -123,7 +124,7 @@ namespace Tango.PMRGenerator.CLI messageFile.Properties.Add(new ProtoProperty("HardwareDancerType", "HardwareDancerType")); - foreach (var prop in typeof(HardwareDancer).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in typeof(HardwareDancer).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive && x.Name != "Active")) { messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription<HardwareDancer>(prop))); } @@ -162,7 +163,7 @@ namespace Tango.PMRGenerator.CLI messageFile.Properties.Add(new ProtoProperty("HardwarePidControlType", "HardwarePidControlType")); - foreach (var prop in typeof(HardwarePidControl).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in typeof(HardwarePidControl).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive && x.Name != "Active")) { messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription<HardwarePidControl>(prop))); } @@ -243,7 +244,7 @@ namespace Tango.PMRGenerator.CLI messageFile.Properties.Add(new ProtoProperty("HardwareWinderType", "HardwareWinderType")); - foreach (var prop in typeof(HardwareWinder).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in typeof(HardwareWinder).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive && x.Name != "Active")) { messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription<HardwareWinder>(prop))); } @@ -281,7 +282,7 @@ namespace Tango.PMRGenerator.CLI messageFile.Properties.Add(new ProtoProperty("HardwareSpeedSensorType", "HardwareSpeedSensorType")); - foreach (var prop in typeof(HardwareSpeedSensor).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in typeof(HardwareSpeedSensor).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive && x.Name != "Active")) { messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription<HardwareSpeedSensor>(prop))); } @@ -319,7 +320,7 @@ namespace Tango.PMRGenerator.CLI messageFile.Properties.Add(new ProtoProperty("HardwareBlowerType", "HardwareBlowerType")); - foreach (var prop in typeof(HardwareBlower).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in typeof(HardwareBlower).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive && x.Name != "Active")) { messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription<HardwareBlower>(prop))); } @@ -357,7 +358,7 @@ namespace Tango.PMRGenerator.CLI messageFile.Properties.Add(new ProtoProperty("HardwareBreakSensorType", "HardwareBreakSensorType")); - foreach (var prop in typeof(HardwareBreakSensor).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in typeof(HardwareBreakSensor).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive && x.Name != "Active")) { messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription<HardwareBreakSensor>(prop))); } @@ -573,6 +574,29 @@ namespace Tango.PMRGenerator.CLI File.WriteAllText(Path.Combine(pmrFolder, "Diagnostics", messageFile.Name + ".proto"), messageString); } + private static void GenerateInterfaceIOs(ObservablesContext db, String pmrFolder) + { + Console.WriteLine("Generating Interface IOs..."); + + ProtoEnumFile enumFile = new ProtoEnumFile(); + enumFile.Name = "InterfaceIOs"; + enumFile.Package = "Tango.PMR.Diagnostics"; + + foreach (var tech_io in db.TechIos.OrderBy(x => x.Code)) + { + enumFile.Fields.Add(new EnumerationField() + { + Name = tech_io.Name.Replace(" ", ""), + Description = $"Designator: {tech_io.Designator}", + Value = tech_io.Code, + }); + } + + String enumString = enumFile.GenerateCode(); + + File.WriteAllText(Path.Combine(pmrFolder, "Diagnostics", enumFile.Name + ".proto"), enumString); + } + private static void GenerateEventTypes(ObservablesContext db, String pmrFolder) { Console.WriteLine("Generating Event Types..."); |
