This commit is contained in:
Stoyan Zlatev
2025-09-11 11:50:37 +02:00
24 changed files with 521 additions and 342 deletions
+9 -6
View File
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.33423.255
# Visual Studio Version 17
VisualStudioVersion = 17.14.36310.24 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{7A0EE7B8-6B7E-41E9-B679-319C8CA48CF1}"
EndProject
@@ -364,10 +364,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockGenesis", "Hardware\Wat
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonConsole", "CommonConsole\CommonConsole.csproj", "{AFC428F5-0141-4A3F-BEF2-470A89D972F6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SIRT", "SIRT", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
_MANUAL_CONTROL|Any CPU = _MANUAL_CONTROL|Any CPU
_MANUAL_CONTROL|Mixed Platforms = _MANUAL_CONTROL|Mixed Platforms
@@ -5865,7 +5864,7 @@ Global
{4E8BB839-D40A-488C-88CE-F21811F1F476} = {43B54F41-6F09-4BCB-9F82-77621275831B}
{56768A27-D0E4-430E-8E75-AFC7319F189A} = {C9393A97-C0BB-4D59-A879-B572BE04CE15}
{E6081C0A-8452-44B4-8EB4-E0CAE9119830} = {56768A27-D0E4-430E-8E75-AFC7319F189A}
{8DE8E742-EE0A-4004-AA49-3D08D748E5AC} = {99B23EE9-CE50-4924-A055-C39EFA038721}
{8DE8E742-EE0A-4004-AA49-3D08D748E5AC} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{FDE234FD-FF24-479F-B5CA-DFB74B4636DA} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
{3332395B-122F-4DE5-A294-9DDAEA09F10C} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{890AA5E6-C55A-4E35-9841-999FA24B5025} = {3332395B-122F-4DE5-A294-9DDAEA09F10C}
@@ -5922,10 +5921,14 @@ Global
{A6B3AB5A-A567-4C77-80FB-1E1E19A00713} = {B5F43F61-4448-4992-85B5-7EDFB82FD643}
{D7A7E1FF-D024-407F-B30D-4C519CFA7BF1} = {A6B3AB5A-A567-4C77-80FB-1E1E19A00713}
{AFC428F5-0141-4A3F-BEF2-470A89D972F6} = {C17363DF-A043-4F25-8EBA-2B3B078227DC}
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {99B23EE9-CE50-4924-A055-C39EFA038721}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
+6 -1
View File
@@ -22,7 +22,12 @@ namespace Xylem.Common.CommonCore.Consts
/// <summary>
/// Name for meter config
/// </summary>
public const String ConfigFileName = "MeterConfig.json";
public const String MeterConfigFileName = "MeterConfig.json";
/// <summary>
/// Name for SIRT config
/// </summary>
public const String SirtConfigFileName = "SirtConfig.json";
/// <summary>
/// Name for offline information e.g. Passwords
@@ -49,7 +49,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
/// <summary>
/// Send delay between records in milliseconds before
/// new record is going to be send or between retries,
/// new record is going to be sent or between retries,
/// this time is independent of the timeout, it is
/// used to delay the next send record after successful
/// response from meter.
@@ -100,10 +100,15 @@
</Compile>
<Compile Include="CommunicationConfig.cs" />
<Compile Include="Const\MeterConfig.cs" />
<Compile Include="SirtConfig.cs" />
<Compile Include="ProcessConfig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\CommonCore\CommonCore.csproj">
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
<Name>CommonCore</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Interfaces\Ports\PortCore\PortCore.csproj">
<Project>{2E139F63-B6FE-4EA9-A098-85364FE9B26C}</Project>
<Name>PortCore</Name>
@@ -2,6 +2,7 @@
using System.ComponentModel;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Consts;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
{
@@ -10,35 +11,26 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
/// </summary>
public class ProcessConfig
{
/// <summary>
/// ctor
/// </summary>
public ProcessConfig()
{
UseRegisterWatchService = false;
UseErrorLogger = false;
AutoUpdateFiles = false;
ProductionMode = true;
}
/// <summary>
/// Load configuration file from AppRoaming or working directory
/// </summary>
/// <param name="file"></param>
public ProcessConfig(String file)
public Boolean ReadProcessConfig()
{
// check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Genesis), file);
// Check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.MeterConfigFileName);
if (!File.Exists(configFile))
{
// take actual working directory
configFile = Path.Combine(file);
// Take actual working directory
configFile = Path.Combine(ProgramConfig.MeterConfigFileName);
if (!File.Exists(configFile))
{
UseRegisterWatchService = false;
UseErrorLogger = false;
return;
AutoUpdateFiles = false;
ProductionMode = true;
return false;
}
}
@@ -54,21 +46,21 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
CalibrationLoggerServiceUrl = meterConfig.CalibrationLoggerServiceUrl;
AutoUpdateFiles = meterConfig.AutoUpdateFiles;
ProductionMode = meterConfig.ProductionMode;
}
return true;
}
/// <summary>
/// Write file to AppRoaming and backup it to actual working directory
/// </summary>
/// <param name="file"></param>
public void Update(String file)
public void Update()
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Genesis), file);
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.MeterConfigFileName);
File.WriteAllText(configFile, JsonConvert.SerializeObject(this));
File.WriteAllText(file, JsonConvert.SerializeObject(this));
File.WriteAllText(ProgramConfig.MeterConfigFileName, JsonConvert.SerializeObject(this));
}
/// <summary>
@@ -114,6 +106,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public Boolean ProductionMode { get; set; } = true;
public Boolean ProductionMode { get; set; }
}
}
@@ -0,0 +1,81 @@
using System;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Consts;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
{
/// <summary>
/// Configuration of SIRT
/// </summary>
public class SirtConfig
{
/// <summary>
/// Load SIRT configuration file from AppRoaming or working directory
/// </summary>
public Boolean ReadSirtConfig()
{
// Check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.SirtConfigFileName);
if (!File.Exists(configFile))
{
// Take actual working directory
configFile = Path.Combine(ProgramConfig.SirtConfigFileName);
if (!File.Exists(configFile))
{
SirtComport433MHz = null;
SirtComport868MHz = null;
SirtBoxNo = null;
StationId = null;
return false;
}
}
using (var tr = new StreamReader(configFile))
{
var sirtConfig = JsonConvert.DeserializeObject<SirtConfig>(tr.ReadToEnd());
SirtComport433MHz = sirtConfig.SirtComport433MHz;
SirtComport868MHz = sirtConfig.SirtComport868MHz;
SirtBoxNo = sirtConfig.SirtBoxNo;
StationId = sirtConfig.StationId;
}
return true;
}
/// <summary>
/// Write file to AppRoaming and backup it to actual working directory
/// </summary>
public void Update()
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.SirtConfigFileName);
File.WriteAllText(configFile, JsonConvert.SerializeObject(this));
File.WriteAllText(ProgramConfig.SirtConfigFileName, JsonConvert.SerializeObject(this));
}
/// <summary>
/// Comport for SIRT interface with 433MHz radio frequency
/// </summary>
public String SirtComport433MHz { get; set; }
/// <summary>
/// Comport for SIRT interface with 868MHz radio frequency
/// </summary>
public String SirtComport868MHz { get; set; }
/// <summary>
/// Box number for calibration settings
/// </summary>
public Int32? SirtBoxNo { get; set; }
/// <summary>
/// Station ID where the SIRT is used
/// </summary>
public Int32? StationId { get; set; }
}
}
@@ -142,7 +142,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// Process configuration
/// </summary>
public ProcessConfig Configuration { internal set; get; } = new ProcessConfig();
public ProcessConfig Configuration { internal set; get; } //= new ProcessConfig();
/// <summary>
/// Transmit protocol access for underlie objects to change response timeout
@@ -798,7 +798,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
ledTransmit.GetTransmitPortSettings());
StreamingProtocol = new StreamingProtocol(streamingIdent, ignoreCorruptedData);
}
Configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
Configuration = new ProcessConfig();
Configuration.ReadProcessConfig();
Logger.Debug($"Slot:{Slot} - Setup done");
}
@@ -95,7 +95,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
private static readonly List<String> _excludedFromCompareParameters = new List<String>
{
"CUSTOMER_AlarmVisualMask", // Fully hard coded, cannot be overwritten
//"CUSTOMER_AlarmEnableMask", //Depending on FW version Will be overwritten by SENSUSRADIO if set System state to 0xFF
"CUSTOMER_AppArrangement", // Is read only, makes no sense to compare anything
"SENSUSRADIO_UpgFWVersion" // After a FW-Update the FW version has changed
};
@@ -111,7 +110,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </summary>
private static readonly List<String> _fieldUpdateBlacklist = new List<String>
{
//TODO THW "CUSTOMER_AlarmEnableMask", // Under discussion
"CUSTOMER_AlarmVisualMask",
"CUSTOMER_BackupCalendarSeconds",
"CUSTOMER_InstallationTime",
@@ -667,7 +667,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
ledTransmit.GetTransmitPortSettings());
StreamingProtocol = new StreamingProtocol(streamingIdent, ignoreCorruptedData);
}
Configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
Configuration = new ProcessConfig(ProgramConfig.MeterConfigFileName);
SetLogger();
WriteLog("Setup done");
@@ -1 +1 @@
89102b0142e574de38a9f47d370f3334e5e6c268
8cb55c312de586b683d72cf58c13e2801d10e14b767777d98338d3e1473a1213
@@ -35,11 +35,10 @@
<appSettings>
<add key="Mode" value="1" /> <!--1 = EOL ; 2 = Picking-->
<add key="SirtComport433" value="14" /> <!--Thomas 14; Roland ; Stoyan ; VFM1 9; VFM4 7-->
<add key="SirtComport868" value="15" /> <!--Thomas 15; Roland ; Stoyan ; VFM1 10; VFM4 8-->
<add key="SirtBoxNr" value="2" /> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 3-->
<add key="StationID" value="2" /> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 4-->
<!--add key="SirtComport433" value="14" /--> <!--Thomas 14; Roland ; Stoyan ; VFM1 9; VFM4 7-->
<!--add key="SirtComport868" value="15" /--> <!--Thomas 15; Roland ; Stoyan ; VFM1 10; VFM4 8-->
<!--add key="SirtBoxNr" value="2" /--> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 3-->
<!--add key="StationID" value="2" /--> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 4-->
</appSettings>
@@ -1,137 +1,137 @@
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
//using System;
//using System.Collections.Generic;
//using System.IO;
//using Newtonsoft.Json;
namespace Xylem.Common.Production.ProductionUiCordonel
{
//namespace Xylem.Common.Production.ProductionUiCordonel
//{
/// <summary>
/// Configuration of ProductionUi
/// </summary>
public class ApplicationSettings
{
// /// <summary>
// /// Configuration of ProductionUi
// /// </summary>
// public class ApplicationSettings
// {
public class Pos
{
public Double Left { get; set; }
public Double Top { get; set; }
public Double Height { get; set; }
public Double Width { get; set; }
}
public class MultiFormChilds
{
public Type ViewModelType { get; set; }
public Boolean Visisble { get; set; }
public String Name { get; set; }
public Int32 Slot { get; set; }
public String TextPort { get; set; }
public Pos StartPos { get; set; }
// public class Pos
// {
// public Double Left { get; set; }
// public Double Top { get; set; }
// public Double Height { get; set; }
// public Double Width { get; set; }
// }
// public class MultiFormChilds
// {
// public Type ViewModelType { get; set; }
// public Boolean Visisble { get; set; }
// public String Name { get; set; }
// public Int32 Slot { get; set; }
// public String TextPort { get; set; }
// public Pos StartPos { get; set; }
}
public Int32 Slot { get; set; }
// }
// public Int32 Slot { get; set; }
public Int32? PressureStationId { get; set; }
public Boolean AutoDetect { get; set; }
// public Int32? PressureStationId { get; set; }
// public Boolean AutoDetect { get; set; }
public Boolean AccessToPresuretestTab { get; set; }
public Boolean AccessToMarrieTab { get; set; }
public Boolean AccessToFinalcheckTab { get; set; }
// public Boolean AccessToPresuretestTab { get; set; }
// public Boolean AccessToMarrieTab { get; set; }
// public Boolean AccessToFinalcheckTab { get; set; }
public Boolean AccessToSettingTab { get; set; }
public Boolean AccessToStatusTab { get; set; }
public Boolean AccessToPickingTab { get; set; }
// public Boolean AccessToSettingTab { get; set; }
// public Boolean AccessToStatusTab { get; set; }
// public Boolean AccessToPickingTab { get; set; }
public Int32? SirtComport433 { get; set; }
public Int32? SirtComport866 { get; set; }
public Int32? SirtBoxNr { get; set; }
// public Int32? SirtComport433 { get; set; }
// public Int32? SirtComport866 { get; set; }
// public Int32? SirtBoxNr { get; set; }
public Int32? StationId { get; set; }
// public Int32? StationId { get; set; }
public List<MultiFormChilds> ChildForms { get; set; }
// public List<MultiFormChilds> ChildForms { get; set; }
/// <summary>
/// ctor
/// </summary>
public ApplicationSettings()
{
Slot = 0;
AutoDetect = false;
AccessToPresuretestTab = false;
AccessToMarrieTab = false;
AccessToFinalcheckTab = false;
AccessToSettingTab = false;
AccessToPickingTab = false;
AccessToStatusTab = false;
PressureStationId = null;
SirtComport433 = null;
SirtComport866 = null;
SirtBoxNr = null;
ChildForms = new List<MultiFormChilds>();
StationId = null;
}
/// <inheritdoc />
public ApplicationSettings(String file)
{
//var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
//nameof(Xylem.Common.Hardware.WaterMeter.Genesis), file);
// /// <summary>
// /// ctor
// /// </summary>
// public ApplicationSettings()
// {
// Slot = 0;
// AutoDetect = false;
// AccessToPresuretestTab = false;
// AccessToMarrieTab = false;
// AccessToFinalcheckTab = false;
// AccessToSettingTab = false;
// AccessToPickingTab = false;
// AccessToStatusTab = false;
// PressureStationId = null;
// SirtComport433 = null;
// SirtComport866 = null;
// SirtBoxNr = null;
// ChildForms = new List<MultiFormChilds>();
// StationId = null;
// }
// /// <inheritdoc />
// public ApplicationSettings(String file)
// {
// //var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
// //nameof(Xylem.Common.Hardware.WaterMeter.Genesis), file);
//if (!File.Exists(configFile))
//{
var configFile = Path.Combine(file);
if (!File.Exists(configFile))
{
Slot = 0;
AutoDetect = false;
AccessToPresuretestTab = false;
AccessToMarrieTab = false;
AccessToFinalcheckTab = false;
AccessToSettingTab = false;
AccessToPickingTab = false;
AccessToStatusTab = false;
PressureStationId = null;
ChildForms = new List<MultiFormChilds>();
StationId = null;
return;
}
//}
// //if (!File.Exists(configFile))
// //{
// var configFile = Path.Combine(file);
// if (!File.Exists(configFile))
// {
// Slot = 0;
// AutoDetect = false;
// AccessToPresuretestTab = false;
// AccessToMarrieTab = false;
// AccessToFinalcheckTab = false;
// AccessToSettingTab = false;
// AccessToPickingTab = false;
// AccessToStatusTab = false;
// PressureStationId = null;
// ChildForms = new List<MultiFormChilds>();
// StationId = null;
// return;
// }
// //}
using (var tr = new StreamReader(configFile))
{
var meterConfig = JsonConvert.DeserializeObject<ApplicationSettings>(tr.ReadToEnd());
if (meterConfig != null)
{
Slot = meterConfig.Slot;
AutoDetect = meterConfig.AutoDetect;
AccessToPresuretestTab = meterConfig.AccessToPresuretestTab;
AccessToMarrieTab = meterConfig.AccessToMarrieTab;
AccessToFinalcheckTab = meterConfig.AccessToFinalcheckTab;
AccessToSettingTab = meterConfig.AccessToSettingTab;
AccessToPickingTab = meterConfig.AccessToPickingTab;
AccessToStatusTab = meterConfig.AccessToStatusTab;
PressureStationId = meterConfig.PressureStationId;
// using (var tr = new StreamReader(configFile))
// {
// var meterConfig = JsonConvert.DeserializeObject<ApplicationSettings>(tr.ReadToEnd());
// if (meterConfig != null)
// {
// Slot = meterConfig.Slot;
// AutoDetect = meterConfig.AutoDetect;
// AccessToPresuretestTab = meterConfig.AccessToPresuretestTab;
// AccessToMarrieTab = meterConfig.AccessToMarrieTab;
// AccessToFinalcheckTab = meterConfig.AccessToFinalcheckTab;
// AccessToSettingTab = meterConfig.AccessToSettingTab;
// AccessToPickingTab = meterConfig.AccessToPickingTab;
// AccessToStatusTab = meterConfig.AccessToStatusTab;
// PressureStationId = meterConfig.PressureStationId;
ChildForms = meterConfig.ChildForms;
StationId = meterConfig.StationId;
}
}
// ChildForms = meterConfig.ChildForms;
// StationId = meterConfig.StationId;
// }
// }
}
// }
public void Update(String file)
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Hardware.WaterMeter.Genesis), file);
// public void Update(String file)
// {
// var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
// nameof(Hardware.WaterMeter.Genesis), file);
if (!File.Exists(configFile))
{
configFile = Path.Combine(file);
}
// if (!File.Exists(configFile))
// {
// configFile = Path.Combine(file);
// }
File.WriteAllText(file, JsonConvert.SerializeObject(this));
}
// File.WriteAllText(file, JsonConvert.SerializeObject(this));
// }
}
}
// }
//}
@@ -2,7 +2,6 @@
using Newtonsoft.Json.Linq;
using SIRTCOM;
using System;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Threading;
@@ -10,6 +9,7 @@ using System.Windows.Threading;
using System.Xml.Linq;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
@@ -18,6 +18,7 @@ using Xylem.Common.Production.ProductionUiCordonel.Properties;
using Xylem.Common.Production.ProductionUiCordonel.UserControls;
using Xylem.Common.Utils.Logging;
using Button = System.Windows.Controls.Button;
// ReSharper disable UnusedAutoPropertyAccessor.Local
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolProcesses
@@ -104,7 +105,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <summary>
/// Comport number of SIRT
/// </summary>
private Byte _sirtComport;
private Int32 _sirtComport;
/// <summary>
/// Radio address Cordonel
@@ -127,10 +128,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
{
Retry();
};
//_checkRadioUserControl.OnDoneRequested += delegate
//{
// SaveRssiLevelsToDb();
//};
}
/// <summary>
@@ -181,6 +178,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2025-Mai-07" author="Thomas Wiedebusch">
/// - Removed change and read back of MainAlarmMask and ExtendedAlarmMask.
/// </remarks>
/// <remarks date="2025-Sep-10" author="Thomas Wiedebusch">
/// - Load settings from SIRT config file instead from AppConfig.
/// </remarks>
public override StatusReturn ExecuteProcess()
{
// This will force to reset all values, Sentinel and Prepare shipping will fail based on EOL Progress
@@ -269,9 +269,22 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
SuccessMsgDispatcher(Resources.StrSuccessMsgDbToMeterEncryptionKey);
ActualProcessProgress++;
_sirtComport = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtComport{freq}"]);
//_sirtSecondComport = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtComportAlarm{freq}"]);
_sirtBoxNr = Convert.ToByte(ConfigurationManager.AppSettings["SirtBoxNr"]);
// Load settings from SIRT config file
var sirtConfig = new SirtConfig();
sirtConfig.ReadSirtConfig();
if (freq == 433 && sirtConfig.SirtComport433MHz != null)
{
int.TryParse(sirtConfig.SirtComport433MHz.Replace("COM", ""), out _sirtComport);
}
if (freq == 868 && sirtConfig.SirtComport433MHz != null)
{
int.TryParse(sirtConfig.SirtComport868MHz.Replace("COM", ""), out _sirtComport);
}
if (sirtConfig.SirtBoxNo != null)
_sirtBoxNr = (Byte)sirtConfig.SirtBoxNo;
var ucRadio = (UcRadioCheck)UserControl;
ucRadio.SetHeadline($"{Resources.StrStateRadioCheck} BOX: {_sirtBoxNr}");
@@ -329,100 +342,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
SuccessMsgDispatcher(Resources.StrSuccessMsgRadioInCustomerMode);
//// Initialize the SIRT
//if (!SirtInit())
//{
// return SetTestFailed(Resources.StrErrorMsgSirt);
//}
////Radio rest alarms
////readout wakeup, interval
////start process
////wait for process exit code
//var WakUpRestore = RegisterConverter.ByteArrayToValue<ushort>(Meter.ReadRegister("SENSUSRADIO_WakeupInterval"));
//var TxIntervalRestore = RegisterConverter.ByteArrayToValue<UInt16>(Meter.ReadRegister("SENSUSRADIO_TxInterval"));
//var LatRestore = RegisterConverter.ByteArrayToValue<ushort>(Meter.ReadRegister("SENSUSRADIO_LatInterval"));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_WakeupInterval",
//new Byte[] { 0x00 }, ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_TxInterval",
//new Byte[] { 0x01 }, ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_LatInterval", RegisterConverter.ValueToByteArray(3), ProgrammingSource.ProgramInternal));
//Meter.Logout();
//var process = new Process
//{
// EnableRaisingEvents = true,
// StartInfo = new ProcessStartInfo
// {
// Arguments = $"COM{_sirtSecondComport} {_radioAddressCordonel} {_radioEncryptionKey}",
// FileName = @"\\sla12file\auftrag\ProductionUiCordonel\CommonConsoleV2\CommonConsole.exe",
// CreateNoWindow = true,
// UseShellExecute = false,
// RedirectStandardError = true,
// RedirectStandardOutput = true
// }
//};
//void logData(string data, bool error)
//{
// if (!string.IsNullOrWhiteSpace(data))
// {
// if (error)
// {
// ErrorMsgDispatcher(data.Trim());
// }
// else
// {
// SuccessMsgDispatcher(data.Trim());
// }
// }
//}
//process.ErrorDataReceived += (_, args) => logData(args.Data, true);
//process.OutputDataReceived += (_, args) => logData(args.Data, false);
//process.Start();
//process.BeginOutputReadLine();
//process.BeginErrorReadLine();
//process.WaitForExit(80_000);
//if (process.ExitCode != 0)
//{
// ErrorMsgDispatcher($"AlarmReset failed ExitCode{process.ExitCode}");
// return SetTestFailed($"AlarmReset failed ExitCode{process.ExitCode}");
//}
////restore
//// reset system state back to shipping mode
//Meter.Login();
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_WakeupInterval", RegisterConverter.ValueToByteArray(WakupRestore) , ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_TxInterval", RegisterConverter.ValueToByteArray(TxIntervalRestore), ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_LatInterval", RegisterConverter.ValueToByteArray(LatRestore), ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_SystemState",
// new Byte[] { 0xFF }, ProgrammingSource.ProgramInternal));
//ActualProcessProgress++;
//_finalRadioSystemState = RegisterConverter.ByteArrayToValue<Byte>(Meter.ReadRegister("SENSUSRADIO_SystemState"));
//ActualProcessProgress++;
//if (// radio system state 0x02 shipping mode, 0x01 production mode, 0x0C transmission and data logger active
// _finalRadioSystemState != 0x02
// // 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);
//}
// Skip radio check by requirement
if (skipRadioCheck)
{
@@ -945,14 +864,19 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2025-Aug-25" author="Stoyan Slatev">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Sep-02" author="Thomas WIedebusch">
/// <remarks date="2025-Sep-02" author="Thomas Wiedebusch">
/// - Multilingual.
/// </remarks>
/// <remarks date="2025-Sep-10" author="Stoyan Slatev">
/// - Reworked.
/// </remarks>
private void CheckAlarmStateFromRF(params Byte[] telegram)
{
if (telegram == null) return;
try
{
var telegramLength = telegram?.Length ?? 0;
var telegramLength = telegram.Length;
if (telegramLength <= 8)
{
@@ -960,8 +884,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
return;
}
if (telegram == null) return;
var semiLength = Math.Min(telegram[7], (Byte)RFTelegrams.SEMI.MIN_LENGTH);
if (telegramLength < semiLength)
@@ -969,9 +891,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
ErrorMsgDispatcher(Resources.StrErrorMsgSemiTelegramLength);
return;
}
var mhz = RegisterConverter.ByteArrayToValue<UInt32>(Meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
var semiBytes = new Byte[semiLength];
Array.Copy(telegram, 8, semiBytes, 0, semiLength);
Array.Copy(telegram, 8, semiBytes, 0, semiLength - 8);
var semi = new RFTelegrams.SEMI(semiBytes, (Int32)mhz);
var alarms = semi.MainAlarmByte;
@@ -101,6 +101,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
return StatusReturn.Failed;
}
}
// ReSharper disable once UnusedVariable used for DEBUG
var readBackScaledBilling =
RegisterConverter.ByteArrayToValue<Int64>(Meter.ReadRegister("GENESISFLOW_ScaledBilling"));
@@ -120,7 +121,17 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
CancellationToken);
RegisterRestorer.OnProcessUpdate -= ProcessUpdate_Handler;
// ReSharper disable once UnusedVariable used for DEBUG
readBackScaledBilling =
RegisterConverter.ByteArrayToValue<Int64>(Meter.ReadRegister("GENESISFLOW_ScaledBilling"));
// ReSharper disable once UnusedVariable used for DEBUG
readBackUnscaledFwd =
RegisterConverter.ByteArrayToValue<UInt64>(Meter.ReadRegister("GENESISFLOW_UnscaledFwd"));
// ReSharper disable once UnusedVariable used for DEBUG
readBackUnscaledRev =
RegisterConverter.ByteArrayToValue<UInt64>(Meter.ReadRegister("GENESISFLOW_UnscaledRev"));
EolProgress.ParametrizationDoneChecked = retVal == StatusReturn.Okay ? EOLStatus.OK : EOLStatus.FAIL;
return retVal;
}
@@ -162,6 +162,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
}
}
// Check all values for 0 after reset and followed reboot which may use the
var readBackScaledBilling =
RegisterConverter.ByteArrayToValue<Int64>(Meter.ReadRegister("GENESISFLOW_ScaledBilling"));
var readBackUnscaledFwd =
@@ -1,6 +1,6 @@
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.RFTelegrams
{
public enum AppCode
public enum AppCode
{
BUP = 0x00,
LAT = 0x01,
@@ -7,7 +7,8 @@
public class SEMI
{
public const int MIN_LENGTH = 120;
//public const int MIN_LENGTH = 120;
public const int MIN_LENGTH = 97;
public SEMI(byte[] payload, int mhz)
{
@@ -54,15 +55,15 @@
this.PulseOutParameter = payload[94];
this.AlarmByteExtended = payload[95];
this.AlarmMaskExtended = payload[96];
this.AlarmMaxPressureTime = payload.ToUInt32BE(97);
this.AlarmMinPressureTime = payload.ToUInt32BE(101);
this.AlarmMaxTemperatureTime = payload.ToUInt32BE(105);
this.AlarmMinTemperatureTime = payload.ToUInt32BE(109);
this.LogContentPressureTemperature = payload.ToUInt16BE(113);
this.FDRContentPressureTemperature = payload.ToUInt16BE(115);
this.UnitExtraFlags = payload[117];
this.MeterSize = payload[118];
this.PressureCalibrationOffset = payload[119];
//this.AlarmMaxPressureTime = payload.ToUInt32BE(97);
//this.AlarmMinPressureTime = payload.ToUInt32BE(101);
//this.AlarmMaxTemperatureTime = payload.ToUInt32BE(105);
//this.AlarmMinTemperatureTime = payload.ToUInt32BE(109);
//this.LogContentPressureTemperature = payload.ToUInt16BE(113);
//this.FDRContentPressureTemperature = payload.ToUInt16BE(115);
//this.UnitExtraFlags = payload[117];
//this.MeterSize = payload[118];
//this.PressureCalibrationOffset = payload[119];
}
public AppCode AppCode { get; }
@@ -151,22 +152,22 @@
public byte AlarmMaskExtended { get; }
public uint AlarmMaxPressureTime { get; }
//public uint AlarmMaxPressureTime { get; }
public uint AlarmMinPressureTime { get; }
//public uint AlarmMinPressureTime { get; }
public uint AlarmMaxTemperatureTime { get; }
//public uint AlarmMaxTemperatureTime { get; }
public uint AlarmMinTemperatureTime { get; }
//public uint AlarmMinTemperatureTime { get; }
public ushort LogContentPressureTemperature { get; }
//public ushort LogContentPressureTemperature { get; }
public ushort FDRContentPressureTemperature { get; }
//public ushort FDRContentPressureTemperature { get; }
public byte UnitExtraFlags { get; }
//public byte UnitExtraFlags { get; }
public byte MeterSize { get; }
//public byte MeterSize { get; }
public byte PressureCalibrationOffset { get; }
//public byte PressureCalibrationOffset { get; }
}
}
@@ -141,10 +141,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel
InitializeFormState();
}
private ApplicationSettings Settings
{
get; set;
}
//private ApplicationSettings Settings
//{
// get; set;
//}
/// <summary>
/// Initialize the FinalTest GUI:
@@ -183,7 +183,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel
}
cbxSlotBox.SelectedIndex = 0;
Settings = new ApplicationSettings("ProductionUiConfig.json");
//Settings = new ApplicationSettings("ProductionUiConfig.json");
UseSetting(true);
@@ -248,7 +248,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel
//}
if (setSlot)
{
cbxSlotBox.SelectedValue = Settings.Slot;
//cbxSlotBox.SelectedValue = Settings.Slot;
cbxSlotBox.SelectedValue = 0;
}
}
@@ -863,10 +864,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel
}
private void StoreSetting()
{
Settings.Update("ProductionUiConfig.json");
}
//private void StoreSetting()
//{
// Settings.Update("ProductionUiConfig.json");
//}
//private void BtnConnect_Click(Object sender, RoutedEventArgs e)
//{
@@ -471,7 +471,6 @@
<Compile Include="Infrastructure\TempMeterModels.cs" />
<Compile Include="Infrastructure\UserLoginModel.cs" />
<Compile Include="OfflinePasswordItem.cs" />
<Compile Include="ProccessConfig.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgrammState.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -1,12 +0,0 @@
using System;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
namespace Xylem.Common.Ui.GenesisToolBox
{
internal class ProccessConfig : ProcessConfig
{
public ProccessConfig(String file) : base(file)
{
}
}
}
+126 -21
View File
@@ -53,9 +53,6 @@
this.tabPage3 = new System.Windows.Forms.TabPage();
this.cmdAddOffline = new System.Windows.Forms.Button();
this.dgvofflinePw = new System.Windows.Forms.DataGridView();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.offlinePaswordItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabPage4 = new System.Windows.Forms.TabPage();
this.lblGlobalCurrentPath = new System.Windows.Forms.Label();
this.btnGlobalSearch = new System.Windows.Forms.Button();
@@ -70,14 +67,27 @@
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.lblSirtStation = new System.Windows.Forms.Label();
this.lblSirtBoxNo = new System.Windows.Forms.Label();
this.lblSirtComport433MHz = new System.Windows.Forms.Label();
this.lblSirtComport868MHz = new System.Windows.Forms.Label();
this.tbxSirtStationId = new System.Windows.Forms.TextBox();
this.tbxSirtBoxNo = new System.Windows.Forms.TextBox();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.offlinePaswordItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.cbxSirtComport433MHz = new System.Windows.Forms.ComboBox();
this.cbxSirtComport868MHz = new System.Windows.Forms.ComboBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvConfig)).BeginInit();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvofflinePw)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).BeginInit();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnReload
@@ -106,6 +116,7 @@
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Controls.Add(this.tabPage5);
this.tabControl1.Location = new System.Drawing.Point(12, 74);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
@@ -320,22 +331,6 @@
this.dgvofflinePw.Size = new System.Drawing.Size(345, 170);
this.dgvofflinePw.TabIndex = 16;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "PcbID";
this.dataGridViewTextBoxColumn1.HeaderText = "PcbID";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "Password";
this.dataGridViewTextBoxColumn2.HeaderText = "Password";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
//
// offlinePaswordItemBindingSource
//
this.offlinePaswordItemBindingSource.DataSource = typeof(Xylem.Common.Ui.GenesisToolBox.OfflinePasswordItem);
//
// tabPage4
//
this.tabPage4.Controls.Add(this.lblGlobalCurrentPath);
@@ -481,6 +476,105 @@
this.label2.TabIndex = 0;
this.label2.Text = "Local (only ToolBox)";
//
// tabPage5
//
this.tabPage5.Controls.Add(this.cbxSirtComport868MHz);
this.tabPage5.Controls.Add(this.cbxSirtComport433MHz);
this.tabPage5.Controls.Add(this.tbxSirtBoxNo);
this.tabPage5.Controls.Add(this.tbxSirtStationId);
this.tabPage5.Controls.Add(this.lblSirtComport868MHz);
this.tabPage5.Controls.Add(this.lblSirtComport433MHz);
this.tabPage5.Controls.Add(this.lblSirtBoxNo);
this.tabPage5.Controls.Add(this.lblSirtStation);
this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(760, 361);
this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "SIRT";
this.tabPage5.UseVisualStyleBackColor = true;
//
// lblSirtStation
//
this.lblSirtStation.AutoSize = true;
this.lblSirtStation.Location = new System.Drawing.Point(22, 24);
this.lblSirtStation.Name = "lblSirtStation";
this.lblSirtStation.Size = new System.Drawing.Size(57, 13);
this.lblSirtStation.TabIndex = 2;
this.lblSirtStation.Text = "Station ID:";
//
// lblSirtBoxNo
//
this.lblSirtBoxNo.AutoSize = true;
this.lblSirtBoxNo.Location = new System.Drawing.Point(22, 51);
this.lblSirtBoxNo.Name = "lblSirtBoxNo";
this.lblSirtBoxNo.Size = new System.Drawing.Size(45, 13);
this.lblSirtBoxNo.TabIndex = 3;
this.lblSirtBoxNo.Text = "Box No:";
//
// 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.TabIndex = 4;
this.lblSirtComport433MHz.Text = "Comport 433 MHz:";
//
// lblSirtComport868MHz
//
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.TabIndex = 5;
this.lblSirtComport868MHz.Text = "Comport 868 MHz:";
//
// tbxSirtStationId
//
this.tbxSirtStationId.Location = new System.Drawing.Point(142, 17);
this.tbxSirtStationId.Name = "tbxSirtStationId";
this.tbxSirtStationId.Size = new System.Drawing.Size(100, 20);
this.tbxSirtStationId.TabIndex = 6;
//
// tbxSirtBoxNo
//
this.tbxSirtBoxNo.Location = new System.Drawing.Point(142, 44);
this.tbxSirtBoxNo.Name = "tbxSirtBoxNo";
this.tbxSirtBoxNo.Size = new System.Drawing.Size(100, 20);
this.tbxSirtBoxNo.TabIndex = 7;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "PcbID";
this.dataGridViewTextBoxColumn1.HeaderText = "PcbID";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "Password";
this.dataGridViewTextBoxColumn2.HeaderText = "Password";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
//
// offlinePaswordItemBindingSource
//
this.offlinePaswordItemBindingSource.DataSource = typeof(Xylem.Common.Ui.GenesisToolBox.OfflinePasswordItem);
//
// cbxSirtComport433MHz
//
this.cbxSirtComport433MHz.FormattingEnabled = true;
this.cbxSirtComport433MHz.Location = new System.Drawing.Point(142, 75);
this.cbxSirtComport433MHz.Name = "cbxSirtComport433MHz";
this.cbxSirtComport433MHz.Size = new System.Drawing.Size(121, 21);
this.cbxSirtComport433MHz.TabIndex = 8;
//
// cbxSirtComport868MHz
//
this.cbxSirtComport868MHz.FormattingEnabled = true;
this.cbxSirtComport868MHz.Location = new System.Drawing.Point(142, 102);
this.cbxSirtComport868MHz.Name = "cbxSirtComport868MHz";
this.cbxSirtComport868MHz.Size = new System.Drawing.Size(121, 21);
this.cbxSirtComport868MHz.TabIndex = 9;
//
// FrmSetup
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -500,9 +594,11 @@
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvofflinePw)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).EndInit();
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -550,5 +646,14 @@
private System.Windows.Forms.Button btnGlobalDefaultLan;
private System.Windows.Forms.Button btnGlobalDefaultLocal;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.Label lblSirtComport868MHz;
private System.Windows.Forms.Label lblSirtComport433MHz;
private System.Windows.Forms.Label lblSirtBoxNo;
private System.Windows.Forms.Label lblSirtStation;
private System.Windows.Forms.TextBox tbxSirtBoxNo;
private System.Windows.Forms.TextBox tbxSirtStationId;
private System.Windows.Forms.ComboBox cbxSirtComport868MHz;
private System.Windows.Forms.ComboBox cbxSirtComport433MHz;
}
}
+51 -9
View File
@@ -39,9 +39,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
private readonly String _serialConfigFilePathName;
private readonly String _offlinePwdPathName;
private readonly DataTable _slotConfigDataTable = new DataTable();
private readonly ProcessConfig _configuration;
//private readonly List<String> _sirt433MhzComports = new List<String>();
//private readonly List<String> _sirt868MHzComports = new List<String>();
private readonly SirtConfig _sirtConfig = new SirtConfig();
private readonly ProcessConfig _configuration = new ProcessConfig();
/// <summary>
/// Ctor
@@ -78,12 +79,33 @@ namespace Xylem.Common.Ui.GenesisToolBox
cbcSlotType.HeaderText = SlotTypeString;
LoadFromFile();
_configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
_configuration.ReadProcessConfig();
cbUseMinMaxCheck.Checked = _configuration.UseMinMaxCheck;
cbUseRegisterWatch.Checked = _configuration.UseRegisterWatchService;
txtWachSeriveUrl.Text = _configuration.RegisterWatchServiceUrl;
cbUpdateFiles.Checked = _configuration.AutoUpdateFiles;
cbxProductionMode.Checked = _configuration.ProductionMode;
_sirtConfig.ReadSirtConfig();
tbxSirtStationId.Text = _sirtConfig.StationId?.ToString();
tbxSirtBoxNo.Text = _sirtConfig.SirtBoxNo?.ToString();
if (_sirtConfig.SirtComport433MHz != null)
cbxSirtComport433MHz.Items.Add(_sirtConfig.SirtComport433MHz);
if (_sirtConfig.SirtComport868MHz != null)
cbxSirtComport868MHz.Items.Add(_sirtConfig.SirtComport868MHz);
var comPorts = SerialPort.GetPortNames().ToList();
foreach (var comPort in comPorts.Where(comPort => !cbxSirtComport433MHz.Items.Contains(comPort)))
{
cbxSirtComport433MHz.Items.Add(comPort);
}
foreach (var comPort in comPorts.Where(comPort => !cbxSirtComport868MHz.Items.Contains(comPort)))
{
cbxSirtComport868MHz.Items.Add(comPort);
}
cbxSirtComport433MHz.Text = cbxSirtComport433MHz.Items[0].ToString();
cbxSirtComport868MHz.Text = cbxSirtComport868MHz.Items[0].ToString();
}
private void BtnReload_Click(Object sender, EventArgs e)
@@ -96,6 +118,25 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
StoreToPc();
StoreOfflineFile();
StoreSirtSettings();
}
private void StoreSirtSettings()
{
// Get the SIRT settings from the GUI
if (int.TryParse(tbxSirtStationId.Text, out var intNo))
{
_sirtConfig.StationId = intNo;
}
if (int.TryParse(tbxSirtBoxNo.Text, out intNo))
{
_sirtConfig.SirtBoxNo = intNo;
}
_sirtConfig.SirtComport433MHz = cbxSirtComport433MHz.Text;
_sirtConfig.SirtComport868MHz = cbxSirtComport868MHz.Text;
_sirtConfig.Update();
}
private void StoreToPc()
@@ -401,28 +442,28 @@ namespace Xylem.Common.Ui.GenesisToolBox
private void cbUseRegisterWatch_CheckedChanged(Object sender, EventArgs e)
{
_configuration.UseRegisterWatchService = cbUseRegisterWatch.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
private void cbUseMinMaxCheck_CheckedChanged(Object sender, EventArgs e)
{
_configuration.UseMinMaxCheck = cbUseMinMaxCheck.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
private void textBox1_TextChanged(Object sender, EventArgs e)
{
_configuration.RegisterWatchServiceUrl = txtWachSeriveUrl.Text;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
private void cbUpdateFiles_CheckedChanged(Object sender, EventArgs e)
{
_configuration.AutoUpdateFiles = cbUpdateFiles.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
@@ -503,6 +544,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
else
{
// ReSharper disable once LocalizableElement
MessageBox.Show("Developer mode! Configuration.json can be exchanged on individual requirements.\n" +
"\nRISK:\n" +
"- Register ranges cannot be checked\n" +
@@ -510,7 +552,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
_configuration.ProductionMode = cbxProductionMode.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
+24
View File
@@ -138,6 +138,30 @@
<metadata name="btcDetectStreaming.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tbcSlot.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcRequestPort.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcRequestType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcStreamingPort.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcSlotType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btcDetectRequest.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btcDetectStreaming.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="offlinePaswordItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="offlinePaswordItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>