diff --git a/Common/.shared/SharedAssemblyInfo.cs b/Common/.shared/SharedAssemblyInfo.cs index 3176818f..5ac3c0b3 100644 --- a/Common/.shared/SharedAssemblyInfo.cs +++ b/Common/.shared/SharedAssemblyInfo.cs @@ -13,4 +13,4 @@ using System.Reflection; // //[assembly: AssemblyVersion("1.2.*.0")] -[assembly: AssemblyVersion("2.8.6.*")] +[assembly: AssemblyVersion("2.8.8.*")] diff --git a/Common/.vs/Common/config/applicationhost.config b/Common/.vs/Common/config/applicationhost.config index 5616ab8b..8f2db308 100644 --- a/Common/.vs/Common/config/applicationhost.config +++ b/Common/.vs/Common/config/applicationhost.config @@ -171,7 +171,7 @@ - + diff --git a/Common/Common.sln.DotSettings b/Common/Common.sln.DotSettings index ad51c2eb..ac891ef0 100644 --- a/Common/Common.sln.DotSettings +++ b/Common/Common.sln.DotSettings @@ -66,6 +66,7 @@ True True True + True True True True @@ -76,6 +77,7 @@ True True True + True True True True diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs index a5de631a..4cef69f8 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs @@ -1,4 +1,6 @@ -namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore +using System.Text.RegularExpressions; + +namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore { using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -31,7 +33,7 @@ public List ConfigApplicationDefinitions { get; } = new List(); - + /// /// Information collected during 'configuration.json' read /// @@ -40,7 +42,7 @@ /// /// Ctor /// - public GenesisConfigurationReader() {} + public GenesisConfigurationReader() { } /// /// Ctor @@ -66,6 +68,9 @@ /// /// /// + /// + /// - Initial. + /// /// /// - AppId from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte /// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the @@ -78,6 +83,10 @@ /// /// - Supported application list introduced. /// + /// + /// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t' + /// data types. + /// public void BuildRegisterList(String configurationJson) { IDictionary sections; @@ -88,7 +97,7 @@ .DeserializeObject>(configurationJson, SerializerSettings) ?? new Dictionary(); } - catch (Exception ) + catch (Exception) { sections = new Dictionary(); } @@ -121,7 +130,7 @@ AppId = appId, AppName = appName, AppVersion = appVersion, - }); + }); var section = sectionKVP.Value; @@ -159,6 +168,7 @@ AppAddress = appId, AppName = appName, DataType = GetType(detail.Type), + DataSize = GetSize(detail.Type), Default = values?.Default is Int64 d ? d : default(Int64?), IsAvailable = false, Maximum = values?.Maximum is Int64 max ? max : default(Int64?), @@ -188,31 +198,107 @@ }, }; + /// + /// Convert data types from interface 'configuration.json' to CLR type or array + /// + /// + /// type + /// + /// + /// - Initial. + /// + /// + /// - Parsed all 'uintxx_t' which are not based on CLR types to byte-array + /// private static Type GetType(String value) { - switch (value.ToLower()) + // Catch all uintxx_t to split to standard CLR or to array + var lowStrValue = value.ToLower(); + if (lowStrValue.Contains("uint") && lowStrValue.Contains("_t")) { + switch (lowStrValue) + { + case "uint8_t": return typeof(Byte); + case "uint16_t": return typeof(UInt16); + case "uint32_t": return typeof(UInt32); + case "uint64_t": return typeof(UInt64); + default: + return typeof(ByteArray); + } + } + + // Catch the signed standard CLR and some special types + switch (lowStrValue) + { + // CLR types case "bool_t": return typeof(Boolean); - case "rpc": return typeof(Rpc); - case "string": return typeof(String); - case "uint32_t": return typeof(UInt32); - case "time_t": return typeof(TimeT); - case "status_t": return typeof(StatusT); - case "uint16_t": return typeof(UInt16); - case "uint8_t": return typeof(Byte); - case "enum8": return typeof(Enum8); - case "uint64_t": return typeof(UInt64); - case "uint96_t": return typeof(UInt96); - case "uint128_t": return typeof(UInt128); case "int8_t": return typeof(SByte); + case "int16_t": return typeof(Int16); case "int32_t": return typeof(Int32); case "int64_t": return typeof(Int64); - case "int16_t": return typeof(Int16); - case "uint72_t": return typeof(UInt72); - case "uint48_t": return typeof(UInt48); - case "uint88_t": return typeof(UInt88); - case "uint672_t": return typeof(UInt672); - default: throw new Exception($"Type {value} not recognized!"); + case "string": return typeof(String); + + // Special types defined in FW interface file 'configuration.json' + case "rpc": return typeof(Rpc); + case "time_t": return typeof(TimeT); + case "status_t": return typeof(StatusT); + case "enum8": return typeof(Enum8); + default: + throw new Exception($"Data type {value} in unknown!"); + } + } + /// + /// Build the data size + /// + /// + /// size + /// + /// - Initial: - parsed all 'uintxx_t' which are not based on CLR types to byte-array + /// + private static Int32 GetSize(String value) + { + // Catch all uintxx_t to split to standard CLR or to array + var lowStrValue = value.ToLower(); + if (lowStrValue.Contains("uint") && lowStrValue.Contains("_t")) + { + switch (lowStrValue) + { + case "uint8_t": return sizeof(Byte); + case "uint16_t": return sizeof(UInt16); + case "uint32_t": return sizeof(UInt32); + case "uint64_t": return sizeof(UInt64); + default: + // Extract the size from the string + var dataSizeStr = Regex.Replace(lowStrValue, "[^0-9]", string.Empty); + if (Int32.TryParse(dataSizeStr, out var dataSize)) + return dataSize / 8; + throw new Exception($"Data size {lowStrValue} cannot be converted!"); + } + } + + // Catch the signed standard CLR and some special types + switch (lowStrValue) + { + // CLR types + case "bool_t": return sizeof(Boolean); + case "int8_t": return sizeof(SByte); + case "int16_t": return sizeof(Int16); + case "int32_t": return sizeof(Int32); + case "int64_t": return sizeof(Int64); + + // Take just some value as the string length is unknown + case "string": return 6 * 4; + + // Special types defined in FW interface file 'configuration.json' + // Remote procedure call is always a 4 byte value + case "rpc": return sizeof(UInt32); + + // Time will be in seconds since 01. Jan 2000 00:00:00 UTC as signed Int32 + case "time_t": return sizeof(Int32); + case "status_t": return sizeof(UInt32); + case "enum8": return sizeof(Byte); + default: + throw new Exception($"Data type {value} in unknown!"); } } } diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs index b5ddf531..8256643e 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs @@ -140,6 +140,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore private ILogger _loggerRawData; + /// + /// Optional request to use the offline passwords + /// + public Boolean UseOfflinePasswords { set; get; } + /// /// Process configuration /// @@ -191,9 +196,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore } /// - public List MeterAppListVersion + public List MeterAppListVersion { - protected set; get; + protected set; get; } = new List(); @@ -204,7 +209,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore } /// - public InterfaceInfo InterfaceInfo + public InterfaceInfo InterfaceInfo { get; internal set; } @@ -228,16 +233,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore } /// - public String LutCrc - { - protected set; get; - } + public String LutCrc { + protected set; + get; + } = "?"; /// - public String MeterSize - { - protected set; get; - } + public String MeterSize { + protected set; + get; + } = "?"; /// public Boolean InterfaceSupportsFwVersion @@ -247,10 +252,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore } /// - public String Region - { - protected set; get; - } + public String Region { + protected set; + get; + } = "?"; /// public String MeterLength @@ -566,7 +571,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore { return false; } - + return true; } @@ -654,19 +659,29 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore Logger.Warn(ex, $"Slot:{Slot} - Register definition file update went wrong."); } - //builds a configuration file reader from configuration.json and reads all registers definitions - //and application definitions - var registerReader = new GenesisConfigurationReader(configFilePath); - - InterfaceInfo = new InterfaceInfo + try { - SupportedFwVersions = new List() - }; - InterfaceInfo.SupportedFwVersions.AddRange(registerReader.InterfaceInfo.SupportedFwVersions); - InterfaceInfo.InterfaceVersion = registerReader.InterfaceInfo.InterfaceVersion; - SetConfigRegisterDefinitions(registerReader.ConfigRegistersDefinitions); - SetConfigApplicationDefinitions(registerReader.ConfigApplicationDefinitions); + //builds a configuration file reader from configuration.json and reads all registers definitions + //and application definitions + var registerReader = new GenesisConfigurationReader(configFilePath); + + InterfaceInfo = new InterfaceInfo + { + SupportedFwVersions = new List() + }; + InterfaceInfo.SupportedFwVersions.AddRange(registerReader.InterfaceInfo.SupportedFwVersions); + InterfaceInfo.InterfaceVersion = registerReader.InterfaceInfo.InterfaceVersion; + + SetConfigRegisterDefinitions(registerReader.ConfigRegistersDefinitions); + SetConfigApplicationDefinitions(registerReader.ConfigApplicationDefinitions); + } + catch (Exception ex) + { + var msg = $"\'configuration.json\' file is incompatible!\nConfig Reader reports: {ex.Message}"; + Logger.Error(ex, $"Slot:{Slot} - {msg}."); + throw new Exception(msg); + } } event EventHandler IMeter.OnDisposeCompleted @@ -1201,6 +1216,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// /// - Used /// + /// + /// - Optional the offline passwords will be used. + /// private String GetPassword() { // without PCB ID it is not possible to login, @@ -1219,14 +1237,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore } // on unknown password try to get it from DB - if (MeterPwdHandlerDb.GetPasswordFromDb(PcbId, out var password)) + if (MeterPwdHandlerDb.GetPasswordFromDb(PcbId, out var password) && !UseOfflinePasswords) { Logger.Info($"Slot:{Slot} - Got password from GenesisPasswordService, " + $"URL({ServiceUrls.GenesisGetPasswordServiceUrl() + PcbId})"); } else { - Logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " + + if (!UseOfflinePasswords) + Logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " + $"URL({ServiceUrls.GenesisGetPasswordServiceUrl() + PcbId}))"); // try to read the password from an offline password file var offlinePwdPathName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @@ -1236,7 +1255,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore var listOfOfflinePasswords = JsonConvert.DeserializeObject>( File.ReadAllText(offlinePwdPathName)); - if (listOfOfflinePasswords != null) + if (listOfOfflinePasswords != null && listOfOfflinePasswords.Any(x => x.PcbId == PcbId )) password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password; if (!string.IsNullOrEmpty(password)) @@ -1467,8 +1486,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore major -= majorIndicatorForB; } - return buildShortVersion ? - $"{major:X0}{minor:X0}{builtMajor:X0}{builtMinor:X0}" : + return buildShortVersion ? + $"{major:X0}{minor:X0}{builtMajor:X0}{builtMinor:X0}" : $"{releaseTypeId}{major:X0}.{minor:X0}.{builtMajor:X0}{builtMinor:X0}"; } @@ -1887,8 +1906,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore Logger.Info($"Slot:{Slot} - Meter size: {MeterSize}"); Logger.Info($"Slot:{Slot} - Upgrade permission: {MetrologyUpgradePermission:X2}"); Logger.Info($"Slot:{Slot} - Interface (configuration.json) version: {InterfaceInfo.InterfaceVersion}"); - - if (InterfaceInfo.SupportedFwVersions.Any( strFwVersion => strFwVersion.Contains(strShortFwVersion))) + + if (InterfaceInfo.SupportedFwVersions.Any(strFwVersion => strFwVersion.Contains(strShortFwVersion))) { InterfaceSupportsFwVersion = true; Logger.Info($"Slot:{Slot} - Interface supports this FW version: {FwVersion}"); @@ -2148,7 +2167,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore return fullAlarm; } - + /// public void ClearAlarm() { @@ -2156,14 +2175,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore var beforeCancelAlarmBroadcastMask = RegisterConverter.ByteArrayToValue(ReadRegister("CUSTOMER_AlarmBroadcastMask")); WriteRegister("CUSTOMER_AlarmEnableMask", Alarm.ALL); - WriteRegister("CUSTOMER_AlarmBroadcastMask", Alarm.ALL ); + WriteRegister("CUSTOMER_AlarmBroadcastMask", Alarm.ALL); WriteRegister(Register.Customer.TriggerAlarmCancel, Alarm.ALL); if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup1")) { // ReSharper disable once UnusedVariable used for debug - var x = ReadRegister("SENSUSRADIO_PersistenceGroup1"); - WriteRegister("SENSUSRADIO_PersistenceGroup1", new Byte[] { 0x00,0xff,0x00,0xff }); + var x = ReadRegister("SENSUSRADIO_PersistenceGroup1"); + WriteRegister("SENSUSRADIO_PersistenceGroup1", new Byte[] { 0x00, 0xff, 0x00, 0xff }); } if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup2")) @@ -2376,6 +2395,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// /// - Changed sensitive information from "*****" to SHA256. /// + /// + /// - Date size directly from register object. + /// public virtual Byte[] ReadRegister(String regName, Int32? expectedLength = null, UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode) { @@ -2384,14 +2406,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore { var regDef = ConfigRegister.GetRegisterDefinitionByName(regName); ConfigRegister.Set(regDef, null); - //_logger.Info($"Slot:{Slot} - Read register({regDef.GetIdent()})"); var hideDataInLog = regDef.RegisterName.Contains("EncryptionKey"); // setup length based on data type if (!expectedLength.HasValue) { - expectedLength = RegisterConverter.SizeOf(regDef); + expectedLength = regDef.DataSize; } var dataLengthPreset = expectedLength.Value; diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/RegisterRestorer.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/RegisterRestorer.cs index d7e5a6de..7cf28d83 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/RegisterRestorer.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/RegisterRestorer.cs @@ -1671,6 +1671,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// /// - CancellationToken. /// + /// + /// - Date size directly from register object. + /// private Boolean ReadRegistersSet(ref List registers, CancellationToken cancellationToken) { if (_currentGenesis == null) @@ -1706,7 +1709,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore try { - var rawRegister = _currentGenesis.ReadRegister(regName, RegisterConverter.SizeOf(regDef)); + var rawRegister = _currentGenesis.ReadRegister(regName, regDef.DataSize); try { if (register != null && rawRegister != null) diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/ByteArray.cs b/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/ByteArray.cs new file mode 100644 index 00000000..92a66d44 --- /dev/null +++ b/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/ByteArray.cs @@ -0,0 +1,6 @@ +namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes +{ + public struct ByteArray + { + } +} diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt128.cs b/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt128.cs deleted file mode 100644 index e8498560..00000000 --- a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt128.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes -{ - public struct UInt128 - { - } -} diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt48.cs b/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt48.cs deleted file mode 100644 index 821c7505..00000000 --- a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt48.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes -{ - public struct UInt48 - { - } -} diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt72.cs b/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt72.cs deleted file mode 100644 index acd378b2..00000000 --- a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt72.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes -{ - public struct UInt72 - { - } -} diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt88.cs b/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt88.cs deleted file mode 100644 index 20733cd7..00000000 --- a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt88.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes -{ - public struct UInt88 - { - } -} diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt96.cs b/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt96.cs deleted file mode 100644 index 4ce80bc7..00000000 --- a/Common/Hardware/WaterMeter/Genesis/Registers/DataTypes/UInt96.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes -{ - public struct UInt96 - { - } -} diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/RegisterConverter.cs b/Common/Hardware/WaterMeter/Genesis/Registers/RegisterConverter.cs index 3dc18b34..95d6c65c 100644 --- a/Common/Hardware/WaterMeter/Genesis/Registers/RegisterConverter.cs +++ b/Common/Hardware/WaterMeter/Genesis/Registers/RegisterConverter.cs @@ -87,6 +87,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers /// /// - Hash password and encryption key with SHA256. /// + /// + /// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t' + /// data types. + /// public static String GetRegisterRawText(RegisterDefinition registerDefinition, Byte[] regRawByteArray, Boolean encryptData = false) { @@ -100,12 +104,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers // reverse the list if it is not a string or the UInt48, UInt72, UInt88,UInt96 or UInt128 which // will be used as placeholder for a string if (registerDefinition.DataType != typeof(String) && - registerDefinition.DataType != typeof(UInt48) && - registerDefinition.DataType != typeof(UInt72) && - registerDefinition.DataType != typeof(UInt88) && - registerDefinition.DataType != typeof(UInt96) && - registerDefinition.DataType != typeof(UInt128) && - registerDefinition.DataType != typeof(UInt672)) + registerDefinition.DataType != typeof(ByteArray)) { tmpList.Reverse(); } @@ -166,6 +165,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers /// - Used to calculate time in UTC based on 01. Jan 2000 /// and the given offset in seconds. /// + /// + /// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t' + /// data types. + /// public static Byte[] ValueToByteArray(T value) { var converted = new Byte[] { 0 }; @@ -239,104 +242,19 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers return BitConverter.GetBytes(Convert.ToSByte(value)); } - else if (value is Byte[]) + else if (value is Byte[] || value is ByteArray) { return (Byte[])Convert.ChangeType(value, typeof(Byte[])); } + else { - throw new ApplicationException($"Data type {typeof(T)} not implemented"); + throw new ApplicationException($"Data type {typeof(T)} is unknown!"); } return converted; } - /// - /// Get size of type - /// - /// - /// size in bytes - /// - /// - Init. - /// - public static Int32 SizeOf(RegisterDefinition registerDefinition) - { - var size = 4; - - if (registerDefinition.DataType == typeof(Boolean)) - { - size = sizeof(Boolean); - } - if (registerDefinition.DataType == typeof(Byte) || - registerDefinition.DataType == typeof(SByte) || - registerDefinition.DataType == typeof(Char) || - registerDefinition.DataType == typeof(Enum8)) - { - size = sizeof(Byte); - } - else if (registerDefinition.DataType == typeof(Int16) || - registerDefinition.DataType == typeof(UInt16)) - { - size = sizeof(Int16); - } - else if (registerDefinition.DataType == typeof(Int32) || - registerDefinition.DataType == typeof(UInt32) || - registerDefinition.DataType == typeof(TimeT)) - { - size = sizeof(Int32); - } - - else if (registerDefinition.DataType == typeof(Int64) || - registerDefinition.DataType == typeof(UInt64)) - { - size = sizeof(Int64); - } - - else if (registerDefinition.DataType == typeof(UInt48)) - { - // 48 Bits / 8 Bits/Byte - size = 6; - } - - else if (registerDefinition.DataType == typeof(UInt72)) - { - // 72 Bits / 8 Bits/Byte - size = 9; - } - - else if (registerDefinition.DataType == typeof(UInt88)) - { - // 88 Bits / 8 Bits/Byte - size = 11; - } - - else if (registerDefinition.DataType == typeof(UInt96)) - { - // 96 Bits / 8 Bits/Byte - size = 3 * 4; - } - - else if (registerDefinition.DataType == typeof(UInt128)) - { - // 128 Bits / 8 Bits/Byte - size = 4 * 4; - } - - else if (registerDefinition.DataType == typeof(UInt672)) - { - // 672 Bits / 8 Bits/Byte - size = 56; - } - - else if (registerDefinition.DataType == typeof(String)) - { - // just some value - size = 6 * 4; - } - - return size; - } - /// /// Build the result of the array as text. /// @@ -350,6 +268,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers /// - Used to calculate time in UTC based on 01. Jan 2000 /// and the given offset in seconds. /// + /// + /// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t' + /// data types. + /// public static String ConvertToText(Byte[] rawByteArray, Type type) { try @@ -392,27 +314,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers { return ByteArrayToValue(rawByteArray).ToString(); } - if (type == typeof(UInt48)) - { - return ""; - } - if (type == typeof(UInt72)) - { - return ""; - } - if (type == typeof(UInt88)) - { - return ""; - } - if (type == typeof(UInt672)) - { - return ""; - } - if (type == typeof(UInt96)) - { - return ""; - } - if (type == typeof(UInt128)) + if (type == typeof(ByteArray) || type == typeof(Byte[])) { return ""; } @@ -451,6 +353,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers /// /// - Padding bytes if input doesn't fit the required size; /// + /// + /// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t' + /// data types. + /// public static T ByteArrayToValue(Byte[] rawByteArray) { if (rawByteArray == null) @@ -461,33 +367,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers Object convertedObj = null; var type = typeof(T); - // For non-numerical or single byte values use the standard implementation - if (type == typeof(UInt48)) - { - return default(T); - } - if (type == typeof(UInt72)) - { - return default(T); - } - if (type == typeof(UInt88)) - { - return default(T); - } - if (type == typeof(UInt96)) - { - return default(T); - } - if (type == typeof(UInt128)) - { - return default(T); - } - if (type == typeof(UInt672)) - { - return default(T); - } - - if (type == typeof(Byte) || type == typeof(Enum8)) { convertedObj = rawByteArray[0]; diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/RegisterDefinition.cs b/Common/Hardware/WaterMeter/Genesis/Registers/RegisterDefinition.cs index bbf42f03..f5d4f3c3 100644 --- a/Common/Hardware/WaterMeter/Genesis/Registers/RegisterDefinition.cs +++ b/Common/Hardware/WaterMeter/Genesis/Registers/RegisterDefinition.cs @@ -37,6 +37,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers /// data type of register /// public Type DataType; + + /// + /// size of the data to support the SizeOf implementation + /// + public Int32 DataSize; /// /// length of one chunk during communication diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/Registers.csproj b/Common/Hardware/WaterMeter/Genesis/Registers/Registers.csproj index 9307fe37..685b50c8 100644 --- a/Common/Hardware/WaterMeter/Genesis/Registers/Registers.csproj +++ b/Common/Hardware/WaterMeter/Genesis/Registers/Registers.csproj @@ -134,12 +134,7 @@ - - - - - - + diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckFinalParametrization.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckFinalParametrization.cs index e0a96779..0597f89e 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckFinalParametrization.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckFinalParametrization.cs @@ -70,7 +70,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // Access to meter requires login if (!Meter.IsLoggedOn) { - Meter.Login(); + Meter.ReLogin(); if (!Meter.IsLoggedOn) { ErrorMsgDispatcher(Resources.StrErrorMsgCordonelLogin); @@ -95,9 +95,11 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr if (retValBol) { EolProgress.ParametrizationCompareChecked = EOLStatus.OK; + Meter?.Logout(); return StatusReturn.Okay; } EolProgress.ParametrizationCompareChecked = EOLStatus.FAIL; + Meter?.Logout(); return StatusReturn.Failed; } catch (Exception ex) diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckRadio.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckRadio.cs index 799d0572..eeacedd1 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckRadio.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckRadio.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading; -using System.Windows.Interop; using System.Windows.Threading; using System.Xml.Linq; using Xylem.Common.CommonCore.Configuration; @@ -106,9 +105,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr private Byte _sirtBoxNr; /// - /// Comport number of SIRT + /// Comport number of RSSI-SIRT /// - private Int32 _sirtComport; + private Int32 _rssiSirtComport; /// /// Radio address Cordonel @@ -184,6 +183,12 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr /// /// - Load settings from SIRT config file instead from AppConfig. /// + /// + /// - Service SIRT for alarm setup over the air. + /// + /// + /// - Service SIRT verbose output and additional error handling and warning. + /// public override StatusReturn ExecuteProcess() { // This will force to reset all values, Sentinel and Prepare shipping will fail based on EOL Progress @@ -218,7 +223,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr { if (!Meter.IsLoggedOn) { - Meter.Login(); + Meter.ReLogin(); if (!Meter.IsLoggedOn) { return SetTestFailed(Resources.StrErrorMsgCordonelLogin); @@ -236,7 +241,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // Initialize the SIRT if (!SirtInit()) { - return SetTestFailed(Resources.StrErrorMsgSirt); + return SetTestFailed(Resources.StrErrorMsgRssiSirt); } //FrequencyIndicator @@ -278,23 +283,24 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr if (freq == 433 && sirtConfig.SirtComport433MHz != null) { - int.TryParse(sirtConfig.SirtComport433MHz.Replace("COM", ""), out _sirtComport); + int.TryParse(sirtConfig.SirtComport433MHz.Replace("COM", ""), out _rssiSirtComport); } if (freq == 868 && sirtConfig.SirtComport433MHz != null) { - int.TryParse(sirtConfig.SirtComport868MHz.Replace("COM", ""), out _sirtComport); + int.TryParse(sirtConfig.SirtComport868MHz.Replace("COM", ""), out _rssiSirtComport); } - var ServicePorts = new List(); - var cport = 0; - if (sirtConfig.ServiceSirtComport433MHz != null && int.TryParse(sirtConfig.ServiceSirtComport433MHz.Replace("COM", ""), out cport)) + var ServicePorts = new List(); + if (sirtConfig.ServiceSirtComport433MHz != null && + int.TryParse(sirtConfig.ServiceSirtComport433MHz.Replace("COM", ""), out var serviceSirtComport)) { - ServicePorts.Add(cport); + ServicePorts.Add(serviceSirtComport); } - if (sirtConfig.ServiceSirtComport868MHz != null && int.TryParse(sirtConfig.ServiceSirtComport868MHz.Replace("COM", ""), out cport)) + if (sirtConfig.ServiceSirtComport868MHz != null && + int.TryParse(sirtConfig.ServiceSirtComport868MHz.Replace("COM", ""), out serviceSirtComport)) { - ServicePorts.Add(cport); + ServicePorts.Add(serviceSirtComport); } @@ -303,7 +309,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr var ucRadio = (UcRadioCheck)UserControl; ucRadio.SetHeadline($"{Resources.StrStateRadioCheck} BOX: {_sirtBoxNr}"); - LogNewStatusMsg($"{Resources.StrStateRadioCheck} Port: COM{_sirtComport}, BOX: {_sirtBoxNr}, " + + LogNewStatusMsg($"{Resources.StrStateRadioCheck} Port: COM{_rssiSirtComport}, BOX: {_sirtBoxNr}, " + $"f: {freq} MHz"); // Tell the radio that something is in the slot which will impact the radio transmission @@ -314,16 +320,33 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr if (ServicePorts.Any()) { + LogNewStatusMsg(Resources.StrStateRadioAlarmSetupOverTheAir); try { - SIRTServer.StartServer(SuccessMsgDispatcher, ErrorMsgDispatcher, ServicePorts.ToArray()); - SIRTServer.StartProgramming(Convert.ToInt32(freq), _radioAddressCordonel, meterEncryptionKey); + if (!SIRTServer.StartServer(SuccessMsgDispatcher, ErrorMsgDispatcher, ServicePorts.ToArray())) + { + SIRTServer.Dispose(); + return SetTestFailed(Resources.StrErrorMsgServiceSirtServerStart); + } + + if (!SIRTServer.StartProgramming(Convert.ToInt32(freq), _radioAddressCordonel, + meterEncryptionKey)) + { + SIRTServer.Dispose(); + return SetTestFailed(Resources.StrErrorMsgServiceSirtProgramming); + } + SIRTServer.Dispose(); } catch (Exception ex) { - ErrorMsgDispatcher(ex.Message); + SIRTServer.Dispose(); + return SetTestFailed(ex.Message); } } + else + { + WarningMsgDispatcher(Resources.StrWarningMsgServiceSirtSkipped); + } // Clear the measurement as on a retry started from main control the old values will be displayed ClearRssiMeasurement(); @@ -365,7 +388,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // If radio check is enabled the signal level has to be in range and the test has to be finished || (!skipRadioCheck && (!_successSignalLevel || !_sirtComOkay || !_testFinished))) { - return SetTestFailed(!_sirtComOkay ? Resources.StrErrorMsgSirt : Resources.StrErrorMsgRadioCheck); + return SetTestFailed(!_sirtComOkay ? Resources.StrErrorMsgRssiSirt : Resources.StrErrorMsgRadioCheck); } SuccessMsgDispatcher(Resources.StrSuccessMsgRadioInCustomerMode); @@ -442,8 +465,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr EolProgress.RadioCheckId = _radioResultCheckId; EolProgress.FinalRadioSystemState = _finalRadioSystemState; - // Essential to logout from meter at any exit + // Essential to logout from meter at any exit to give the radio app the chance + // to access the parameters and config file Meter?.Logout(); + Thread.Sleep(1000); _stateMachine?.Stop(); _stateMachine = null; @@ -520,7 +545,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr { ActualProcessProgress++; GetRssiMinMaxValuesFromDb(_sirtBoxNr, Meter.OrderNumber); - SendPamListenSemi((Int32)_radioAddressCordonel, _sirtComport, _radioEncryptionKey); + SendPamListenSemi((Int32)_radioAddressCordonel, _rssiSirtComport, _radioEncryptionKey); UpdateUc(); ActualProcessProgress++; } @@ -566,7 +591,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr } ClearRssiMeasurement(); UpdateUc(); - SendPamListenSemi((Int32)_radioAddressCordonel, _sirtComport, _radioEncryptionKey); + SendPamListenSemi((Int32)_radioAddressCordonel, _rssiSirtComport, _radioEncryptionKey); } /// diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs index 2136da04..75ad3d5e 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs @@ -214,16 +214,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr processState: ProcessState.RebootCordonel, processInfo: Resources.StrStateRebootCordonel, productionProcessNo: 8, - nextStateOnSuccess: ProcessState.CheckFinalParametrization), - - // Precondition: - The reboot process including the store all configurations has to be - // completed. - // Check final configuration has to be executed exclusively with automatic - new ProcessStateStruct( - productionProcess: new CheckFinalParametrization(Resources.StrStateCheckParametrization), - processState: ProcessState.CheckFinalParametrization, - processInfo: Resources.StrStateCheckParametrization, - productionProcessNo: 9, nextStateOnSuccess: ProcessState.CheckRadio), // Precondition: - The final parametrization, reboot process including the store all @@ -234,9 +224,19 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr productionProcess: new CheckRadio(Resources.StrStateRadioCheck), processState: ProcessState.CheckRadio, processInfo: Resources.StrStateRadioCheck, + productionProcessNo: 9, + nextStateOnSuccess: ProcessState.CheckFinalParametrization), + + // Precondition: - The reboot process including the store all configurations has to be + // completed. + // Check final configuration has to be executed exclusively with automatic + new ProcessStateStruct( + productionProcess: new CheckFinalParametrization(Resources.StrStateCheckParametrization), + processState: ProcessState.CheckFinalParametrization, + processInfo: Resources.StrStateCheckParametrization, productionProcessNo: 10, nextStateOnSuccess: ProcessState.CheckOrderNumber), - + // This scans the order number, it has to be executed exclusively with automatic new ProcessStateStruct( productionProcess: new CheckOrderNumber(Resources.StrStateCheckOrderNumber), diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecFinalParametrization.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecFinalParametrization.cs index 1738e883..d72ac822 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecFinalParametrization.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecFinalParametrization.cs @@ -92,7 +92,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // access to meter requires login if (!Meter.IsLoggedOn) { - Meter.Login(); + Meter.ReLogin(); if (!Meter.IsLoggedOn) { ErrorMsgDispatcher(Resources.StrErrorMsgCordonelLogin); diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecPasswordFile.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecPasswordFile.cs index 19c02e65..0a0a3789 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecPasswordFile.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecPasswordFile.cs @@ -186,7 +186,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr ucPwd.UpdateImage(ucPwd.imgWriteToMeter, ImgState.Active); if (!Meter.IsLoggedOn) - Meter.Login(); + Meter.ReLogin(); // Install and check password file var retryCtr = 2; diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecRebootCordonel.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecRebootCordonel.cs index df0067df..c102fe5a 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecRebootCordonel.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecRebootCordonel.cs @@ -69,7 +69,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // access to meter requires login if (!Meter.IsLoggedOn) { - Meter.Login(); + Meter.ReLogin(); if (!Meter.IsLoggedOn) { ErrorMsgDispatcher(Resources.StrErrorMsgCordonelLogin); @@ -98,7 +98,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // access to meter requires login if (!Meter.IsLoggedOn) { - Meter.Login(); + Meter.ReLogin(); if (!Meter.IsLoggedOn) { ErrorMsgDispatcher(Resources.StrErrorMsgCordonelLogin); diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecStoreConfiguration.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecStoreConfiguration.cs index b8694a26..8123bc65 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecStoreConfiguration.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/ExecStoreConfiguration.cs @@ -44,7 +44,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // access to meter requires login if (!Meter.IsLoggedOn) { - Meter.Login(); + Meter.ReLogin(); if (!Meter.IsLoggedOn) { ErrorMsgDispatcher(Resources.StrErrorMsgCordonelLogin); diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs index 64d76e62..6fe00b63 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs @@ -335,79 +335,85 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses // Signal state change to logger OnStateMachineStateChanged?.Invoke(this, new ProcessStateArgs(_stateMachineState)); - - // Check if state is the first in the list of production processes to reset cancellationToken and - // calculate the over all process steps to feed the progress bars. - var startProcessState = _processStateDef.GetStateOfFirstProcess(); - if (startProcessState == _stateMachineState) + + if (_processStateDef != null) { - // Kill all processes at start - KillProcesses(); - // Avoid immediately cancellation for first process of the process chain - ResetCancellationToken(); - // Set up the counter for maximum overall process progress bar in GUI - CalcAndPushMaxOverAllProcessSteps(); - } - - // Get the processStateStruct of this new required stateMachineState - var processStateStruct = _processStateDef.GetProcessStateStructOfState(_stateMachineState); - - switch (_stateMachineState) - { - case ProcessState.Idle: - break; - - case ProcessState.CheckNewMeter: - // Detection of Cordonel has to be completed before assigning next state. It has to be checked if - // the meter changed to clear all collected contents of previous run. To UPDATE ALL INFORMATION after - // new meter assignment the "DetectCordonel" has to be repeated to return here "Old Meter" and then - // enter the "ConnectCordonel"! - if (processStateStruct.NextStateOnSuccess != null) - { - _stateMachineState = CheckForNewMeter() ? (ProcessState)processStateStruct.NextStateOnSuccess : - processStateStruct.ErrorExitState; - } - else - { - _stateMachineState = ProcessState.Error; - } - break; - - case ProcessState.RepeatFailedTests: - _stateMachineState = RepeatFailedTests(); - break; - - case ProcessState.AbortTest: - AbortProcesses(); - _stateMachineState = ProcessState.Idle; - break; - - case ProcessState.Stop: + // Check if state is the first in the list of production processes to reset cancellationToken and + // calculate the over all process steps to feed the progress bars. + var startProcessState = _processStateDef.GetStateOfFirstProcess(); + if (startProcessState == _stateMachineState) + { + // Kill all processes at start KillProcesses(); - _stateMachineState = ProcessState.Idle; - break; + // Avoid immediately cancellation for first process of the process chain + ResetCancellationToken(); + // Set up the counter for maximum overall process progress bar in GUI + CalcAndPushMaxOverAllProcessSteps(); + } - case ProcessState.Error: - // Common error handling routine - ProcessErrorHandler(_stateChangeRequestProcess); - // Start the error handler with its user feedback request. It has to be started - // always even if the abortion of all processes is required! The error handler - // will change the exit state based on the user input. - StartProcess(processStateStruct); - break; + // Get the processStateStruct of this new required stateMachineState + var processStateStruct = _processStateDef.GetProcessStateStructOfState(_stateMachineState); - case ProcessState.StateListDelimiter: - _stateMachineState = ProcessState.Idle; - break; + switch (_stateMachineState) + { + case ProcessState.Idle: + break; - default: - // This is the call to the processes for a specific test - StartProcess(processStateStruct); - if (processStateStruct.KickOffParallelState != null) - { - _stateMachineState = (ProcessState)processStateStruct.KickOffParallelState; - } - break; + case ProcessState.CheckNewMeter: + // Detection of Cordonel has to be completed before assigning next state. It has to be checked if + // the meter changed to clear all collected contents of previous run. To UPDATE ALL INFORMATION after + // new meter assignment the "DetectCordonel" has to be repeated to return here "Old Meter" and then + // enter the "ConnectCordonel"! + if (processStateStruct.NextStateOnSuccess != null) + { + _stateMachineState = CheckForNewMeter() + ? (ProcessState)processStateStruct.NextStateOnSuccess + : processStateStruct.ErrorExitState; + } + else + { + _stateMachineState = ProcessState.Error; + } + + break; + + case ProcessState.RepeatFailedTests: + _stateMachineState = RepeatFailedTests(); + break; + + case ProcessState.AbortTest: + AbortProcesses(); + _stateMachineState = ProcessState.Idle; + break; + + case ProcessState.Stop: + KillProcesses(); + _stateMachineState = ProcessState.Idle; + break; + + case ProcessState.Error: + // Common error handling routine + ProcessErrorHandler(_stateChangeRequestProcess); + // Start the error handler with its user feedback request. It has to be started + // always even if the abortion of all processes is required! The error handler + // will change the exit state based on the user input. + StartProcess(processStateStruct); + break; + + case ProcessState.StateListDelimiter: + _stateMachineState = ProcessState.Idle; + break; + + default: + // This is the call to the processes for a specific test + StartProcess(processStateStruct); + if (processStateStruct.KickOffParallelState != null) + { + _stateMachineState = (ProcessState)processStateStruct.KickOffParallelState; + } + + break; + } } } catch (ThreadAbortException ex) @@ -451,7 +457,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses } } } - + /// /// Returns the currentGenesis information for display /// @@ -463,7 +469,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses { return _cordonelRequirements; } - + /// /// Returns the currentGenesis information for display /// @@ -475,8 +481,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses { return _genesisMeter; } - - + + /// /// Clears all collected data on new genesisMeter and reminds the detected for next /// detection and run of this comparison. @@ -520,7 +526,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses InitNewMeter(); InitProcesses(ppNo); ResetCancellationToken(); - + // Remind actual genesis for next call _lastPcbId = _genesisMeter?.PcbId; @@ -578,7 +584,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses return state; } - + /// /// Error handler /// @@ -609,6 +615,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses pp.RetryProcess(); pp = _processStateDef.GetProcessOfState(ProcessState.RebootCordonel); pp.RetryProcess(); + pp = _processStateDef.GetProcessOfState(ProcessState.CheckRadio); + pp.RetryProcess(); pp = _processStateDef.GetProcessOfState(ProcessState.CheckFinalParametrization); pp.RetryProcess(); } @@ -629,7 +637,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses OnProcessProgressChanged?.Invoke(this, new ProcessProgressArgs(_maxOverallProcessesSteps, ProcessProgressArgs.ProcessProgressType.MaxOverallProcessSteps)); } - + /// /// Calculate all processes which are completed or skipped and signal to GUI. /// @@ -676,9 +684,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses process.IdleProcess(); // All processes from and behind this process will be killed to kep the preceding as is - else if ( _processStateDef.GetProductionProcessNoOfProcess(process) >= productionProcessNo) + else if (_processStateDef.GetProductionProcessNoOfProcess(process) >= productionProcessNo) process.IdleProcess(); - + // Add process to list to feed the process window in main screen if (Processes.All(pp => pp.ProcessName != process.ProcessName)) { @@ -922,7 +930,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses if (productionProcessNo == null) pp.IdleProcess(); // All processes from and behind this process will be killed to kep the preceding as is - else if ( _processStateDef.GetProductionProcessNoOfProcess(pp) >= productionProcessNo) + else if (_processStateDef.GetProductionProcessNoOfProcess(pp) >= productionProcessNo) pp.IdleProcess(); } } diff --git a/Common/Production/ProductionUiCordonel/Properties/Resources.Designer.cs b/Common/Production/ProductionUiCordonel/Properties/Resources.Designer.cs index 42ea54cb..8e5ed948 100644 --- a/Common/Production/ProductionUiCordonel/Properties/Resources.Designer.cs +++ b/Common/Production/ProductionUiCordonel/Properties/Resources.Designer.cs @@ -933,6 +933,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties { } } + /// + /// Looks up a localized string similar to ERROR: RSSI SIRT could not be initialized . + /// + internal static string StrErrorMsgRssiSirt { + get { + return ResourceManager.GetString("StrErrorMsgRssiSirt", resourceCulture); + } + } + /// /// Looks up a localized string similar to ERROR: Order number scan failed. /// @@ -978,6 +987,24 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties { } } + /// + /// Looks up a localized string similar to ERROR: Service SIRT programming failed . + /// + internal static string StrErrorMsgServiceSirtProgramming { + get { + return ResourceManager.GetString("StrErrorMsgServiceSirtProgramming", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ERROR: Service SIRT message server start failed . + /// + internal static string StrErrorMsgServiceSirtServerStart { + get { + return ResourceManager.GetString("StrErrorMsgServiceSirtServerStart", resourceCulture); + } + } + /// /// Looks up a localized string similar to ERROR: Error saving RSSI to database failed. /// @@ -987,15 +1014,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties { } } - /// - /// Looks up a localized string similar to ERROR: SIRT could not be initialized . - /// - internal static string StrErrorMsgSirt { - get { - return ResourceManager.GetString("StrErrorMsgSirt", resourceCulture); - } - } - /// /// Looks up a localized string similar to ERROR: SIRT telegram is too short. /// @@ -2058,6 +2076,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties { } } + /// + /// Looks up a localized string similar to Alarm settings via radio. + /// + internal static string StrStateRadioAlarmSetupOverTheAir { + get { + return ResourceManager.GetString("StrStateRadioAlarmSetupOverTheAir", resourceCulture); + } + } + /// /// Looks up a localized string similar to Check radio. /// @@ -2498,5 +2525,14 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties { return ResourceManager.GetString("StrWarningMsgRepeatedAccumulatorReset", resourceCulture); } } + + /// + /// Looks up a localized string similar to WARNING: Service SIRT alarm mask setup skipped . + /// + internal static string StrWarningMsgServiceSirtSkipped { + get { + return ResourceManager.GetString("StrWarningMsgServiceSirtSkipped", resourceCulture); + } + } } } diff --git a/Common/Production/ProductionUiCordonel/Properties/Resources.de.resx b/Common/Production/ProductionUiCordonel/Properties/Resources.de.resx index 65982e8f..69bc09fb 100644 --- a/Common/Production/ProductionUiCordonel/Properties/Resources.de.resx +++ b/Common/Production/ProductionUiCordonel/Properties/Resources.de.resx @@ -270,6 +270,9 @@ Funktest + + + Alarmeinstellungen über Funk Cordonel ist versandfertig @@ -424,8 +427,17 @@ FEHLER: Funkmodul nicht im Kundenmodus - - FEHLER: SIRT konnte nicht initialisiert werden + + FEHLER: RSSI SIRT konnte nicht initialisiert werden + + + FEHLER: Service SIRT Programmierung fehlgeschlagen + + + FEHLER: Service SIRT Start des Messageserves fehlgeschlagen + + + WARNUNG: Service SIRT Alarmmaskeneinstellung übersprungen FEHLER: Funkverschlüsselungscode fehlerhaft diff --git a/Common/Production/ProductionUiCordonel/Properties/Resources.resx b/Common/Production/ProductionUiCordonel/Properties/Resources.resx index a5bd96f2..fb9a72cc 100644 --- a/Common/Production/ProductionUiCordonel/Properties/Resources.resx +++ b/Common/Production/ProductionUiCordonel/Properties/Resources.resx @@ -270,6 +270,9 @@ Check radio + + + Alarm settings via radio Cordonel is ready for shipping @@ -424,8 +427,17 @@ ERROR: Radio not in customer mode - - ERROR: SIRT could not be initialized + + ERROR: RSSI SIRT could not be initialized + + + ERROR: Service SIRT programming failed + + + ERROR: Service SIRT message server start failed + + + WARNING: Service SIRT alarm mask setup skipped ERROR: Radio encryption code wrong diff --git a/Common/TempFlansh/Form1.cs b/Common/TempFlansh/Form1.cs index 72b7711b..acbaf363 100644 --- a/Common/TempFlansh/Form1.cs +++ b/Common/TempFlansh/Form1.cs @@ -162,7 +162,7 @@ namespace TempFlansh catch (Exception ex) { txtLuts.Text = "-"; - MessageBox.Show(ex.Message); + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); SetEnable(programmState.Start); } } diff --git a/Common/Ui/GenesisToolBox/FrmFwUpdate.Designer.cs b/Common/Ui/GenesisToolBox/FrmFwUpdate.Designer.cs index c875aeb9..287d714c 100644 --- a/Common/Ui/GenesisToolBox/FrmFwUpdate.Designer.cs +++ b/Common/Ui/GenesisToolBox/FrmFwUpdate.Designer.cs @@ -109,6 +109,7 @@ this.chbFilterIsDeveloper = new System.Windows.Forms.CheckBox(); this.saveConfigFile = new System.Windows.Forms.SaveFileDialog(); this.lblConfigVersion = new System.Windows.Forms.Label(); + this.cbxUseOfflinePwds = new System.Windows.Forms.CheckBox(); this.grpSetup.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox4.SuspendLayout(); @@ -130,6 +131,7 @@ // // grpSetup // + this.grpSetup.Controls.Add(this.cbxUseOfflinePwds); this.grpSetup.Controls.Add(this.lblCoreRevision); this.grpSetup.Controls.Add(this.btnConnect); this.grpSetup.Controls.Add(this.lblConnectPcb); @@ -153,7 +155,7 @@ // // btnConnect // - this.btnConnect.Location = new System.Drawing.Point(8, 96); + this.btnConnect.Location = new System.Drawing.Point(102, 91); this.btnConnect.Name = "btnConnect"; this.btnConnect.Size = new System.Drawing.Size(116, 24); this.btnConnect.TabIndex = 24; @@ -164,7 +166,7 @@ // lblConnectPcb // this.lblConnectPcb.AutoSize = true; - this.lblConnectPcb.Location = new System.Drawing.Point(7, 20); + this.lblConnectPcb.Location = new System.Drawing.Point(7, 24); this.lblConnectPcb.Name = "lblConnectPcb"; this.lblConnectPcb.Size = new System.Drawing.Size(100, 13); this.lblConnectPcb.TabIndex = 23; @@ -173,7 +175,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(7, 68); + this.label2.Location = new System.Drawing.Point(7, 96); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(28, 13); this.label2.TabIndex = 20; @@ -203,7 +205,7 @@ "18", "19", "20"}); - this.cbComSlot.Location = new System.Drawing.Point(41, 65); + this.cbComSlot.Location = new System.Drawing.Point(41, 93); this.cbComSlot.Name = "cbComSlot"; this.cbComSlot.Size = new System.Drawing.Size(37, 21); this.cbComSlot.TabIndex = 5; @@ -986,6 +988,17 @@ this.lblConfigVersion.TabIndex = 31; this.lblConfigVersion.Text = "Configuration Version: ?"; // + // cbxUseOfflinePwds + // + this.cbxUseOfflinePwds.AutoSize = true; + this.cbxUseOfflinePwds.Location = new System.Drawing.Point(10, 65); + this.cbxUseOfflinePwds.Name = "cbxUseOfflinePwds"; + this.cbxUseOfflinePwds.Size = new System.Drawing.Size(132, 17); + this.cbxUseOfflinePwds.TabIndex = 26; + this.cbxUseOfflinePwds.Text = "Use Offline Passwords"; + this.cbxUseOfflinePwds.UseVisualStyleBackColor = true; + this.cbxUseOfflinePwds.CheckedChanged += new System.EventHandler(this.cbxUseOfflinePwds_CheckedChanged); + // // FrmFwUpdate // this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound; @@ -1116,5 +1129,6 @@ private System.Windows.Forms.Button btnRebootMeter; private System.Windows.Forms.CheckBox cbxMetUpdPerm; private System.Windows.Forms.Label lblConfigVersion; + private System.Windows.Forms.CheckBox cbxUseOfflinePwds; } } \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/FrmFwUpdate.cs b/Common/Ui/GenesisToolBox/FrmFwUpdate.cs index 86d0259c..b53ec3e0 100644 --- a/Common/Ui/GenesisToolBox/FrmFwUpdate.cs +++ b/Common/Ui/GenesisToolBox/FrmFwUpdate.cs @@ -625,6 +625,12 @@ namespace Xylem.Common.Ui.GenesisToolBox /// /// - Compare the max supported FW versions of the configuration.json. /// + /// + /// - Catch error message on unknown data type and kill meter. + /// + /// + /// - Use optional offline passwords. + /// private void Connect() { try @@ -636,27 +642,28 @@ namespace Xylem.Common.Ui.GenesisToolBox { return; } + lblOverall.Text = @"Login to Cordonel..."; - lblOverall.Text = @"Establish data base connection.."; + ViewProgressPcb(true); + + _currentGenesis?.DisposeMeter(); + //dispose old meter + _meterBatch.RemoveAllMeters(); + _currentGenesis = null; + + //assign new meter and assign meter to FW update file if this exists + _currentGenesis = new GenesisMeter(); + _currentGenesis.UseOfflinePasswords = cbxUseOfflinePwds.Checked; + _currentGenesis.SetupFromConfigFile(slotNr); + _meterBatch.AddMeter(_currentGenesis); + + _currentGenesis.Configuration.UseRegisterWatchService = false; + _currentGenesis.Configuration.UseMinMaxCheck = false; + + lblActualProcess.Text = @"Connecting to PCB..."; Task.Factory.StartNew(() => { - ViewProgressPcb(true); - - _currentGenesis?.DisposeMeter(); - //dispose old meter - _meterBatch.RemoveAllMeters(); - _currentGenesis = null; - Thread.Sleep(200); - - //assign new meter and assign meter to FW update file if this exists - _currentGenesis = new GenesisMeter(); - - _currentGenesis.SetupFromConfigFile(slotNr); - _meterBatch.AddMeter(_currentGenesis); - - _currentGenesis.Configuration.UseRegisterWatchService = false; - _currentGenesis.Configuration.UseMinMaxCheck = false; _meterBatch.MetersLogin(); if (!_currentGenesis.IsLoggedOn) @@ -701,7 +708,12 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(ex.Message); + ViewProgressPcb(false); + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); + // Dispose meter + _meterBatch.RemoveAllMeters(); + // If meter is not already assigned to batch as the config reader may fail + _currentGenesis?.DisposeMeter(); } } #endregion @@ -1533,6 +1545,10 @@ namespace Xylem.Common.Ui.GenesisToolBox } #endregion #region CheckBoxes + private void cbxUseOfflinePwds_CheckedChanged(Object sender, EventArgs e) + { + cbxUseOfflinePwds.ForeColor = cbxUseOfflinePwds.Checked ? Color.Red : Color.Black; + } /// /// File parts are consecutive, stop process at first failed part and retry from /// this part on all others behind @@ -1567,6 +1583,11 @@ namespace Xylem.Common.Ui.GenesisToolBox cbxConsecutiveFilePartsRetryEnable.Checked = false; } + private void cbxStoreConfigEnable_CheckedChanged(Object sender, EventArgs e) + { + if (_meterFwUpdate != null) + _meterFwUpdate.StoreConfigEnable = cbxStoreConfigEnable.Checked; + } /// /// Activation of manual control buttons for individual update procedure /// @@ -1920,12 +1941,6 @@ namespace Xylem.Common.Ui.GenesisToolBox lblOverall.Visible = false; } - private void cbxStoreConfigEnable_CheckedChanged(Object sender, EventArgs e) - { - if (_meterFwUpdate != null) - _meterFwUpdate.StoreConfigEnable = cbxStoreConfigEnable.Checked; - } - #endregion } diff --git a/Common/Ui/GenesisToolBox/FrmFwUpdate.resx b/Common/Ui/GenesisToolBox/FrmFwUpdate.resx index 74104195..6e475939 100644 --- a/Common/Ui/GenesisToolBox/FrmFwUpdate.resx +++ b/Common/Ui/GenesisToolBox/FrmFwUpdate.resx @@ -132,6 +132,12 @@ True + + True + + + True + 465, 17 diff --git a/Common/Ui/GenesisToolBox/FrmLog.cs b/Common/Ui/GenesisToolBox/FrmLog.cs index 21beb7e2..2b8d26f0 100644 --- a/Common/Ui/GenesisToolBox/FrmLog.cs +++ b/Common/Ui/GenesisToolBox/FrmLog.cs @@ -33,6 +33,9 @@ namespace Xylem.Common.Ui.GenesisToolBox Connect(); } + /// + /// - Catch error message on unknown data type and kill meter. + /// private void Connect() { try @@ -238,7 +241,12 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(ex.Message); + ViewProgressPcb(false); + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); + // Dispose meter + _meterBatch.RemoveAllMeters(); + // If meter is not already assigned to batch as the config reader may fail + _currentGenesis?.DisposeMeter(); } } diff --git a/Common/Ui/GenesisToolBox/FrmLowLevelTools.Designer.cs b/Common/Ui/GenesisToolBox/FrmLowLevelTools.Designer.cs index f62f01ac..844c21ae 100644 --- a/Common/Ui/GenesisToolBox/FrmLowLevelTools.Designer.cs +++ b/Common/Ui/GenesisToolBox/FrmLowLevelTools.Designer.cs @@ -84,8 +84,8 @@ this.label3 = new System.Windows.Forms.Label(); this.tbxFileToEraseDrive = new System.Windows.Forms.TextBox(); this.btnEraseFile = new System.Windows.Forms.Button(); - this.btnPwdCheck = new System.Windows.Forms.Button(); this.lblConfigVersion = new System.Windows.Forms.Label(); + this.cbxUseOfflinePwds = new System.Windows.Forms.CheckBox(); this.grpSetup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.groupBox1.SuspendLayout(); @@ -95,6 +95,7 @@ // // grpSetup // + this.grpSetup.Controls.Add(this.cbxUseOfflinePwds); this.grpSetup.Controls.Add(this.tbxDateTime); this.grpSetup.Controls.Add(this.label1); this.grpSetup.Controls.Add(this.label10); @@ -109,16 +110,19 @@ this.grpSetup.Controls.Add(this.label6); this.grpSetup.Controls.Add(this.lblFwVersion); this.grpSetup.Controls.Add(this.lblConnectPcb); - this.grpSetup.Location = new System.Drawing.Point(12, 69); + this.grpSetup.Controls.Add(this.label2); + this.grpSetup.Controls.Add(this.btnConnect); + this.grpSetup.Controls.Add(this.cbComSlot); + this.grpSetup.Location = new System.Drawing.Point(12, 79); this.grpSetup.Name = "grpSetup"; - this.grpSetup.Size = new System.Drawing.Size(257, 273); + this.grpSetup.Size = new System.Drawing.Size(257, 280); this.grpSetup.TabIndex = 24; this.grpSetup.TabStop = false; - this.grpSetup.Text = "Cordonel Info"; + this.grpSetup.Text = "Cordonel"; // // tbxDateTime // - this.tbxDateTime.Location = new System.Drawing.Point(130, 207); + this.tbxDateTime.Location = new System.Drawing.Point(130, 255); this.tbxDateTime.Name = "tbxDateTime"; this.tbxDateTime.ReadOnly = true; this.tbxDateTime.Size = new System.Drawing.Size(116, 20); @@ -127,7 +131,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(10, 210); + this.label1.Location = new System.Drawing.Point(11, 258); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(87, 13); this.label1.TabIndex = 37; @@ -136,7 +140,7 @@ // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(10, 180); + this.label10.Location = new System.Drawing.Point(11, 230); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(116, 13); this.label10.TabIndex = 36; @@ -144,7 +148,7 @@ // // tbxRadio // - this.tbxRadio.Location = new System.Drawing.Point(130, 177); + this.tbxRadio.Location = new System.Drawing.Point(130, 227); this.tbxRadio.Name = "tbxRadio"; this.tbxRadio.ReadOnly = true; this.tbxRadio.Size = new System.Drawing.Size(116, 20); @@ -152,7 +156,7 @@ // // tbxRegion // - this.tbxRegion.Location = new System.Drawing.Point(130, 147); + this.tbxRegion.Location = new System.Drawing.Point(130, 198); this.tbxRegion.Name = "tbxRegion"; this.tbxRegion.ReadOnly = true; this.tbxRegion.Size = new System.Drawing.Size(116, 20); @@ -161,7 +165,7 @@ // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(10, 150); + this.label8.Location = new System.Drawing.Point(11, 201); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(44, 13); this.label8.TabIndex = 33; @@ -169,7 +173,7 @@ // // tbxPcbId // - this.tbxPcbId.Location = new System.Drawing.Point(130, 27); + this.tbxPcbId.Location = new System.Drawing.Point(130, 77); this.tbxPcbId.Name = "tbxPcbId"; this.tbxPcbId.ReadOnly = true; this.tbxPcbId.Size = new System.Drawing.Size(116, 20); @@ -177,7 +181,7 @@ // // tbxMeterFw // - this.tbxMeterFw.Location = new System.Drawing.Point(130, 57); + this.tbxMeterFw.Location = new System.Drawing.Point(130, 107); this.tbxMeterFw.Name = "tbxMeterFw"; this.tbxMeterFw.ReadOnly = true; this.tbxMeterFw.Size = new System.Drawing.Size(116, 20); @@ -185,7 +189,7 @@ // // tbxMeterMeterSize // - this.tbxMeterMeterSize.Location = new System.Drawing.Point(130, 117); + this.tbxMeterMeterSize.Location = new System.Drawing.Point(130, 167); this.tbxMeterMeterSize.Name = "tbxMeterMeterSize"; this.tbxMeterMeterSize.ReadOnly = true; this.tbxMeterMeterSize.Size = new System.Drawing.Size(116, 20); @@ -193,7 +197,7 @@ // // tbxMeterLutCrc // - this.tbxMeterLutCrc.Location = new System.Drawing.Point(130, 87); + this.tbxMeterLutCrc.Location = new System.Drawing.Point(130, 138); this.tbxMeterLutCrc.Name = "tbxMeterLutCrc"; this.tbxMeterLutCrc.ReadOnly = true; this.tbxMeterLutCrc.Size = new System.Drawing.Size(116, 20); @@ -202,7 +206,7 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(10, 120); + this.label5.Location = new System.Drawing.Point(11, 171); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(60, 13); this.label5.TabIndex = 28; @@ -211,7 +215,7 @@ // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(10, 90); + this.label6.Location = new System.Drawing.Point(11, 141); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(86, 13); this.label6.TabIndex = 27; @@ -220,7 +224,7 @@ // lblFwVersion // this.lblFwVersion.AutoSize = true; - this.lblFwVersion.Location = new System.Drawing.Point(10, 60); + this.lblFwVersion.Location = new System.Drawing.Point(10, 110); this.lblFwVersion.Name = "lblFwVersion"; this.lblFwVersion.Size = new System.Drawing.Size(57, 13); this.lblFwVersion.TabIndex = 25; @@ -229,7 +233,7 @@ // lblConnectPcb // this.lblConnectPcb.AutoSize = true; - this.lblConnectPcb.Location = new System.Drawing.Point(10, 29); + this.lblConnectPcb.Location = new System.Drawing.Point(11, 80); this.lblConnectPcb.Name = "lblConnectPcb"; this.lblConnectPcb.Size = new System.Drawing.Size(33, 13); this.lblConnectPcb.TabIndex = 23; @@ -237,7 +241,7 @@ // // btnConnect // - this.btnConnect.Location = new System.Drawing.Point(363, 29); + this.btnConnect.Location = new System.Drawing.Point(130, 44); this.btnConnect.Name = "btnConnect"; this.btnConnect.Size = new System.Drawing.Size(116, 25); this.btnConnect.TabIndex = 24; @@ -248,7 +252,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(282, 32); + this.label2.Location = new System.Drawing.Point(11, 50); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(28, 13); this.label2.TabIndex = 20; @@ -278,7 +282,7 @@ "18", "19", "20"}); - this.cbComSlot.Location = new System.Drawing.Point(316, 29); + this.cbComSlot.Location = new System.Drawing.Point(45, 47); this.cbComSlot.Name = "cbComSlot"; this.cbComSlot.Size = new System.Drawing.Size(37, 21); this.cbComSlot.TabIndex = 5; @@ -287,7 +291,7 @@ // // btnClearDisplay // - this.btnClearDisplay.Location = new System.Drawing.Point(10, 24); + this.btnClearDisplay.Location = new System.Drawing.Point(10, 14); this.btnClearDisplay.Name = "btnClearDisplay"; this.btnClearDisplay.Size = new System.Drawing.Size(116, 25); this.btnClearDisplay.TabIndex = 33; @@ -348,7 +352,7 @@ // this.lblFwUpdateInfo.AutoSize = true; this.lblFwUpdateInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFwUpdateInfo.Location = new System.Drawing.Point(18, 29); + this.lblFwUpdateInfo.Location = new System.Drawing.Point(18, 34); this.lblFwUpdateInfo.Name = "lblFwUpdateInfo"; this.lblFwUpdateInfo.Size = new System.Drawing.Size(72, 13); this.lblFwUpdateInfo.TabIndex = 27; @@ -374,9 +378,9 @@ this.groupBox1.Controls.Add(this.btnStoreConfiguration); this.groupBox1.Controls.Add(this.btnFixBattery); this.groupBox1.Controls.Add(this.btnClearDisplay); - this.groupBox1.Location = new System.Drawing.Point(275, 69); + this.groupBox1.Location = new System.Drawing.Point(275, 79); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(136, 291); + this.groupBox1.Size = new System.Drawing.Size(136, 280); this.groupBox1.TabIndex = 28; this.groupBox1.TabStop = false; this.groupBox1.Text = "Tools"; @@ -384,7 +388,7 @@ // btnRepairPassword // this.btnRepairPassword.Enabled = false; - this.btnRepairPassword.Location = new System.Drawing.Point(10, 262); + this.btnRepairPassword.Location = new System.Drawing.Point(10, 252); this.btnRepairPassword.Name = "btnRepairPassword"; this.btnRepairPassword.Size = new System.Drawing.Size(116, 25); this.btnRepairPassword.TabIndex = 41; @@ -394,7 +398,7 @@ // // btnPulseModeOff // - this.btnPulseModeOff.Location = new System.Drawing.Point(10, 205); + this.btnPulseModeOff.Location = new System.Drawing.Point(10, 195); this.btnPulseModeOff.Name = "btnPulseModeOff"; this.btnPulseModeOff.Size = new System.Drawing.Size(116, 25); this.btnPulseModeOff.TabIndex = 40; @@ -404,7 +408,7 @@ // // btnTidyFile // - this.btnTidyFile.Location = new System.Drawing.Point(10, 174); + this.btnTidyFile.Location = new System.Drawing.Point(10, 164); this.btnTidyFile.Name = "btnTidyFile"; this.btnTidyFile.Size = new System.Drawing.Size(116, 25); this.btnTidyFile.TabIndex = 39; @@ -414,7 +418,7 @@ // // btnGetDateTime // - this.btnGetDateTime.Location = new System.Drawing.Point(10, 144); + this.btnGetDateTime.Location = new System.Drawing.Point(10, 134); this.btnGetDateTime.Name = "btnGetDateTime"; this.btnGetDateTime.Size = new System.Drawing.Size(116, 25); this.btnGetDateTime.TabIndex = 38; @@ -424,7 +428,7 @@ // // btnSetDateTime // - this.btnSetDateTime.Location = new System.Drawing.Point(10, 114); + this.btnSetDateTime.Location = new System.Drawing.Point(10, 104); this.btnSetDateTime.Name = "btnSetDateTime"; this.btnSetDateTime.Size = new System.Drawing.Size(116, 25); this.btnSetDateTime.TabIndex = 37; @@ -434,7 +438,7 @@ // // btnRebootMeter // - this.btnRebootMeter.Location = new System.Drawing.Point(10, 234); + this.btnRebootMeter.Location = new System.Drawing.Point(10, 224); this.btnRebootMeter.Name = "btnRebootMeter"; this.btnRebootMeter.Size = new System.Drawing.Size(116, 25); this.btnRebootMeter.TabIndex = 36; @@ -444,7 +448,7 @@ // // btnStoreConfiguration // - this.btnStoreConfiguration.Location = new System.Drawing.Point(10, 84); + this.btnStoreConfiguration.Location = new System.Drawing.Point(10, 74); this.btnStoreConfiguration.Name = "btnStoreConfiguration"; this.btnStoreConfiguration.Size = new System.Drawing.Size(116, 25); this.btnStoreConfiguration.TabIndex = 35; @@ -454,7 +458,7 @@ // // btnFixBattery // - this.btnFixBattery.Location = new System.Drawing.Point(10, 54); + this.btnFixBattery.Location = new System.Drawing.Point(10, 44); this.btnFixBattery.Name = "btnFixBattery"; this.btnFixBattery.Size = new System.Drawing.Size(116, 25); this.btnFixBattery.TabIndex = 34; @@ -514,9 +518,9 @@ this.groupBox2.Controls.Add(this.btnListFileDetails); this.groupBox2.Controls.Add(this.btnReadLogFiles); this.groupBox2.Controls.Add(this.btnUploadConfig); - this.groupBox2.Location = new System.Drawing.Point(417, 69); + this.groupBox2.Location = new System.Drawing.Point(417, 80); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(136, 259); + this.groupBox2.Size = new System.Drawing.Size(136, 280); this.groupBox2.TabIndex = 37; this.groupBox2.TabStop = false; this.groupBox2.Text = "Log"; @@ -604,7 +608,7 @@ this.groupBox3.Controls.Add(this.label3); this.groupBox3.Controls.Add(this.tbxFileToEraseDrive); this.groupBox3.Controls.Add(this.btnEraseFile); - this.groupBox3.Location = new System.Drawing.Point(559, 69); + this.groupBox3.Location = new System.Drawing.Point(559, 80); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(136, 123); this.groupBox3.TabIndex = 40; @@ -656,27 +660,27 @@ this.btnEraseFile.UseVisualStyleBackColor = true; this.btnEraseFile.Click += new System.EventHandler(this.btnEraseFile_Click); // - // btnPwdCheck - // - this.btnPwdCheck.Location = new System.Drawing.Point(485, 29); - this.btnPwdCheck.Name = "btnPwdCheck"; - this.btnPwdCheck.Size = new System.Drawing.Size(109, 25); - this.btnPwdCheck.TabIndex = 41; - this.btnPwdCheck.Text = "Password Check"; - this.btnPwdCheck.UseVisualStyleBackColor = true; - this.btnPwdCheck.Visible = false; - this.btnPwdCheck.Click += new System.EventHandler(this.btnConnectSkeleton_Click); - // // lblConfigVersion // this.lblConfigVersion.AutoSize = true; this.lblConfigVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblConfigVersion.Location = new System.Drawing.Point(18, 48); + this.lblConfigVersion.Location = new System.Drawing.Point(18, 56); this.lblConfigVersion.Name = "lblConfigVersion"; this.lblConfigVersion.Size = new System.Drawing.Size(119, 13); this.lblConfigVersion.TabIndex = 41; this.lblConfigVersion.Text = "Configuration Version: ?"; // + // cbxUseOfflinePwds + // + this.cbxUseOfflinePwds.AutoSize = true; + this.cbxUseOfflinePwds.Location = new System.Drawing.Point(14, 19); + this.cbxUseOfflinePwds.Name = "cbxUseOfflinePwds"; + this.cbxUseOfflinePwds.Size = new System.Drawing.Size(132, 17); + this.cbxUseOfflinePwds.TabIndex = 42; + this.cbxUseOfflinePwds.Text = "Use Offline Passwords"; + this.cbxUseOfflinePwds.UseVisualStyleBackColor = true; + this.cbxUseOfflinePwds.CheckedChanged += new System.EventHandler(this.cbxUseOfflinePwds_CheckedChanged); + // // FrmLowLevelTools // this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound; @@ -698,10 +702,6 @@ this.Controls.Add(this.lblActualProcess); this.Controls.Add(this.grpSetup); this.Controls.Add(this.barOverallProgressUpdate); - this.Controls.Add(this.btnConnect); - this.Controls.Add(this.btnPwdCheck); - this.Controls.Add(this.cbComSlot); - this.Controls.Add(this.label2); this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(739, 500); this.MinimizeBox = false; @@ -779,7 +779,7 @@ private System.Windows.Forms.Button btnReadPowCorr; private System.Windows.Forms.Button btnReadStatus; private System.Windows.Forms.Button btnRepairPassword; - private System.Windows.Forms.Button btnPwdCheck; private System.Windows.Forms.Label lblConfigVersion; + private System.Windows.Forms.CheckBox cbxUseOfflinePwds; } } \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs b/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs index 0a2fb08d..b7c347ed 100644 --- a/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs +++ b/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs @@ -259,6 +259,9 @@ namespace Xylem.Common.Ui.GenesisToolBox /// /// - Compare the max supported FW versions of the configuration.json. /// + /// + /// - Catch error message on unknown data type and kill meter. + /// private void Connect() { try @@ -271,39 +274,41 @@ namespace Xylem.Common.Ui.GenesisToolBox return; } lblOverall.Text = @"Login to Cordonel..."; - lblActualProcess.Text = @"Establish data base connection..."; + + ViewProgressPcb(true); + + _currentGenesis?.DisposeMeter(); + //dispose old meter + _meterBatch.RemoveAllMeters(); + _currentGenesis = null; + + //assign new meter and assign meter to FW update file if this exists + _currentGenesis = new GenesisMeter(); + _currentGenesis.UseOfflinePasswords = cbxUseOfflinePwds.Checked; + _currentGenesis.SetupFromConfigFile(slotNr); + _meterBatch.AddMeter(_currentGenesis); + + _currentGenesis.Configuration.UseRegisterWatchService = false; + _currentGenesis.Configuration.UseMinMaxCheck = false; + + lblActualProcess.Text = @"Connecting to PCB..."; Task.Factory.StartNew(() => { - ViewProgressPcb(true); - - _currentGenesis?.DisposeMeter(); - //dispose old meter - _meterBatch.RemoveAllMeters(); - _currentGenesis = null; - - //assign new meter and assign meter to FW update file if this exists - _currentGenesis = new GenesisMeter(); - - _currentGenesis.SetupFromConfigFile(slotNr); - _meterBatch.AddMeter(_currentGenesis); - - _currentGenesis.Configuration.UseRegisterWatchService = false; - _currentGenesis.Configuration.UseMinMaxCheck = false; - - Invoke(new Action(() => { lblActualProcess.Text = @"Connecting to PCB..."; })); _meterBatch.MetersLogin(); var retValPwdBuild = MeterPwdHandlerDb.RequestPwdFileFromDb(_currentGenesis.PcbId, out var pwdContainer); - // CASE 1: - Passwords are generated in database but password file is not installed or doesn't work. - // - The production password is the SkeletonKey as the login succeeded. - // - // If password file is initially not installed and the database password returned the SkeletonKey - // the login has been successfully executed with this SkeletonKey, so a repair of the password - // file needs to be enabled! + // CASE 1: - The 'production password' is the 'Lvl8 password' as the login succeeded. + if (retValPwdBuild && _currentGenesis.IsLoggedOn && pwdContainer.Skeleton.Equals(pwdContainer.Password)) { + // CASE 2: - Passwords are generated in database but password file is not installed or doesn't work. + // - The 'production password' is the 'SkeletonKey' as the login succeeded. + // + // If password file is initially not installed and the database password returned the SkeletonKey + // the login has been successfully executed with this SkeletonKey, so a repair of the password + // file needs to be enabled! ShowPasswordRepairMessage(@"Password exists on database but the SkeletonKey is valid - [Repair Password] enabled"); } @@ -314,9 +319,8 @@ namespace Xylem.Common.Ui.GenesisToolBox // Try to log in with password level 8 which may not be published to the database var retVal = _currentGenesis.Login(Encoding.UTF8.GetString(pwdContainer.ListOfPasswords.Last())); - // CASE 2: - Passwords are generated in database and correctly installed. The login check will be done - // with the generated password, but the production password is still on SkeletonKey. - // - The production password is the SkeletonKey as login succeeded. + // CASE 3: - Passwords are generated in database and correctly installed. The login check will be done + // with the generated password, but the 'production password' is still the 'SkeletonKey'. // - The database update of the production password went wrong! if (_currentGenesis.IsLoggedOn && retVal) { @@ -332,7 +336,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { // This is needed from meter as an unsuccessful login requires a delay for the next trial Thread.Sleep(4000); - // CASE 3: - The production password didn't work, so the SkeletonKey will be tried. + // CASE 4: - The production password didn't work, so the SkeletonKey will be tried. if (_currentGenesis.Login(pwdContainer.Skeleton)) { ShowPasswordRepairMessage(@"Successfully logged in with SkeletonKey - [Repair Password] enabled"); @@ -458,8 +462,13 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(ex.Message); + ViewProgressPcb(false); + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); LogErrorText(ex.Message); + // Dispose meter + _meterBatch.RemoveAllMeters(); + // If meter is not already assigned to batch as the config reader may fail + _currentGenesis?.DisposeMeter(); } } @@ -2071,7 +2080,7 @@ namespace Xylem.Common.Ui.GenesisToolBox // Reset timer _startTime = DateTimeOffset.UtcNow; LowLevelActionControl(true); - + var msg = "Repair password"; LogText(msg); lblOverall.Text = msg; @@ -2197,6 +2206,11 @@ namespace Xylem.Common.Ui.GenesisToolBox ExportDate = exportDate; } } + + private void cbxUseOfflinePwds_CheckedChanged(Object sender, EventArgs e) + { + cbxUseOfflinePwds.ForeColor = cbxUseOfflinePwds.Checked ? Color.Red : Color.Black; + } } } diff --git a/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs b/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs index d6b6b9f2..6e2c8d6d 100644 --- a/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs +++ b/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs @@ -78,6 +78,7 @@ this.lblUpdateTime = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.lblConfigVersion = new System.Windows.Forms.Label(); + this.cbxUseOfflinePwds = new System.Windows.Forms.CheckBox(); this.grpSetup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.groupBox1.SuspendLayout(); @@ -85,6 +86,7 @@ // // grpSetup // + this.grpSetup.Controls.Add(this.cbxUseOfflinePwds); this.grpSetup.Controls.Add(this.btnClearDisplay); this.grpSetup.Controls.Add(this.label10); this.grpSetup.Controls.Add(this.tbxRadio); @@ -101,16 +103,16 @@ this.grpSetup.Controls.Add(this.lblConnectPcb); this.grpSetup.Controls.Add(this.label2); this.grpSetup.Controls.Add(this.cbComSlot); - this.grpSetup.Location = new System.Drawing.Point(12, 69); + this.grpSetup.Location = new System.Drawing.Point(12, 82); this.grpSetup.Name = "grpSetup"; - this.grpSetup.Size = new System.Drawing.Size(257, 273); + this.grpSetup.Size = new System.Drawing.Size(257, 262); this.grpSetup.TabIndex = 24; this.grpSetup.TabStop = false; this.grpSetup.Text = "Cordonel"; // // btnClearDisplay // - this.btnClearDisplay.Location = new System.Drawing.Point(128, 239); + this.btnClearDisplay.Location = new System.Drawing.Point(130, 225); this.btnClearDisplay.Name = "btnClearDisplay"; this.btnClearDisplay.Size = new System.Drawing.Size(116, 25); this.btnClearDisplay.TabIndex = 33; @@ -121,7 +123,7 @@ // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(10, 212); + this.label10.Location = new System.Drawing.Point(10, 200); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(116, 13); this.label10.TabIndex = 36; @@ -129,7 +131,7 @@ // // tbxRadio // - this.tbxRadio.Location = new System.Drawing.Point(128, 208); + this.tbxRadio.Location = new System.Drawing.Point(130, 197); this.tbxRadio.Name = "tbxRadio"; this.tbxRadio.ReadOnly = true; this.tbxRadio.Size = new System.Drawing.Size(68, 20); @@ -137,7 +139,7 @@ // // tbxRegion // - this.tbxRegion.Location = new System.Drawing.Point(128, 178); + this.tbxRegion.Location = new System.Drawing.Point(130, 172); this.tbxRegion.Name = "tbxRegion"; this.tbxRegion.ReadOnly = true; this.tbxRegion.Size = new System.Drawing.Size(68, 20); @@ -146,7 +148,7 @@ // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(10, 182); + this.label8.Location = new System.Drawing.Point(10, 175); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(44, 13); this.label8.TabIndex = 33; @@ -154,7 +156,7 @@ // // tbxPcbId // - this.tbxPcbId.Location = new System.Drawing.Point(128, 59); + this.tbxPcbId.Location = new System.Drawing.Point(130, 72); this.tbxPcbId.Name = "tbxPcbId"; this.tbxPcbId.ReadOnly = true; this.tbxPcbId.Size = new System.Drawing.Size(68, 20); @@ -162,7 +164,7 @@ // // tbxMeterFw // - this.tbxMeterFw.Location = new System.Drawing.Point(128, 88); + this.tbxMeterFw.Location = new System.Drawing.Point(130, 97); this.tbxMeterFw.Name = "tbxMeterFw"; this.tbxMeterFw.ReadOnly = true; this.tbxMeterFw.Size = new System.Drawing.Size(68, 20); @@ -170,7 +172,7 @@ // // tbxMeterMeterSize // - this.tbxMeterMeterSize.Location = new System.Drawing.Point(128, 148); + this.tbxMeterMeterSize.Location = new System.Drawing.Point(130, 147); this.tbxMeterMeterSize.Name = "tbxMeterMeterSize"; this.tbxMeterMeterSize.ReadOnly = true; this.tbxMeterMeterSize.Size = new System.Drawing.Size(68, 20); @@ -178,7 +180,7 @@ // // tbxMeterLutCrc // - this.tbxMeterLutCrc.Location = new System.Drawing.Point(128, 118); + this.tbxMeterLutCrc.Location = new System.Drawing.Point(130, 122); this.tbxMeterLutCrc.Name = "tbxMeterLutCrc"; this.tbxMeterLutCrc.ReadOnly = true; this.tbxMeterLutCrc.Size = new System.Drawing.Size(68, 20); @@ -187,7 +189,7 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(10, 152); + this.label5.Location = new System.Drawing.Point(10, 150); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(60, 13); this.label5.TabIndex = 28; @@ -196,7 +198,7 @@ // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(10, 122); + this.label6.Location = new System.Drawing.Point(10, 125); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(86, 13); this.label6.TabIndex = 27; @@ -205,7 +207,7 @@ // lblFwVersion // this.lblFwVersion.AutoSize = true; - this.lblFwVersion.Location = new System.Drawing.Point(10, 92); + this.lblFwVersion.Location = new System.Drawing.Point(10, 100); this.lblFwVersion.Name = "lblFwVersion"; this.lblFwVersion.Size = new System.Drawing.Size(57, 13); this.lblFwVersion.TabIndex = 25; @@ -213,7 +215,7 @@ // // btnConnect // - this.btnConnect.Location = new System.Drawing.Point(128, 24); + this.btnConnect.Location = new System.Drawing.Point(130, 41); this.btnConnect.Name = "btnConnect"; this.btnConnect.Size = new System.Drawing.Size(116, 25); this.btnConnect.TabIndex = 24; @@ -224,7 +226,7 @@ // lblConnectPcb // this.lblConnectPcb.AutoSize = true; - this.lblConnectPcb.Location = new System.Drawing.Point(10, 62); + this.lblConnectPcb.Location = new System.Drawing.Point(10, 75); this.lblConnectPcb.Name = "lblConnectPcb"; this.lblConnectPcb.Size = new System.Drawing.Size(33, 13); this.lblConnectPcb.TabIndex = 23; @@ -233,7 +235,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(10, 30); + this.label2.Location = new System.Drawing.Point(10, 47); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(28, 13); this.label2.TabIndex = 20; @@ -263,7 +265,7 @@ "18", "19", "20"}); - this.cbComSlot.Location = new System.Drawing.Point(44, 27); + this.cbComSlot.Location = new System.Drawing.Point(44, 44); this.cbComSlot.Name = "cbComSlot"; this.cbComSlot.Size = new System.Drawing.Size(37, 21); this.cbComSlot.TabIndex = 5; @@ -347,7 +349,7 @@ // this.lblFwUpdateInfo.AutoSize = true; this.lblFwUpdateInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFwUpdateInfo.Location = new System.Drawing.Point(18, 30); + this.lblFwUpdateInfo.Location = new System.Drawing.Point(18, 34); this.lblFwUpdateInfo.Name = "lblFwUpdateInfo"; this.lblFwUpdateInfo.Size = new System.Drawing.Size(72, 13); this.lblFwUpdateInfo.TabIndex = 27; @@ -385,9 +387,9 @@ this.groupBox1.Controls.Add(this.lvlSelechtFile); this.groupBox1.Controls.Add(this.btnStopFwUpdate); this.groupBox1.Controls.Add(this.btnOpenLutFile); - this.groupBox1.Location = new System.Drawing.Point(275, 69); + this.groupBox1.Location = new System.Drawing.Point(275, 82); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(436, 273); + this.groupBox1.Size = new System.Drawing.Size(436, 262); this.groupBox1.TabIndex = 28; this.groupBox1.TabStop = false; this.groupBox1.Text = "Lookup Table File"; @@ -572,12 +574,23 @@ // this.lblConfigVersion.AutoSize = true; this.lblConfigVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblConfigVersion.Location = new System.Drawing.Point(18, 49); + this.lblConfigVersion.Location = new System.Drawing.Point(18, 57); this.lblConfigVersion.Name = "lblConfigVersion"; this.lblConfigVersion.Size = new System.Drawing.Size(119, 13); this.lblConfigVersion.TabIndex = 33; this.lblConfigVersion.Text = "Configuration Version: ?"; // + // cbxUseOfflinePwds + // + this.cbxUseOfflinePwds.AutoSize = true; + this.cbxUseOfflinePwds.Location = new System.Drawing.Point(13, 20); + this.cbxUseOfflinePwds.Name = "cbxUseOfflinePwds"; + this.cbxUseOfflinePwds.Size = new System.Drawing.Size(132, 17); + this.cbxUseOfflinePwds.TabIndex = 34; + this.cbxUseOfflinePwds.Text = "Use Offline Passwords"; + this.cbxUseOfflinePwds.UseVisualStyleBackColor = true; + this.cbxUseOfflinePwds.CheckedChanged += new System.EventHandler(this.cbxUseOfflinePwds_CheckedChanged); + // // FrmLutUpdate // this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound; @@ -666,5 +679,6 @@ private System.Windows.Forms.TextBox tbxRadio; private System.Windows.Forms.Button btnClearDisplay; private System.Windows.Forms.Label lblConfigVersion; + private System.Windows.Forms.CheckBox cbxUseOfflinePwds; } } \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/FrmLutUpdate.cs b/Common/Ui/GenesisToolBox/FrmLutUpdate.cs index becc5746..23c1a06b 100644 --- a/Common/Ui/GenesisToolBox/FrmLutUpdate.cs +++ b/Common/Ui/GenesisToolBox/FrmLutUpdate.cs @@ -189,6 +189,9 @@ namespace Xylem.Common.Ui.GenesisToolBox /// /// - Compare the max supported FW versions of the configuration.json. /// + /// + /// - Catch error message on unknown data type and kill meter. + /// private void Connect() { try @@ -200,28 +203,29 @@ namespace Xylem.Common.Ui.GenesisToolBox { return; } + lblOverall.Text = @"Login to Cordonel..."; - lblOverall.Text = @"Establish data base connection.."; + ViewProgressPcb(true); + + _currentGenesis?.DisposeMeter(); + //dispose old meter + _meterBatch.RemoveAllMeters(); + _currentGenesis = null; + + //assign new meter and assign meter to FW update file if this exists + _currentGenesis = new GenesisMeter(); + _currentGenesis.UseOfflinePasswords = cbxUseOfflinePwds.Checked; + _currentGenesis.SetupFromConfigFile(slotNr); + _meterBatch.AddMeter(_currentGenesis); + + _currentGenesis.Configuration.UseRegisterWatchService = false; + _currentGenesis.Configuration.UseMinMaxCheck = false; + + lblActualProcess.Text = @"Connecting to PCB..."; Task.Factory.StartNew(() => { - ViewProgressPcb(true); - - _currentGenesis?.DisposeMeter(); - //dispose old meter - _meterBatch.RemoveAllMeters(); - _currentGenesis = null; - Thread.Sleep(200); - - //assign new meter and assign meter to FW update file if this exists - _currentGenesis = new GenesisMeter(); - - _currentGenesis.SetupFromConfigFile(slotNr); - _meterBatch.AddMeter(_currentGenesis); - - _currentGenesis.Configuration.UseRegisterWatchService = false; - _currentGenesis.Configuration.UseMinMaxCheck = false; - _meterBatch.MetersLogin(); + _meterBatch.MetersLogin(); if (!_currentGenesis.IsLoggedOn) { @@ -284,8 +288,13 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(ex.Message); + ViewProgressPcb(false); + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); LogErrorText(ex.Message); + // Dispose meter + _meterBatch.RemoveAllMeters(); + // If meter is not already assigned to batch as the config reader may fail + _currentGenesis?.DisposeMeter(); } } #endregion @@ -893,6 +902,11 @@ namespace Xylem.Common.Ui.GenesisToolBox _currentGenesis.Logout(); lblOverall.Visible = false; } - } + + private void cbxUseOfflinePwds_CheckedChanged(Object sender, EventArgs e) + { + cbxUseOfflinePwds.ForeColor = cbxUseOfflinePwds.Checked ? Color.Red : Color.Black; + } + } } diff --git a/Common/Ui/GenesisToolBox/FrmMainForm.cs b/Common/Ui/GenesisToolBox/FrmMainForm.cs index 6f979afd..e7d57418 100644 --- a/Common/Ui/GenesisToolBox/FrmMainForm.cs +++ b/Common/Ui/GenesisToolBox/FrmMainForm.cs @@ -90,9 +90,11 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(@"GenesisToolBox\n\n" + - @"Network Connection Error!\n\n" + - ex.Message); + var msg = "Unable to acquire a valid license for this GTB!\n\n" + + "Network access error! " + + "Please connect to the Xylem network or establish a VPN connection.\n\n" + + "Network feedback: "; + MessageBox.Show(msg + ex.Message, @"GenesisToolBox (GTB)", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); CheckConfigs(); @@ -107,9 +109,9 @@ namespace Xylem.Common.Ui.GenesisToolBox } if (!access) { - MessageBox.Show(@"GenesisToolBox\n\n" + - @"Your version licence is expired!\n\n" + - SoftwareVersion.Current); + var msg = $"The GTB {SoftwareVersion.Current} is out of support!\n\n" + + "Please check for versions on the SharePoint location."; + MessageBox.Show(msg, @"GenesisToolBox (GTB)", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } @@ -410,7 +412,7 @@ namespace Xylem.Common.Ui.GenesisToolBox foreach (var control in controlsToRemove) { - this.Controls.Remove(control); + Controls.Remove(control); } } @@ -486,13 +488,13 @@ namespace Xylem.Common.Ui.GenesisToolBox groupBox.Show(); } - else if (control is MenuStrip menu && menu.Items != null) + else if (control is MenuStrip menu) { foreach (var item in menu.Items) { if (item is ToolStripMenuItem toolStripMenuItem) { - this.ShowAvailableMenuItems(toolStripMenuItem); + ShowAvailableMenuItems(toolStripMenuItem); } } } @@ -507,20 +509,21 @@ namespace Xylem.Common.Ui.GenesisToolBox { return; } - else if (toolStripMenuItem.Tag is SoftwareFunctions softwareFunction) + + if (toolStripMenuItem.Tag is SoftwareFunctions softwareFunction) { toolStripMenuItem.Visible = Debugger.IsAttached || Software.IsEnabled(softwareFunction); } var dropdownItems = toolStripMenuItem.DropDownItems; - if (dropdownItems != null && dropdownItems.Count > 0) + if (dropdownItems.Count > 0) { foreach (var item in dropdownItems) { if (item is ToolStripMenuItem _toolStripMenuItem) { - this.ShowAvailableMenuItems(_toolStripMenuItem); + ShowAvailableMenuItems(_toolStripMenuItem); } } } @@ -536,7 +539,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { Software.Initialize(); - this.Controls.Remove(registerForm); + Controls.Remove(registerForm); } HideContent(); @@ -544,14 +547,14 @@ namespace Xylem.Common.Ui.GenesisToolBox if (Software.IsRegistrationPending) { registerForm = new RegisterLDAPUser(InitializeFormState); - registerForm.OnCancellation += this.OnControlCancellation; + registerForm.OnCancellation += OnControlCancellation; - this.menu.Hide(); - this.Controls.Add(registerForm); + mainMenu.Hide(); + Controls.Add(registerForm); } else { - this.menu.Show(); + mainMenu.Show(); SetSoftwareFunctions(); ShowAvailableSoftwareFunctions(); } @@ -582,7 +585,7 @@ namespace Xylem.Common.Ui.GenesisToolBox if (!hasLoginForm) { - var loginForm = new LoginForm(this.OnControlCancellation); + var loginForm = new LoginForm(OnControlCancellation); Controls.Add(loginForm); } @@ -590,23 +593,23 @@ namespace Xylem.Common.Ui.GenesisToolBox private void OnChangePasswordClick(Object _, EventArgs _1) { - this.HideContent(); + HideContent(); - var control = new ChangePassword(this.OnControlCancellation); + var control = new ChangePassword(OnControlCancellation); - this.Controls.Add(control); + Controls.Add(control); } private void OnControlCancellation(Control control) { if (control != null) { - this.HideContent(); + HideContent(); // Software.Initialize(); } - this.InitializeFormState(); + InitializeFormState(); } #endregion Form initialization diff --git a/Common/Ui/GenesisToolBox/FrmStreamingQuality.cs b/Common/Ui/GenesisToolBox/FrmStreamingQuality.cs index f5797e14..246d70ff 100644 --- a/Common/Ui/GenesisToolBox/FrmStreamingQuality.cs +++ b/Common/Ui/GenesisToolBox/FrmStreamingQuality.cs @@ -104,6 +104,9 @@ namespace Xylem.Common.Ui.GenesisToolBox base.Dispose(); } + /// + /// - Catch error message on unknown data type and kill meter. + /// private void Connect() { Int32 slotNr; @@ -116,15 +119,15 @@ namespace Xylem.Common.Ui.GenesisToolBox { _currentGenesis?.DisposeMeter(); _currentGenesis = null; + ViewProgress(true); + _currentGenesis = new GenesisMeterStreamingQuality(); + _currentGenesis.SetupFromConfigFile(slotNr); + _meterBatch.AddMeter(_currentGenesis); + Task.Factory.StartNew(() => { - ViewProgress(true); - _currentGenesis = new GenesisMeterStreamingQuality(); - _currentGenesis.SetupFromConfigFile(slotNr); - _meterBatch.AddMeter(_currentGenesis); - - _meterBatch.MetersLogin(); + _meterBatch.MetersLogin(); WriteValue(Register.Genesisflow.SampleRate, SampleRateHz); @@ -145,7 +148,11 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); + // Dispose meter + _meterBatch.RemoveAllMeters(); + // If meter is not already assigned to batch as the config reader may fail + _currentGenesis?.DisposeMeter(); } } } diff --git a/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs b/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs index a1b549c8..690de8ab 100644 --- a/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs +++ b/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs @@ -50,7 +50,7 @@ this.BtnFileSplit = new System.Windows.Forms.Button(); this.btnFiles = new System.Windows.Forms.Button(); this.btnLegacyTestApp = new System.Windows.Forms.Button(); - this.menu = new System.Windows.Forms.MenuStrip(); + this.mainMenu = new System.Windows.Forms.MenuStrip(); this.menuItemOptions = new System.Windows.Forms.ToolStripMenuItem(); this.menuItemLogin = new System.Windows.Forms.ToolStripMenuItem(); this.menuItemLogout = new System.Windows.Forms.ToolStripMenuItem(); @@ -58,7 +58,7 @@ this.gpGerneral.SuspendLayout(); this.gpLAA.SuspendLayout(); this.gbDeveloper.SuspendLayout(); - this.menu.SuspendLayout(); + this.mainMenu.SuspendLayout(); this.SuspendLayout(); // // gpGerneral @@ -322,14 +322,14 @@ // // menu // - this.menu.AutoSize = false; - this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mainMenu.AutoSize = false; + this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuItemOptions}); - this.menu.Location = new System.Drawing.Point(0, 0); - this.menu.Name = "menu"; - this.menu.Size = new System.Drawing.Size(361, 24); - this.menu.TabIndex = 24; - this.menu.TextDirection = System.Windows.Forms.ToolStripTextDirection.Vertical90; + this.mainMenu.Location = new System.Drawing.Point(0, 0); + this.mainMenu.Name = "mainMenu"; + this.mainMenu.Size = new System.Drawing.Size(361, 24); + this.mainMenu.TabIndex = 24; + this.mainMenu.TextDirection = System.Windows.Forms.ToolStripTextDirection.Vertical90; // // optionsMenuItem // @@ -371,9 +371,9 @@ this.Controls.Add(this.gbDeveloper); this.Controls.Add(this.gpLAA); this.Controls.Add(this.gpGerneral); - this.Controls.Add(this.menu); + this.Controls.Add(this.mainMenu); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MainMenuStrip = this.menu; + this.MainMenuStrip = this.mainMenu; this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(377, 530); this.MinimizeBox = false; @@ -385,8 +385,8 @@ this.gpGerneral.ResumeLayout(false); this.gpLAA.ResumeLayout(false); this.gbDeveloper.ResumeLayout(false); - this.menu.ResumeLayout(false); - this.menu.PerformLayout(); + this.mainMenu.ResumeLayout(false); + this.mainMenu.PerformLayout(); this.ResumeLayout(false); } @@ -415,7 +415,7 @@ private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button btnLowLevelTools; - private System.Windows.Forms.MenuStrip menu; + private System.Windows.Forms.MenuStrip mainMenu; private System.Windows.Forms.ToolStripMenuItem menuItemOptions; private System.Windows.Forms.ToolStripMenuItem menuItemLogin; private System.Windows.Forms.ToolStripMenuItem menuItemLogout; diff --git a/Common/Ui/GenesisToolBox/frmMainForm.cs b/Common/Ui/GenesisToolBox/frmMainForm.cs index 6f979afd..e7d57418 100644 --- a/Common/Ui/GenesisToolBox/frmMainForm.cs +++ b/Common/Ui/GenesisToolBox/frmMainForm.cs @@ -90,9 +90,11 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(@"GenesisToolBox\n\n" + - @"Network Connection Error!\n\n" + - ex.Message); + var msg = "Unable to acquire a valid license for this GTB!\n\n" + + "Network access error! " + + "Please connect to the Xylem network or establish a VPN connection.\n\n" + + "Network feedback: "; + MessageBox.Show(msg + ex.Message, @"GenesisToolBox (GTB)", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); CheckConfigs(); @@ -107,9 +109,9 @@ namespace Xylem.Common.Ui.GenesisToolBox } if (!access) { - MessageBox.Show(@"GenesisToolBox\n\n" + - @"Your version licence is expired!\n\n" + - SoftwareVersion.Current); + var msg = $"The GTB {SoftwareVersion.Current} is out of support!\n\n" + + "Please check for versions on the SharePoint location."; + MessageBox.Show(msg, @"GenesisToolBox (GTB)", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } @@ -410,7 +412,7 @@ namespace Xylem.Common.Ui.GenesisToolBox foreach (var control in controlsToRemove) { - this.Controls.Remove(control); + Controls.Remove(control); } } @@ -486,13 +488,13 @@ namespace Xylem.Common.Ui.GenesisToolBox groupBox.Show(); } - else if (control is MenuStrip menu && menu.Items != null) + else if (control is MenuStrip menu) { foreach (var item in menu.Items) { if (item is ToolStripMenuItem toolStripMenuItem) { - this.ShowAvailableMenuItems(toolStripMenuItem); + ShowAvailableMenuItems(toolStripMenuItem); } } } @@ -507,20 +509,21 @@ namespace Xylem.Common.Ui.GenesisToolBox { return; } - else if (toolStripMenuItem.Tag is SoftwareFunctions softwareFunction) + + if (toolStripMenuItem.Tag is SoftwareFunctions softwareFunction) { toolStripMenuItem.Visible = Debugger.IsAttached || Software.IsEnabled(softwareFunction); } var dropdownItems = toolStripMenuItem.DropDownItems; - if (dropdownItems != null && dropdownItems.Count > 0) + if (dropdownItems.Count > 0) { foreach (var item in dropdownItems) { if (item is ToolStripMenuItem _toolStripMenuItem) { - this.ShowAvailableMenuItems(_toolStripMenuItem); + ShowAvailableMenuItems(_toolStripMenuItem); } } } @@ -536,7 +539,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { Software.Initialize(); - this.Controls.Remove(registerForm); + Controls.Remove(registerForm); } HideContent(); @@ -544,14 +547,14 @@ namespace Xylem.Common.Ui.GenesisToolBox if (Software.IsRegistrationPending) { registerForm = new RegisterLDAPUser(InitializeFormState); - registerForm.OnCancellation += this.OnControlCancellation; + registerForm.OnCancellation += OnControlCancellation; - this.menu.Hide(); - this.Controls.Add(registerForm); + mainMenu.Hide(); + Controls.Add(registerForm); } else { - this.menu.Show(); + mainMenu.Show(); SetSoftwareFunctions(); ShowAvailableSoftwareFunctions(); } @@ -582,7 +585,7 @@ namespace Xylem.Common.Ui.GenesisToolBox if (!hasLoginForm) { - var loginForm = new LoginForm(this.OnControlCancellation); + var loginForm = new LoginForm(OnControlCancellation); Controls.Add(loginForm); } @@ -590,23 +593,23 @@ namespace Xylem.Common.Ui.GenesisToolBox private void OnChangePasswordClick(Object _, EventArgs _1) { - this.HideContent(); + HideContent(); - var control = new ChangePassword(this.OnControlCancellation); + var control = new ChangePassword(OnControlCancellation); - this.Controls.Add(control); + Controls.Add(control); } private void OnControlCancellation(Control control) { if (control != null) { - this.HideContent(); + HideContent(); // Software.Initialize(); } - this.InitializeFormState(); + InitializeFormState(); } #endregion Form initialization diff --git a/Common/Ui/GenesisToolBox/frmMainForm.resx b/Common/Ui/GenesisToolBox/frmMainForm.resx index 9fcb69e5..410d84de 100644 --- a/Common/Ui/GenesisToolBox/frmMainForm.resx +++ b/Common/Ui/GenesisToolBox/frmMainForm.resx @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 diff --git a/Common/Ui/GenesisToolBox/frmPassword.cs b/Common/Ui/GenesisToolBox/frmPassword.cs index 75d35372..8142a71b 100644 --- a/Common/Ui/GenesisToolBox/frmPassword.cs +++ b/Common/Ui/GenesisToolBox/frmPassword.cs @@ -245,6 +245,9 @@ namespace Xylem.Common.Ui.GenesisToolBox base.Dispose(); } + /// + /// - Catch error message on unknown data type and kill meter. + /// private void Connect() { Int32 slotNr; @@ -262,15 +265,14 @@ namespace Xylem.Common.Ui.GenesisToolBox _meterBatch.RemoveAllMeters(); _currentGenesis = null; + ViewProgressPcb(true); + _currentGenesis = new GenesisMeter(); + _currentGenesis.SetupFromConfigFile(slotNr); + _meterBatch.AddMeter(_currentGenesis); + Task.Factory.StartNew(() => { - ViewProgressPcb(true); - _currentGenesis = new GenesisMeter(); - _currentGenesis.SetupFromConfigFile(slotNr); - _meterBatch.AddMeter(_currentGenesis); - - _meterBatch.MetersLogin(); - + _meterBatch.MetersLogin(); if (_currentGenesis.IsLoggedOn) { @@ -290,7 +292,12 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { - MessageBox.Show(ex.Message); + ViewProgressPcb(false); + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); + // Dispose meter + _meterBatch.RemoveAllMeters(); + // If meter is not already assigned to batch as the config reader may fail + _currentGenesis?.DisposeMeter(); } } } diff --git a/Common/Ui/GenesisToolBox/frmRegisterStore.Designer.cs b/Common/Ui/GenesisToolBox/frmRegisterStore.Designer.cs index ee4ad668..027f698c 100644 --- a/Common/Ui/GenesisToolBox/frmRegisterStore.Designer.cs +++ b/Common/Ui/GenesisToolBox/frmRegisterStore.Designer.cs @@ -57,6 +57,7 @@ this.lblGtbVersion = new System.Windows.Forms.Label(); this.lblConfigVersion = new System.Windows.Forms.Label(); this.btnFileToRegister = new System.Windows.Forms.Button(); + this.cbxUseOfflinePwds = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.registerGridView)).BeginInit(); this.pnlBussy.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nundCalResultID)).BeginInit(); @@ -65,7 +66,7 @@ // cbComSlot // this.cbComSlot.FormattingEnabled = true; - this.cbComSlot.Location = new System.Drawing.Point(41, 56); + this.cbComSlot.Location = new System.Drawing.Point(44, 91); this.cbComSlot.Name = "cbComSlot"; this.cbComSlot.Size = new System.Drawing.Size(58, 21); this.cbComSlot.TabIndex = 0; @@ -74,7 +75,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(10, 59); + this.label1.Location = new System.Drawing.Point(10, 94); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(28, 13); this.label1.TabIndex = 1; @@ -83,9 +84,9 @@ // // btnRead // - this.btnRead.Location = new System.Drawing.Point(10, 123); + this.btnRead.Location = new System.Drawing.Point(251, 123); this.btnRead.Name = "btnRead"; - this.btnRead.Size = new System.Drawing.Size(175, 30); + this.btnRead.Size = new System.Drawing.Size(110, 30); this.btnRead.TabIndex = 2; this.btnRead.Text = "Read Meter"; this.btnRead.UseVisualStyleBackColor = true; @@ -101,16 +102,16 @@ this.registerGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.registerGridView.Location = new System.Drawing.Point(8, 171); this.registerGridView.Name = "registerGridView"; - this.registerGridView.Size = new System.Drawing.Size(679, 370); + this.registerGridView.Size = new System.Drawing.Size(778, 370); this.registerGridView.TabIndex = 3; this.registerGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.registerGridView_CellClick); this.registerGridView.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.registerGridView_CellEndEdit); // // btnConnect // - this.btnConnect.Location = new System.Drawing.Point(105, 50); + this.btnConnect.Location = new System.Drawing.Point(125, 87); this.btnConnect.Name = "btnConnect"; - this.btnConnect.Size = new System.Drawing.Size(80, 30); + this.btnConnect.Size = new System.Drawing.Size(110, 30); this.btnConnect.TabIndex = 4; this.btnConnect.Text = "Connect"; this.btnConnect.UseVisualStyleBackColor = true; @@ -119,7 +120,7 @@ // lblState // this.lblState.AutoSize = true; - this.lblState.Location = new System.Drawing.Point(10, 94); + this.lblState.Location = new System.Drawing.Point(12, 132); this.lblState.Name = "lblState"; this.lblState.Size = new System.Drawing.Size(78, 13); this.lblState.TabIndex = 5; @@ -132,9 +133,9 @@ // // btnGetPCbID // - this.btnGetPCbID.Location = new System.Drawing.Point(309, 50); + this.btnGetPCbID.Location = new System.Drawing.Point(399, 16); this.btnGetPCbID.Name = "btnGetPCbID"; - this.btnGetPCbID.Size = new System.Drawing.Size(80, 30); + this.btnGetPCbID.Size = new System.Drawing.Size(110, 30); this.btnGetPCbID.TabIndex = 11; this.btnGetPCbID.Text = "Get PCB ID"; this.btnGetPCbID.UseVisualStyleBackColor = true; @@ -152,7 +153,7 @@ this.pnlBussy.Controls.Add(this.label3); this.pnlBussy.Location = new System.Drawing.Point(8, 171); this.pnlBussy.Name = "pnlBussy"; - this.pnlBussy.Size = new System.Drawing.Size(704, 398); + this.pnlBussy.Size = new System.Drawing.Size(803, 398); this.pnlBussy.TabIndex = 51; this.pnlBussy.Visible = false; // @@ -184,7 +185,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.probarBussy.Location = new System.Drawing.Point(12, 286); this.probarBussy.Name = "probarBussy"; - this.probarBussy.Size = new System.Drawing.Size(680, 23); + this.probarBussy.Size = new System.Drawing.Size(779, 23); this.probarBussy.TabIndex = 1; // // label3 @@ -201,7 +202,7 @@ // // btnReadFwVersions // - this.btnReadFwVersions.Location = new System.Drawing.Point(400, 50); + this.btnReadFwVersions.Location = new System.Drawing.Point(399, 51); this.btnReadFwVersions.Name = "btnReadFwVersions"; this.btnReadFwVersions.Size = new System.Drawing.Size(110, 30); this.btnReadFwVersions.TabIndex = 52; @@ -211,7 +212,7 @@ // // btn_CalibrationRestore // - this.btn_CalibrationRestore.Location = new System.Drawing.Point(516, 50); + this.btn_CalibrationRestore.Location = new System.Drawing.Point(560, 14); this.btn_CalibrationRestore.Name = "btn_CalibrationRestore"; this.btn_CalibrationRestore.Size = new System.Drawing.Size(110, 30); this.btn_CalibrationRestore.TabIndex = 58; @@ -222,7 +223,7 @@ // // button1 // - this.button1.Location = new System.Drawing.Point(400, 85); + this.button1.Location = new System.Drawing.Point(399, 87); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(110, 30); this.button1.TabIndex = 60; @@ -232,9 +233,9 @@ // // button2 // - this.button2.Location = new System.Drawing.Point(602, 120); + this.button2.Location = new System.Drawing.Point(560, 85); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(98, 30); + this.button2.Size = new System.Drawing.Size(110, 30); this.button2.TabIndex = 61; this.button2.Text = "Set default Pulse"; this.button2.UseVisualStyleBackColor = true; @@ -242,9 +243,9 @@ // // btnStoreAll // - this.btnStoreAll.Location = new System.Drawing.Point(251, 52); + this.btnStoreAll.Location = new System.Drawing.Point(251, 16); this.btnStoreAll.Name = "btnStoreAll"; - this.btnStoreAll.Size = new System.Drawing.Size(52, 55); + this.btnStoreAll.Size = new System.Drawing.Size(110, 28); this.btnStoreAll.TabIndex = 62; this.btnStoreAll.Text = "Store All"; this.btnStoreAll.UseVisualStyleBackColor = true; @@ -252,9 +253,9 @@ // // btnRegisterToFile // - this.btnRegisterToFile.Location = new System.Drawing.Point(282, 120); + this.btnRegisterToFile.Location = new System.Drawing.Point(251, 50); this.btnRegisterToFile.Name = "btnRegisterToFile"; - this.btnRegisterToFile.Size = new System.Drawing.Size(107, 30); + this.btnRegisterToFile.Size = new System.Drawing.Size(110, 30); this.btnRegisterToFile.TabIndex = 63; this.btnRegisterToFile.Text = "RegisterToFile"; this.btnRegisterToFile.UseVisualStyleBackColor = true; @@ -267,9 +268,9 @@ // // btnBatLife // - this.btnBatLife.Location = new System.Drawing.Point(309, 85); + this.btnBatLife.Location = new System.Drawing.Point(399, 123); this.btnBatLife.Name = "btnBatLife"; - this.btnBatLife.Size = new System.Drawing.Size(80, 30); + this.btnBatLife.Size = new System.Drawing.Size(110, 30); this.btnBatLife.TabIndex = 71; this.btnBatLife.Text = "Lifetime"; this.btnBatLife.UseVisualStyleBackColor = true; @@ -277,9 +278,9 @@ // // btnRadioPressure // - this.btnRadioPressure.Location = new System.Drawing.Point(506, 120); + this.btnRadioPressure.Location = new System.Drawing.Point(560, 123); this.btnRadioPressure.Name = "btnRadioPressure"; - this.btnRadioPressure.Size = new System.Drawing.Size(90, 30); + this.btnRadioPressure.Size = new System.Drawing.Size(110, 30); this.btnRadioPressure.TabIndex = 72; this.btnRadioPressure.Text = "Activate Radio"; this.btnRadioPressure.UseVisualStyleBackColor = true; @@ -287,25 +288,26 @@ // // nundCalResultID // - this.nundCalResultID.Location = new System.Drawing.Point(518, 82); + this.nundCalResultID.Location = new System.Drawing.Point(562, 58); this.nundCalResultID.Maximum = new decimal(new int[] { 999999, 0, 0, 0}); this.nundCalResultID.Name = "nundCalResultID"; - this.nundCalResultID.Size = new System.Drawing.Size(114, 20); + this.nundCalResultID.Size = new System.Drawing.Size(110, 20); this.nundCalResultID.TabIndex = 73; this.nundCalResultID.Visible = false; // // btnFingerWeg // - this.btnFingerWeg.Location = new System.Drawing.Point(638, 52); + this.btnFingerWeg.Location = new System.Drawing.Point(729, 49); this.btnFingerWeg.Name = "btnFingerWeg"; this.btnFingerWeg.Size = new System.Drawing.Size(62, 63); this.btnFingerWeg.TabIndex = 74; this.btnFingerWeg.Text = "Do NOT touch! Recalib!"; this.btnFingerWeg.UseVisualStyleBackColor = true; + this.btnFingerWeg.Visible = false; this.btnFingerWeg.Click += new System.EventHandler(this.FingerWeg_Clicked); // // lblGtbVersion @@ -320,7 +322,7 @@ // lblConfigVersion // this.lblConfigVersion.AutoSize = true; - this.lblConfigVersion.Location = new System.Drawing.Point(10, 31); + this.lblConfigVersion.Location = new System.Drawing.Point(10, 33); this.lblConfigVersion.Name = "lblConfigVersion"; this.lblConfigVersion.Size = new System.Drawing.Size(119, 13); this.lblConfigVersion.TabIndex = 76; @@ -328,19 +330,31 @@ // // btnFileToRegister // - this.btnFileToRegister.Location = new System.Drawing.Point(393, 120); + this.btnFileToRegister.Location = new System.Drawing.Point(251, 87); this.btnFileToRegister.Name = "btnFileToRegister"; - this.btnFileToRegister.Size = new System.Drawing.Size(107, 30); + this.btnFileToRegister.Size = new System.Drawing.Size(110, 30); this.btnFileToRegister.TabIndex = 77; this.btnFileToRegister.Text = "FileToRegister"; this.btnFileToRegister.UseVisualStyleBackColor = true; this.btnFileToRegister.Click += new System.EventHandler(this.btnFileToRegister_Click); // + // cbxUseOfflinePwds + // + this.cbxUseOfflinePwds.AutoSize = true; + this.cbxUseOfflinePwds.Location = new System.Drawing.Point(12, 59); + this.cbxUseOfflinePwds.Name = "cbxUseOfflinePwds"; + this.cbxUseOfflinePwds.Size = new System.Drawing.Size(132, 17); + this.cbxUseOfflinePwds.TabIndex = 78; + this.cbxUseOfflinePwds.Text = "Use Offline Passwords"; + this.cbxUseOfflinePwds.UseVisualStyleBackColor = true; + this.cbxUseOfflinePwds.CheckedChanged += new System.EventHandler(this.cbxUseOfflinePwds_CheckedChanged); + // // FrmRegisterStore // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(704, 553); + this.ClientSize = new System.Drawing.Size(803, 553); + this.Controls.Add(this.cbxUseOfflinePwds); this.Controls.Add(this.btnFileToRegister); this.Controls.Add(this.lblConfigVersion); this.Controls.Add(this.lblGtbVersion); @@ -404,5 +418,6 @@ private System.Windows.Forms.Label lblGtbVersion; private System.Windows.Forms.Label lblConfigVersion; private System.Windows.Forms.Button btnFileToRegister; + private System.Windows.Forms.CheckBox cbxUseOfflinePwds; } } \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/frmRegisterStore.cs b/Common/Ui/GenesisToolBox/frmRegisterStore.cs index e28758dd..3f01f7bd 100644 --- a/Common/Ui/GenesisToolBox/frmRegisterStore.cs +++ b/Common/Ui/GenesisToolBox/frmRegisterStore.cs @@ -34,6 +34,7 @@ using Xylem.Common.Logic.ServiceCore; using Xylem.Common.Logic.SoftwareAccessHelper; using Xylem.Common.Utils.Logging; using XylemCommonUiLegacyGenCtl; +using static System.Net.Mime.MediaTypeNames; using static Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.GenesisMeter; using Access = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Access; @@ -166,126 +167,130 @@ namespace Xylem.Common.Ui.GenesisToolBox int.TryParse(cbComSlot.SelectedItem.ToString(), out slotNR)) { SetBusy(true, "Connect"); - Task.Factory.StartNew(() => { conntect(slotNR); }).ContinueWith(delegate + if (Connect(slotNR)) { + Task.Factory.StartNew(() => + { - Invoke(new Action(() => - { - var loggedinMeters = 0; - foreach (var me in _meterBatch.ListOfMeters) + Invoke(new Action(() => { - if (me is GenesisMeter) + var loggedinMeters = 0; + foreach (var me in _meterBatch.ListOfMeters) { - if (((GenesisMeter)me).IsLoggedOn) + if (me is GenesisMeter) { - loggedinMeters = loggedinMeters + 1; - _currentGenesis = ((GenesisMeter)me); + if (((GenesisMeter)me).IsLoggedOn) + { + loggedinMeters = loggedinMeters + 1; + _currentGenesis = ((GenesisMeter)me); + } } } - } - if (loggedinMeters == _meterBatch.ListOfMeters.Count) - { - lblState.ForeColor = Color.Green; - lblState.Text = $@"Connected to PCB {_currentPcbId}"; - lblConfigVersion.Text = @"Configuration Version: " + - _currentGenesis.InterfaceInfo.InterfaceVersion; - lblConfigVersion.ForeColor = _currentGenesis.InterfaceSupportsFwVersion ? - Color.Green: - Color.Red; - if (!_currentGenesis.InterfaceSupportsFwVersion) + if (loggedinMeters == _meterBatch.ListOfMeters.Count) { - var text = "CONFIGURATION OUTDATED!\n\n" + - "The loaded \"configuration.json\" " + - $"version: {_currentGenesis.InterfaceInfo.InterfaceVersion}\n" + - $"does NOT support the Cordonel FW version: {_currentGenesis.FwVersion}!"; - MessageBox.Show(text, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); + lblState.ForeColor = Color.Green; + lblState.Text = $@"Connected to PCB {_currentPcbId}"; + lblConfigVersion.Text = @"Configuration Version: " + + _currentGenesis.InterfaceInfo.InterfaceVersion; + lblConfigVersion.ForeColor = + _currentGenesis.InterfaceSupportsFwVersion ? Color.Green : Color.Red; + if (!_currentGenesis.InterfaceSupportsFwVersion) + { + var text = "CONFIGURATION OUTDATED!\n\n" + + "The loaded \"configuration.json\" " + + $"version: {_currentGenesis.InterfaceInfo.InterfaceVersion}\n" + + $"does NOT support the Cordonel FW version: {_currentGenesis.FwVersion}!"; + MessageBox.Show(text, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + _dataTable.Rows.Clear(); + + + var masterRegisters = new MeterRegisters(); + + foreach (var item in _currentGenesis.GetRegistersDic()) + { + + var row = _dataTable.NewRow(); + row["Name"] = item.Key.GetIdent(); + row["Type"] = item.Key.DataType.Name; + row["isChecked"] = false; + row["Value"] = ""; + row["RawValue"] = item.Value; + row["RawValueFile"] = item.Value; + + + row["Min"] = item.Key.Minimum; + row["Max"] = item.Key.Maximum; + row["Description"] = item.Key.RegisterDetail.Description; + String From = item.Key.RegisterDetail.Version.First.HasValue + ? item.Key.RegisterDetail.Version.First.Value.ToString() + : "-"; + + String To = item.Key.RegisterDetail.Version.Last.HasValue + ? item.Key.RegisterDetail.Version.Last.Value.ToString() + : "-"; + + row["Version"] = $"from {From} to {To}"; + row["IsAvailable"] = item.Key.IsAvailable; + + + + + row["Privilege"] = item.Key.RegisterDetail.Privilege.Lvl8.ToString(); + row["btnHistoryText"] = "View History"; + + _dataTable.Rows.Add(row); + } + + registerGridView.DataSource = _dataTable.DefaultView; + registerGridView.Columns["isChecked"].SortMode = + DataGridViewColumnSortMode.Automatic; + registerGridView.Sort(registerGridView.Columns["isChecked"], + ListSortDirection.Descending); + registerGridView.Columns["RawValueFile"].Visible = false; + registerGridView.Sort(registerGridView.Columns["Name"], + ListSortDirection.Ascending); + + var btnHistory = new DataGridViewButtonColumn(); + btnHistory.Name = "btnHistory"; + + + btnHistory.DataPropertyName = "btnHistoryText"; + registerGridView.Columns.AddRange(new DataGridViewColumn[] { btnHistory }); + + + //foreach (DataGridViewRow row in registerGridView.Rows) + //{ + // if (row.Cells["Type"].Value != null && row.Cells["Type"].Value.ToString().ToLower().Contains("string")) + // { + // row.ReadOnly = true; + // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).Value = false; + // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).FlatStyle = FlatStyle.Flat; + // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).Style.ForeColor = Color.DarkGray; + // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).ReadOnly = true; + // ((DataGridViewTextBoxCell)row.Cells["Value"]).Value = "String is not a supported data type"; + // } + //} + } + else + { + lblState.ForeColor = Color.Red; + lblState.Text = $"Not Connected to PCB"; } - _dataTable.Rows.Clear(); + //lblState.Text = loggedinMeters.Equals(_meterBatch.ListOfMeters.Count) ? $"Connected to Pcb{_currentPcbId}" : $"Not Connected to Pcb"; + }) + ); + SetBusy(false); + }); - var masterRegisters = new MeterRegisters(); - - foreach (var item in _currentGenesis.GetRegistersDic()) - { - - var row = _dataTable.NewRow(); - row["Name"] = item.Key.GetIdent(); - row["Type"] = item.Key.DataType.Name; - row["isChecked"] = false; - row["Value"] = ""; - row["RawValue"] = item.Value; - row["RawValueFile"] = item.Value; - - - row["Min"] = item.Key.Minimum; - row["Max"] = item.Key.Maximum; - row["Description"] = item.Key.RegisterDetail.Description; - String From = item.Key.RegisterDetail.Version.First.HasValue - ? item.Key.RegisterDetail.Version.First.Value.ToString() - : "-"; - - String To = item.Key.RegisterDetail.Version.Last.HasValue - ? item.Key.RegisterDetail.Version.Last.Value.ToString() - : "-"; - - row["Version"] = $"from {From} to {To}"; - row["IsAvailable"] = item.Key.IsAvailable; - - - - - row["Privilege"] = item.Key.RegisterDetail.Privilege.Lvl8.ToString(); - row["btnHistoryText"] = "View History"; - - _dataTable.Rows.Add(row); - } - - registerGridView.DataSource = _dataTable.DefaultView; - registerGridView.Columns["isChecked"].SortMode = - DataGridViewColumnSortMode.Automatic; - registerGridView.Sort(registerGridView.Columns["isChecked"], - ListSortDirection.Descending); - registerGridView.Columns["RawValueFile"].Visible = false; - registerGridView.Sort(registerGridView.Columns["Name"], - ListSortDirection.Ascending); - - var btnHistory = new DataGridViewButtonColumn(); - btnHistory.Name = "btnHistory"; - - - btnHistory.DataPropertyName = "btnHistoryText"; - registerGridView.Columns.AddRange(new DataGridViewColumn[] { btnHistory }); - - - //foreach (DataGridViewRow row in registerGridView.Rows) - //{ - // if (row.Cells["Type"].Value != null && row.Cells["Type"].Value.ToString().ToLower().Contains("string")) - // { - // row.ReadOnly = true; - // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).Value = false; - // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).FlatStyle = FlatStyle.Flat; - // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).Style.ForeColor = Color.DarkGray; - // ((DataGridViewCheckBoxCell)row.Cells["isChecked"]).ReadOnly = true; - // ((DataGridViewTextBoxCell)row.Cells["Value"]).Value = "String is not a supported data type"; - // } - //} - } - else - { - lblState.ForeColor = Color.Red; - lblState.Text = $"Not Connected to PCB"; - } - - //lblState.Text = loggedinMeters.Equals(_meterBatch.ListOfMeters.Count) ? $"Connected to Pcb{_currentPcbId}" : $"Not Connected to Pcb"; - }) - - ); - SetBusy(false); - }); - + } } + + SetBusy(false); } } @@ -462,23 +467,16 @@ namespace Xylem.Common.Ui.GenesisToolBox _meterBatch.Dispose(); } - private void conntect(Int32 slotNR) + private Boolean Connect(Int32 slotNR) { try { _meterBatch.RemoveAllMeters(); _currentGenesis = new GenesisMeter(); - //_currentGenesis.IsDevelopmentUsage = true; //Make sure to set this before login - try - { - _currentGenesis.SetupFromConfigFile(slotNR); - _currentGenesis.EnableAutoLogon(); - _meterBatch.AddMeter(_currentGenesis); - } - catch (Exception ex) - { - Logger.Value.Error(ex, $"Slot #{slotNR} failed: {ex.Message}"); - } + _currentGenesis.UseOfflinePasswords = cbxUseOfflinePwds.Checked; + _currentGenesis.SetupFromConfigFile(slotNR); + _currentGenesis.EnableAutoLogon(); + _meterBatch.AddMeter(_currentGenesis); _currentGenesis.Login(); _currentPcbId = _currentGenesis.PcbId; @@ -486,8 +484,16 @@ namespace Xylem.Common.Ui.GenesisToolBox } catch (Exception ex) { + MessageBox.Show(ex.Message, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.Value.Error(ex, ex.Message); + // Dispose meter + _meterBatch.RemoveAllMeters(); + // If meter is not already assigned to batch as the config reader may fail + _currentGenesis?.DisposeMeter(); + return false; } + + return true; } private void getPcbId(Int32 slotNR) @@ -1679,7 +1685,7 @@ namespace Xylem.Common.Ui.GenesisToolBox button2.BackColor = Color.Yellow; try { - conntect(slotNR); + Connect(slotNR); foreach (var me in _meterBatch.ListOfMeters) { if (me is GenesisMeter) @@ -1728,7 +1734,7 @@ namespace Xylem.Common.Ui.GenesisToolBox button1.BackColor = Color.Yellow; try { - conntect(slotNR); + Connect(slotNR); var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0)); foreach (var me in _meterBatch.ListOfMeters) { @@ -1889,7 +1895,7 @@ namespace Xylem.Common.Ui.GenesisToolBox btnRegisterToFile.BackColor = Color.Yellow; try { - conntect(slotNR); + Connect(slotNR); foreach (var me in _meterBatch.ListOfMeters) { if (me is GenesisMeter) @@ -2023,7 +2029,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { try { - conntect(slotNR); + Connect(slotNR); foreach (var me in _meterBatch.ListOfMeters) { if (me is GenesisMeter) @@ -2067,7 +2073,7 @@ namespace Xylem.Common.Ui.GenesisToolBox try { - conntect(slotNR); + Connect(slotNR); foreach (var me in _meterBatch.ListOfMeters) { if (me is GenesisMeter) @@ -2160,7 +2166,7 @@ namespace Xylem.Common.Ui.GenesisToolBox try { var ret = "nicht geklappt"; - conntect(slotNR); + Connect(slotNR); foreach (var me in _meterBatch.ListOfMeters) { if (me is GenesisMeter Meter) @@ -2296,7 +2302,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { try { - conntect(slotNR); + Connect(slotNR); foreach (var Me in _meterBatch.ListOfMeters) { if (Me is GenesisMeter) @@ -2946,6 +2952,11 @@ namespace Xylem.Common.Ui.GenesisToolBox MessageBox.Show(NotstringBuilder.ToString()); } + + private void cbxUseOfflinePwds_CheckedChanged(Object sender, EventArgs e) + { + cbxUseOfflinePwds.ForeColor = cbxUseOfflinePwds.Checked ? Color.Red : Color.Black; + } } public class Q3Calibration diff --git a/Common/Ui/GenesisToolBox/frmSetup.Designer.cs b/Common/Ui/GenesisToolBox/frmSetup.Designer.cs index cb497eb1..8f1b09ee 100644 --- a/Common/Ui/GenesisToolBox/frmSetup.Designer.cs +++ b/Common/Ui/GenesisToolBox/frmSetup.Designer.cs @@ -71,6 +71,10 @@ this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.tabPage5 = new System.Windows.Forms.TabPage(); + this.cbxSirtService868MHz = new System.Windows.Forms.ComboBox(); + this.cbxSirtService433MHz = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); this.cbxSirtComport868MHz = new System.Windows.Forms.ComboBox(); this.cbxSirtComport433MHz = new System.Windows.Forms.ComboBox(); this.tbxSirtBoxNo = new System.Windows.Forms.TextBox(); @@ -79,10 +83,6 @@ this.lblSirtComport433MHz = new System.Windows.Forms.Label(); this.lblSirtBoxNo = new System.Windows.Forms.Label(); this.lblSirtStation = new System.Windows.Forms.Label(); - this.cbxSirtService868MHz = new System.Windows.Forms.ComboBox(); - this.cbxSirtService433MHz = new System.Windows.Forms.ComboBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvConfig)).BeginInit(); @@ -517,6 +517,40 @@ this.tabPage5.Text = "SIRT"; this.tabPage5.UseVisualStyleBackColor = true; // + // cbxSirtService868MHz + // + this.cbxSirtService868MHz.FormattingEnabled = true; + this.cbxSirtService868MHz.Location = new System.Drawing.Point(142, 164); + this.cbxSirtService868MHz.Name = "cbxSirtService868MHz"; + this.cbxSirtService868MHz.Size = new System.Drawing.Size(121, 21); + this.cbxSirtService868MHz.TabIndex = 13; + // + // cbxSirtService433MHz + // + this.cbxSirtService433MHz.FormattingEnabled = true; + this.cbxSirtService433MHz.Location = new System.Drawing.Point(142, 137); + this.cbxSirtService433MHz.Name = "cbxSirtService433MHz"; + this.cbxSirtService433MHz.Size = new System.Drawing.Size(121, 21); + this.cbxSirtService433MHz.TabIndex = 12; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(22, 168); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(114, 13); + this.label5.TabIndex = 11; + this.label5.Text = "Service Port 868 MHz:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(22, 140); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(114, 13); + this.label7.TabIndex = 10; + this.label7.Text = "Service Port 433 MHz:"; + // // cbxSirtComport868MHz // this.cbxSirtComport868MHz.FormattingEnabled = true; @@ -552,18 +586,18 @@ this.lblSirtComport868MHz.AutoSize = true; this.lblSirtComport868MHz.Location = new System.Drawing.Point(22, 106); this.lblSirtComport868MHz.Name = "lblSirtComport868MHz"; - this.lblSirtComport868MHz.Size = new System.Drawing.Size(95, 13); + this.lblSirtComport868MHz.Size = new System.Drawing.Size(103, 13); this.lblSirtComport868MHz.TabIndex = 5; - this.lblSirtComport868MHz.Text = "Comport 868 MHz:"; + this.lblSirtComport868MHz.Text = "RSSI Port 868 MHz:"; // // lblSirtComport433MHz // this.lblSirtComport433MHz.AutoSize = true; this.lblSirtComport433MHz.Location = new System.Drawing.Point(22, 78); this.lblSirtComport433MHz.Name = "lblSirtComport433MHz"; - this.lblSirtComport433MHz.Size = new System.Drawing.Size(95, 13); + this.lblSirtComport433MHz.Size = new System.Drawing.Size(103, 13); this.lblSirtComport433MHz.TabIndex = 4; - this.lblSirtComport433MHz.Text = "Comport 433 MHz:"; + this.lblSirtComport433MHz.Text = "RSSI Port 433 MHz:"; // // lblSirtBoxNo // @@ -583,40 +617,6 @@ this.lblSirtStation.TabIndex = 2; this.lblSirtStation.Text = "Station ID:"; // - // cbxSirtService868MHz - // - this.cbxSirtService868MHz.FormattingEnabled = true; - this.cbxSirtService868MHz.Location = new System.Drawing.Point(142, 164); - this.cbxSirtService868MHz.Name = "cbxSirtService868MHz"; - this.cbxSirtService868MHz.Size = new System.Drawing.Size(121, 21); - this.cbxSirtService868MHz.TabIndex = 13; - // - // cbxSirtService433MHz - // - this.cbxSirtService433MHz.FormattingEnabled = true; - this.cbxSirtService433MHz.Location = new System.Drawing.Point(142, 137); - this.cbxSirtService433MHz.Name = "cbxSirtService433MHz"; - this.cbxSirtService433MHz.Size = new System.Drawing.Size(121, 21); - this.cbxSirtService433MHz.TabIndex = 12; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(22, 168); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(114, 13); - this.label5.TabIndex = 11; - this.label5.Text = "Service Port 868 MHz:"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(22, 140); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(114, 13); - this.label7.TabIndex = 10; - this.label7.Text = "Service Port 433 MHz:"; - // // FrmSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);