/// /// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Reflection; namespace Common { /// /// Helper class to assign descriptions to enum values /// public class Description : Attribute { public string Text; public Description(string t) { Text = t; } } public static class GetDescription { /// Extension method for enum-s public static string ToDescription(this Enum en) { Type type = en.GetType(); MemberInfo[] memInfo = type.GetMember(en.ToString()); if (memInfo != null && memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(Description), false); if (attrs != null && attrs.Length > 0) return ((Description)attrs[0]).Text; } return en.ToString(); /// Return ToString() value in case there is no description } } /// /// Identifies the type of a database /// public enum DBType { None, /// Database disabled MySql, /// MySQL database SQLite, /// SQLite Count } public enum ProcedureSelection { #if LANG_CS [Description("Žádné")] None, [Description("Lokální postupy")] FromLocalDB, [Description("Postupy ze sdílené databázy")] FromSharedDB, [Description("Zakázky z Oracle databázy")] OrderNrFromOracleDB, [Description("Zakázky ze sledovací databázy")] OrderNrFromTracingDB, #else [Description("None")] None, [Description("Local procedures")] FromLocalDB, [Description("Shared procedures")] FromSharedDB, [Description("Orders from Oracle DB")] OrderFromOracleDB, [Description("Orders from Tracing DB")] OrderFromTracingDB, #endif Count } /// /// Obsolete - replaced by enum ProcedureSelection (above) in 3.1 and newer /// public enum RemoteDBUse { [Description("Local DB only")] LocalDBOnly, [Description("Remote DB only")] RemoteDBOnly, [Description("Both DB-s, local 1st")] BothDBsLocalFirst, [Description("Both DB-s, remote 1st")] BothDBsRemoteFirst, Count } /// /// Obsolete - Contains a procedure name and a database specification (local/remote). /// public class ProcedureInfo { public readonly string Name; public readonly bool IsRemote; public ProcedureInfo(string name, bool isRemote) { Name = name; IsRemote = isRemote; } } /// /// Test designation mode for IperlLogger and IperlHead opto data files /// public enum DesigMode { Auto, Based_on_procedure, As_specified, Count } public enum LoginMethod { UserName, /// = alias, abbreviation FullName, /// = description Number, Count } public enum AuthorizedAs { PowerUser, LocalUser, RemoteUser, Count } /// /// GID-s of user groups, each user is member of one or more groups. /// public enum GID { Testers, TestingSpecialists, HeadOfLab, MaintenanceSpecialists, Metrologists, CalibrationSpecialists, Administrators, /// application / network / database administrator TraceabilityManagement, MetrologicalAuthority, WaterMeterAuthority, NrOfGroups, /// Number of groups (this is not a GroupID) None, } public enum MySortOrder { None, Ascending, /// The same like SortOrder.Ascending Descending, /// The same like SortOrder.Descending Ascending2, /// Sorts by a surname in ascending order in case or 'Name Surname' column Descending2, /// Sorts by a surname in descending order in case or 'Name Surname' column } /// /// Flags returned by each device configuration control Verify(...) function. /// public enum CfgUpdateFlags { None = 0, Error = 0x1, /// Some settings in the user control are invalid and cannot be set Warning = 0x02, /// Some settings in the user control are suspicious, can be set after user confirmation RestartRqrd = 0x04, /// TBF program restart is required to apply all changed parameters AnyChange = 0x08, /// At least one parameter have changed VolatileChange = 0x10, InvokeCfgChange = 0x20, /// Invoke CfgChange handler of the component } /// /// Event severity /// public enum Severity { Undefined, Notification, Warning, Error, FatalError, Count } public enum EventClass { Undefined, EquipmentHW, Metrology, TestingProcess, BadResults, ComputerResources, Network, Other, Count } public enum SubscriberGroup : long { None = 0, Metrology = 1, Maintenance = 2, Production = 4, Management = 8, Finish = 16, } public enum EViewerOption { Undefined, AllEvents, RecentEvents, UnreadEvents, } public enum ProcedureState { Active, History, Count, } public enum FlowNames { QnQtQmin = 0, Q3Q2Q1 = 1, QpQi = 2, Count, } public enum ProfileType { Q3R, QnClassColdWater, QnClassHotWater, QpQi, Manual, Count, } public enum ErrorLimitType { Manual, QpClass, Count, } /// Kind of meters for the procedure / test public enum MetersKind { #if LANG_DE [Description("Wasserzähler")] Single, [Description("Verbundwasserzähler")] Combined, [Description("Wärmezähler")] HeatMeter, #elif LANG_FR [Description("Compteurs eau")] Single, [Description("Mètres composés")] Combined, [Description("Thermomètres")] HeatMeter, #elif LANG_CS [Description("Vodoměry")] Single, [Description("Kombinované vodoměry")] Combined, [Description("Měřiče tepla")] HeatMeter, #elif LANG_RU [Description("Счетчик")] Single, [Description("Комбинированный счетчик")] Combined, [Description("Счетчик тепла")] HeatMeter, #else [Description("Water meters")] Single, [Description("Compound water meters")] Combined, [Description("Heat meters")] HeatMeter, #endif } public enum CompoundMeterId : byte { Single, CompoundMain, CompoundAux, Compound, HeatMeterVolume, HeatMeterEnergy, SingleOrCompound, /// Only used when querying results } public enum Medium { [Description("")] NotSpecified, #if LANG_PL [Description("zimna")] ColdWater, [Description("ciepła")] HotWater, #elif LANG_IT [Description("freddo")] ColdWater, [Description("caldo")] HotWater, #elif LANG_FR [Description("eau froide")] ColdWater, [Description("eau chaude")] HotWater, #else [Description("cold")] ColdWater, [Description("hot")] HotWater, #endif Count } public enum Mounting { [Description("")] NotSpecified, #if LANG_DE [Description("H")] H, /// horizontal [Description("V")] V, /// vertical [Description("STR")] S, /// standrohre [Description("F")] F, /// fall [Description("H/V")] HV, /// horizontal / vertical #else [Description("H")] H, /// horizontal [Description("V")] V, /// vertical [Description("S")] S, /// steig [Description("F")] F, /// fall [Description("H/V")] HV, /// horizontal / vertical #endif Count } public enum TemperatureClass { [Description("")] NotSpecified, [Description("T30")] T30, [Description("T50")] T50, [Description("T70")] T70, [Description("T90")] T90, [Description("T130")] T130, [Description("T180")] T180, [Description("T30/70")] T30_70, [Description("T30/90")] T30_90, [Description("T30/130")] T30_130, [Description("T30/180")] T30_180, [Description("30")] t30, [Description("50")] t50, [Description("70")] t70, [Description("90")] t90, [Description("130")] t130, [Description("180")] t180, Count } public enum FlowProfileSensitivityClass { [Description("")] NotSpecified, [Description("U0")] U0, /// ? [Description("D0")] D0, /// ? /// Count } public enum PressureLossClass { [Description("")] NotSpecified, [Description("dp63")] dp63, /// 0.063 MPa = 0.63 bar, TODO: Change to "Δp63" [Description("dp40")] dp40, /// 0.040 MPa = 0.40 bar [Description("dp25")] dp25, /// 0.025 MPa = 0.25 bar [Description("dp16")] dp16, /// 0.016 MPa = 0.16 bar [Description("dp10")] dp10, /// 0.010 MPa = 0.10 bar Count } /// Maximum Admissible Pressure public enum MaxAdmissiblePressure { [Description("")] NotSpecified, [Description("MAP6")] MAP6, [Description("MAP10")] MAP10, [Description("MAP16")] MAP16, [Description("MAP25")] MAP25, [Description("MAP40")] MAP40, Count } /// Register reader type public enum RegisterReaderType { Unknown, Pulses, /// Sick, optical and similar Camera, /// CLP1611 DataStream, /// iPerl Manual, /// Entered by human via form (also from camera images) Count } /// Transition step is finished when this condition is fulfilled public enum StepCondition { None, Scale1Empty, Scale2Empty, Scale3Empty, AllScalesEmpty, Count } /// /// State of water filled in the test bench. /// public enum FillState { Unknown, /// Test bench fill state is unknown Empty, /// Test bench is empty, no water Full, /// Test bench is full of water Count } public enum MeretProtocol { [Description("")] Undefined, [Description("Meret (obsolete)")] Meret, [Description("Modbus")] Modbus, Count } public enum Publish : sbyte { #if LANG_DE /// german [Description("nie")] Never = 0, [Description("immer")] Always = 1, [Description("Bildschirm")] OnScreen = 2, [Description("intern")] Internal = 3, #elif LANG_FR [Description("jamais")] Never = 0, [Description("toujours")] Always = 1, [Description("À l'écran")] OnScreen = 2, [Description("interne")] Internal = 3, #elif LANG_CS /// czech [Description("nikdy")] Never = 0, [Description("vždy")] Always = 1, [Description("na obrazovku")] OnScreen = 2, [Description("interně")] Internal = 3, #elif LANG_SK /// slovak [Description("nikdy")] Never = 0, [Description("vždy")] Always = 1, [Description("na obrazovku")] OnScreen = 2, [Description("interne")] Internal = 3, #elif LANG_PL /// polish [Description("nigdy")] Never = 0, [Description("zawsze")] Always = 1, [Description("na ekranie")] OnScreen = 2, [Description("wewnętrznie")] Internal = 3, #elif LANG_RU /// russian [Description("никогда")] Never = 0, [Description("всегда")] Always = 1, [Description("толька экран")] OnScreen = 2, [Description("внутренно")] Internal = 3, #else /// english [Description("Never")] Never = 0, [Description("Always")] Always = 1, [Description("On screen")] OnScreen = 2, [Description("Internal")] Internal = 3, #endif Count } public enum MassMethod : byte { #if LANG_DE /// nemecky [Description("Waage")] Scale, [Description("Spanne")] Spread, [Description("Standardabw.")] StdDev, #elif LANG_FR [Description("Balance")] Scale, [Description("Envergure")] Spread, [Description("Déviation std.")] StdDev, #elif LANG_CS /// cesky [Description("váhou")] Scale, [Description("max.rozdíl")] Spread, [Description("std.dev.")] StdDev, #else [Description("Scale")] Scale, [Description("Spread")] Spread, [Description("Std.dev.")] StdDev, #endif Count } /// /// Three state test results and/or water meter result (Algeria PT25 requirement). /// NearlyOK means error is within error limits not narrowed by uncertainty /// OK: Uncertainty + ErrLimLo <= error <= ErrLimHi - Uncertainty /// NearlyOK: not OK but stil ErrLimLo <= error <= ErrLimHi /// Nok: otherwise /// public enum ThreeState { #if LANG_FR [Description("NC")] Nok, /// Totally failed: not OK and not NearlyOK [Description("2e/Ff")] NearlyOK, /// Nearly OK, not OK but not totally failed [Description("***")] OK, /// OK #else [Description("NOK")] Nok, /// Totally failed: not OK and not NearlyOK [Description("Nearly OK")] NearlyOK, /// Nearly OK, not OK but not totally failed [Description("OK")] OK, /// OK #endif Count } public enum TestProfile { UserDefined, UserDefinedHeatMeter, Protected, /// The first protected one ProtectedHeatMeter, } public enum Progress { JustStarted, TransitionBefore, SwitchingFlowDetection, FlowSetting, Aborted, /// Use as an argument when a test was aborted Test, TransitionAfter, Completed, Count, } public enum Device { Screen, Printer, Disk, } public enum PageOrientation { Portrait, Landscape, Count, } public enum ItemCategory { #if LANG_DE [Description("Allgemein")] Other, [Description("Prüfstanddaten")] BenchData, [Description("Prüfstandergebnisse")] BenchResult, [Description("Prüfpunktdaten")] TestData, [Description("Prüfpunktergebnisse")] TestResult, [Description("Wasserzelledaten")] MeterData, [Description("Wasserzelleergebnisse")] MeterResult, #elif LANG_FR [Description("Autres")] Other, [Description("Données de banc")] BenchData, [Description("Résultats du banc")] BenchResult, [Description("Données de test")] TestData, [Description("Résultats de test")] TestResult, [Description("Données du compteur d'eau")] MeterData, [Description("Résultats du compteur d'eau")] MeterResult, #else [Description("Other")] Other, [Description("Bench data")] BenchData, [Description("Bench result")] BenchResult, [Description("Test data")] TestData, [Description("Test result")] TestResult, [Description("Meter data")] MeterData, [Description("Meter result")] MeterResult, #endif Count, } /// Possible modes of operation of components and devices. public enum DebugMode { #if LANG_DE [Description("Erkennen-aus")] DetectedOff = -2, [Description("Erkennen-ein")] DetectedOn = -1, [Description("Normal")] Normal = 0, /// Normal operation [Description("Auto-erkennen")] AutoDetect, /// The component (device) will be auto-detected [Description("Fehler")] FailureDuringOperation, /// Failure during operation -> disabled [Description("Aus")] Off, /// The component is off [Description("Aufzeichnen")] Record, [Description("Abspielen")] Replay, [Description("Simuliert")] Simulate, /// Test bench simulation, this mode does not require any hardware [Description("Geerbt")] Inherit, #elif LANG_FR [Description("Détection automatique: Éteindre")] DetectedOff = -2, [Description("Détection automatique: Allumé")] DetectedOn = -1, [Description("Ordinaire")] Normal = 0, [Description("Détection automatique")] AutoDetect, [Description("Erreur d'exécution")] FailureDuringOperation, [Description("Éteindre")] Off, [Description("Record")] Record, [Description("Répondre")] Replay, [Description("Simuler")] Simulate, [Description("Hériter")] Inherit, #else [Description("Detected off")] DetectedOff = -2, [Description("Detected on")] DetectedOn = -1, [Description("Normal")] Normal = 0, /// Normal operation [Description("Auto detect")] AutoDetect, /// The component (device) will be auto-detected [Description("Run-time error")] FailureDuringOperation, /// Failure during operation -> disabled [Description("Off")] Off, /// The component is off [Description("Record")] Record, [Description("Replay")] Replay, [Description("Simulate")] Simulate, /// Test bench simulation, this mode does not require any hardware [Description("Inherit")] Inherit, #endif Count, } public enum LogLevel { #if LANG_DE [Description("Aus")] Off, [Description("Schwerwiegend")] Fatal, [Description("Fehler")] Error, [Description("Warnung")] Warn, [Description("Info")] Info, [Description("Debug")] Debug, [Description("Alles")] All, #else [Description("Off")] Off, [Description("Fatal")] Fatal, [Description("Error")] Error, [Description("Warn")] Warn, [Description("Info")] Info, [Description("Debug")] Debug, [Description("All")] All, #endif Count, } /// Arrangement of tests public enum TestsArrangement { Rows, Columns, } /// Arrangement of meters public enum MetersArrangement { Vertically, Horizontally, } public enum Alignment { #if LANG_DE [Description("links")] Left, [Description("zentriert")] Center, [Description("rechts")] Right, [Description("angepasst")] Justified, #elif LANG_FR [Description("gauche")] Left, [Description("centré")] Center, [Description("droit")] Right, [Description("justifié")] Justified, #else [Description("Left")] Left, [Description("Center")] Center, [Description("Right")] Right, [Description("Justified")] Justified, #endif Count } public enum VertAlignment { [Description("Top")] Top, [Description("Middle")] Middle, [Description("Bottom")] Bottom, } public enum TableForm { None, Rows, Columns, ColumnsPL, Count, } public enum ImageRotation { [Description("0 deg")] None, [Description("90 deg")] Deg90, [Description("180 deg")] Deg180, [Description("270 deg")] Deg270, Count } public enum CameraDisplayResolution { Small, Medium, Large, // FullScreen, Count, } public enum ErrorFlagsMode : sbyte { #if LANG_DE [Description("aus")] Off, [Description("info")] Info, [Description("ein")] On, [Description("stopp")] Stop, #elif LANG_FR [Description("éteindre")] Off, [Description("info")] Info, [Description("allumé")] On, [Description("arrêter")] Stop, #elif LANG_CS [Description("vypnuto")] Off, [Description("info")] Info, [Description("zapnuto")] On, [Description("stop")] Stop, #elif LANG_RU [Description("выкл")] Off, [Description("инфо")] Info, [Description("вкл")] On, [Description("останов")] Stop, #elif LANG_PL [Description("nie")] Off, [Description("info")] Info, [Description("tak")] On, [Description("przestać")] Stop, #else // LANG_EN [Description("off")] Off, [Description("info")] Info, [Description("on")] On, [Description("stop")] Stop, #endif Count } public enum ErrorFlagMask : long { E1 = (1L << 0), /// shift = 0, E1 = 1L E2 = (1L << 1), E3 = (1L << 2), E4 = (1L << 3), E5 = (1L << 4), E6 = (1L << 5), E7 = (1L << 6), E8 = (1L << 7), E9 = (1L << 8), E10 = (1L << 9), E11 = (1L << 10), E12 = (1L << 11), E13 = (1L << 12), E14 = (1L << 13), E15 = (1L << 14), E16 = (1L << 15), E17 = (1L << 16), E18 = (1L << 17), E19 = (1L << 18), E20 = (1L << 19), E21 = (1L << 20), E22 = (1L << 21), E23 = (1L << 22), E24 = (1L << 23), E25 = (1L << 24), E26 = (1L << 25), /// iPERL: Invalid Q2 correction factors, mismatch between factors in the water meter and in DB E27 = (1L << 26), /// iPERL: Wrong counting direction E28 = (1L << 27), /// iPERL: Missing workflow step (assembly or test) E29 = (1L << 28), E30 = (1L << 29), E31 = (1L << 30), E32 = (1L << 31), E33 = (1L << 32), E34 = (1L << 33), E35 = (1L << 34), E36 = (1L << 35), E37 = (1L << 36), E38 = (1L << 37), E39 = (1L << 38), E40 = (1L << 39), E41 = (1L << 40), E42 = (1L << 41), E43 = (1L << 42), E44 = (1L << 43), E45 = (1L << 44), E46 = (1L << 45), E47 = (1L << 46), E48 = (1L << 47), E49 = (1L << 48), E50 = (1L << 49), E51 = (1L << 50), E52 = (1L << 51), E53 = (1L << 52), E54 = (1L << 53), E55 = (1L << 54), E56 = (1L << 55), E57 = (1L << 56), E58 = (1L << 57), E59 = (1L << 58), E60 = (1L << 59), E61 = (1L << 60), E62 = (1L << 61), E63 = (1L << 62), } #region iPERL enums public enum Side { #if LANG_CS [Description("Levá")] Left, [Description("Pravá")] Right, #else [Description("Left")] Left, [Description("Right")] Right, #endif Count } public enum FlowDir { R_L, L_R, Count } public enum Counting { Arbitrary, Positive, Negative, Count } public enum OptoHeadState { Disabled, OptoAndDirOK, OptoNok, DirNok, Count } #endregion iPERL enums }