Initial commit
This commit is contained in:
commit
fe54fceb1e
6
CRC_CCITT/App.config
Normal file
6
CRC_CCITT/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
104
CRC_CCITT/CRC_CCITT.csproj
Normal file
104
CRC_CCITT/CRC_CCITT.csproj
Normal file
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4B7D6CF3-3C77-4A1F-A55E-4BD48C858330}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CRC_CCITT</RootNamespace>
|
||||
<AssemblyName>CRC_CCITT</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>d:\Temp\CRC_CCITT_Docu\\CRC_CCITT.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>itemPicker.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="crcGenerator.cs" />
|
||||
<Compile Include="crcProgram.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="s19FileHandler.cs" />
|
||||
<Compile Include="txtFileHandler.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="itemPicker.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
10
CRC_CCITT/CRC_CCITT.csproj.vspscc
Normal file
10
CRC_CCITT/CRC_CCITT.csproj.vspscc
Normal file
@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
35
CRC_CCITT/CRC_CCITT.sln
Normal file
35
CRC_CCITT/CRC_CCITT.sln
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.852
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CRC_CCITT", "CRC_CCITT.csproj", "{4B7D6CF3-3C77-4A1F-A55E-4BD48C858330}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4B7D6CF3-3C77-4A1F-A55E-4BD48C858330}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4B7D6CF3-3C77-4A1F-A55E-4BD48C858330}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4B7D6CF3-3C77-4A1F-A55E-4BD48C858330}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4B7D6CF3-3C77-4A1F-A55E-4BD48C858330}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8E3A0A0D-3584-415E-BD14-31AE18DB6D98}
|
||||
EndGlobalSection
|
||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||
SccNumberOfProjects = 1
|
||||
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||
SccTeamFoundationServer = http://10.1.0.164:8080/tfs/sensusprojectcollection
|
||||
SccProjectUniqueName0 = CRC_CCITT.csproj
|
||||
SccProjectName0 = .
|
||||
SccAuxPath0 = http://10.1.0.164:8080/tfs/sensusprojectcollection
|
||||
SccLocalPath0 = .
|
||||
SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
10
CRC_CCITT/CRC_CCITT.vssscc
Normal file
10
CRC_CCITT/CRC_CCITT.vssscc
Normal file
@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
|
||||
}
|
||||
38
CRC_CCITT/Properties/AssemblyInfo.cs
Normal file
38
CRC_CCITT/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Resources;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CRC_CCITT")]
|
||||
[assembly: AssemblyDescription("Polynomal 0x1021; CRC16")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("SENSUS")]
|
||||
[assembly: AssemblyProduct("CRC_CCITT")]
|
||||
[assembly: AssemblyCopyright("Copyright © SENSUS 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a1e7c4e5-2f56-4ad6-8116-e615e1634655")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
8
CRC_CCITT/bin/Debug/CRC_CCITT.XML
Normal file
8
CRC_CCITT/bin/Debug/CRC_CCITT.XML
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>CRC_CCITT</name>
|
||||
</assembly>
|
||||
<members>
|
||||
</members>
|
||||
</doc>
|
||||
BIN
CRC_CCITT/bin/Debug/CRC_CCITT.exe
Normal file
BIN
CRC_CCITT/bin/Debug/CRC_CCITT.exe
Normal file
Binary file not shown.
6
CRC_CCITT/bin/Debug/CRC_CCITT.exe.config
Normal file
6
CRC_CCITT/bin/Debug/CRC_CCITT.exe.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
CRC_CCITT/bin/Debug/CRC_CCITT.pdb
Normal file
BIN
CRC_CCITT/bin/Debug/CRC_CCITT.pdb
Normal file
Binary file not shown.
BIN
CRC_CCITT/bin/Debug/CRC_CCITT.vshost.exe
Normal file
BIN
CRC_CCITT/bin/Debug/CRC_CCITT.vshost.exe
Normal file
Binary file not shown.
6
CRC_CCITT/bin/Debug/CRC_CCITT.vshost.exe.config
Normal file
6
CRC_CCITT/bin/Debug/CRC_CCITT.vshost.exe.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
11
CRC_CCITT/bin/Debug/CRC_CCITT.vshost.exe.manifest
Normal file
11
CRC_CCITT/bin/Debug/CRC_CCITT.vshost.exe.manifest
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
66
CRC_CCITT/bin/Debug/Test_Input_CRC_CCITT.bat
Normal file
66
CRC_CCITT/bin/Debug/Test_Input_CRC_CCITT.bat
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
@REM *********************** Motorola-s19 - GOOD TEST CASES ****************************************************************************************************************************************************
|
||||
|
||||
|
||||
@REM ======================= Motorola-s19 - suffuciant parameters and valid file - different input and output file =============================================================================================
|
||||
@REM CRC_CCITT -file_in=test_in.s19 -file_out=test_crc.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= Motorola-s19 - suffuciant parameters and valid file - identical input and output file =============================================================================================
|
||||
@REM CRC_CCITT -file_in=test_in_out.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= Motorola-s19 - suffuciant parameters and valid file - identical input and output file - single address range ======================================================================
|
||||
@REM CRC_CCITT -file_in=test_in_out.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02
|
||||
|
||||
@REM ======================= Motorola-s19 - suffuciant parameters and valid file - different input and output file - crc address outside of input file address range ==========================================
|
||||
@REM CRC_CCITT -file_in=test_in.s19 -file_out=test_crc.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5B00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
|
||||
@REM *********************** Motorola-s19 - ERRONEOUS TEST CASES ***********************************************************************************************************************************************
|
||||
|
||||
|
||||
@REM ======================= Motorola-s19 - wrong file =========================================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=undefined.s19 -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD
|
||||
|
||||
@REM ======================= Motorola-s19 - insufficiant parameters ============================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=test_in.s19 -crc_address=0x5C00 -start_address1=0x5C02
|
||||
|
||||
@REM ======================= Motorola-s19 - address contains wrong sign ========================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=Wrong_Address_Sign.s19 -file_out=test_crc.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= Motorola-s19 - data contains wrong sign ===========================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=Wrong_Data_Sign.s19 -file_out=test_crc.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= Motorola-s19 - wrong length =======================================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=Wrong_Length.s19 -file_out=test_crc.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= Motorola-s19 - wrong checksum =====================================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=Wrong_SRecord_Checksum.s19 -file_out=test_crc.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= Motorola-s19 - wrong s19 record ===================================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=Wrong_SRecord_Id.s19 -file_out=test_crc.s19 -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@REM *********************** TI-txt - GOOD TEST CASES **********************************************************************************************************************************************************
|
||||
|
||||
@REM ======================= TI-txt - suffuciant parameters and valid file - different input and output file ===================================================================================================
|
||||
@REM CRC_CCITT -file_in=test_in.txt -file_out=test_crc.txt -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= TI-txt - suffuciant parameters and valid file - identical input and output file ===================================================================================================
|
||||
@REM CRC_CCITT -file_in=test_in_out.txt -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
@REM ======================= TI-txt - suffuciant parameters and valid file - different input and output file - crc address outside of input file address range ================================================
|
||||
@REM CRC_CCITT -file_in=test_in.txt -file_out=test_crc.txt -order=LSB_FIRST -size=WORD -crc_address=0x5B00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
|
||||
|
||||
@REM *********************** TI-txt - ERRONEOUS TEST CASES *****************************************************************************************************************************************************
|
||||
|
||||
|
||||
@REM ======================= TI-txt - invalid input file - corrupted ===========================================================================================================================================
|
||||
@REM CRC_CCITT -file_in=Corrupted_File.txt -file_out=test_crc.txt -order=LSB_FIRST -size=WORD -crc_address=0x5C00 -start_address1=0x5C02 -length1=0x51FD -start_address2=0x010000 -length2=0x02FFFF
|
||||
|
||||
|
||||
@PAUSE
|
||||
1632
CRC_CCITT/bin/Debug/Wrong_Address_Sign.s19
Normal file
1632
CRC_CCITT/bin/Debug/Wrong_Address_Sign.s19
Normal file
File diff suppressed because it is too large
Load Diff
1632
CRC_CCITT/bin/Debug/Wrong_Data_Sign.s19
Normal file
1632
CRC_CCITT/bin/Debug/Wrong_Data_Sign.s19
Normal file
File diff suppressed because it is too large
Load Diff
1632
CRC_CCITT/bin/Debug/Wrong_Length.s19
Normal file
1632
CRC_CCITT/bin/Debug/Wrong_Length.s19
Normal file
File diff suppressed because it is too large
Load Diff
1632
CRC_CCITT/bin/Debug/Wrong_SRecord_Checksum.s19
Normal file
1632
CRC_CCITT/bin/Debug/Wrong_SRecord_Checksum.s19
Normal file
File diff suppressed because it is too large
Load Diff
1632
CRC_CCITT/bin/Debug/Wrong_SRecord_Id.s19
Normal file
1632
CRC_CCITT/bin/Debug/Wrong_SRecord_Id.s19
Normal file
File diff suppressed because it is too large
Load Diff
1632
CRC_CCITT/bin/Debug/test.s19
Normal file
1632
CRC_CCITT/bin/Debug/test.s19
Normal file
File diff suppressed because it is too large
Load Diff
3016
CRC_CCITT/bin/Debug/test.txt
Normal file
3016
CRC_CCITT/bin/Debug/test.txt
Normal file
File diff suppressed because it is too large
Load Diff
387
CRC_CCITT/crcGenerator.cs
Normal file
387
CRC_CCITT/crcGenerator.cs
Normal file
@ -0,0 +1,387 @@
|
||||
/*********************************************************************************************************************/
|
||||
/*!@file crcGenerator.cs
|
||||
* @brief Implementation of CRC algorithms.
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @copyright
|
||||
*
|
||||
* ___________________________________________________________________________________________________________________\n
|
||||
* Copyright (c) 2016 SENSUS, GmbH.\n
|
||||
* All Rights Reserved.\n
|
||||
* \n
|
||||
* Confidential property of\n
|
||||
* SENSUS GmbH,\n
|
||||
* Meineckestr. 10, 30880 LAATZEN, GERMANY\n
|
||||
* \n
|
||||
* Design by\n
|
||||
* Hard- und Softwareentwicklung Thomas Wiedebusch,\n
|
||||
* Ostermarsch 17c, 31191 ALGERMISSEN/UMMELN, GERMANY\n
|
||||
* \n
|
||||
*====================================================================================================================\n
|
||||
* @intro
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* Functions:\n
|
||||
* CRC16 LSB 0x1021,\n
|
||||
* CRC16 MSB 0x1021.\n
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @version
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* V1.00 19-Feb-2016..23-Feb-2016 by Thomas Wiedebusch\n
|
||||
* - Initial.
|
||||
*
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace CRC_CCITT
|
||||
{
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Prototype of delegate for memory set function.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 20-Feb-2016
|
||||
* @param[in] memAddress_u32 address to fill
|
||||
* @param[in] memData_u8 data for memory
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public delegate void crcGenrator_memSetFn_t(UInt32 memAddress_u32, Byte memData_u8);
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Prototype of delegate for memory get function.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 20-Feb-2016
|
||||
* @param[in] memAddress_u32 address to fill
|
||||
* @return memData_u8
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public delegate Byte crcGenrator_memGetFn_t(UInt32 memAddress_u32);
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief crcGenerator class.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..20-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public class crcGenerator_t
|
||||
{
|
||||
//class variables
|
||||
public const UInt32 maxMemBytes_cu32 = 0xFFFFFF; //maximum size of memory
|
||||
Byte addressRangeLoops_u8 = 0; //no address range
|
||||
Byte[] memory_u8a;
|
||||
UInt16 crcValue_u16;
|
||||
UInt32 startAddress1_u32;
|
||||
UInt32 length1_u32;
|
||||
UInt32 startAddress2_u32;
|
||||
UInt32 length2_u32;
|
||||
Byte bitSize_u8;
|
||||
delegate void crc16Fn_t();
|
||||
crc16Fn_t Crc16Fn_vdp; //internal reminder for CRC function
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Constructor for CRC generation class:\n
|
||||
* -initializes required address ranges,\n
|
||||
* -initializes memory with 0xFF,\n
|
||||
* -sets function pointer to required CRC function.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..20-Feb-2016
|
||||
* @param[in] startAddress1_u32 first address to compute
|
||||
* @param[in] length1_u32 length of data of first segment
|
||||
* @param[in] startAddress2_u32 second address to compute
|
||||
* @param[in] length2_u32 length of data of second segment
|
||||
* @param[in] seed_u16 initial seed value for computation
|
||||
* @param[in] wordAccess_bol access data as word if set, else as byte
|
||||
* @param[in] lsbFirst_bol access data LSB first if set, else MSB first
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public crcGenerator_t( UInt32 startAddress1In_u32, UInt32 length1In_u32, UInt32 startAddress2In_u32,
|
||||
UInt32 length2In_u32, UInt16 seedIn_u16, bool wordAccessIn_bol, bool lsbFirstIn_bol)
|
||||
{
|
||||
crcValue_u16 = seedIn_u16;
|
||||
startAddress1_u32 = startAddress1In_u32;
|
||||
length1_u32 = length1In_u32;
|
||||
startAddress2_u32 = startAddress2In_u32;
|
||||
length2_u32 = length2In_u32;
|
||||
//allocate memory for data
|
||||
memory_u8a = new Byte[maxMemBytes_cu32];
|
||||
//assign pointer to function
|
||||
if (lsbFirstIn_bol)
|
||||
{
|
||||
Crc16Fn_vdp = new crc16Fn_t(Crc16Lsb_vd);
|
||||
}
|
||||
else
|
||||
{
|
||||
Crc16Fn_vdp = new crc16Fn_t(Crc16Msb_vd);
|
||||
}
|
||||
//calculate bit size to process
|
||||
if (wordAccessIn_bol)//access word wise
|
||||
{
|
||||
bitSize_u8 = 16;
|
||||
}
|
||||
else//access byte wise
|
||||
{
|
||||
bitSize_u8 = 8;
|
||||
}
|
||||
//check first address range
|
||||
if ((startAddress1_u32 > 0) && (length1_u32 > 0))
|
||||
{
|
||||
addressRangeLoops_u8++;
|
||||
}
|
||||
//check second address range
|
||||
if ((startAddress2_u32 > 0) && (length2_u32 > 0))
|
||||
{
|
||||
addressRangeLoops_u8++;
|
||||
}
|
||||
|
||||
//Init entire memory with 0xFF
|
||||
InitMemory_vd();
|
||||
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Get delegate of memory set function.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 20-Feb-2016
|
||||
* @return SetMemory_vd delegate
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public crcGenrator_memSetFn_t MemSetFn_vdp()
|
||||
{
|
||||
return SetMemory_vd;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Get delegate of memory get function.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 20-Feb-2016
|
||||
* @return GetMemory_u8 delegate
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public crcGenrator_memGetFn_t MemGetFn_u8p()
|
||||
{
|
||||
return GetMemory_u8;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Initialize memory with 0xFF each cell.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void InitMemory_vd()
|
||||
{
|
||||
for (UInt32 ctr_u32 = 0; ctr_u32 < maxMemBytes_cu32; ctr_u32++)
|
||||
{
|
||||
memory_u8a[ctr_u32] = 0xFF;
|
||||
}
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Builds the CRC16 LSB first.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..23-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void Crc16Lsb_vd()
|
||||
{
|
||||
UInt32 memAddress_u32;
|
||||
UInt32 byteCtr_u32;
|
||||
UInt32 byteSize_u32;
|
||||
Byte bitCtr_u8;
|
||||
Byte dataByte_u8;
|
||||
UInt16 dataWord_u16;
|
||||
|
||||
//load first address range
|
||||
memAddress_u32 = startAddress1_u32;
|
||||
//byte size is one higher to accumulate the start and end address
|
||||
byteSize_u32 = length1_u32 + 1;
|
||||
|
||||
//process entire memory
|
||||
while( addressRangeLoops_u8-- > 0)
|
||||
{
|
||||
for( byteCtr_u32 = 0; byteCtr_u32 < byteSize_u32; byteCtr_u32 += (UInt32)( bitSize_u8/8) )
|
||||
{
|
||||
//read data lower byte
|
||||
dataByte_u8 = memory_u8a[ memAddress_u32++ ];
|
||||
//copy lower data byte to lower word because of LSB will be XORed
|
||||
dataWord_u16 = (UInt16)((UInt16)dataByte_u8 & 0x00FF);
|
||||
//assemble word if word access is required
|
||||
if( 16 == bitSize_u8)
|
||||
{
|
||||
//read data byte higher byte
|
||||
dataByte_u8 = memory_u8a[ memAddress_u32++ ];
|
||||
//put higher byte to higher word
|
||||
dataWord_u16 |= (UInt16)((((UInt16)dataByte_u8 << 8) & 0xFF00));
|
||||
}
|
||||
|
||||
//process single byte or word
|
||||
for( bitCtr_u8 = 0; bitCtr_u8 < bitSize_u8; bitCtr_u8++)
|
||||
{
|
||||
//test if CRC highest bit or data input lowest bit is XORed set to one
|
||||
if( 0x8000 == ( (crcValue_u16 ^ ( dataWord_u16 << 15) ) & 0x8000) )//inverse shifted in LSB first
|
||||
{
|
||||
//shift CRC high bit out
|
||||
crcValue_u16 <<= 1;
|
||||
//apply generator polynomial
|
||||
crcValue_u16 ^= 0x1021;
|
||||
}
|
||||
else//CRC highest bit and data input lowest bit is equal
|
||||
{
|
||||
crcValue_u16 <<= 1;
|
||||
}
|
||||
dataWord_u16 >>= 1; //LSB first shifted in
|
||||
}//process single byte or word
|
||||
}//byte counter
|
||||
//load second address range
|
||||
memAddress_u32 = startAddress2_u32;
|
||||
//byte size is one higher to accumulate the start and end address
|
||||
byteSize_u32 = length2_u32 + 1;
|
||||
}//process entire memory while()
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Builds the CRC16 MSB first.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..23-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void Crc16Msb_vd()
|
||||
{
|
||||
UInt32 memAddress_u32;
|
||||
UInt32 byteCtr_u32;
|
||||
UInt32 byteSize_u32;
|
||||
Byte bitCtr_u8;
|
||||
Byte dataByte_u8;
|
||||
UInt16 dataWord_u16;
|
||||
|
||||
//load first address range
|
||||
memAddress_u32 = startAddress1_u32;
|
||||
|
||||
//byte size is one higher to accumulate the start and end address
|
||||
byteSize_u32 = length1_u32 + 1;
|
||||
|
||||
//process entire memory
|
||||
while( addressRangeLoops_u8-- > 0)
|
||||
{
|
||||
for ( byteCtr_u32 = 0; byteCtr_u32 < byteSize_u32; byteCtr_u32 += (UInt32)( bitSize_u8 / 8))
|
||||
{
|
||||
//read data lower byte
|
||||
dataByte_u8 = memory_u8a[ memAddress_u32++ ];
|
||||
//copy lower data byte to higher word because of MSB will be XORed
|
||||
dataWord_u16 = (UInt16)((((UInt16)dataByte_u8 << 8) & 0xFF00));
|
||||
//assemble word if word access is required
|
||||
if ( 16 == bitSize_u8)
|
||||
{
|
||||
//read data byte higher byte
|
||||
dataByte_u8 = memory_u8a[ memAddress_u32++ ];
|
||||
//move lower byte back to lower word
|
||||
dataWord_u16 >>= 8;
|
||||
//put higher byte to higher word
|
||||
dataWord_u16 |= (UInt16)((((UInt16)dataByte_u8 << 8) & 0xFF00));
|
||||
}
|
||||
|
||||
//process single byte or word
|
||||
for (bitCtr_u8 = 0; bitCtr_u8 < bitSize_u8; bitCtr_u8++)
|
||||
{
|
||||
//test if CRC highest bit or data input highest bit is XORed set to one
|
||||
if (0x8000 == ( ( crcValue_u16 ^ dataWord_u16) & 0x8000) )//shifted in MSB first
|
||||
{
|
||||
//shift CRC high bit out
|
||||
crcValue_u16 <<= 1;
|
||||
//apply generator polynomial
|
||||
crcValue_u16 ^= 0x1021;
|
||||
}
|
||||
else//CRC highest bit and data input highest bit is equal
|
||||
{
|
||||
crcValue_u16 <<= 1;
|
||||
}
|
||||
dataWord_u16 <<= 1; //MSB first shifted in
|
||||
}//process single byte or word
|
||||
}//byte counter
|
||||
//load second address range
|
||||
memAddress_u32 = startAddress2_u32;
|
||||
//byte size is one higher to accumulate the start and end address
|
||||
byteSize_u32 = length2_u32 + 1;
|
||||
}//process entire memory while()
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Builds the CRC16 based on assigned function pointer.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016
|
||||
* @return crcValue_u16 built CRC16 result
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public UInt16 CrcCalculate_u16()
|
||||
{
|
||||
Crc16Fn_vdp();
|
||||
return crcValue_u16;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Set/Fill memory at address with data, check the address range.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016
|
||||
* @param[in] address_u32 address to fill
|
||||
* @param[in] data_u8 data for memory
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void SetMemory_vd(UInt32 address_u32, Byte data_u8)
|
||||
{
|
||||
if (address_u32 < maxMemBytes_cu32) //avoid access beyond the reserved range
|
||||
{
|
||||
memory_u8a[address_u32] = data_u8;
|
||||
}
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Get data of memory at address.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016
|
||||
* @param[in] address_u32 address to read
|
||||
* @return data_u8 at memory location
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
Byte GetMemory_u8(UInt32 address_u32)
|
||||
{
|
||||
return memory_u8a[address_u32];
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Get maximum value for memory address.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 21-Feb-2016
|
||||
* @return maxMemBytes_cu32 maximum memory addresses
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public UInt32 GetMaxMemoryAddress_u8()
|
||||
{
|
||||
return maxMemBytes_cu32;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
}//class crcGenerator
|
||||
}//namespace CRC_CCITT
|
||||
/*=====================================END OF FILE===================================================================*/
|
||||
|
||||
570
CRC_CCITT/crcProgram.cs
Normal file
570
CRC_CCITT/crcProgram.cs
Normal file
@ -0,0 +1,570 @@
|
||||
/*********************************************************************************************************************/
|
||||
/*!@file crcProgram.cs
|
||||
* @brief Main file for CRC_CCITT.
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @copyright
|
||||
*
|
||||
* ___________________________________________________________________________________________________________________\n
|
||||
* Copyright (c) 2016 SENSUS, GmbH.\n
|
||||
* All Rights Reserved.\n
|
||||
* \n
|
||||
* Confidential property of\n
|
||||
* SENSUS GmbH,\n
|
||||
* Meineckestr. 10, 30880 LAATZEN, GERMANY\n
|
||||
* \n
|
||||
* Design by\n
|
||||
* Hard- und Softwareentwicklung Thomas Wiedebusch,\n
|
||||
* Ostermarsch 17c, 31191 ALGERMISSEN/UMMELN, GERMANY\n
|
||||
* \n
|
||||
*====================================================================================================================\n
|
||||
* @intro
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* crcProgram:\n
|
||||
* - Initial CRC16 calculation for polynomial 0x1021,\n
|
||||
* inputs: -file_in name of s19 | txt file,\n
|
||||
* [-file_out name of s19 | txt file],\n
|
||||
* -start_address1=0..0xFFFFFE\n
|
||||
* -end_address1=0..0xFFFFFF | -length1=0..0xFFFFFF\n
|
||||
* [-start_address2=0..0xFFFFFE]\n
|
||||
* [-end_address2=0..0xFFFFFF | -length2=0..0xFFFFFE]\n
|
||||
* [-crc_address=0..0xFFFFFF]\n
|
||||
* [-seed=0..0xFFFF]\n
|
||||
* [-order=MMSB_FIRST|LSB_FIRST]\n
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @version
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* V1.00 19-Feb-2016..26.Feb-2016 by Thomas Wiedebusch\n
|
||||
* - Initial.
|
||||
*
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace CRC_CCITT
|
||||
{
|
||||
class crcProgram_t
|
||||
{
|
||||
//class variables
|
||||
public const String fileUndefined_cstr = "undefined";
|
||||
const UInt16 searchIgnoreBytesOfString_cu16 = 3;
|
||||
static String inputFile_strs = fileUndefined_cstr;
|
||||
static String outputFile_strs = fileUndefined_cstr;
|
||||
static UInt32 crcAddress_u32s = 0;
|
||||
static UInt32 startAddress1_u32s = 0;
|
||||
static UInt32 endAddress1_u32s = 0;
|
||||
static UInt32 length1_u32s = 0;
|
||||
//optional input parameters
|
||||
static UInt32 startAddress2_u32s = 0; //second address range undefined
|
||||
static UInt32 endAddress2_u32s = 0; //second address range undefined
|
||||
static UInt32 length2_u32s = 0; //second address range undefined
|
||||
static UInt16 seed_u16s = 0xFFFF; //default value
|
||||
static bool wordAccess_bols = false; //default BYTE access
|
||||
static bool lsbFirst_bols = false; //default MSB first
|
||||
//internal variables
|
||||
static UInt16 crcResult_u16s = 0;
|
||||
static bool crcAddressDefined_bols = false; //assume missing arguments
|
||||
static Byte argsNumber_u8s = 0;
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Main program.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..25-Feb-2016
|
||||
* @param[in] args_st
|
||||
* @return exit code
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void Main(string[] args_str)
|
||||
{
|
||||
try
|
||||
{
|
||||
//required input parameters
|
||||
argsNumber_u8s = (Byte)args_str.GetLength(0);
|
||||
//check number of command line args and start of syntax for command line parameter input"-"
|
||||
if ((argsNumber_u8s > 2) && ("-" == args_str[0].Substring(0, 1)))
|
||||
{
|
||||
//extract information given by command line input
|
||||
ParseCommandLineArguments_vds(args_str);
|
||||
|
||||
//check and init input parameters
|
||||
CheckAndLimitInput_vds();
|
||||
|
||||
}//check number of command line parameters and string "-" as start for parameter input
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
//set the address ranges for output to console, therefore the arguments have to be extracted
|
||||
BuildAddressRanges_vds();
|
||||
|
||||
//initial messages for input display to user after address build
|
||||
DisplayStartMsg_vds();
|
||||
|
||||
//check for sufficient number of input parameters and defined file to process
|
||||
if(((endAddress1_u32s > 0) && (length1_u32s > 0)) && (String.Compare(inputFile_strs, fileUndefined_cstr) != 0))
|
||||
{
|
||||
//check for physically file existence
|
||||
if (File.Exists( inputFile_strs))
|
||||
{
|
||||
//confirm the file has been file found
|
||||
DisplayFileInformationMsg_vds();
|
||||
|
||||
//start the file and CRC processing
|
||||
if (Process_bols())
|
||||
{
|
||||
//output crc result to console
|
||||
DisplayResultMsg_vds();
|
||||
}
|
||||
else
|
||||
{
|
||||
//file has unknown format
|
||||
DispalyUnknownFileFormatErrorMsg_vd();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//input file can't be found, don't start processing
|
||||
DisplayInFileNotFoundErrorMsg_vds();
|
||||
}
|
||||
}
|
||||
else//if parameters are missing or help request
|
||||
{
|
||||
DisplayMissedParamErrorMsg_vds();
|
||||
}//argumentsSufficient_bols
|
||||
}//Main
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Process file and CRC.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 21-Feb-2016..25-Feb-2016
|
||||
* @return files valid
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static bool Process_bols()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
//initialize CRC generator
|
||||
crcGenerator_t crcGenerator_cl = new crcGenerator_t(startAddress1_u32s, length1_u32s,
|
||||
startAddress2_u32s, length2_u32s, seed_u16s, wordAccess_bols, lsbFirst_bols);
|
||||
|
||||
crcGenrator_memSetFn_t MemSetFn_vdp = crcGenerator_cl.MemSetFn_vdp();
|
||||
crcGenrator_memGetFn_t MemGetFn_u8p = crcGenerator_cl.MemGetFn_u8p();
|
||||
|
||||
//initialize s19 file handler
|
||||
s19FileHandler_t s19FileHandler_cl = new s19FileHandler_t(inputFile_strs, outputFile_strs, MemSetFn_vdp,
|
||||
MemGetFn_u8p, crcAddress_u32s, crcAddressDefined_bols);
|
||||
|
||||
//initialize txt file handler
|
||||
txtFileHandler_t txtFileHandler_cl = new txtFileHandler_t(inputFile_strs, outputFile_strs, MemSetFn_vdp,
|
||||
MemGetFn_u8p, crcAddress_u32s, crcAddressDefined_bols);
|
||||
|
||||
//read file, extract and copy to memory, returns false on corrupted record
|
||||
if (s19FileHandler_cl.ValidateInputFile_bol())
|
||||
{
|
||||
returnValue_bol = true;
|
||||
|
||||
//process crc
|
||||
crcResult_u16s = crcGenerator_cl.CrcCalculate_u16();
|
||||
|
||||
//create the output file
|
||||
s19FileHandler_cl.CreateOutputFile_vd(crcResult_u16s);
|
||||
}
|
||||
//read file, extract and copy to memory, returns false on corrupted record
|
||||
else if (txtFileHandler_cl.ValidateInputFile_bol())
|
||||
{
|
||||
returnValue_bol = true;
|
||||
|
||||
//process crc
|
||||
crcResult_u16s = crcGenerator_cl.CrcCalculate_u16();
|
||||
|
||||
//create the output file
|
||||
txtFileHandler_cl.CreateOutputFile_vd(crcResult_u16s);
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Safety module to avoid wrong input ranges:\n
|
||||
* Takes input range from crcGenerator_t class.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 21-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void CheckAndLimitInput_vds()
|
||||
{
|
||||
//get the defined input range for addresses from crcGenerator class
|
||||
UInt32 maxAddress_u32 = crcGenerator_t.maxMemBytes_cu32;
|
||||
|
||||
if (startAddress1_u32s > maxAddress_u32)
|
||||
{
|
||||
startAddress1_u32s = maxAddress_u32;
|
||||
}
|
||||
if (startAddress2_u32s > maxAddress_u32)
|
||||
{
|
||||
startAddress2_u32s = maxAddress_u32;
|
||||
}
|
||||
if (endAddress1_u32s > maxAddress_u32)
|
||||
{
|
||||
endAddress1_u32s = maxAddress_u32;
|
||||
}
|
||||
if (endAddress2_u32s > maxAddress_u32)
|
||||
{
|
||||
endAddress2_u32s = maxAddress_u32;
|
||||
}
|
||||
if (length1_u32s + startAddress1_u32s > maxAddress_u32)
|
||||
{
|
||||
length1_u32s = maxAddress_u32 - startAddress1_u32s;
|
||||
}
|
||||
if (length2_u32s + startAddress2_u32s > maxAddress_u32)
|
||||
{
|
||||
length2_u32s = maxAddress_u32 - startAddress2_u32s;
|
||||
}
|
||||
if (crcAddress_u32s > maxAddress_u32)
|
||||
{
|
||||
crcAddress_u32s = maxAddress_u32;
|
||||
}
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Build address ranges out of end addresses or lengths.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 21-Feb-2016..23-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void BuildAddressRanges_vds()
|
||||
{
|
||||
//check for start and end address
|
||||
if (endAddress1_u32s < startAddress1_u32s)
|
||||
{
|
||||
endAddress1_u32s = startAddress1_u32s;
|
||||
}
|
||||
|
||||
//check first address range
|
||||
if( length1_u32s > 0)
|
||||
{
|
||||
endAddress1_u32s = startAddress1_u32s + length1_u32s;
|
||||
}
|
||||
else
|
||||
{
|
||||
length1_u32s = endAddress1_u32s - startAddress1_u32s;
|
||||
}//first address range is defined
|
||||
|
||||
//check for start and end address
|
||||
if (endAddress2_u32s < startAddress2_u32s)
|
||||
{
|
||||
endAddress2_u32s = startAddress2_u32s;
|
||||
}
|
||||
//check second address range
|
||||
if (length2_u32s > 0)
|
||||
{
|
||||
endAddress2_u32s = startAddress2_u32s + length2_u32s;
|
||||
}
|
||||
else
|
||||
{
|
||||
length2_u32s = endAddress2_u32s - startAddress2_u32s;
|
||||
}//second address range is defined
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Parse command line arguments:\n
|
||||
* -extracts the path and file information,\n
|
||||
* -extracts and assigns the variables.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..23-Feb-2016
|
||||
* @param[in] args_st command line arguments
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void ParseCommandLineArguments_vds(String[] args_str)
|
||||
{
|
||||
//assign numerical values to the variables or strings to strings
|
||||
for (Byte ctr_u8 = 0; ctr_u8 < argsNumber_u8s; ctr_u8++)
|
||||
{
|
||||
try
|
||||
{
|
||||
//read args string
|
||||
String argsString_str = args_str[ctr_u8];
|
||||
|
||||
//search for "="
|
||||
UInt16 stringCtr_u16 = 0;
|
||||
UInt16 stringLength_u16 = (UInt16)argsString_str.Length;
|
||||
//avoid access on string size below size of ignored bytes, may be possible on additional wrong space
|
||||
if (stringLength_u16 > searchIgnoreBytesOfString_cu16)
|
||||
{
|
||||
//remove at least the 3 digits to avoid search overrun
|
||||
stringLength_u16 -= searchIgnoreBytesOfString_cu16;
|
||||
while ((stringCtr_u16 != argsString_str.IndexOf("=", stringCtr_u16))
|
||||
&& (stringCtr_u16 < stringLength_u16))
|
||||
{
|
||||
stringCtr_u16++;
|
||||
}
|
||||
//extract compare string
|
||||
String compareString_str = argsString_str.Substring(1, stringCtr_u16 - 1);
|
||||
String textString_str;
|
||||
//deliver and convert string to variable
|
||||
switch (compareString_str)
|
||||
{
|
||||
case "file_in":
|
||||
//extract text and remove the "=" before the text
|
||||
inputFile_strs = argsString_str.Substring(stringCtr_u16 + 1,
|
||||
argsString_str.Length - stringCtr_u16 - 1);
|
||||
break;
|
||||
case "file_out":
|
||||
//extract text and remove the "=" before the text
|
||||
outputFile_strs = argsString_str.Substring(stringCtr_u16 + 1,
|
||||
argsString_str.Length - stringCtr_u16 - 1);
|
||||
break;
|
||||
case "crc_address":
|
||||
crcAddressDefined_bols = true;
|
||||
crcAddress_u32s = ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
;
|
||||
break;
|
||||
case "start_address1":
|
||||
startAddress1_u32s = ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
break;
|
||||
case "end_address1":
|
||||
endAddress1_u32s = ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
break;
|
||||
case "length1":
|
||||
length1_u32s = ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
break;
|
||||
case "start_address2":
|
||||
startAddress2_u32s = ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
break;
|
||||
case "end_address2":
|
||||
endAddress2_u32s = ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
break;
|
||||
case "length2":
|
||||
length2_u32s = ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
break;
|
||||
case "seed":
|
||||
seed_u16s = (UInt16)ExtractUint32HexNumberFromString_u32s(argsString_str, stringCtr_u16);
|
||||
break;
|
||||
case "order":
|
||||
//extract text and remove the "=" before the text
|
||||
textString_str = argsString_str.Substring(stringCtr_u16 + 1,
|
||||
argsString_str.Length - stringCtr_u16 - 1);
|
||||
if (0 == String.Compare(textString_str, "LSB_FIRST"))
|
||||
{
|
||||
lsbFirst_bols = true;
|
||||
}
|
||||
break;
|
||||
case "size":
|
||||
//extract text and remove the "=" before the text
|
||||
textString_str = argsString_str.Substring(stringCtr_u16 + 1,
|
||||
argsString_str.Length - stringCtr_u16 - 1);
|
||||
if (0 == String.Compare(textString_str, "WORD"))
|
||||
{
|
||||
wordAccess_bols = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}//switch
|
||||
}//string length minimum
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
}//all arguments access
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Converts input string of hex number to uint32.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..23-Feb-2016
|
||||
* @param[in] argsString_st input string
|
||||
* @param[in] stringCtr_u16 string counter at last parameter identifier "="
|
||||
* @return number_u32 extracted uint32
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static UInt32 ExtractUint32HexNumberFromString_u32s(String argsString_str, UInt16 stringCtr_u16)
|
||||
{
|
||||
UInt32 number_u32 = 0;
|
||||
|
||||
try
|
||||
{
|
||||
//extract variable and remove the "=0x" before the hexadecimal number
|
||||
String variableString_str = argsString_str.Substring(stringCtr_u16 + searchIgnoreBytesOfString_cu16,
|
||||
argsString_str.Length - stringCtr_u16 - searchIgnoreBytesOfString_cu16);
|
||||
number_u32 = UInt32.Parse(variableString_str, System.Globalization.NumberStyles.HexNumber);
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return number_u32;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Display start message.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..25-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void DisplayStartMsg_vds()
|
||||
{
|
||||
//output program information
|
||||
Console.WriteLine("================================================================================");
|
||||
Console.WriteLine(" CRC_CCITT (CRC16 Polynomial 0x1021) Builder!");
|
||||
Console.WriteLine(" File input formats are Motorola-s19 and TI-txt files");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Version V1.00");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Copyright (c) 2016 SENSUS GmbH, Laatzen, Germany");
|
||||
Console.WriteLine(" All rights reserved");
|
||||
Console.WriteLine(" Written by Thomas Wiedebusch");
|
||||
Console.WriteLine("================================================================================");
|
||||
|
||||
//Scanned address and size information
|
||||
Console.WriteLine("Start address1: 0x{0:X}", startAddress1_u32s);
|
||||
Console.WriteLine("Length1: 0x{0:X}", length1_u32s);
|
||||
Console.WriteLine("End address1: 0x{0:X}", endAddress1_u32s);
|
||||
if ((startAddress2_u32s > 0) && (length2_u32s > 0))
|
||||
{
|
||||
Console.WriteLine("Start address2: 0x{0:X}", startAddress2_u32s);
|
||||
Console.WriteLine("Length2: 0x{0:X}", length2_u32s);
|
||||
Console.WriteLine("End address2: 0x{0:X}", endAddress2_u32s);
|
||||
}
|
||||
|
||||
//output seed value
|
||||
Console.WriteLine("Seed: 0x{0:X4}", seed_u16s);
|
||||
|
||||
//check data format
|
||||
if (wordAccess_bols)
|
||||
{
|
||||
Console.WriteLine("Access format: WORD");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Access format: BYTE");
|
||||
}
|
||||
|
||||
//check access order
|
||||
if (lsbFirst_bols)
|
||||
{
|
||||
Console.WriteLine("Access order: LSB_FIRST");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Access order: MSB_FIRST");
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Display insufficient parameter error message.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..25-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void DisplayMissedParamErrorMsg_vds()
|
||||
{
|
||||
Console.WriteLine("================================================================================");
|
||||
Console.WriteLine("PARAMETERS ARE MISSED OR WRONG FORMAT, CRC CALCULATION CAN'T BE EXECUTED!");
|
||||
Console.WriteLine("================================================================================");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Required parameters for CRC16 calculation (order independent):");
|
||||
Console.WriteLine("-file_in=file_name is the name of the input file as string, required");
|
||||
Console.WriteLine("[-file_out=file_name] is the name of the output file as string, optional");
|
||||
Console.WriteLine("[-crc_address=0x0..0xFFFFFF] required for file out, else only console display");
|
||||
Console.WriteLine("-start_address1=0x0..0xFFFFFF required");
|
||||
Console.WriteLine("-end_address1|length1=0x0..0xFFFFFF required");
|
||||
Console.WriteLine("[-start_address2=0x0..0xFFFFFF] optional, default 0x0");
|
||||
Console.WriteLine("[-end_address2|length1=0..0xFFFFFF] optional, default 0x0");
|
||||
Console.WriteLine("[-seed=0x0..0xFFFF] optional, default 0xFFFF");
|
||||
Console.WriteLine("[-size=BYTE|WORD] optional, default BYTE");
|
||||
Console.WriteLine("[-order=MSB_FIRST|LSB_FIRST] optional, default MSB_FIRST");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("================================================================================");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Display result message.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..25-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void DisplayResultMsg_vds()
|
||||
{
|
||||
if (crcAddressDefined_bols)
|
||||
{
|
||||
Console.WriteLine("CRC address: 0x{0:X}", crcAddress_u32s);
|
||||
}
|
||||
Console.WriteLine("Computed CRC16: 0x{0:X4}", crcResult_u16s);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Display file information message.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 21-Feb-2016..24-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void DisplayFileInformationMsg_vds()
|
||||
{
|
||||
//In/output file information
|
||||
Console.WriteLine("Input File: " + inputFile_strs);
|
||||
//if the output file is not explicitly defined output file = input file
|
||||
if (fileUndefined_cstr == outputFile_strs)
|
||||
{
|
||||
Console.WriteLine("Output File: " + inputFile_strs);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Output File: " + outputFile_strs);
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Display input file not found.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 21-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void DisplayInFileNotFoundErrorMsg_vds()
|
||||
{
|
||||
Console.WriteLine("INPUT FILE \"" + inputFile_strs + "\" NOT FOUND!");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Display file format is unknown.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 21-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
static void DispalyUnknownFileFormatErrorMsg_vd()
|
||||
{
|
||||
Console.WriteLine("UNEXPECTED FILE FORMAT!");
|
||||
Console.WriteLine("Input file is corrupted or not a Motorola-s19 or TI-txt file!");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
}//class crcProgram
|
||||
}//namespace CRC_CCITT
|
||||
/*=====================================END OF FILE===================================================================*/
|
||||
BIN
CRC_CCITT/itemPicker.ico
Normal file
BIN
CRC_CCITT/itemPicker.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
771
CRC_CCITT/s19FileHandler.cs
Normal file
771
CRC_CCITT/s19FileHandler.cs
Normal file
@ -0,0 +1,771 @@
|
||||
/*********************************************************************************************************************/
|
||||
/*!@file s19FileHandler.cs
|
||||
* @brief Handle for Motorola-S19 files.
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @copyright
|
||||
*
|
||||
* ___________________________________________________________________________________________________________________\n
|
||||
* Copyright (c) 2016 SENSUS, GmbH.\n
|
||||
* All Rights Reserved.\n
|
||||
* \n
|
||||
* Confidential property of\n
|
||||
* SENSUS GmbH,\n
|
||||
* Meineckestr. 10, 30880 LAATZEN, GERMANY\n
|
||||
* \n
|
||||
* Design by\n
|
||||
* Hard- und Softwareentwicklung Thomas Wiedebusch,\n
|
||||
* Ostermarsch 17c, 31191 ALGERMISSEN/UMMELN, GERMANY\n
|
||||
* \n
|
||||
*====================================================================================================================\n
|
||||
* @intro
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* Functions:\n
|
||||
* Reading S19 files,\n
|
||||
* Support of S0, S2, S5 and S8 records (24Bit addresses and 16Bit record counter),\n
|
||||
* Building S5 record and place it at the end of the file,\n
|
||||
* Replacing bytes and generating S2 record for CRC.\n
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @version
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* V1.00 19-Feb-2016..26-Feb-2016 by Thomas Wiedebusch\n
|
||||
* - Initial.
|
||||
*
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace CRC_CCITT
|
||||
{
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief s19FileHandler class.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..24-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public class s19FileHandler_t
|
||||
{
|
||||
//class variables
|
||||
String inputFile_str; //file name
|
||||
String outputFile_str; //file name
|
||||
String fileLine_str; //one line of the file
|
||||
crcGenrator_memSetFn_t MemSetFn_vdp; //set data to address of working memory
|
||||
crcGenrator_memGetFn_t MemGetFn_u8p; //get data from working memory
|
||||
|
||||
bool s8RecordFoundInFile_bol = false; //S8 record detected
|
||||
UInt32 s8RecordFileLine_u32 = 0; //S8 record line in file
|
||||
|
||||
bool crcRecordFoundInFile_bol = false; //S2 record with CRC address detected
|
||||
UInt32 crcRecordFileLine_u32 = 0; //S2 record with CRC address line in file
|
||||
bool placeCrcToFile_bol; //CRC output to file is required
|
||||
UInt32 crcAddress_u32; //address for CRC
|
||||
|
||||
bool s5RecordFoundInFile_bol = false; //S5 record detected
|
||||
UInt32 s5RecordFileLine_u32 = 0; //S5 record line in file
|
||||
bool s5RecordPlacedInoutputFile_bol = false; //S5 record not applied to output file
|
||||
|
||||
//S19-Record string, protocol
|
||||
const String fileHeader_cstr = "S0";
|
||||
const String dataRecord24BitAddress_cstr = "S2";
|
||||
const String dataRecordCounter16Bit_cstr = "S5";
|
||||
const String startAddress24Bit_cstr = "S8";
|
||||
|
||||
const Byte s19RecordIdStrSize_cu8 = 2; //size of S19 identifier
|
||||
|
||||
const Byte s19RecordLengthStrSize_cu8 = 2; //size of S19 length
|
||||
|
||||
const Byte s0RecordAddressStrSize_cu8 = 4; //size of S0 address
|
||||
const Byte s2RecordAddressStrSize_cu8 = 6; //size of S2 address
|
||||
const Byte s8RecordAddressStrSize_cu8 = 6; //size of S8 address
|
||||
|
||||
const Byte s19RecordDataCrcStrSize_cu8 = 4; //size of S19 CRC16 data
|
||||
const Byte s19RecordDataStrSize_cu8 = 2; //size of S19 data
|
||||
const Byte s5RecordCountStrSize_cu8 = 4; //size of S5 counter
|
||||
|
||||
const Byte s19RecordCheckStrSize_cu8 = 2; //size of S19 checksum
|
||||
|
||||
//S19-Record extracted
|
||||
String s19RecordId_str; //record identifier containing the "S" and a number
|
||||
Byte s19RecordLength_u8; //length for data and check
|
||||
UInt32 s19RecordAddress_u32; //data address for CRC generator module
|
||||
const Byte maxS19RecordData_cu8 = 32; //number of maximum data bytes in one record
|
||||
Byte[] s19RecordData_u8a =
|
||||
new Byte[maxS19RecordData_cu8]; //data fields for dispatch to CRC generator
|
||||
Byte s19RecordRecChecksum_u8; //checksum read for length, address and data
|
||||
|
||||
//calculations
|
||||
Byte s19RecordCalcChecksum_u8; //rebuild checksum based on file data
|
||||
UInt16 s2RecordCounter_u16 = 0; //S2 record counter
|
||||
UInt32 fileLineCtr_u32 = 0; //actual accessed file line
|
||||
const Byte addressFieldNotUsed_cu8 = 0; //address not used (S5-Record) for checksum calculation
|
||||
const Byte addressField16BitSize_cu8 = 2; //16 bit address size (S0-Record) for checksum calculation
|
||||
const Byte addressField24BitSize_cu8 = 3; //24 bit address size (S2, S8-Records) for checksum calculation
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Constructor for S19 class:\n
|
||||
* -initializes file,\n
|
||||
* -this constructor will only be called if the input file has been found,\n
|
||||
* -sets delegates to memory set and get function being able to dispatch read data.\n
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 19-Feb-2016..21-Feb-2016
|
||||
* @param[in] inputFileIn_str file name for input file
|
||||
* @param[in] outputFileIn_str file name for output file, can be identical with input file
|
||||
* @param[in] MemSetInFn_vdp set function to dispatch data to memory
|
||||
* @param[in] MemGetInFn_vdp get function to read data from memory
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public s19FileHandler_t(String inputFileIn_str, String outputFileIn_str, crcGenrator_memSetFn_t MemSetInFn_vdp,
|
||||
crcGenrator_memGetFn_t MemGetInFn_u8p, UInt32 crcAddressIn_u32, bool placeCrcToFileIn_bol)
|
||||
{
|
||||
inputFile_str = inputFileIn_str;
|
||||
outputFile_str = outputFileIn_str;
|
||||
MemSetFn_vdp = MemSetInFn_vdp;
|
||||
MemGetFn_u8p = MemGetInFn_u8p;
|
||||
placeCrcToFile_bol = placeCrcToFileIn_bol;
|
||||
crcAddress_u32 = crcAddressIn_u32;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Read input file and store to output file:\n
|
||||
* -reads every line, format has been checked,\n
|
||||
* -replaces CRC if required,\n
|
||||
* -creates S5 record before the end of file S8 record.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 23-Feb-2016..24-Feb-2016
|
||||
* @param[in] crcResult_u16 result of CRC calculation
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public void CreateOutputFile_vd(UInt16 crcResult_u16)
|
||||
{
|
||||
//the file line counter will be used to reference the input of already detected records
|
||||
fileLineCtr_u32 = 0;
|
||||
|
||||
//mark that s5 record hasn't be accessed
|
||||
s5RecordPlacedInoutputFile_bol = false;
|
||||
|
||||
try
|
||||
{
|
||||
//check if file exits
|
||||
if (File.Exists(inputFile_str))
|
||||
{
|
||||
//opens file for read
|
||||
StreamReader inputFile_st = new StreamReader(inputFile_str);
|
||||
if (File.Exists(outputFile_str))
|
||||
{
|
||||
//erase it
|
||||
File.Delete(outputFile_str);
|
||||
}
|
||||
|
||||
//open it for write access
|
||||
StreamWriter outputFile_st = new StreamWriter(outputFile_str, true);
|
||||
|
||||
//read single line until and output it to the output file
|
||||
do
|
||||
{
|
||||
//read one line of the input file
|
||||
fileLine_str = inputFile_st.ReadLine();
|
||||
//output of CRC to file is required
|
||||
if (placeCrcToFile_bol)
|
||||
{
|
||||
//replace CRC data or build a new entry containing CRC data only
|
||||
BuildS19CrcRecord_vd(crcResult_u16, outputFile_st);
|
||||
}//output of CRC to file is required
|
||||
//check for S5 record generation, replace current S5 record or insert before S8 record
|
||||
if (!s5RecordPlacedInoutputFile_bol)
|
||||
{
|
||||
if ((s5RecordFoundInFile_bol && (s5RecordFileLine_u32 == fileLineCtr_u32))
|
||||
|| (s8RecordFoundInFile_bol && (s8RecordFileLine_u32 == fileLineCtr_u32)))
|
||||
{
|
||||
BuildS5Record_vd(outputFile_st);
|
||||
}//replace S5 or insert before S8 record
|
||||
}//S5 not generated
|
||||
|
||||
//write all lines to output file
|
||||
outputFile_st.WriteLine( fileLine_str);
|
||||
|
||||
//change file line of input file
|
||||
fileLineCtr_u32++;
|
||||
} while (!inputFile_st.EndOfStream);
|
||||
|
||||
//place S5 record at file end if not already found
|
||||
if (!s5RecordPlacedInoutputFile_bol)
|
||||
{
|
||||
//places S5 directly at file end position
|
||||
BuildS5Record_vd(outputFile_st);
|
||||
}
|
||||
//release files
|
||||
inputFile_st.Close();
|
||||
outputFile_st.Close();
|
||||
|
||||
//if the output file is equal to the input file, erase input file and rename temporary output file
|
||||
if (crcProgram_t.fileUndefined_cstr == outputFile_str)
|
||||
{
|
||||
File.Delete(inputFile_str);
|
||||
if (File.Exists(outputFile_str))
|
||||
{
|
||||
//rename output to input file name, output file will be deleted
|
||||
File.Move(outputFile_str, inputFile_str);
|
||||
}
|
||||
|
||||
}
|
||||
}//input file exists
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Build S5 record:\n
|
||||
* -places it directly to output file if S8 record detected,\n
|
||||
* -replaces it if old S5 record detected.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 24-Feb-2016
|
||||
* @param[in] outputFile_st output file stream object
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void BuildS5Record_vd(StreamWriter outputFile_st)
|
||||
{
|
||||
//build the S5 record
|
||||
s19RecordId_str = dataRecordCounter16Bit_cstr;
|
||||
|
||||
//build a new record just containing the S5 without address
|
||||
s19RecordLength_u8 = s5RecordCountStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2;
|
||||
|
||||
//set counter value
|
||||
s19RecordData_u8a[0] = (Byte)((s2RecordCounter_u16 >> 8) & 0xFF);
|
||||
s19RecordData_u8a[1] = (Byte)(s2RecordCounter_u16 & 0xFF);
|
||||
|
||||
//if S8 record found in file, build a new record and place it directly
|
||||
if (s8RecordFoundInFile_bol && (s8RecordFileLine_u32 == fileLineCtr_u32))
|
||||
{
|
||||
outputFile_st.WriteLine(BuildS19Record_str(addressFieldNotUsed_cu8));
|
||||
s5RecordPlacedInoutputFile_bol = true;
|
||||
}
|
||||
//replace file line string if s5 record
|
||||
else if (s5RecordFoundInFile_bol && (s5RecordFileLine_u32 == fileLineCtr_u32))
|
||||
{
|
||||
//create s5-Record string for file output
|
||||
fileLine_str = BuildS19Record_str(addressFieldNotUsed_cu8);
|
||||
s5RecordPlacedInoutputFile_bol = true;
|
||||
}
|
||||
//Nor S8 neither S5 record detected in input file, output S5 directly
|
||||
else
|
||||
{
|
||||
outputFile_st.WriteLine(BuildS19Record_str(addressFieldNotUsed_cu8));
|
||||
s5RecordPlacedInoutputFile_bol = true;
|
||||
}
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Build CRC record:\n
|
||||
* -places it directly to output file if new record required,\n
|
||||
* -replaces data in existing S2 record at CRC address and overwrites actual fileLine_str.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 24-Feb-2016..26-Feb-2016
|
||||
* @param[in] crcResult_u16 result of CRC calculation
|
||||
* @param[in] outputFile_st output file stream object
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void BuildS19CrcRecord_vd(UInt16 crcResult_u16, StreamWriter outputFile_st)
|
||||
{
|
||||
s19RecordId_str = dataRecord24BitAddress_cstr;
|
||||
//if CRC record address is NOT found in file, build a new record and place it directly behind the S0
|
||||
if (!crcRecordFoundInFile_bol)
|
||||
{
|
||||
//output only on file line counter equals 1
|
||||
if (1 == fileLineCtr_u32)
|
||||
{
|
||||
//build a new record just containing the CRC at specified address
|
||||
s19RecordLength_u8 = s2RecordAddressStrSize_cu8 / 2 + s19RecordDataCrcStrSize_cu8 / 2
|
||||
+ s19RecordCheckStrSize_cu8 / 2;
|
||||
s19RecordAddress_u32 = crcAddress_u32;
|
||||
//set CRC16 value
|
||||
s19RecordData_u8a[0] = (Byte)(crcResult_u16 & 0xFF);
|
||||
s19RecordData_u8a[1] = (Byte)((crcResult_u16 >> 8) & 0xFF);
|
||||
|
||||
//create s2-Record string for file output and write this additional line to file
|
||||
outputFile_st.WriteLine(BuildS19Record_str(addressField24BitSize_cu8));
|
||||
//remove CRC to file request
|
||||
placeCrcToFile_bol = false;
|
||||
}//file line counter == 1
|
||||
}//CRC record is NOT in input file, a new one has been placed to output file
|
||||
//replace CRC record, this has previously being identified by its file line counter in input file
|
||||
else if (fileLineCtr_u32 == crcRecordFileLine_u32)
|
||||
{
|
||||
//first the length, data and address is being filled, ignore return value
|
||||
ExtractAndCheckS2Record_bol();
|
||||
|
||||
//search address of CRC in S2-Record
|
||||
UInt32 searchAddress_u32 = s19RecordAddress_u32;
|
||||
Byte ctr_u8 = 0;
|
||||
while ((crcAddress_u32 < searchAddress_u32) && (ctr_u8 < maxS19RecordData_cu8))
|
||||
{
|
||||
searchAddress_u32++;
|
||||
ctr_u8++;
|
||||
}
|
||||
|
||||
//replace cells with CRC16 value
|
||||
s19RecordData_u8a[ctr_u8++] = (Byte)(crcResult_u16 & 0xFF);
|
||||
s19RecordData_u8a[ctr_u8] = (Byte)((crcResult_u16 >> 8) & 0xFF);
|
||||
|
||||
//create s2-Record string for file output
|
||||
fileLine_str = BuildS19Record_str(addressField24BitSize_cu8);
|
||||
//remove CRC to file request
|
||||
placeCrcToFile_bol = false;
|
||||
}//replace CRC record
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Assembling a S19-Record from:\n
|
||||
* -s19RecordId_str,\n
|
||||
* -s19RecordLength_u8,\n
|
||||
* -s19RecordAddress_u32,\n
|
||||
* -s19RecordData_u8a,\n
|
||||
* -s19RecordCalcChecksum_u8.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 24-Feb-2016
|
||||
* @param[in] s19AddressByteLength_u8 length of address field (0, 2, 3 byte)
|
||||
* @return s19Record_str entirely assembled S19-Record
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
String BuildS19Record_str(Byte s19AddressByteLength_u8)
|
||||
{
|
||||
String s19Record_str = s19RecordId_str;
|
||||
|
||||
//place the length
|
||||
s19Record_str += s19RecordLength_u8.ToString("X2");
|
||||
|
||||
//for 16 bit or 24 bit address fields
|
||||
if (addressField24BitSize_cu8 == s19AddressByteLength_u8)
|
||||
{
|
||||
s19Record_str += s19RecordAddress_u32.ToString("X6");
|
||||
}
|
||||
else if(addressField16BitSize_cu8 == s19AddressByteLength_u8)
|
||||
{
|
||||
s19Record_str += s19RecordAddress_u32.ToString("X4");
|
||||
}
|
||||
|
||||
//place data bytes
|
||||
Byte dataSize_u8 = (Byte)(s19RecordLength_u8 - s19RecordCheckStrSize_cu8 / 2 - s19AddressByteLength_u8);
|
||||
for (Byte dataCtr_u8 = 0; dataCtr_u8 < dataSize_u8; dataCtr_u8++)
|
||||
{
|
||||
s19Record_str += s19RecordData_u8a[dataCtr_u8].ToString("X2");
|
||||
}
|
||||
|
||||
//build the checksum
|
||||
BuildS19RecordChecksum_vd(s19AddressByteLength_u8);
|
||||
|
||||
//place the calculated checksum
|
||||
s19Record_str += s19RecordCalcChecksum_u8.ToString("X2");
|
||||
|
||||
return s19Record_str;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Read file and dispatch the S2-Records to the CRC generator:\n
|
||||
* -reads every line and checks format.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 23-Feb-2016..25-Feb-2016
|
||||
* @return file format valid
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public bool ValidateInputFile_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
fileLineCtr_u32 = 0;
|
||||
|
||||
try
|
||||
{
|
||||
//check if file exits
|
||||
if (File.Exists(inputFile_str))
|
||||
{
|
||||
//resets s2 record counter
|
||||
s2RecordCounter_u16 = 0;
|
||||
|
||||
//opens file for read
|
||||
StreamReader inputFile_st = new StreamReader(inputFile_str);
|
||||
|
||||
//read single line until file end or validation failed
|
||||
do
|
||||
{
|
||||
fileLine_str = inputFile_st.ReadLine();
|
||||
|
||||
//decode the file line
|
||||
returnValue_bol = ProcessInputFileLine_bol();
|
||||
|
||||
//change file line counter after check and line counter reminder for the records
|
||||
fileLineCtr_u32++;
|
||||
} while (returnValue_bol && !inputFile_st.EndOfStream);
|
||||
//release file
|
||||
inputFile_st.Close();
|
||||
}
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Builds the S19 Record checksum, the S19 fields have to be prepared in advance:\n
|
||||
* -Byte wise accumulation as word from length until last data byte,\n
|
||||
* -ones complement of accumulation result,\n
|
||||
* -masked out lower byte and typecast lower byte to byte,\n
|
||||
* -s19RecordLength_u8 (length of address + data + checksum)\n
|
||||
* -s19RecordAddress_u32,\n
|
||||
* -s19RecordData_u8a[],\n
|
||||
* -result is always being placed to s19RecordCalcChecksum_u8 (length + address + data).
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 24-Feb-2016
|
||||
* @param[in] s19AddressByteLength_u8 length of address field (0, 2, 3 byte)
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void BuildS19RecordChecksum_vd(Byte s19AddressByteLength_u8)
|
||||
{
|
||||
UInt16 accu_u16 = (UInt16)s19RecordLength_u8;
|
||||
//for 16 bit or 24 bit address fields
|
||||
if (s19AddressByteLength_u8 > addressFieldNotUsed_cu8)
|
||||
{
|
||||
accu_u16 += (UInt16)((s19RecordAddress_u32 >> 8) & 0x00FF);
|
||||
accu_u16 += (UInt16)(s19RecordAddress_u32 & 0x00FF);
|
||||
//for 24 bit address filed
|
||||
if (s19AddressByteLength_u8 > addressField16BitSize_cu8)
|
||||
{
|
||||
accu_u16 += (UInt16)((s19RecordAddress_u32 >> 16) & 0x00FF);
|
||||
}
|
||||
}
|
||||
Byte dataSize_u8 = (Byte)(s19RecordLength_u8 - s19RecordCheckStrSize_cu8 / 2 - s19AddressByteLength_u8);
|
||||
for (Byte ctr_u8 = 0; ctr_u8 < dataSize_u8; ctr_u8++)
|
||||
{
|
||||
accu_u16 += (UInt16)s19RecordData_u8a[ctr_u8];
|
||||
}
|
||||
s19RecordCalcChecksum_u8 = (Byte)(~accu_u16 & 0x00FF);
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Extract the information given by the read line from file:\n
|
||||
* -extracts the record identifier S0, S2, S5 or S8,\n
|
||||
* -dispatches S2 records to CRC generator memory,\n
|
||||
* -branches to the extract subroutines for the record types,\n
|
||||
* -sets record counters and reminders.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 22-Feb-2016..25-Feb-2016
|
||||
* @return s19 file validated
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
bool ProcessInputFileLine_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
try
|
||||
{
|
||||
//copy identifier
|
||||
s19RecordId_str = fileLine_str.Substring(0, s19RecordIdStrSize_cu8);
|
||||
switch (s19RecordId_str)
|
||||
{
|
||||
case fileHeader_cstr:
|
||||
returnValue_bol = ExtractAndCheckS0Record_bol();
|
||||
break;
|
||||
case dataRecord24BitAddress_cstr:
|
||||
if (ExtractAndCheckS2Record_bol())
|
||||
{
|
||||
returnValue_bol = true;
|
||||
//s2 record counter
|
||||
s2RecordCounter_u16++;
|
||||
|
||||
//dispatch content to CRC generator
|
||||
Byte dataSize_u8 = (Byte)(s19RecordLength_u8 - s19RecordCheckStrSize_cu8 / 2
|
||||
- s2RecordAddressStrSize_cu8 / 2);
|
||||
for (Byte ctr_u8 = 0; ctr_u8 < dataSize_u8; ctr_u8++)
|
||||
{
|
||||
MemSetFn_vdp(s19RecordAddress_u32, s19RecordData_u8a[ctr_u8]);
|
||||
|
||||
//check for CRC address in S2 record
|
||||
if (crcAddress_u32 == s19RecordAddress_u32)
|
||||
{
|
||||
//remind S2 with CRC content
|
||||
crcRecordFoundInFile_bol = true;
|
||||
crcRecordFileLine_u32 = fileLineCtr_u32;
|
||||
}//CRC address found
|
||||
|
||||
//setup next address after CRC check
|
||||
s19RecordAddress_u32++;
|
||||
|
||||
}//data copied
|
||||
}
|
||||
break;
|
||||
case dataRecordCounter16Bit_cstr:
|
||||
if (ExtractAndCheckS5Record_bol())
|
||||
{
|
||||
returnValue_bol = true;
|
||||
//remind S8 content
|
||||
s5RecordFoundInFile_bol = true;
|
||||
s5RecordFileLine_u32 = fileLineCtr_u32;
|
||||
}
|
||||
break;
|
||||
case startAddress24Bit_cstr:
|
||||
if (ExtractAndCheckS8Record_bol())
|
||||
{
|
||||
returnValue_bol = true;
|
||||
//remind S8 content
|
||||
s8RecordFoundInFile_bol = true;
|
||||
s8RecordFileLine_u32 = fileLineCtr_u32;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}//switch
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Extract the information given by the read line from file:\n
|
||||
* -copies data to hexadecimal data buffer,\
|
||||
* -builds the checksum and validates it.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 22-Feb-2016..24-Feb-2016
|
||||
* @return s19 file validated
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
bool ExtractAndCheckS0Record_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
Byte stringPositionCtr_u8 = s19RecordIdStrSize_cu8;
|
||||
|
||||
try
|
||||
{
|
||||
//extract the length
|
||||
String var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordLengthStrSize_cu8);
|
||||
s19RecordLength_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//limit length to avoid access of behind the border
|
||||
if (s19RecordLength_u8 > maxS19RecordData_cu8 + s0RecordAddressStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2)
|
||||
{
|
||||
s19RecordLength_u8 = maxS19RecordData_cu8 + s0RecordAddressStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2;
|
||||
}
|
||||
|
||||
//extract the address and accumulate it, it should be 0 for S0 record
|
||||
stringPositionCtr_u8 += s19RecordLengthStrSize_cu8;
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s0RecordAddressStrSize_cu8);
|
||||
s19RecordAddress_u32 = UInt32.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//extract and accumulate data
|
||||
stringPositionCtr_u8 += s0RecordAddressStrSize_cu8;
|
||||
for (Byte ctr_u8 = 0; ctr_u8 < s19RecordLength_u8 - s19RecordCheckStrSize_cu8 / 2
|
||||
- s0RecordAddressStrSize_cu8 / 2; ctr_u8++)
|
||||
{
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordDataStrSize_cu8);
|
||||
s19RecordData_u8a[ctr_u8] = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
stringPositionCtr_u8 += s19RecordDataStrSize_cu8;
|
||||
}
|
||||
//read the checksum
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordCheckStrSize_cu8);
|
||||
s19RecordRecChecksum_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//build new checksum
|
||||
BuildS19RecordChecksum_vd(addressField16BitSize_cu8);
|
||||
|
||||
//compare the calculated with the received checksum
|
||||
if (s19RecordCalcChecksum_u8 == s19RecordRecChecksum_u8)
|
||||
{
|
||||
returnValue_bol = true;
|
||||
}
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Extract the information given by the read line from file:\n
|
||||
* -copies data to hexadecimal data buffer,\
|
||||
* -builds the checksum and validates it.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 22-Feb-2016..24-Feb-2016
|
||||
* @return s19 file validated
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
bool ExtractAndCheckS8Record_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
Byte stringPositionCtr_u8 = s19RecordIdStrSize_cu8;
|
||||
|
||||
try
|
||||
{
|
||||
//extract the length
|
||||
String var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordLengthStrSize_cu8);
|
||||
s19RecordLength_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//limit length to avoid access of behind the border
|
||||
if (s19RecordLength_u8 > s8RecordAddressStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2)
|
||||
{
|
||||
s19RecordLength_u8 = s8RecordAddressStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2;
|
||||
}
|
||||
//extract the address and accumulate it
|
||||
stringPositionCtr_u8 += s19RecordLengthStrSize_cu8;
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s8RecordAddressStrSize_cu8);
|
||||
s19RecordAddress_u32 = UInt32.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//read the checksum
|
||||
stringPositionCtr_u8 += s8RecordAddressStrSize_cu8;
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordCheckStrSize_cu8);
|
||||
s19RecordRecChecksum_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//build new checksum
|
||||
BuildS19RecordChecksum_vd(addressField24BitSize_cu8);
|
||||
|
||||
//compare the calculated with the received checksum
|
||||
if (s19RecordCalcChecksum_u8 == s19RecordRecChecksum_u8)
|
||||
{
|
||||
returnValue_bol = true;
|
||||
}
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Extract the information given by the read line from file:\n
|
||||
* -builds the base address,\n
|
||||
* -copies data to hexadecimal data buffer,\n
|
||||
* -builds the checksum and validates it.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 22-Feb-2016..24-Feb-2016
|
||||
* @return s19 file validated
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
bool ExtractAndCheckS2Record_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
Byte stringPositionCtr_u8 = s19RecordIdStrSize_cu8;
|
||||
|
||||
try
|
||||
{
|
||||
//extract the length
|
||||
String var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordLengthStrSize_cu8);
|
||||
s19RecordLength_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//limit length to avoid access of behind the border
|
||||
if (s19RecordLength_u8 > maxS19RecordData_cu8 + s2RecordAddressStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2)
|
||||
{
|
||||
s19RecordLength_u8 = maxS19RecordData_cu8 + s2RecordAddressStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2;
|
||||
}
|
||||
|
||||
//extract the address and accumulate it
|
||||
stringPositionCtr_u8 += s19RecordLengthStrSize_cu8;
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s2RecordAddressStrSize_cu8);
|
||||
s19RecordAddress_u32 = UInt32.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//extract and accumulate data
|
||||
stringPositionCtr_u8 += s2RecordAddressStrSize_cu8;
|
||||
Byte dataSize_u8 = (Byte)(s19RecordLength_u8 - s19RecordCheckStrSize_cu8 / 2 - s2RecordAddressStrSize_cu8 / 2);
|
||||
for (Byte ctr_u8 = 0; ctr_u8 < dataSize_u8; ctr_u8++)
|
||||
{
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordDataStrSize_cu8);
|
||||
s19RecordData_u8a[ctr_u8] = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
stringPositionCtr_u8 += s19RecordDataStrSize_cu8;
|
||||
}
|
||||
//read the checksum
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordCheckStrSize_cu8);
|
||||
s19RecordRecChecksum_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//build new checksum
|
||||
BuildS19RecordChecksum_vd(addressField24BitSize_cu8);
|
||||
|
||||
//compare the calculated with the received checksum
|
||||
if (s19RecordCalcChecksum_u8 == s19RecordRecChecksum_u8)
|
||||
{
|
||||
returnValue_bol = true;
|
||||
}//checksum okay
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Extract the information given by the read line from file:\n
|
||||
* -copies data to hexadecimal data buffer,\
|
||||
* -builds the checksum and validates it.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 22-Feb-2016..24-Feb-2014
|
||||
* @return s19 file validated
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
bool ExtractAndCheckS5Record_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
Byte stringPositionCtr_u8 = s19RecordIdStrSize_cu8;
|
||||
|
||||
try
|
||||
{
|
||||
//extract the length which should always be 3
|
||||
String var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordLengthStrSize_cu8);
|
||||
s19RecordLength_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//limit length to avoid access of behind the border
|
||||
if (s19RecordLength_u8 > s5RecordCountStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2)
|
||||
{
|
||||
s19RecordLength_u8 = s5RecordCountStrSize_cu8 / 2 + s19RecordCheckStrSize_cu8 / 2;
|
||||
}
|
||||
//extract and accumulate the counts
|
||||
stringPositionCtr_u8 += s19RecordLengthStrSize_cu8;
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s5RecordCountStrSize_cu8);
|
||||
UInt16 s2RecordCtr_u16 = UInt16.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//read the checksum
|
||||
stringPositionCtr_u8 += s5RecordCountStrSize_cu8;
|
||||
var_str = fileLine_str.Substring(stringPositionCtr_u8, s19RecordCheckStrSize_cu8);
|
||||
s19RecordRecChecksum_u8 = Byte.Parse(var_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//build new checksum
|
||||
BuildS19RecordChecksum_vd(addressFieldNotUsed_cu8);
|
||||
|
||||
//compare the calculated with the received checksum
|
||||
if (s19RecordCalcChecksum_u8 == s19RecordRecChecksum_u8)
|
||||
{
|
||||
returnValue_bol = true;
|
||||
}
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
}//class s19FileHandler
|
||||
}//namespace CRC_CCITT
|
||||
/*=====================================END OF FILE===================================================================*/
|
||||
|
||||
398
CRC_CCITT/txtFileHandler.cs
Normal file
398
CRC_CCITT/txtFileHandler.cs
Normal file
@ -0,0 +1,398 @@
|
||||
/*********************************************************************************************************************/
|
||||
/*!@file txtFileHandler.cs
|
||||
* @brief Handle for Texas Instruments-txt files.
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @copyright
|
||||
*
|
||||
* ___________________________________________________________________________________________________________________\n
|
||||
* Copyright (c) 2016 SENSUS, GmbH.\n
|
||||
* All Rights Reserved.\n
|
||||
* \n
|
||||
* Confidential property of\n
|
||||
* SENSUS GmbH,\n
|
||||
* Meineckestr. 10, 30880 LAATZEN, GERMANY\n
|
||||
* \n
|
||||
* Design by\n
|
||||
* Hard- und Softwareentwicklung Thomas Wiedebusch,\n
|
||||
* Ostermarsch 17c, 31191 ALGERMISSEN/UMMELN, GERMANY\n
|
||||
* \n
|
||||
*====================================================================================================================\n
|
||||
* @intro
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* Functions:\n
|
||||
* Reading txt files,\n
|
||||
* Replacing bytes with CRC.\n
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
* @version
|
||||
*
|
||||
*____________________________________________________________________________________________________________________\n
|
||||
* V1.00 25-Feb-2016..27-Feb-2016 by Thomas Wiedebusch\n
|
||||
* - Initial.
|
||||
*
|
||||
*
|
||||
*====================================================================================================================\n
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace CRC_CCITT
|
||||
{
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief txtFileHandler class.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 25-Feb-2016
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
class txtFileHandler_t
|
||||
{
|
||||
//class variables
|
||||
String inputFile_str; //file name
|
||||
String outputFile_str; //file name
|
||||
String fileLine_str; //one line of the file
|
||||
crcGenrator_memSetFn_t MemSetFn_vdp; //set data to address of working memory
|
||||
crcGenrator_memGetFn_t MemGetFn_u8p; //get data from working memory
|
||||
|
||||
UInt32 crcFileLineBaseAddress_u32 = 0; //CRC file line address reminder set during input file processing
|
||||
UInt32 crcFileLine_u32 = 0; //CRC address line in file reminder set during input file processing
|
||||
bool crcFileLineFound_bol = false; //CRC address in file found reminder
|
||||
UInt32 memAddressCtr_u32 = 0; //CRC memory address counter
|
||||
bool placeCrcToFile_bol; //CRC output to file is required
|
||||
UInt32 crcAddress_u32; //CRC address given as parameter at startup
|
||||
|
||||
//txt file markers
|
||||
const Char addressMarker_cchr = '@'; //base address marker
|
||||
const Char endOfFileMarker_cchr = 'q'; //end of file marker
|
||||
const Byte maxDataOfFileLine_cu8 = 16; //maximum data at one file line
|
||||
const Byte fileLineDataCellIncrement_cu8 = 3; //3 digits increment for one data byte e.g. A5_
|
||||
|
||||
//calculations
|
||||
UInt32 fileLineCtr_u32 = 0; //actual accessed file line
|
||||
bool memoryAddressSetup_bol = false; //initial memory address has been set
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Constructor for txt file handler class:\n
|
||||
* -initializes file,\n
|
||||
* -this constructor will only be called if the input file has been found,\n
|
||||
* -sets delegates to memory set and get function being able to dispatch read data.\n
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 25-Feb-2016
|
||||
* @param[in] inputFileIn_str file name for input file
|
||||
* @param[in] outputFileIn_str file name for output file, can be identical with input file
|
||||
* @param[in] MemSetInFn_vdp set function to dispatch data to memory
|
||||
* @param[in] MemGetInFn_vdp get function to read data from memory
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public txtFileHandler_t(String inputFileIn_str, String outputFileIn_str, crcGenrator_memSetFn_t MemSetInFn_vdp,
|
||||
crcGenrator_memGetFn_t MemGetInFn_u8p, UInt32 crcAddressIn_u32, bool placeCrcToFileIn_bol)
|
||||
{
|
||||
inputFile_str = inputFileIn_str;
|
||||
outputFile_str = outputFileIn_str;
|
||||
MemSetFn_vdp = MemSetInFn_vdp;
|
||||
MemGetFn_u8p = MemGetInFn_u8p;
|
||||
placeCrcToFile_bol = placeCrcToFileIn_bol;
|
||||
crcAddress_u32 = crcAddressIn_u32;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Read file and dispatch the data to the CRC generator:\n
|
||||
* -reads every line and checks format.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 25-Feb-2016
|
||||
* @return file format valid
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public bool ValidateInputFile_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
fileLineCtr_u32 = 0;
|
||||
|
||||
try
|
||||
{
|
||||
//check if file exits
|
||||
if (File.Exists(inputFile_str))
|
||||
{
|
||||
//opens file for read
|
||||
StreamReader inputFile_st = new StreamReader(inputFile_str);
|
||||
|
||||
//read single line until file end or validation failed
|
||||
do
|
||||
{
|
||||
fileLine_str = inputFile_st.ReadLine();
|
||||
|
||||
//decode the file line
|
||||
returnValue_bol = ProcessInputFileLine_bol();
|
||||
|
||||
//change file line counter after check and line counter reminder for the records
|
||||
fileLineCtr_u32++;
|
||||
} while (returnValue_bol && !inputFile_st.EndOfStream);
|
||||
//release file
|
||||
inputFile_st.Close();
|
||||
}
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Extract the information given by the read line from file:\n
|
||||
* -builds base address from '@' input,\n
|
||||
* -extracts bytes and dispatches these to CRC generator memory,\n
|
||||
* -searches for CRC address and reminds file line for this,\n
|
||||
* -validates file with file end marker 'q'.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 25-Feb-2016..26-Feb-2016
|
||||
* @return txt file valid
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
bool ProcessInputFileLine_bol()
|
||||
{
|
||||
bool returnValue_bol = false;
|
||||
|
||||
try
|
||||
{
|
||||
//read first byte of line
|
||||
Char lineStart_chr = fileLine_str[0];
|
||||
switch (lineStart_chr)
|
||||
{
|
||||
case addressMarker_cchr:
|
||||
//extract new base address
|
||||
String mem_str = fileLine_str.Substring(1, fileLine_str.Length - 1);
|
||||
memAddressCtr_u32 = UInt32.Parse( mem_str, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
//check memory address range
|
||||
if( crcGenerator_t.maxMemBytes_cu32 > memAddressCtr_u32)
|
||||
{
|
||||
memoryAddressSetup_bol = true;
|
||||
returnValue_bol = true;
|
||||
}
|
||||
break;
|
||||
case endOfFileMarker_cchr:
|
||||
//if end of file marker read on first line then the file is invalid
|
||||
if (0 != fileLineCtr_u32)
|
||||
{
|
||||
returnValue_bol = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//if data read on first line then the file is invalid
|
||||
if ((0 != fileLineCtr_u32) && (memoryAddressSetup_bol))
|
||||
{
|
||||
Byte data_u8;
|
||||
Byte fileLineDataCtr_u8 = 0;
|
||||
String data_str;
|
||||
//remind the base address of this file line to save it for CRC replacement
|
||||
UInt32 fileLineBaseAddress_u32 = memAddressCtr_u32;
|
||||
//search file line
|
||||
for (Byte ctr_u8 = 0; ctr_u8 < maxDataOfFileLine_cu8; ctr_u8++)
|
||||
{
|
||||
//inner loop limitation to actual file line length
|
||||
while (fileLine_str.Length > fileLineDataCtr_u8)
|
||||
{
|
||||
//remind file line for CRC output
|
||||
if (crcAddress_u32 == memAddressCtr_u32)
|
||||
{
|
||||
//remind the file entry
|
||||
crcFileLine_u32 = fileLineCtr_u32;
|
||||
//remind the base address for the file line for CRC replacement
|
||||
crcFileLineBaseAddress_u32 = fileLineBaseAddress_u32;
|
||||
//mark that entry has been found
|
||||
crcFileLineFound_bol = true;
|
||||
}
|
||||
//extract data
|
||||
data_str = fileLine_str.Substring(fileLineDataCtr_u8, fileLineDataCellIncrement_cu8);
|
||||
data_u8 = Byte.Parse(data_str, System.Globalization.NumberStyles.HexNumber);
|
||||
//dispatch data to CRC generator
|
||||
MemSetFn_vdp(memAddressCtr_u32, data_u8);
|
||||
memAddressCtr_u32++;
|
||||
fileLineDataCtr_u8 += fileLineDataCellIncrement_cu8;
|
||||
}//file line length
|
||||
}//data counter
|
||||
returnValue_bol = true;
|
||||
}
|
||||
break;
|
||||
}//switch
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
return returnValue_bol;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Read input file and store it to output file:\n
|
||||
* -reads every line, format has been checked,\n
|
||||
* -replaces CRC if required.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 25-Feb-2016..26-Feb-2016
|
||||
* @param[in] crcResult_u16 result of CRC calculation
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
public void CreateOutputFile_vd(UInt16 crcResult_u16)
|
||||
{
|
||||
//the file line counter will be used to reference the input of already detected records
|
||||
fileLineCtr_u32 = 0;
|
||||
|
||||
try
|
||||
{
|
||||
//check if file exits
|
||||
if (File.Exists(inputFile_str))
|
||||
{
|
||||
//opens file for read
|
||||
StreamReader inputFile_st = new StreamReader(inputFile_str);
|
||||
if (File.Exists(outputFile_str))
|
||||
{
|
||||
//erase it
|
||||
File.Delete(outputFile_str);
|
||||
}
|
||||
|
||||
//open it for write access
|
||||
StreamWriter outputFile_st = new StreamWriter(outputFile_str, true);
|
||||
|
||||
//read single line until and output it to the output file
|
||||
do
|
||||
{
|
||||
//read one line of the input file
|
||||
fileLine_str = inputFile_st.ReadLine();
|
||||
|
||||
//output of CRC to file is required
|
||||
if (placeCrcToFile_bol)
|
||||
{
|
||||
//if CRC address is not in file generate a new address with CRC only at the beginning
|
||||
if (!crcFileLineFound_bol)
|
||||
{
|
||||
//build a new file entry for CRC which is not inside the file address range
|
||||
BuildAndWriteNewCrc_vd(crcResult_u16, outputFile_st);
|
||||
//remove CRC to file request
|
||||
placeCrcToFile_bol = false;
|
||||
}
|
||||
//search for file entry to replace CRC
|
||||
else if (crcFileLine_u32 == fileLineCtr_u32)
|
||||
{
|
||||
//the base address for this file line has been set in advance during file scan
|
||||
ReplaceCrcData_vd(crcResult_u16);
|
||||
//remove CRC to file request
|
||||
placeCrcToFile_bol = false;
|
||||
}
|
||||
}//output of CRC to file is required
|
||||
|
||||
//write all lines to output file
|
||||
outputFile_st.WriteLine(fileLine_str);
|
||||
|
||||
//change file line of input file
|
||||
fileLineCtr_u32++;
|
||||
} while (!inputFile_st.EndOfStream);
|
||||
|
||||
//release files
|
||||
inputFile_st.Close();
|
||||
outputFile_st.Close();
|
||||
|
||||
//if the output file is equal to the input file, erase input file and rename temporary output file
|
||||
if (crcProgram_t.fileUndefined_cstr == outputFile_str)
|
||||
{
|
||||
File.Delete(inputFile_str);
|
||||
if (File.Exists(outputFile_str))
|
||||
{
|
||||
//rename output to input file name, output file will be deleted
|
||||
File.Move(outputFile_str, inputFile_str);
|
||||
}
|
||||
|
||||
}
|
||||
}//input file exists
|
||||
}//try
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Replaces the CRC data if CRC address is inside the file address range:\n
|
||||
* -search for CRC address,\n
|
||||
* -replace CRC data in fileLine_str.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 26-Feb-2016..27-Feb-2016
|
||||
* @param[in] crcResult_u16 result of CRC calculation
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void ReplaceCrcData_vd(UInt16 crcResult_u16)
|
||||
{
|
||||
//build the CRC sub string for replacement
|
||||
Byte dataLsb_u8 = (Byte)(crcResult_u16 & 0x00FF);
|
||||
Byte dataMsb_u8 = (Byte)((crcResult_u16 >> 8) & 0x00FF);
|
||||
String crcSubStringOutput_str = dataLsb_u8.ToString("X2") + " " + dataMsb_u8.ToString("X2") + " ";
|
||||
|
||||
//search for address entry in file
|
||||
memAddressCtr_u32 = crcFileLineBaseAddress_u32;
|
||||
UInt32 beforeCrcAddress_u32 = crcFileLineBaseAddress_u32;
|
||||
Byte ctr_u8 = 0;
|
||||
while (memAddressCtr_u32 < crcAddress_u32)
|
||||
{
|
||||
ctr_u8 += fileLineDataCellIncrement_cu8;
|
||||
memAddressCtr_u32++;
|
||||
}
|
||||
|
||||
//extract string before CRC address from fileLine_str
|
||||
String beforeCrcAddress_str = "";
|
||||
if (beforeCrcAddress_u32 < crcAddress_u32)
|
||||
{
|
||||
beforeCrcAddress_str = fileLine_str.Substring(0, ctr_u8);
|
||||
}
|
||||
|
||||
//extract string after CRC address from fileLine_str
|
||||
String afterCrcAddress_str = "";
|
||||
if (fileLine_str.Length > ctr_u8 + 2 * fileLineDataCellIncrement_cu8)
|
||||
{
|
||||
afterCrcAddress_str = fileLine_str.Substring(ctr_u8 + 2 * fileLineDataCellIncrement_cu8,
|
||||
fileLine_str.Length - (ctr_u8 + 2 * fileLineDataCellIncrement_cu8));
|
||||
}
|
||||
|
||||
//replace fileLine_str with substring at ctr position
|
||||
fileLine_str = beforeCrcAddress_str + crcSubStringOutput_str + afterCrcAddress_str;
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
/*!@brief Builds and writes a new CRC entry if CRC address is outside the file address range:\n
|
||||
* -assemble and write CRC address,\n
|
||||
* -assemble and write CRC data.
|
||||
* @author Thomas Wiedebusch
|
||||
* @date 26-Feb-2016
|
||||
* @param[in] crcResult_u16 result of CRC calculation
|
||||
* @param[in] outputFile_st output file stream object
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
void BuildAndWriteNewCrc_vd(UInt16 crcResult_u16, StreamWriter outputFile_st)
|
||||
{
|
||||
//build the NEW address for CRC
|
||||
String crcOutput_str = addressMarker_cchr.ToString();
|
||||
crcOutput_str += crcAddress_u32.ToString("X");
|
||||
//write address to file
|
||||
outputFile_st.WriteLine(crcOutput_str);
|
||||
|
||||
//build the CRC file line (line contains CRC only)
|
||||
Byte dataLsb_u8, dataMsb_u8;
|
||||
dataLsb_u8 = (Byte)(crcResult_u16 & 0x00FF);
|
||||
dataMsb_u8 = (Byte)((crcResult_u16 >> 8) & 0x00FF);
|
||||
crcOutput_str = dataLsb_u8.ToString("X2") + " " + dataMsb_u8.ToString("X2");
|
||||
//write CRC data to file
|
||||
outputFile_st.WriteLine(crcOutput_str);
|
||||
}
|
||||
/**/
|
||||
/*---------------------------------------------------------------------------------------------------------------*/
|
||||
}//class txtFileHandler
|
||||
}//namespace CRC_CCITT
|
||||
/*=====================================END OF FILE===================================================================*/
|
||||
25
Common/.shared/HistorySnippetRD.snippet
Normal file
25
Common/.shared/HistorySnippetRD.snippet
Normal file
@ -0,0 +1,25 @@
|
||||
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
|
||||
|
||||
<CodeSnippet Format="1.0.0">
|
||||
<Header>
|
||||
<Title>History RD</Title>
|
||||
<Description>History snipped for RD</Description>
|
||||
<Shortcut>HistoryR</Shortcut>
|
||||
<SnippetTypes>
|
||||
<SnippetType>Expansion</SnippetType>
|
||||
</SnippetTypes>
|
||||
</Header>
|
||||
<Snippet>
|
||||
<Code Language="csharp">
|
||||
<![CDATA[
|
||||
/// <history date="$DateTime$" author="T.Wiedebusch">
|
||||
/// -
|
||||
/// </history>
|
||||
]]>
|
||||
|
||||
|
||||
</Code>
|
||||
</Snippet>
|
||||
</CodeSnippet>
|
||||
|
||||
</CodeSnippets>
|
||||
86
Common/.shared/NlogConfig.xml
Normal file
86
Common/.shared/NlogConfig.xml
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<variable name="BasePath" value="C:\GenesisLog2\"/>
|
||||
<targets>
|
||||
|
||||
<!--CalibrationHelper-->
|
||||
<target name="CalibrationHelper" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\CalibrationHelper.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_CalibrationHelper.log" />
|
||||
|
||||
<!--LedRawData-->
|
||||
<target xsi:type="BufferingWrapper"
|
||||
name="TargetLedRawDataBase"
|
||||
bufferSize="10000"
|
||||
flushTimeout="-1"
|
||||
slidingTimeout="true"
|
||||
>
|
||||
<target name="LedRawDataBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\LedRawData_BASE.log" CreateDirs="True" layout ="${longdate} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_LedRawData_BASE.log" />
|
||||
</target>
|
||||
<!--C:\GenesisLog\${shortdate}
|
||||
C:\GenesisLog\${shortdate}-->
|
||||
|
||||
<!--MeterBatch-->
|
||||
<target name="MeterBatch" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_Meter_BASE.log" />
|
||||
|
||||
<!--Meter-->
|
||||
<target name="MeterBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_Meter_BASE.log" />
|
||||
<target name="Slot:0" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_SlotSlot:0.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_Meter_SlotSlot:0.log" />
|
||||
|
||||
<!--COM-->
|
||||
<target name="COMBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\COM_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_COM_BASE.log" />
|
||||
|
||||
<!--ServiceFwUpdateBuilder-->
|
||||
<target name="ServiceFwUpdateBuilder" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateBuilder.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ServiceFwUpdateBuilder.log" />
|
||||
|
||||
<!--ServiceFwUpdateLoader-->
|
||||
<target name="ServiceFwUpdateLoader" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateLoader.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ServiceFwUpdateLoader.log" />
|
||||
|
||||
<!--ServiceFwUpdateSw-->
|
||||
<target name="ServiceFwUpdateSw" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateSw.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ServiceFwUpdateSw.log" />
|
||||
|
||||
<!--default-->
|
||||
<target name="default" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\default.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_default.log" />
|
||||
<target name="PreAdjWr" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\PreAdjWr.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
|
||||
|
||||
<target name="ctlBatch" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ctlBatch.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ctlBatch.log" />
|
||||
<target name="StreamingQualityFile" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\StreamingQuality.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
|
||||
<target name="ProductionUIFile" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ProductionUIFile.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
|
||||
</targets>
|
||||
<rules>
|
||||
<!--ServiceFwUpdateBuilder-->
|
||||
<logger name="ServiceFwUpdateBuilder" minLevel="Trace" appendTo="ServiceFwUpdateSw"/>
|
||||
<!--ServiceFwUpdateLoader-->
|
||||
<logger name="ServiceFwUpdateLoader" minLevel="Trace" appendTo="ServiceFwUpdateLoader"/>
|
||||
<!--ServiceFwUpdateSw-->
|
||||
<logger name="ServiceFwUpdateSw" minLevel="Trace" appendTo="ServiceFwUpdateSw"/>
|
||||
<!--CalibrationHelper-->
|
||||
<logger name="CalibrationHelper" minLevel="Trace" appendTo="CalibrationHelper"/>
|
||||
<!--LedRawData-->
|
||||
<logger name="LedRawDataBase" minLevel="Trace" appendTo="TargetLedRawDataBase"/>
|
||||
<!--MeterBatch-->
|
||||
<logger name="MeterBatch" minLevel="Trace" appendTo="MeterBatch"/>
|
||||
<!--Meter-->
|
||||
<logger name="MeterBase" minLevel="Trace" appendTo="MeterBase"/>
|
||||
<logger name="Slot:0" minLevel="Trace" appendTo="Slot:0"/>
|
||||
|
||||
<logger name="GenesisRequestProtocolBase" minLevel="Trace" appendTo="MeterBase"/>
|
||||
<logger name="MeasurementBase" minLevel="Trace" appendTo="MeterBase"/>
|
||||
<!--COM-->
|
||||
<logger name="SerialComPortBase" minLevel="Trace" appendTo="COMBase"/>
|
||||
<logger name="IrdaBase" minLevel="Trace" appendTo="COMBase"/>
|
||||
<logger name="RfidBase" minLevel="Trace" appendTo="COMBase"/>
|
||||
<logger name="TransmitProtocolBase" minLevel="Trace" appendTo="COMBase"/>
|
||||
<!--default-->
|
||||
<logger name="*" minLevel="Debug" appendTo="default"/>
|
||||
|
||||
<!--Ui logger-->
|
||||
<logger name="ctlBatch" minLevel="Trace" appendTo="ctlBatch"/>
|
||||
<logger name="StreamingQuality" minLevel="Trace" appendTo="StreamingQualityFile"/>
|
||||
<logger name="PreAdjWr" minLevel="Trace" appendTo="PreAdjWr"/>
|
||||
|
||||
<logger name="ProductionUI" minLevel="Trace" appendTo="ProductionUIFile"/>
|
||||
|
||||
</rules>
|
||||
</nlog>
|
||||
18
Common/.shared/SharedAssemblyInfo.cs
Normal file
18
Common/.shared/SharedAssemblyInfo.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Reflection;
|
||||
|
||||
//#if DEBUG
|
||||
//[assembly: AssemblyConfiguration("DEBUG")]
|
||||
//#else
|
||||
//[assembly: AssemblyConfiguration("RELEASE")]
|
||||
//#endif
|
||||
//[assembly: AssemblyCompany("Sensus")]
|
||||
//[assembly: AssemblyProduct("Sensus WaterMeter Genesis")]
|
||||
//[assembly: AssemblyCopyright("Copyright © Sensus 2020")]
|
||||
//[assembly: AssemblyTrademark("WaterMeter Genesis")]
|
||||
|
||||
//
|
||||
//[assembly: AssemblyVersion("1.2.*.0")]
|
||||
|
||||
|
||||
[assembly: AssemblyVersion("1.0.3.*")]
|
||||
[assembly: AssemblyFileVersion("1.3.0.10")]
|
||||
3
Common/.shared/SharedAssemblyInfoCoreVersion.cs
Normal file
3
Common/.shared/SharedAssemblyInfoCoreVersion.cs
Normal file
@ -0,0 +1,3 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyFileVersion("1.2.0.5")]
|
||||
250
Common/.shared/status.json
Normal file
250
Common/.shared/status.json
Normal file
@ -0,0 +1,250 @@
|
||||
{
|
||||
"OK": {"id": 0},
|
||||
"ERROR_ZERO_APPS": {"id": 1},
|
||||
"ERROR_NO_MEMORY": {"id": 2},
|
||||
"ERROR_NOT_IMPLEMENTED": {"id": 3},
|
||||
"ERROR_BLOCK_NOT_FOUND": {"id": 4},
|
||||
"ERROR_NO_SUCH_VAR": {"id": 5},
|
||||
"ERROR_NO_CLIB": {"id": 6},
|
||||
"ERROR_KEY_FAILURE": {"id": 7},
|
||||
"ERROR_NO_SLOTS_FREE": {"id": 8},
|
||||
"ERROR_VECTOR_OUT_OF_RANGE": {"id": 9},
|
||||
"ERROR_BAD_VECTOR_RELEASE": {"id": 10},
|
||||
"ERROR_DRIVER_BUSY": {"id": 11},
|
||||
"ERROR_OUT_OF_RANGE": {"id": 12},
|
||||
"ERROR_CANT_CANCEL_TICK": {"id": 13},
|
||||
"ERROR_ID_OUT_OF_RANGE": {"id": 14},
|
||||
"ERROR_HANDLE_OUT_OF_RANGE": {"id": 15},
|
||||
"ERROR_INCAPABLE_HARDWARE": {"id": 16},
|
||||
"ERROR_ALREADY_OPEN": {"id": 17},
|
||||
"ERROR_STRING_TOO_LONG": {"id": 18},
|
||||
"ERROR_CORRUPT_CONFIGURATION": {"id": 19},
|
||||
"ERROR_TIMEOUT": {"id": 20},
|
||||
"ERROR_NO_PRIVILEGE": {"id": 21},
|
||||
"ERROR_DEVICE_DORMANT": {"id": 22},
|
||||
"ERROR_MEDIA_FAILURE": {"id": 23},
|
||||
"ERROR_BUFFER_OVERFLOW": {"id": 24},
|
||||
"ERROR_UPGRADE_SYNTAX_ERROR": {"id": 25},
|
||||
"ERROR_UPGRADE_DEPENDENCY_NOT_MET": {"id": 26},
|
||||
"ERROR_UPGRADE_MISSING": {"id": 27},
|
||||
"ERROR_UPGRADE_FRAGMENTED_BY_CLIB": {"id": 28},
|
||||
"ERROR_TRUNCATED": {"id": 29},
|
||||
"ERROR_INVALID_HEADER": {"id": 30},
|
||||
"ERROR_WONT_DELETE_CLIB": {"id": 31},
|
||||
"ERROR_BAD_REGISTER_VALUE": {"id": 32},
|
||||
"ERROR_NO_CHANGE_MADE": {"id": 33},
|
||||
"ERROR_NOT_ATOMIC": {"id": 34},
|
||||
"ERROR_CALENDAR_CHANGED": {"id": 35},
|
||||
"ERROR_WORM_FIELD": {"id": 36},
|
||||
"ERROR_CONVERSION_UNSUPPORTED": {"id": 37},
|
||||
"ERROR_CPU_PERMISSION_FAULT": {"id": 38},
|
||||
"ERROR_CPU_SOFTWARE_FAULT": {"id": 39},
|
||||
"ERROR_CPU_DECODE_FAULT": {"id": 40},
|
||||
"ERROR_CPU_ADDRESS_ACCESS_FAULT": {"id": 41},
|
||||
"ERROR_CPU_UNCAUGHT_FAULT": {"id": 42},
|
||||
"ERROR_ACCURACY_LOST": {"id": 43},
|
||||
"ERROR_EXIT_FAILURE": {"id": 44},
|
||||
"ERROR_CANT_CANCEL_CALLBACK": {"id": 45},
|
||||
"ERROR_RECOVERED_SPACE": {"id": 46},
|
||||
"ERROR_DRIVE_FULL": {"id": 47},
|
||||
"ERROR_NO_FILE_HANDLES_AVAILABLE": {"id": 48},
|
||||
"ERROR_EXCESSIVE_RESTARTS": {"id": 49},
|
||||
"ERROR_MPU_SETUP_FAILED": {"id": 50},
|
||||
"ERROR_DEVICE_NOT_OPEN": {"id": 51},
|
||||
"ERROR_NO_RESPONSE": {"id": 52},
|
||||
"ERROR_EXIT_WATCHDOG": {"id": 53},
|
||||
"ERROR_WONT_DELETE_SPECIAL": {"id": 54},
|
||||
"ERROR_WONT_UPGRADE_SPECIAL": {"id": 55},
|
||||
"ERROR_POWERMON_TABLE_FULL": {"id": 256},
|
||||
"ERROR_POWERMON_UNKNOWN_PARAMETER": {"id": 257},
|
||||
"ERROR_POWERMON_OUT_OF_RANGE": {"id": 258},
|
||||
"ERROR_POWERMON_STOP_CYCLING": {"id": 259},
|
||||
"ERROR_POWERMON_TEMPERATURE_LIMIT": {"id": 260},
|
||||
"ERROR_POWERMON_BATTERY_STATUS_CHANGED": {"id": 261},
|
||||
"ERROR_POWERMON_BATTERY_CRITICAL": {"id": 262},
|
||||
"ERROR_CONFIGEX_LOCKED_OUT": {"id": 1024},
|
||||
"ERROR_CONFIGEX_AUTHENTICATION_FAILURE": {"id": 1025},
|
||||
"ERROR_CONFIGEX_ACCESS_DENIED": {"id": 1026},
|
||||
"ERROR_CONFIGEX_UNKNOWN_PARAMETER": {"id": 1027},
|
||||
"ERROR_CONFIGEX_IN_USE": {"id": 1028},
|
||||
"ERROR_CONFIGEX_SIZES_DONT_MATCH": {"id": 1029},
|
||||
"ERROR_CONFIGEX_CANT_READ_CONFIG_FILE": {"id": 1030},
|
||||
"ERROR_CONFIGEX_USER_NOT_KNOWN": {"id": 1031},
|
||||
"ERROR_CONFIGEX_CANT_CREATE_CONFIG_FILE": {"id": 1032},
|
||||
"ERROR_CONFIGEX_STORE_DIDNT_STORE": {"id": 1033},
|
||||
"ERROR_CONFIGEX_STORE_CORRUPT": {"id": 1034},
|
||||
"ERROR_CONFIGEX_EXPECTED_WRITE": {"id": 1035},
|
||||
"ERROR_CONFIGEX_EXPECTED_READ": {"id": 1036},
|
||||
"ERROR_CONFIGEX_STOP_CYCLING": {"id": 1037},
|
||||
"ERROR_CONFIGEX_TOO_MANY_OPEN": {"id": 1038},
|
||||
"ERROR_CONFIGEX_NEVER_OPENED": {"id": 1039},
|
||||
"ERROR_CONFIGEX_FILE_PROTECTED": {"id": 1040},
|
||||
"ERROR_CONFIGEX_PARTIAL_RECALL": {"id": 1041},
|
||||
"ERROR_CONFIGEX_DEFAULT_PASSWORD_USED": {"id": 1042},
|
||||
"ERROR_OPTICALPORT_PAYLOAD_COUNT": {"id": 1280},
|
||||
"ERROR_OPTICALPORT_INVALID_SUBREASON": {"id": 1281},
|
||||
"ERROR_OPTICALPORT_INVALID_BAUDRATE": {"id": 1282},
|
||||
"ERROR_OPTICALPORT_INVALID_BUFFERSIZE": {"id": 1283},
|
||||
"ERROR_OPTICALPORT_CRCFAILURE": {"id": 1284},
|
||||
"ERROR_OPTICALPORT_UNRECOGNISEDCMD": {"id": 1285},
|
||||
"ERROR_OPTICALPORT_FRAMING": {"id": 1286},
|
||||
"ERROR_OPTICALPORT_OVERFLOW": {"id": 1287},
|
||||
"ERROR_OPTICALPORT_PACKETTIMEOUT": {"id": 1288},
|
||||
"ERROR_OPTICALPORT_INVALIDESCAPE": {"id": 1289},
|
||||
"ERROR_OPTICALPORT_UNKNOWN_PARAMETER": {"id": 1290},
|
||||
"ERROR_OPTICALPORT_TRAINING_FAILED": {"id": 1291},
|
||||
"ERROR_OPTICALPORT_NOBREAK": {"id": 1292},
|
||||
"ERROR_LOGGER_UNKNOWN_PARAMETER": {"id": 2048},
|
||||
"ERROR_LOGGER_RESTARTED": {"id": 2049},
|
||||
"ERROR_LOGGER_BLOCK_LISTING": {"id": 2050},
|
||||
"ERROR_CUSTOMER_REBOOT,": {"id": 2304},
|
||||
"ERROR_CUSTOMER_REBOOT_STOP,": {"id": 2305},
|
||||
"ERROR_CUSTOMER_LOW_BATTERY,": {"id": 2306},
|
||||
"ERROR_CUSTOMER_LOW_BATTERY_STOP,": {"id": 2307},
|
||||
"ERROR_CUSTOMER_VERY_LOW_BATTERY,": {"id": 2308},
|
||||
"ERROR_CUSTOMER_VERY_LOW_BATTERY_STOP,": {"id": 2309},
|
||||
"ERROR_CUSTOMER_CONFIG_ERROR,": {"id": 2310},
|
||||
"ERROR_CUSTOMER_CONFIG_ERROR_STOP,": {"id": 2311},
|
||||
"ERROR_CUSTOMER_EMPTY_PIPE,": {"id": 2312},
|
||||
"ERROR_CUSTOMER_EMPTY_PIPE_STOP,": {"id": 2313},
|
||||
"ERROR_CUSTOMER_MAGNETIC_TAMPER,": {"id": 2314},
|
||||
"ERROR_CUSTOMER_MAGNETIC_TAMPER_STOP,": {"id": 2315},
|
||||
"ERROR_CUSTOMER_REVERSE_FLOW,": {"id": 2316},
|
||||
"ERROR_CUSTOMER_REVERSE_FLOW_STOP,": {"id": 2317},
|
||||
"ERROR_CUSTOMER_SUSPECT_LEAK,": {"id": 2318},
|
||||
"ERROR_CUSTOMER_SUSPECT_LEAK_STOP,": {"id": 2319},
|
||||
"ERROR_CUSTOMER_BROKEN_PIPE,": {"id": 2320},
|
||||
"ERROR_CUSTOMER_BROKEN_PIPE_STOP,": {"id": 2321},
|
||||
"ERROR_CUSTOMER_LOW_PRESSURE,": {"id": 2322},
|
||||
"ERROR_CUSTOMER_LOW_PRESSURE_STOP,": {"id": 2323},
|
||||
"ERROR_CUSTOMER_HIGH_PRESSURE,": {"id": 2324},
|
||||
"ERROR_CUSTOMER_HIGH_PRESSURE_STOP,": {"id": 2325},
|
||||
"ERROR_CUSTOMER_LOW_TEMPERATURE,": {"id": 2326},
|
||||
"ERROR_CUSTOMER_LOW_TEMPERATURE_STOP,": {"id": 2327},
|
||||
"ERROR_CUSTOMER_HIGH_TEMPERATURE,": {"id": 2328},
|
||||
"ERROR_CUSTOMER_HIGH_TEMPERATURE_STOP,": {"id": 2329},
|
||||
"ERROR_CUSTOMER_RADIO_ERROR,": {"id": 2330},
|
||||
"ERROR_CUSTOMER_RADIO_ERROR_STOP,": {"id": 2331},
|
||||
"ERROR_CUSTOMER_METROLOGY_PARAMS,": {"id": 2332},
|
||||
"ERROR_CUSTOMER_METROLOGY_PARAMS_STOP,": {"id": 2333},
|
||||
"ERROR_CUSTOMER_METROLOGY_MEASURE,": {"id": 2334},
|
||||
"ERROR_CUSTOMER_METROLOGY_MEASURE_STOP,": {"id": 2335},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_6,": {"id": 2336},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_6_STOP,": {"id": 2337},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_7,": {"id": 2338},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_7_STOP,": {"id": 2339},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_8,": {"id": 2340},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_8_STOP,": {"id": 2341},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_9,": {"id": 2342},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_9_STOP,": {"id": 2343},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_10,": {"id": 2344},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_10_STOP,": {"id": 2345},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_11,": {"id": 2346},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_11_STOP,": {"id": 2347},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_12,": {"id": 2348},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_12_STOP,": {"id": 2349},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_13,": {"id": 2350},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_13_STOP,": {"id": 2351},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_14,": {"id": 2352},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_14_STOP,": {"id": 2353},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_15,": {"id": 2354},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_15_STOP,": {"id": 2355},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_16,": {"id": 2356},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_16_STOP,": {"id": 2357},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_17,": {"id": 2358},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_17_STOP,": {"id": 2359},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_18,": {"id": 2360},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_18_STOP,": {"id": 2361},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_19,": {"id": 2362},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_19_STOP,": {"id": 2363},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_20,": {"id": 2364},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_20_STOP,": {"id": 2365},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_21,": {"id": 2366},
|
||||
"ERROR_CUSTOMER_UNALLOCATED_21_STOP,": {"id": 2367},
|
||||
"ERROR_CUSTOMER_UNKNOWN_PARAMETER,": {"id": 2368},
|
||||
"ERROR_CUSTOMER_LOCALE_UNDEFINED,": {"id": 2369},
|
||||
"ERROR_CUSTOMER_NO_SUCH_ALARM,": {"id": 2370},
|
||||
"ERROR_CUSTOMER_OUT_OF_RANGE,": {"id": 2371},
|
||||
"ERROR_CUSTOMER_NOT_IMPLEMENTED,": {"id": 2372},
|
||||
"ERROR_CUSTOMER_BAD_CONFIG,": {"id": 2373},
|
||||
"ERROR_CUSTOMER_DID_NOT_STORE,": {"id": 2374},
|
||||
"ERROR_CUSTOMER_STORE_PENDING,": {"id": 2375},
|
||||
"ERROR_GENESISFLOW_BAD_TEST": {"id": 3840},
|
||||
"ERROR_GENESISFLOW_BAD_CONFIG": {"id": 3841},
|
||||
"ERROR_GENESISFLOW_DID_NOT_STORE": {"id": 3842},
|
||||
"ERROR_GENESISFLOW_STORE_PENDING": {"id": 3843},
|
||||
"ERROR_GENESISFLOW_STORE_BUFFER_SIZE": {"id": 3844},
|
||||
"ERROR_GENESISFLOW_STRING_TOO_LONG": {"id": 3845},
|
||||
"ERROR_GENESISFLOW_BAD_DISPLAY_MODE": {"id": 3846},
|
||||
"ERROR_GENESISFLOW_GLASS_TOO_LONG": {"id": 3847},
|
||||
"ERROR_GENESISFLOW_SLOT_NOT_YOURS": {"id": 3848},
|
||||
"ERROR_GENESISFLOW_SUBLIST_TOO_LONG": {"id": 3849},
|
||||
"ERROR_GENESISFLOW_NO_TEMP_SENSOR": {"id": 3850},
|
||||
"ERROR_GENESISFLOW_UNDER_TEMP": {"id": 3851},
|
||||
"ERROR_GENESISFLOW_LOW_TEMP_WARNING": {"id": 3852},
|
||||
"ERROR_GENESISFLOW_HIGH_TEMP_WARNING": {"id": 3853},
|
||||
"ERROR_GENESISFLOW_OVER_TEMP": {"id": 3854},
|
||||
"ERROR_GENESISFLOW_MISMATCHING_LSB": {"id": 3855},
|
||||
"ERROR_GENESISFLOW_OUT_OF_RANGE_PWDIFF": {"id": 3856},
|
||||
"ERROR_GENESISFLOW_OUT_OF_RANGE_AMPLITUDE": {"id": 3857},
|
||||
"ERROR_GENESISFLOW_OUT_OF_RANGE_TOF": {"id": 3858},
|
||||
"ERROR_GENESISFLOW_OUT_OF_RANGE_DTOF": {"id": 3859},
|
||||
"ERROR_GENESISFLOW_TOF_TIMEOUT": {"id": 3860},
|
||||
"ERROR_GENESISFLOW_CAL_CHANGE": {"id": 3861},
|
||||
"ERROR_GENESISFLOW_OUT_OF_RANGE_INTERVAL": {"id": 3862},
|
||||
"ERROR_GENESISFLOW_VALIDATE_FAIL": {"id": 3863},
|
||||
"ERROR_GENESISFLOW_OUT_OF_RANGE_TEMP": {"id": 3864},
|
||||
"ERROR_GENESISFLOW_NOT_READY": {"id": 3865},
|
||||
"ERROR_GENESISFLOW_METROLOGY_ERROR": {"id": 3866},
|
||||
"ERROR_GENESISFLOW_GP30_ID_ERROR": {"id": 3867},
|
||||
"ERROR_GENESISFLOW_GP30_FLAG_ERROR": {"id": 3868},
|
||||
"ERROR_GENESISFLOW_GP30_TIMEOUT_ERROR": {"id": 3869},
|
||||
"ERROR_GENESISFLOW_GP30_REQUEST_ERROR": {"id": 3870},
|
||||
"ERROR_GENESISFLOW_GP30_SEQ_ERROR": {"id": 3871},
|
||||
"ERROR_GENESISFLOW_VALUE_SEALED": {"id": 3872},
|
||||
"ERROR_GENESISFLOW_IN_TEST_MODE": {"id": 3873},
|
||||
"ERROR_GENESISFLOW_UNKNOWN_STATE": {"id": 3874},
|
||||
"ERROR_GENESISFLOW_DISPLAY_INIT_SUCCEEDED": {"id": 3875},
|
||||
"ERROR_GENESISFLOW_DISPLAY_INIT_FAILED": {"id": 3876},
|
||||
"ERROR_GENESISFLOW_GP30_INIT_FAILED": {"id": 3877},
|
||||
"ERROR_GENESISFLOW_START_TIMER_SUCCEEDED": {"id": 3878},
|
||||
"ERROR_GENESISFLOW_START_TIMER_FAILED": {"id": 3879},
|
||||
"ERROR_GENESISFLOW_VOLUME_STORE_FAILED": {"id": 3880},
|
||||
"ERROR_GENESISFLOW_EMPTY_PIPE": {"id": 3881},
|
||||
"ERROR_GENESISFLOW_PARAMETER_ERROR": {"id": 3882},
|
||||
"ERROR_GENESISFLOW_GP30_INTERNAL_ERROR": {"id": 3883},
|
||||
"ERROR_GENESISFLOW_GLASS_TOO_SHORT": {"id": 3884},
|
||||
"ERROR_GENESISFLOW_STORE_CAL_FAILED": {"id": 3885},
|
||||
"ERROR_GENESISFLOW_STORE_CONF_FAILED": {"id": 3886},
|
||||
"ERROR_GENESISFLOW_MODE_CHANGE": {"id": 3887},
|
||||
"ERROR_GENESISFLOW_BAD_POW10": {"id": 3888},
|
||||
"ERROR_GENESISFLOW_BAD_DECIMAL_SEPARATOR": {"id": 3889},
|
||||
"ERROR_GENESISFLOW_BAD_UNITS": {"id": 3890},
|
||||
"ERROR_GENESISFLOW_BAD_ICONS": {"id": 3891},
|
||||
"ERROR_GENESISFLOW_BAD_THOUSAND_SEPARATOR": {"id": 3892},
|
||||
"ERROR_GENESISFLOW_NEW_LOCALE_REJECTED": {"id": 3893},
|
||||
"ERROR_GENESISFLOW_SET_ACCUMULATORS": {"id": 3894},
|
||||
"ERROR_GENESISFLOW_SEAL_OPENED": {"id": 3895},
|
||||
"ERROR_GENESISFLOW_CALIBRATION_RECALL_INCOMPLETE": {"id": 3896},
|
||||
"ERROR_METROLOGYASST_BAD_CONFIG": {"id": 4608},
|
||||
"ERROR_METROLOGYASST_DID_NOT_STORE": {"id": 4609},
|
||||
"ERROR_METROLOGYASST_PENDING_STORE": {"id": 4610},
|
||||
"ERROR_IRDA_BAD_CONFIG": {"id": 5120},
|
||||
"ERROR_IRDA_BAD_LENGTH": {"id": 5121},
|
||||
"ERROR_NA2WALARMS_SENSOR_INVALID": {"id": 5888},
|
||||
"ERROR_NA2WALARMS_UNKNOWN_PARAMETER": {"id": 5889},
|
||||
"ERROR_NA2WALARMS_ALARM_INVALID": {"id": 5890},
|
||||
"ERROR_NA2WALARMS_UNIMPLEMENTED": {"id": 5891},
|
||||
"ERROR_NA2WALARMS_UNCONFIGURED": {"id": 5892},
|
||||
"ERROR_NA2WALARMS_CONFIG_INVALID": {"id": 5893},
|
||||
"ERROR_NA2WALARMS_NO_LATEST": {"id": 5894},
|
||||
"ERROR_NA2WALARMS_FIXED_TYPE": {"id": 5895},
|
||||
"ERROR_NA2WALARMS_PREDEF_SET": {"id": 5896},
|
||||
"ERROR_NA2WALARMS_USERDEF_VOLUME_SET": {"id": 5897},
|
||||
"ERROR_NA2WALARMS_USERDEF_TEMPERATURE_SET": {"id": 5898},
|
||||
"ERROR_NA2WALARMS_USERDEF_PRESSURE_SET": {"id": 5899},
|
||||
"ERROR_NA2WALARMS_PREDEF_CLEAR": {"id": 5900},
|
||||
"ERROR_NA2WALARMS_USERDEF_VOLUME_CLEAR": {"id": 5901},
|
||||
"ERROR_NA2WALARMS_USERDEF_TEMPERATURE_CLEAR": {"id": 5902},
|
||||
"ERROR_NA2WALARMS_USERDEF_PRESSURE_CLEAR": {"id": 5903}
|
||||
}
|
||||
1057
Common/.vs/config/applicationhost.config
Normal file
1057
Common/.vs/config/applicationhost.config
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Common/Common.VC.db
Normal file
BIN
Common/Common.VC.db
Normal file
Binary file not shown.
3978
Common/Common.sln
Normal file
3978
Common/Common.sln
Normal file
File diff suppressed because it is too large
Load Diff
25
Common/Common.sln.DotSettings
Normal file
25
Common/Common.sln.DotSettings
Normal file
@ -0,0 +1,25 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=accu/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Applic/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=binfile/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=BUGFIX/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Calib/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=CCITT/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=CONFIGEXCHANGE/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Consts/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cordonel/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=dispached/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=FFFF/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=GENESISFLOW/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=GENSISFLOW/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Irda/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=licence/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Metrology/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=METROLOGYASST/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCBID/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=prot/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=RFID/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=SENSUSRADIO/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Thermo/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Uart/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
32
Common/Common.sln.DotSettings.user
Normal file
32
Common/Common.sln.DotSettings.user
Normal file
@ -0,0 +1,32 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Int64 x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/AutoNamingCompletedVersion/@EntryValue">2</s:Int64>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNamingAutoDetectionCompleted/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNotificationDisabled/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">True</s:Boolean>
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=EnumMember/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Interfaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Locals/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Method/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Parameters/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="s_" Suffix="" Style="AaBb" /></Policy></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Property/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PublicFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=StaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=TypesAndNamespaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="D:\Projekte\SENSUS_tfs_workspaces\WorkBenchV2\Main\Common\Ui\IrdaFunctionalTestApp\bin\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.dll" />
|
||||
</AssemblyExplorer></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/Hierarchy/EntityFrameworkOptions/IsAlreadyNotifiedAboutEntityFramework/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/Profiling/Configurations/=0/@EntryIndexedValue"><data><HostParameters type="LocalHostParameters" /><Argument type="StandaloneArgument"><Arguments IsNull="False"></Arguments><FileName>D:\Workspace\WorkBenchV2\Main\ZeroFlowTool\bin\Debug\GenesisDisplayTool.exe</FileName><WorkingDirectory>D:\Workspace\WorkBenchV2\Main\ZeroFlowTool\bin\Debug</WorkingDirectory><Scope><ProcessFilters /></Scope></Argument><Info type="PerformanceInfo"><MeasureType>Sampling</MeasureType><MeterKind>Rdtsc</MeterKind><InjectInfo><SymbolSearch><SearchPaths /></SymbolSearch><Scope><PatternFilters /><DenyAttributeFilters /></Scope></InjectInfo></Info><CoreOptions type="CoreOptions"><CoreTempPath IsNull="False"></CoreTempPath><RemoteEndPoint IsNull="False"></RemoteEndPoint><AdditionalEnvironmentVariables /></CoreOptions><HostOptions type="HostOptions"><HostTempPath IsNull="False"></HostTempPath></HostOptions></data></s:String>
|
||||
<s:String x:Key="/Default/Profiling/Configurations/=1/@EntryIndexedValue"><data><HostParameters type="LocalHostParameters" /><Argument type="StandaloneArgument"><Arguments IsNull="False"></Arguments><FileName IsNull="False"></FileName><WorkingDirectory IsNull="False"></WorkingDirectory><Scope><ProcessFilters /></Scope></Argument><Info type="PerformanceInfo"><MeasureType>TracingInject</MeasureType><MeterKind>Rdtsc</MeterKind><InjectInfo><SymbolSearch><SearchPaths /></SymbolSearch><Scope><PatternFilters><Item /></PatternFilters><DenyAttributeFilters /></Scope></InjectInfo></Info><CoreOptions type="CoreOptions"><CoreTempPath IsNull="False"></CoreTempPath><RemoteEndPoint IsNull="False"></RemoteEndPoint><AdditionalEnvironmentVariables /></CoreOptions><HostOptions type="HostOptions"><HostTempPath IsNull="False"></HostTempPath></HostOptions></data></s:String>
|
||||
<s:String x:Key="/Default/Profiling/Configurations/=2/@EntryIndexedValue"><data><HostParameters type="LocalHostParameters" /><Argument type="StandaloneArgument"><Arguments IsNull="False"></Arguments><FileName IsNull="False"></FileName><WorkingDirectory IsNull="False"></WorkingDirectory><Scope><ProcessFilters /></Scope></Argument><Info type="TimelineInfo" /><CoreOptions type="CoreOptions"><CoreTempPath IsNull="False"></CoreTempPath><RemoteEndPoint IsNull="False"></RemoteEndPoint><AdditionalEnvironmentVariables /></CoreOptions><HostOptions type="HostOptions"><HostTempPath IsNull="False"></HostTempPath><ReprofileDisableReason>LaunchedByReSharperUnitTestRunner</ReprofileDisableReason></HostOptions></data></s:String>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ZEROFLOW/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/VsIntegrationViewOptions/ShowCharts/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/VsIntegrationViewOptions/ShowPlainList/@EntryValue">False</s:Boolean>
|
||||
|
||||
</wpf:ResourceDictionary>
|
||||
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9EB1F659-6F73-4F65-BCAB-4114FD94F5FC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xylem.Common.CommonCore.Configuration</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.CommonCore.Configuration</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '_MANUAL_CONTROL|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\_MANUAL_CONTROL\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\.shared\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ServiceUrls.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
34
Common/CommonCore.Configuration/Properties/AssemblyInfo.cs
Normal file
34
Common/CommonCore.Configuration/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CommonCore.Configuration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
//[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CommonCore.Configuration")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(true)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9eb1f659-6f73-4f65-bcab-4114fd94f5fc")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
614
Common/CommonCore.Configuration/ServiceUrls.cs
Normal file
614
Common/CommonCore.Configuration/ServiceUrls.cs
Normal file
@ -0,0 +1,614 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Configuration
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Urls for data base accesses
|
||||
/// </summary>
|
||||
public static class ServiceUrls
|
||||
{
|
||||
private const String DefaultGetPcbIdsFromSafeServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetPcbIdsFromSafe?ContainerDbId=";
|
||||
|
||||
private const String DefaultAddPcbIdsToSafeServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/AddPcbIdsToSafe?ContainerDbId=";
|
||||
|
||||
private const String DefaultDownloadFilesPartsServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/FileUpToDate/GetFileParts?ParentFileId=";
|
||||
|
||||
private const String DefaultListAllFwPackagesServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=1";
|
||||
|
||||
private const String DefaultListAllFwUpdateSafesServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=4";
|
||||
|
||||
private const String DefaultSetCordonelAppVersionServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/ProccesState/SetCordonelProgress?PcbId=";
|
||||
|
||||
private const String DefaultGetCordonelAppVersionServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/ProccesState/GetCordonelAppVersion?PcbId=";
|
||||
|
||||
private const String DefaultListAllCordonelCustomersWithFilterServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Order/GetCordonelCustomers?FilterName=";
|
||||
|
||||
private const String DefaultListAllCordonelCustomerOrdersServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Order/GetCustomersCordonelOrders?CustomerNumber=";
|
||||
|
||||
private const String DefaultListAllOrderCordonelsServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Order/GetCordonelOrderList?CustomerOrderNumber=";
|
||||
|
||||
private const String DefaultDownloadFwUpdateSafeServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetFWUpdateSafeContainerContent?SafeContainerId=";
|
||||
|
||||
private const String DefaultListAllFwUpdateSafesForUserServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetFWUpdateSafeContainers?UserId=";
|
||||
|
||||
private const String DefaultFileContentDownloadServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetFileContent?FileId=";
|
||||
|
||||
private const String DefaultFwUpdateReportUploadServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/PostFWUpdateReportFile";
|
||||
|
||||
private const String DefaultFwUpdateReportDownloadServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetFWUpdateReportFile?";
|
||||
|
||||
private const String DefaultFwUpdateSafeContainerUploadServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/PostFWUpdateSafeOdd";
|
||||
|
||||
private const String DefaultEditFwUpdateUserValidityServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/EditUserValidity?Id=";
|
||||
|
||||
private const String DefaultRefreshFwUpdateUsersHardwareIdServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/RefreshUsersHardwareId?Id=";
|
||||
|
||||
private const String DefaultRefreshFwUpdateUsersPasswordHashServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/RefreshUsersPasswordHash?Id=";
|
||||
|
||||
private const String DefaultCreateNewFwUpdateUserServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/AddNewUser?";
|
||||
|
||||
private const String DefaultListAllFwUpdateUsersServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetUserList";
|
||||
|
||||
private const String DefaultListAllFwUpdateBuilderOperatorsServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetAllBuilderOperator";
|
||||
|
||||
private const String DefaultGetFwUpdateUserByIdServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetUserList?Id=";
|
||||
|
||||
private const String DefaultGetFwUpdateUserByLoginNameServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/GetUserList?LogInName=";
|
||||
|
||||
private const String DefaultRegisterWatchServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/RegisterWatch/";
|
||||
|
||||
private const String DefaultGenesisGetOrderNumberServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Password/ordernumber?PcbId=";
|
||||
|
||||
private const String DefaultGenesisGetRadioAddressServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Password/radioadress?PcbId=";
|
||||
|
||||
private const String DefaultGenesisGetKeySetIdServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Password/getkeysetid?PcbId=";
|
||||
|
||||
private const String DefaultGenesisGetPasswordServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Password/GetPassword?PcbId=";
|
||||
|
||||
private const String DefaultGenesisSetPasswordServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Password/setpassword?PcbId=";
|
||||
|
||||
private const String DefaultGenesisPasswordContainerServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Password/GetPasswordHashFileContent?PcbId=";
|
||||
|
||||
private const String DefaultMarriageServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/Marriage/";
|
||||
|
||||
private const String DefaultMeterProcessStateUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/ProccesState/";
|
||||
|
||||
private const String DefaultGenesisFinalCheckServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/FinalCheck/";
|
||||
|
||||
private const String DefaultGenesisRadioCheckServiceUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/RadioCheck/";
|
||||
|
||||
private const String DefaultGetSoftwareStartUpAccessUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/SoftwareAccess/GetVersionIsValid";
|
||||
|
||||
private const String DefaultSetSoftwareLicenseUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/SoftwareAccess/SetVersionIsValid?Program=";
|
||||
|
||||
private const String DefaultGetSoftwareLicenseUrl =
|
||||
"http://10.49.40.25/MeterProcessState/api/SoftwareAccess/GetCurrentVersion?Program=";
|
||||
|
||||
private const String DefaultGenesisCalibrationResult =
|
||||
"http://10.49.40.25/MeterProcessState/api/GenesisMeter/PostCalibrationResult";
|
||||
|
||||
private const String DefaultGenesisMeter =
|
||||
"http://10.49.40.25/MeterProcessState/api/GenesisMeter/";
|
||||
|
||||
private const String DefaultFileContentController =
|
||||
"http://10.49.40.25/MeterProcessState/api/FileUpToDate/";
|
||||
|
||||
private const String DefaultKeyServerCustom =
|
||||
"https://nodes.sms-esaap.com/keygenproxy/api/v3/custom/";
|
||||
|
||||
private const String DefaultMeterInfoForTestBench =
|
||||
"http://10.49.40.25/MeterProcessState/api/TestBench/GetMeterInfoForTestBench?PcbID=";
|
||||
|
||||
|
||||
|
||||
|
||||
//private const String DefaultGenesisGetOrderNumberServiceUrl =
|
||||
// "http://localhost:56011/api/Password/ordernumber?PcbId=";
|
||||
|
||||
//private const String DefaultGenesisGetRadioAdressServiceUrl =
|
||||
// "http://localhost:56011/api/Password/radioadress?PcbId=";
|
||||
|
||||
//private const String DefaultGenesisGetKeySetIdServiceUrl =
|
||||
// "http://localhost:56011/api/Password/getkeysetid?PcbId=";
|
||||
|
||||
//private const String DefaultGenesisGetPasswordServiceUrl =
|
||||
// "http://localhost:56011/api/Password/GetPassword?PcbId=";
|
||||
|
||||
//private const String DefaultGenesisSetPasswordServiceUrl =
|
||||
// "http://localhost:56011/api/Password/setpassword?PcbId=";
|
||||
|
||||
//private const String DefaultGenesisPasswordContainerServiceUrl =
|
||||
// "http://localhost:56011/api/Password/GetPasswordHashFileContent?PcbId=";
|
||||
|
||||
//private const String DefaultMarriageServiceUrl =
|
||||
// "http://localhost:56011/api/Marriage/";
|
||||
|
||||
//private const String DefaultMeterProcessStateUrl =
|
||||
// "http://localhost:56011/api/ProccesState/";
|
||||
|
||||
|
||||
//private const String DefaultGenesisFinalCheckServiceUrl =
|
||||
// "http://localhost:56011/api/FinalCheck/";
|
||||
|
||||
|
||||
//private const String DefaultGenesisRadioCheckServiceUrl =
|
||||
// "http://localhost:56011/api/RadioCheck/";
|
||||
|
||||
//private const String DefaultGetSoftwareStartUpAccessUrl =
|
||||
// "http://localhost:56011/api/SoftwareAccess/GetVersionIsValid";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// List all PCB IDs from a safe. As the safe may be deleted, this information is still accessible.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String MeterInfoForTestBench()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["MeterInfoForTestBenchServiceUrl"] ??
|
||||
DefaultMeterInfoForTestBench;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all PCB IDs from a safe. As the safe may be deleted, this information is still accessible.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllPcbIdsFromSafe()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GetPcbIdsFromSafeServiceUrl"] ??
|
||||
DefaultGetPcbIdsFromSafeServiceUrl;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add PCB IDs to a safe. As the safe may be deleted, this information is still accessible.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String AddPcbIdsToSafeServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["AddPcbIdsToSafeServiceUrl"] ??
|
||||
DefaultAddPcbIdsToSafeServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all Cordonel FW package.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String DownloadFileParts()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["DownloadFilePartsServiceUrl"] ??
|
||||
DefaultDownloadFilesPartsServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update Safe container list for specific user
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllFwUpdateSafesForUserServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllFwUpdateSafesForUserServiceUrl"] ??
|
||||
DefaultListAllFwUpdateSafesForUserServiceUrl;
|
||||
}
|
||||
/// <summary>
|
||||
/// FW-Update Safe container
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String DownloadFwUpdateSafeServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["DownloadFwUpdateSafeServiceUrl"] ??
|
||||
DefaultDownloadFwUpdateSafeServiceUrl;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get all Cordonel safes description files.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllFwUpdateSafes()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllFwUpdateSafesServiceUrl"] ??
|
||||
DefaultListAllFwUpdateSafesServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all Cordonel FW package description files.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllFwPackages()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllFwPackagesServiceUrl"] ??
|
||||
DefaultListAllFwPackagesServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set all applications versions installed to a specific Cordonel.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String UploadCordonelAppVersionServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["SetCordonelAppVersionServiceUrl"] ??
|
||||
DefaultSetCordonelAppVersionServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all applications versions installed to a specific Cordonel.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String DownloadCordonelAppVersionServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GetCordonelAppVersionServiceUrl"] ??
|
||||
DefaultGetCordonelAppVersionServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all Cordonel customers with search filter (e.g. %sus% where % is a filter for 0 to multiple
|
||||
/// alphanumeric characters) to get the customer names and the order numbers.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllCordonelCustomersWithFilterServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllCordonelCustomersWithFilterServiceUrl"] ??
|
||||
DefaultListAllCordonelCustomersWithFilterServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all Cordonel orders of a selected customer
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllCordonelCustomerOrdersServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllCordonelCustomerOrdersServiceUrl"] ??
|
||||
DefaultListAllCordonelCustomerOrdersServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all Cordonels of a specific order number to get the customer serial number and the Pcb ID.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllOrderCordonelsServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllOrderCordonelsServiceUrl"] ??
|
||||
DefaultListAllOrderCordonelsServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register watch service
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String RegisterWatchServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["RegisterWatchServiceUrl"] ??
|
||||
DefaultRegisterWatchServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// File content download
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String DownloadFileContentServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["FileContentDownloadServiceUrl"] ??
|
||||
DefaultFileContentDownloadServiceUrl;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update report doanload as string
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String DownloadFwUpdateReportServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["FwUpdateReportDownloadServiceUrl"] ??
|
||||
DefaultFwUpdateReportDownloadServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update report upload as string
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String UploadFwUpdateReportServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["FwUpdateReportUploadServiceUrl"] ??
|
||||
DefaultFwUpdateReportUploadServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update Safe container upload
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String UploadFwUpdateSafeContainerServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["FwUpdateSafeContainerUploadServiceUrl"] ??
|
||||
DefaultFwUpdateSafeContainerUploadServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update user validation url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String EditFwUpdateUserValidityServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["EditFwUpdateUserValidityServiceUrl"] ??
|
||||
DefaultEditFwUpdateUserValidityServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update user HW-Id url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String RefreshFwUpdateUsersHardwareIdServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["RefreshFwUpdateUsersHardwareIdServiceUrl"] ??
|
||||
DefaultRefreshFwUpdateUsersHardwareIdServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update user password hash for encryption url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String RefreshFwUpdateUsersPasswordHashServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["RefreshFwUpdateUsersPasswordHashServiceUrl"] ??
|
||||
DefaultRefreshFwUpdateUsersPasswordHashServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update create new user url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String CreateNewFwUpdateUserServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["CreateNewFwUpdateUserServiceUrl"] ??
|
||||
DefaultCreateNewFwUpdateUserServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update list all users url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllFwUpdateUsersServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllFwUpdateUsersServiceUrl"] ??
|
||||
DefaultListAllFwUpdateUsersServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update list all users url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String ListAllFwUpdateBuilderOperatorsServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["ListAllFwUpdateBuilderOperatorsServiceUrl"] ??
|
||||
DefaultListAllFwUpdateBuilderOperatorsServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update get user information by user Id url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GetFwUpdateUserByIdServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GetFwUpdateUserByIdServiceUrl"] ??
|
||||
DefaultGetFwUpdateUserByIdServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FW-Update get user information by user login name url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GetFwUpdateUserByLoginNameServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GetFwUpdateUserByLoginNameServiceUrl"] ??
|
||||
DefaultGetFwUpdateUserByLoginNameServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis check radio parameter url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisRadioCheckServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisRadioCheckServiceUrl"] ??
|
||||
DefaultGenesisRadioCheckServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis radio parameter get url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisFinalCheckServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisFinalCheckServiceUrl"] ??
|
||||
DefaultGenesisFinalCheckServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marriage service url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String MarriageServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["MarriageServiceUrl"] ??
|
||||
DefaultMarriageServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis process status url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String MeterProcessStateUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["MeterProcessStateUrl"] ??
|
||||
DefaultMeterProcessStateUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis get radio address url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisGetRadioAddressServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisGetRadioAddressServiceUrl"] ??
|
||||
DefaultGenesisGetRadioAddressServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis get key set id url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisGetOrderNumberServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisGetOrderNumberServiceUrl"] ??
|
||||
DefaultGenesisGetOrderNumberServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis get key set id url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisGetKeySetIdServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisGetKeySetIdServiceUrl"] ??
|
||||
DefaultGenesisGetKeySetIdServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis get password url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisGetPasswordServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisGetPasswordServiceUrl"] ??
|
||||
DefaultGenesisGetPasswordServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis get password url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisGetPasswordContainerServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisPasswordContainerServiceUrl"] ??
|
||||
DefaultGenesisPasswordContainerServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis set password url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisSetPasswordServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisSetPasswordServiceUrl"] ??
|
||||
DefaultGenesisSetPasswordServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the SW license
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String SetSoftwareLicenseUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["SetSoftwareLicenseUrl"] ??
|
||||
DefaultSetSoftwareLicenseUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the SW license
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GetSoftwareLicenseUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GetSoftwareLicenseUrl"] ??
|
||||
DefaultGetSoftwareLicenseUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check the SW license with a given name and version
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GetSoftwareStartUpAccessUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GetSoftwareStartUpAccessUrl"] ??
|
||||
DefaultGetSoftwareStartUpAccessUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Post Genesis calibration results
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String PostGenesisCalibrationResultUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisCalibrationResult"] ??
|
||||
DefaultGenesisCalibrationResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Post Genesis calibration results
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String FileContentControllerUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["DefaultFileContentController"] ??
|
||||
DefaultFileContentController;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Root for all function regarding the BSI Key generation service
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String KeyServerCustom()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["DefaultKeyServerCustom"] ??
|
||||
DefaultKeyServerCustom;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Root for all function regarding the meter itself
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisMeter()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisMeter"] ??
|
||||
DefaultGenesisMeter;
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Common/CommonCore/CommonCore.csproj
Normal file
63
Common/CommonCore/CommonCore.csproj
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xylem.Common.CommonCore</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.CommonCore</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>false</Deterministic>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '_MANUAL_CONTROL|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\_MANUAL_CONTROL\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\.shared\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Consts\ProgramConfig.cs" />
|
||||
<Compile Include="Consts\SyncMarkRecord.cs" />
|
||||
<Compile Include="Exceptions\DB\PcbIdNotException.cs" />
|
||||
<Compile Include="Exceptions\ICommonException.cs" />
|
||||
<Compile Include="Exceptions\DB\NoKeyException.cs" />
|
||||
<Compile Include="Exceptions\WaterMeter\LvlNotSupportedException.cs" />
|
||||
<Compile Include="Exceptions\Web\TokenRequiredException.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
43
Common/CommonCore/Consts/ProgramConfig.cs
Normal file
43
Common/CommonCore/Consts/ProgramConfig.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Consts
|
||||
{
|
||||
public static class ProgramConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of register definition file
|
||||
/// </summary>
|
||||
public const String RegisterDefinitionFileName = "configuration.json";
|
||||
|
||||
/// <summary>
|
||||
/// Name of serial configuration file
|
||||
/// </summary>
|
||||
public const String SerialConfigFileName = "SerialConfig.json";
|
||||
|
||||
/// <summary>
|
||||
/// Name for NLog config
|
||||
/// </summary>
|
||||
public const String NlogConfig = "NlogConfig.xml";
|
||||
|
||||
/// <summary>
|
||||
/// Name for meter config
|
||||
/// </summary>
|
||||
public const String ConfigFileName = "MeterConfig.json";
|
||||
|
||||
/// <summary>
|
||||
/// Name for offline information e.g. Passwords
|
||||
/// </summary>
|
||||
public const String OfflineInfoFile = "OfflineFile.json";
|
||||
|
||||
/// <summary>
|
||||
/// Path for data logger.
|
||||
/// </summary>
|
||||
public const String BaseLoggingPath = "C:\\GenesisLog\\";
|
||||
|
||||
/// <summary>
|
||||
/// Sub folder for genesis contents.
|
||||
/// </summary>
|
||||
public const String GenesisBaseFolder = "Genesis\\";
|
||||
|
||||
}
|
||||
}
|
||||
47
Common/CommonCore/Consts/SyncMarkRecord.cs
Normal file
47
Common/CommonCore/Consts/SyncMarkRecord.cs
Normal file
@ -0,0 +1,47 @@
|
||||
namespace Xylem.Common.CommonCore.Consts
|
||||
{
|
||||
/// <summary>
|
||||
/// data marker for incoming record being used at serialComPort receive event
|
||||
/// to stamp a start/intermediate/end record for an accurate actual time,
|
||||
/// additionally being used to decide if decoding will be executed at !SkipDecoding
|
||||
/// to speed up processing time.
|
||||
/// </summary>
|
||||
public enum SyncMarkRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// not synchronized stream, avoid decoding of protocol, this is not needed
|
||||
/// </summary>
|
||||
SkipDecoding,
|
||||
|
||||
/// <summary>
|
||||
/// find start package and decode protocol
|
||||
/// </summary>
|
||||
SyncStart,
|
||||
|
||||
/// <summary>
|
||||
/// find end package and decode protocol
|
||||
/// </summary>
|
||||
SyncEnd,
|
||||
|
||||
/// <summary>
|
||||
/// decode intermediate package for internal update of measurement
|
||||
/// </summary>
|
||||
DecodeIntermediate,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// decode intermediate package for internal checkmesurement quality
|
||||
/// </summary>
|
||||
DecodeIntermediateQuality,
|
||||
|
||||
/// <summary>
|
||||
/// decode every package for logging, zero-flow etc.
|
||||
/// </summary>
|
||||
DecodeEveryPackage,
|
||||
|
||||
/// <summary>
|
||||
/// just flush buffer, will not mark any package
|
||||
/// </summary>
|
||||
FlushBuffer
|
||||
}
|
||||
}
|
||||
41
Common/CommonCore/Exceptions/DB/NoKeyException.cs
Normal file
41
Common/CommonCore/Exceptions/DB/NoKeyException.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Exceptions.Db
|
||||
{
|
||||
public class NoKeyStoredException : Exception, ICommonException
|
||||
{
|
||||
Guid? LCode = null;
|
||||
public NoKeyStoredException(Guid? Location = null)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
public NoKeyStoredException(string message, Guid? Location = null)
|
||||
: base(message)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public NoKeyStoredException(string message, Exception inner, Guid? Location = null)
|
||||
: base(message, inner)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public string GetHelpText()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"Report this to a developer or database admin.");
|
||||
sb.AppendLine($"Something went wrong while store the keyset on BSI.");
|
||||
|
||||
|
||||
if (LCode.HasValue)
|
||||
{
|
||||
sb.AppendLine($"LCode:{LCode.Value}");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Common/CommonCore/Exceptions/DB/PcbIdNotException.cs
Normal file
41
Common/CommonCore/Exceptions/DB/PcbIdNotException.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Exceptions.Db
|
||||
{
|
||||
public class PcbIdNotException : Exception, ICommonException
|
||||
{
|
||||
Guid? LCode = null;
|
||||
public PcbIdNotException(Guid? Location = null)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
public PcbIdNotException(string message, Guid? Location = null)
|
||||
: base(message)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public PcbIdNotException(string message, Exception inner, Guid? Location = null)
|
||||
: base(message, inner)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public string GetHelpText()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"1. Retry your request.");
|
||||
sb.AppendLine($"2. Check if you Pcb was produced by LAA Operations.");
|
||||
sb.AppendLine($"3. Ask the source of you pcb for the password and the pcbid and let it regiuster at LAA Operations.");
|
||||
|
||||
if (LCode.HasValue)
|
||||
{
|
||||
sb.AppendLine($"LCode:{LCode.Value}");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Common/CommonCore/Exceptions/ICommonException.cs
Normal file
12
Common/CommonCore/Exceptions/ICommonException.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Exceptions
|
||||
{
|
||||
interface ICommonException
|
||||
{
|
||||
string GetHelpText();
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Exceptions.WaterMeter
|
||||
{
|
||||
public class LvlNotSupportedException : Exception, ICommonException
|
||||
{
|
||||
Guid? LCode = null;
|
||||
public LvlNotSupportedException(Guid? Location = null)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
public LvlNotSupportedException(string message, Guid? Location = null)
|
||||
: base(message)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public LvlNotSupportedException(string message, Exception inner, Guid? Location = null)
|
||||
: base(message, inner)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public string GetHelpText()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"You can not login at this lvl if the meter is locked.");
|
||||
sb.AppendLine($"Try to use an other level or unlock the meter.");
|
||||
if (LCode.HasValue)
|
||||
{
|
||||
sb.AppendLine($"LCode:{LCode.Value}");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Common/CommonCore/Exceptions/Web/TokenRequiredException.cs
Normal file
40
Common/CommonCore/Exceptions/Web/TokenRequiredException.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Exceptions
|
||||
{
|
||||
public class TokenRequiredException : Exception, ICommonException
|
||||
{
|
||||
Guid? LCode = null;
|
||||
public TokenRequiredException(Guid? Location = null)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
public TokenRequiredException(string message, Guid? Location = null)
|
||||
: base(message)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public TokenRequiredException(string message, Exception inner, Guid? Location = null)
|
||||
: base(message, inner)
|
||||
{
|
||||
LCode = Location;
|
||||
}
|
||||
|
||||
public string GetHelpText()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"Token is required for locked meter.");
|
||||
sb.AppendLine($"Add token too your local key store.");
|
||||
|
||||
if (LCode.HasValue)
|
||||
{
|
||||
sb.AppendLine($"LCode:{LCode.Value}");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Common/CommonCore/Properties/AssemblyInfo.cs
Normal file
8
Common/CommonCore/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Xylem.Common.CommonCore")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: ComVisible(true)]
|
||||
[assembly: Guid("D9E161CA-9D23-42FD-B012-B055924EAABE")]
|
||||
|
||||
36
Common/CommonCore/ThreadWatcher/Properties/AssemblyInfo.cs
Normal file
36
Common/CommonCore/ThreadWatcher/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Xylem.Common.CommonCore.ThreadWatcher")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CommonCore.ThreadWatcher")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(true)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("94ca71f3-c5d7-4ec6-ba47-fa8eea3c9406")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
62
Common/CommonCore/ThreadWatcher/ThreadWatcher.cs
Normal file
62
Common/CommonCore/ThreadWatcher/ThreadWatcher.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Xylem.Common.CommonCore.ThreadWatcher
|
||||
{
|
||||
|
||||
public sealed class TaskWatcher
|
||||
{
|
||||
#region Singleton
|
||||
private static readonly Lazy<TaskWatcher>
|
||||
lazy =
|
||||
new Lazy<TaskWatcher>
|
||||
(() => new TaskWatcher());
|
||||
|
||||
public static TaskWatcher Instance { get { return lazy.Value; } }
|
||||
#endregion
|
||||
private TaskWatcher()
|
||||
{
|
||||
tasks = new ConcurrentDictionary<Guid, Task>();
|
||||
}
|
||||
|
||||
|
||||
private ConcurrentDictionary<Guid, Task> tasks;
|
||||
public void Add(Task t)
|
||||
{
|
||||
tasks.TryAdd(Guid.NewGuid(), t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public sealed class ThreadWatcher
|
||||
{
|
||||
#region Singleton
|
||||
private static readonly Lazy<ThreadWatcher>
|
||||
lazy =
|
||||
new Lazy<ThreadWatcher>
|
||||
(() => new ThreadWatcher());
|
||||
|
||||
public static ThreadWatcher Instance { get { return lazy.Value; } }
|
||||
#endregion
|
||||
private ThreadWatcher()
|
||||
{
|
||||
threads = new ConcurrentDictionary<Guid, Thread>();
|
||||
tasks = new ConcurrentDictionary<Guid, Task>();
|
||||
}
|
||||
|
||||
private ConcurrentDictionary<Guid,Thread> threads;
|
||||
|
||||
|
||||
private ConcurrentDictionary<Guid, Task> tasks;
|
||||
public void Start(Thread t)
|
||||
{
|
||||
|
||||
t.Start();
|
||||
|
||||
threads.TryAdd(Guid.NewGuid(), t);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
59
Common/CommonCore/ThreadWatcher/ThreadWatcher.csproj
Normal file
59
Common/CommonCore/ThreadWatcher/ThreadWatcher.csproj
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{94CA71F3-C5D7-4EC6-BA47-FA8EEA3C9406}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xylem.Common.CommonCore.ThreadWatcher</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.CommonCore.ThreadWatcher</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ThreadWatcher.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
20
Common/CordonelAssemblyLine/App.config
Normal file
20
Common/CordonelAssemblyLine/App.config
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
|
||||
<appSettings>
|
||||
<add key="PickingSlot" value="1"/>
|
||||
<add key="PickingBarcode" value="COM20"/>
|
||||
|
||||
<add key="LeakSlot" value="2"/>
|
||||
<add key="LeakStationId" value="1"/>
|
||||
|
||||
<add key="MarriageSlot" value="4"/>
|
||||
<add key="MarriageBarcode" value="COM21"/>
|
||||
|
||||
|
||||
</appSettings>
|
||||
|
||||
</configuration>
|
||||
9
Common/CordonelAssemblyLine/App.xaml
Normal file
9
Common/CordonelAssemblyLine/App.xaml
Normal file
@ -0,0 +1,9 @@
|
||||
<Application x:Class="CordonelAssemblyLine.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:CordonelAssemblyLine"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
17
Common/CordonelAssemblyLine/App.xaml.cs
Normal file
17
Common/CordonelAssemblyLine/App.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace CordonelAssemblyLine
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
59
Common/CordonelAssemblyLine/Converter/MathConverter.cs
Normal file
59
Common/CordonelAssemblyLine/Converter/MathConverter.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace CordonelAssemblyLine.Converter
|
||||
{
|
||||
public class MathConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
|
||||
return double.Parse((string)value, CultureInfo.CurrentUICulture);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
string format = "";
|
||||
string strValue = (string)value;
|
||||
strValue = strValue.Replace("x", "*").Replace("X", "*");
|
||||
if (strValue.ToUpper().Contains("E"))
|
||||
{
|
||||
|
||||
return double.Parse(strValue, CultureInfo.InvariantCulture).ToString(format);
|
||||
//2E-07
|
||||
}
|
||||
else if (strValue.Contains("^-") && strValue.Contains("*"))
|
||||
{
|
||||
var split = strValue.Split('*');
|
||||
var mulit = double.Parse(split.First());
|
||||
var powNumber = double.Parse(split.Last().Split('^').First());
|
||||
var powBy = double.Parse(split.Last().Split('^').Last());
|
||||
|
||||
|
||||
return (mulit * Math.Pow(powNumber, powBy)).ToString(format);
|
||||
//2*10^-3
|
||||
}
|
||||
else if (strValue.Contains("-") && strValue.Contains("*"))
|
||||
{
|
||||
|
||||
var split = strValue.Split('*');
|
||||
var mulit = double.Parse(split.First());
|
||||
var powNumber = double.Parse(split.Last().Split('-').First());
|
||||
var powBy = double.Parse(split.Last().Split('-').Last());
|
||||
powBy = powBy * -1;
|
||||
return (mulit * Math.Pow(powNumber, powBy)).ToString(format);
|
||||
|
||||
}
|
||||
else if (strValue.Contains("0,0"))
|
||||
{
|
||||
return double.Parse(strValue, CultureInfo.CurrentUICulture).ToString(format);
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
204
Common/CordonelAssemblyLine/CordonelAssemblyLine.csproj
Normal file
204
Common/CordonelAssemblyLine/CordonelAssemblyLine.csproj
Normal file
@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0FFBCA6C-E828-4196-B0A8-988DEA3E077F}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>CordonelAssemblyLine</RootNamespace>
|
||||
<AssemblyName>CordonelAssemblyLine</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Converter\MathConverter.cs" />
|
||||
<Compile Include="Data\PressureResultDataNotifyable.cs" />
|
||||
<Compile Include="Event\StringArgs.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Leak.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Marriage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Picking.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Leak.xaml.cs">
|
||||
<DependentUpon>Leak.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Marriage.xaml.cs">
|
||||
<DependentUpon>Marriage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\MarriageViewModel.cs" />
|
||||
<Compile Include="Model\LeakViewModel.cs" />
|
||||
<Compile Include="Model\PickingModel.cs" />
|
||||
<Compile Include="Picking.xaml.cs">
|
||||
<DependentUpon>Picking.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonCore.Configuration\CommonCore.Configuration.csproj">
|
||||
<Project>{9EB1F659-6F73-4F65-BCAB-4114FD94F5FC}</Project>
|
||||
<Name>CommonCore.Configuration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\Applications\Applications.csproj">
|
||||
<Project>{315E94B8-B82F-4B25-B5BD-297DF3BC1D54}</Project>
|
||||
<Name>Applications</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
|
||||
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
||||
<Name>GenesisCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\Registers\Registers.csproj">
|
||||
<Project>{F4AAF7E6-7333-4284-B735-E32DEB076C64}</Project>
|
||||
<Name>Registers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\WaterMeterCore\WaterMeterCore.csproj">
|
||||
<Project>{8203ABB8-38E5-472E-A742-33F38B7A74A6}</Project>
|
||||
<Name>WaterMeterCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\WaterMeterCore\WaterMeterRegisters\WaterMeterRegisters.csproj">
|
||||
<Project>{26AFCF1E-1287-48B8-A506-32B1E8A0DD0E}</Project>
|
||||
<Name>WaterMeterRegisters</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logic.PrdoctionToProductMapper\Logic.ProductionToProductMapper.csproj">
|
||||
<Project>{D0C859D9-D55E-4E85-AC50-0FF31B1CE50D}</Project>
|
||||
<Name>Logic.ProductionToProductMapper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logic\ProductionOrderCore\ProductionOrderCore.csproj">
|
||||
<Project>{6D2777BB-7A88-466D-A49B-3266F9BF0160}</Project>
|
||||
<Name>ProductionOrderCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
||||
<Project>{A33E3C6D-EAAE-4A20-A0EE-F9E6922FD029}</Project>
|
||||
<Name>SoftwareAccessHelper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Ui.ProductionControls\Ui.ProductionControls.csproj">
|
||||
<Project>{70bf5094-0f03-41fc-b0bd-befcf51686c9}</Project>
|
||||
<Name>Ui.ProductionControls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Utils\Logging\Logging.csproj">
|
||||
<Project>{4B88B0D3-E791-4774-9521-EABEACDC420E}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
161
Common/CordonelAssemblyLine/Data/PressureResultDataNotifyable.cs
Normal file
161
Common/CordonelAssemblyLine/Data/PressureResultDataNotifyable.cs
Normal file
@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
|
||||
namespace CordonelAssemblyLine.Data
|
||||
{
|
||||
public class PressureResultDataNotifyable : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public PressureResultDataNotifyable(PressureResultData baseData)
|
||||
{
|
||||
LeakRate = baseData.LeakRate;
|
||||
Passed = baseData.Passed;
|
||||
PcbId = baseData.PcbId;
|
||||
Remark = baseData.Remark;
|
||||
Rev = baseData.Rev;
|
||||
TesterName = baseData.TesterName;
|
||||
Testpoints = new ObservableCollection<PressureTestPoints>();
|
||||
baseData.Testpoints.ForEach(o => Testpoints.Add(o));
|
||||
TestPressure = baseData.TestPressure;
|
||||
}
|
||||
public PressureResultDataNotifyable()
|
||||
{
|
||||
|
||||
}
|
||||
public void InternalPropertyChanged(String propertyName = "")
|
||||
{
|
||||
NotifyPropertyChanged(propertyName);
|
||||
}
|
||||
|
||||
|
||||
public string PcbId;
|
||||
|
||||
|
||||
private int rev = 0;
|
||||
|
||||
public int Rev
|
||||
{
|
||||
get { return rev; }
|
||||
set
|
||||
{
|
||||
rev = value;
|
||||
InternalPropertyChanged(nameof(Rev));
|
||||
}
|
||||
}
|
||||
private bool? passed = false;
|
||||
public bool? Passed
|
||||
{
|
||||
get { return passed; }
|
||||
set
|
||||
{
|
||||
passed = value;
|
||||
InternalPropertyChanged(nameof(Passed));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private string testerName = "";
|
||||
public String TesterName
|
||||
{
|
||||
get { return testerName; }
|
||||
set
|
||||
{
|
||||
testerName = value;
|
||||
InternalPropertyChanged(nameof(TesterName));
|
||||
}
|
||||
}
|
||||
|
||||
private string testPressure = "6";
|
||||
public String TestPressure
|
||||
{
|
||||
get { return testPressure; }
|
||||
set
|
||||
{
|
||||
testPressure = value;
|
||||
InternalPropertyChanged(nameof(TestPressure));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string leakRate = " 0,00001";
|
||||
public String LeakRate
|
||||
{
|
||||
get { return leakRate; }
|
||||
set
|
||||
{
|
||||
leakRate = value;
|
||||
InternalPropertyChanged(nameof(LeakRate));
|
||||
}
|
||||
}
|
||||
|
||||
private string remark = "";
|
||||
public String Remark
|
||||
{
|
||||
get { return remark; }
|
||||
set
|
||||
{
|
||||
remark = value;
|
||||
InternalPropertyChanged(nameof(Remark));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<PressureTestPoints> testpoints = new ObservableCollection<PressureTestPoints>() {
|
||||
new PressureTestPoints() { Ident = 1, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 2, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 3, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 4, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 5, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 6, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 7, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 8, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 9, Input = "0,000000200000" },
|
||||
new PressureTestPoints() { Ident = 10, Input = "0,000000200000" }
|
||||
};
|
||||
public ObservableCollection<PressureTestPoints> Testpoints
|
||||
{
|
||||
get { return testpoints; }
|
||||
set
|
||||
{
|
||||
testpoints = value;
|
||||
InternalPropertyChanged(nameof(Testpoints));
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetAllTestPoints(string input)
|
||||
{
|
||||
foreach (var item in Testpoints)
|
||||
{
|
||||
item.Input = input;
|
||||
}
|
||||
InternalPropertyChanged(nameof(Testpoints));
|
||||
}
|
||||
public PressureResultData ToBase()
|
||||
{
|
||||
var baseData = new PressureResultData();
|
||||
baseData.LeakRate = LeakRate;
|
||||
baseData.Passed = Passed;
|
||||
baseData.PcbId = PcbId;
|
||||
baseData.Remark = Remark;
|
||||
baseData.Rev = Rev;
|
||||
baseData.TesterName = TesterName;
|
||||
baseData.Testpoints = Testpoints.ToList();
|
||||
baseData.TestPressure = TestPressure;
|
||||
return baseData;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
17
Common/CordonelAssemblyLine/Event/StringArgs.cs
Normal file
17
Common/CordonelAssemblyLine/Event/StringArgs.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CordonelAssemblyLine.Event
|
||||
{
|
||||
public class StringArgs : EventArgs
|
||||
{
|
||||
public readonly string Content;
|
||||
public StringArgs(string content)
|
||||
{
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Common/CordonelAssemblyLine/Leak.xaml
Normal file
115
Common/CordonelAssemblyLine/Leak.xaml
Normal file
@ -0,0 +1,115 @@
|
||||
<Window x:Class="CordonelAssemblyLine.Leak"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:c="clr-namespace:CordonelAssemblyLine.Converter"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CordonelAssemblyLine"
|
||||
mc:Ignorable="d"
|
||||
Title="Leak" Height="450" Width="800" Background="Aqua">
|
||||
<Window.Resources>
|
||||
<c:MathConverter x:Key="myMathConverter"/>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid Grid.Row="8">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="15*"/>
|
||||
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="100*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="20*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="180" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<Label x:Name="lblHeadline" Content="HE-Schnüffeln" Grid.Column="0" Grid.Row="0" FontWeight="Bold" FontSize="24" Height="47" VerticalAlignment="Top" Margin="0,0,111,0" Grid.RowSpan="2" Grid.ColumnSpan="2" />
|
||||
|
||||
<Label x:Name="lblLeakrate" Content="Grenz-Leckrate >" HorizontalAlignment="Left" Margin="2,0,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="2" Height="26" Width="123" Grid.ColumnSpan="2" />
|
||||
<TextBox x:Name="txtLeakrate" Height="26" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" Text="{Binding Result.LeakRate, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Left" Width="289" Margin="3,0,0,0" Grid.ColumnSpan="2" />
|
||||
|
||||
|
||||
|
||||
<TextBox x:Name="TxtPresurePcbId" Height="26" IsEnabled="False" TextWrapping="Wrap" Text="{Binding CurrentPcbID, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Width="150" Margin="1,0,0,0" Grid.RowSpan="2" />
|
||||
<Label Content="PcbId" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="40" Grid.RowSpan="2"/>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Margin="2,0,197,0">
|
||||
<TextBlock Text="Rev: "/>
|
||||
<Label Content="{Binding Result.Rev, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Top" Height="26" Width="40"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<Label Content="Prüfdruck in bar" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="113" Grid.RowSpan="2" />
|
||||
<TextBox x:Name="txtPressure" Height="26" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" Text="{Binding Result.TestPressure, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Width="150" Margin="1,0,0,0" Grid.RowSpan="2" />
|
||||
|
||||
|
||||
<TextBox x:Name="txtTester" Height="26" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" Text="{Binding TesterName, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" Width="150" Margin="1,0,0,0" Grid.RowSpan="2" />
|
||||
|
||||
|
||||
<Label Content="Prüfer" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="85" Grid.RowSpan="2" />
|
||||
|
||||
|
||||
<ListView x:Name="listViewTestPotins" ItemsSource="{Binding Result.Testpoints, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="2" Grid.RowSpan="4" HorizontalAlignment="left" Width="380" Margin="12,10,0,0" Grid.ColumnSpan="3" >
|
||||
<ListView.View>
|
||||
<GridView >
|
||||
<GridViewColumn Header="Nr" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate >
|
||||
<Label Content="{Binding Ident}" Height="22" FontWeight="Bold" FontSize="10" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="Wert" >
|
||||
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Margin="0" ToolTip="{Binding ToolTipInput}" Height="22" Width="125" FontWeight="Bold" FontSize="13" VerticalContentAlignment="Center" Text="{Binding Input, Mode=TwoWay, Converter={StaticResource myMathConverter}}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Right" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Stretch" >
|
||||
</TextBox>
|
||||
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Header="" >
|
||||
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="Für alle übernehmen" Height="22" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" FontWeight="Bold" FontSize="13" Click="Button_Click" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
<Label Content="Bemerkung" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Height="26" Width="113" Grid.Column="0" Grid.Row="4" />
|
||||
|
||||
<TextBox Text="{Binding Result.Remark, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" Margin="11,10,8,7" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" SpellCheck.IsEnabled="True" SpellCheck.SpellingReform="PreAndPostreform" Grid.Row="4" Grid.Column="1" />
|
||||
|
||||
|
||||
<Button Name="btnPresueOk" Background="LightGreen" Grid.ColumnSpan="2" Content="Bestanden" HorizontalAlignment="Left" Height="35" Margin="12,5,0,0" Grid.Row="6" VerticalAlignment="Top" Width="280" Click="BtnPresueOk_Click" Grid.Column="2" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<Button Name="btnPresueFailed" Background="LightPink" Grid.ColumnSpan="2" Content="Nicht Bestanden" HorizontalAlignment="Left" Height="35" Margin="9,5,0,0" Grid.Row="6" VerticalAlignment="Top" Width="281" Click="BtnPresueFailed_Click" Grid.Column="0" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<TextBlock Name="tippBox" Grid.Column="5" HorizontalAlignment="Left" Grid.Row="2" Grid.RowSpan="3" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" />
|
||||
<Label Content="Tipp:" Grid.Column="5" HorizontalAlignment="Left"
|
||||
Grid.Row="1" VerticalAlignment="Top"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
114
Common/CordonelAssemblyLine/Leak.xaml.cs
Normal file
114
Common/CordonelAssemblyLine/Leak.xaml.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using CordonelAssemblyLine.Event;
|
||||
using CordonelAssemblyLine.Model;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace CordonelAssemblyLine
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Leak.xaml
|
||||
/// </summary>
|
||||
public partial class Leak : Window
|
||||
{
|
||||
private LeakViewModel ViewModel = null;
|
||||
public Leak(CancellationToken globalCancellationToken, int slotNR, int? stationID = null, string Tester= "-")
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new LeakViewModel(slotNR, stationID);
|
||||
ViewModel.TesterName = Tester;
|
||||
DataContext = ViewModel;
|
||||
ViewModel.MeterDetectedHandler += ViewModel_MeterDetectedHandler;
|
||||
ViewModel.OnStoreDone += ViewModel_OnStoreDone;
|
||||
tippBox.Text = ViewModel.ToolTipInput;
|
||||
|
||||
}
|
||||
|
||||
private void BtnPresueFailed_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.StoreData(false);
|
||||
}
|
||||
|
||||
private void BtnPresueOk_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.StoreData(true);
|
||||
}
|
||||
private void ViewModel_OnStoreDone(object sender, StringArgs e)
|
||||
{
|
||||
MessageBox.Show(e.Content);
|
||||
}
|
||||
private void ViewModel_MeterDetectedHandler(object sender, EventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
bool update = false;
|
||||
if (sender is null)
|
||||
{
|
||||
ViewModel.InputIsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewModel.ReloadData(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ViewModel.InputIsEnabled = false;
|
||||
MessageBox.Show($"Fehler: {ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string input = "";
|
||||
var obj = ((FrameworkElement)sender).DataContext;
|
||||
if (obj is Xylem.Common.Logic.ProductionOrderCore.TestResults.PressureTestPoints ptp)
|
||||
{
|
||||
ViewModel.Result.SetAllTestPoints(ptp.Input);
|
||||
|
||||
|
||||
}
|
||||
var d = listViewTestPotins.DataContext;
|
||||
listViewTestPotins.DataContext = null;
|
||||
listViewTestPotins.DataContext = d;
|
||||
// var c = e.Changes.First();
|
||||
// if (c.RemovedLength == 0)
|
||||
// {
|
||||
// var input = txtSender.Text.Substring(c.Offset, c.AddedLength);
|
||||
// if (BarcodeInputActiveOffset.HasValue)
|
||||
// {
|
||||
// BarcodeInput = $"{BarcodeInput}{input}";
|
||||
|
||||
// if (input == System.Environment.NewLine)
|
||||
// {
|
||||
// var tmpOffset = BarcodeInputActiveOffset.Value;
|
||||
// BarcodeInputActiveOffset = null;
|
||||
// OnBarcodeInput?.Invoke(null, new StringArgs(BarcodeInput));
|
||||
// txtSender.Text = txtSender.Text.Replace(BarcodeInput, "");
|
||||
// BarcodeInput = "";
|
||||
// txtSender.Focus();
|
||||
// txtSender.CaretIndex = tmpOffset;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (ViewModel != null && ViewModel.BarcodeTrigger.Any(t => t == input))
|
||||
// {
|
||||
|
||||
// BarcodeInput = txtSender.Text.Substring(c.Offset, c.AddedLength);
|
||||
// BarcodeInputActiveOffset = c.Offset;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
52
Common/CordonelAssemblyLine/MainWindow.xaml
Normal file
52
Common/CordonelAssemblyLine/MainWindow.xaml
Normal file
@ -0,0 +1,52 @@
|
||||
<Window x:Class="CordonelAssemblyLine.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CordonelAssemblyLine"
|
||||
xmlns:ProductionControls="clr-namespace:ProductionControls;assembly=ProductionControls"
|
||||
xmlns:ProductionControls1="clr-namespace:Ui.ProductionControls;assembly=ProductionControls"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="264*"/>
|
||||
<ColumnDefinition Width="151*"/>
|
||||
<ColumnDefinition Width="160*"/>
|
||||
<ColumnDefinition Width="217*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Content="Picking" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click"/>
|
||||
<Button Content="Leak" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_1" Grid.Row="1"/>
|
||||
<Button Content="Marrieage" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_2" Grid.Row="2"/>
|
||||
<TextBox Name="txtPickingBarcode" Grid.Column="2" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox Name="txtPickingSlot" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||
<Label Content="Slot" Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="30"/>
|
||||
<Label Content="BarcodePort" Grid.Column="2" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="75"/>
|
||||
|
||||
|
||||
<TextBox Name="txtLeakStation" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox Name="txtLeakSlot" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||
<Label Content="Slot" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="30"/>
|
||||
<Label Content="StationId" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="57"/>
|
||||
|
||||
<TextBox Name="txtMarrieageBarcode" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox Name="txtMarrieageSlot" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||
<Label Content="Slot" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="30"/>
|
||||
<Label Content="BarcodePort" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="75"/>
|
||||
<TextBox x:Name="txtTester" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||
<Label Content="Tester" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="57"/>
|
||||
|
||||
<ProductionControls1:ctlPictureProgressBar Name="progressBar" HorizontalAlignment="Left" Height="80" Margin="11,0,0,0" Grid.Row="3" VerticalAlignment="Top" Width="771" Grid.ColumnSpan="4"/>
|
||||
<Button Name="btn1" Content="1" Grid.Column="3" HorizontalAlignment="Left" Height="28" Margin="30,36,0,0" Grid.Row="2" VerticalAlignment="Top" Width="17" Click="Btn1_Click"/>
|
||||
<Button Name="btn2" Content="2" Grid.Column="3" HorizontalAlignment="Left" Height="28" Margin="52,36,0,0" Grid.Row="2" VerticalAlignment="Top" Width="17" Click="Btn2_Click"/>
|
||||
<Button Name="btn3" Content="3" Grid.Column="3" HorizontalAlignment="Left" Height="28" Margin="89,36,0,0" Grid.Row="2" VerticalAlignment="Top" Width="17" Click="Btn3_Click"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
117
Common/CordonelAssemblyLine/MainWindow.xaml.cs
Normal file
117
Common/CordonelAssemblyLine/MainWindow.xaml.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace CordonelAssemblyLine
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private CancellationTokenSource cancellation = new CancellationTokenSource();
|
||||
private Picking PickingWindow;
|
||||
private Leak LeakWindow;
|
||||
private Marriage MarriageWindow;
|
||||
public string PickingSlot { get; set; }
|
||||
|
||||
public string PickingBarcode { get; set; }
|
||||
public string LeakSlot { get; set; }
|
||||
public string LeakStationId { get; set; }
|
||||
public string MarriageSlot { get; set; }
|
||||
public string MarriageBarcode { get; set; }
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
PickingSlot = System.Configuration.ConfigurationManager.AppSettings["PickingSlot"].ToString();
|
||||
PickingBarcode = System.Configuration.ConfigurationManager.AppSettings["PickingBarcode"].ToString();
|
||||
LeakSlot = System.Configuration.ConfigurationManager.AppSettings["LeakSlot"].ToString();
|
||||
LeakStationId = System.Configuration.ConfigurationManager.AppSettings["LeakStationId"].ToString();
|
||||
MarriageSlot = System.Configuration.ConfigurationManager.AppSettings["MarriageSlot"].ToString();
|
||||
MarriageBarcode = System.Configuration.ConfigurationManager.AppSettings["MarriageBarcode"].ToString();
|
||||
|
||||
txtPickingBarcode.Text = PickingBarcode;
|
||||
txtPickingSlot.Text = PickingSlot;
|
||||
txtLeakStation.Text = LeakStationId;
|
||||
txtLeakSlot.Text = LeakSlot;
|
||||
txtMarrieageBarcode.Text = MarriageBarcode;
|
||||
txtMarrieageSlot.Text = MarriageSlot;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (PickingWindow == null)
|
||||
{
|
||||
var tmp = 0;
|
||||
if (int.TryParse(txtPickingSlot.Text, out tmp))
|
||||
{
|
||||
PickingWindow = new Picking(cancellation.Token, txtPickingBarcode.Text, tmp);
|
||||
PickingWindow.Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (LeakWindow == null)
|
||||
{
|
||||
var tmpSlot = 0;
|
||||
var tmpStation = 0;
|
||||
if (int.TryParse(txtLeakSlot.Text, out tmpSlot) && int.TryParse(txtLeakStation.Text, out tmpStation))
|
||||
{
|
||||
LeakWindow = new Leak(cancellation.Token, tmpSlot, tmpStation, txtTester.Text);
|
||||
LeakWindow.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MarriageWindow == null)
|
||||
{
|
||||
var tmp = 0;
|
||||
if (int.TryParse(txtMarrieageSlot.Text, out tmp))
|
||||
{
|
||||
MarriageWindow = new Marriage(cancellation.Token, tmp, txtMarrieageBarcode.Text);
|
||||
MarriageWindow.Show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement> progressbars = new System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement>();
|
||||
string el1 = "nicht so lang";
|
||||
string el2 = "Maximal dreißig zeichen 30!!!";
|
||||
string el3 = "viel zu viele zeichen man kann auch nicht alles haben3";
|
||||
private void Btn1_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Cloud, Name = el1});
|
||||
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Compare, Name = el2});
|
||||
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Irda, Name = el3 });
|
||||
progressBar.AddRange(progressbars);
|
||||
progressbars.Where(n => n.Name == el1).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
|
||||
}
|
||||
|
||||
private void Btn2_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
progressbars.Where(n => n.Name == el1).First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
progressbars.Where(n => n.Name == el2).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
|
||||
}
|
||||
|
||||
private void Btn3_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
progressbars.Where(n => n.Name == el2).First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
progressbars.Where(n => n.Name == el3).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Common/CordonelAssemblyLine/Marriage.xaml
Normal file
70
Common/CordonelAssemblyLine/Marriage.xaml
Normal file
@ -0,0 +1,70 @@
|
||||
<Window x:Class="CordonelAssemblyLine.Marriage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CordonelAssemblyLine"
|
||||
mc:Ignorable="d"
|
||||
Title="Marriage" Height="287.361" Width="489.32" Loaded="Window_Loaded">
|
||||
<Grid>
|
||||
<StackPanel Background="BlanchedAlmond" >
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="Verheiraten" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="Scanner:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding Scanner, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Height="26" Width="115" />
|
||||
<Label Background="{Binding ResultColor}" Content="Ep:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="2" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding Slot, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="3" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="Medlung:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding State, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="36,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Height="26" Width="332" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="Ergebnis:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding Result, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Height="26" Width="359" />
|
||||
|
||||
|
||||
<TextBox Name="TxtSerialNumber" Text="{Binding SerialNr, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Grid.ColumnSpan="2" Height="26" Margin="24,10,0,0" TextWrapping="Wrap" IsEnabled="False" VerticalAlignment="Top" Width="190" Grid.Column="1" Grid.Row="4"/>
|
||||
<Label Content="SerialNumber" HorizontalAlignment="Left" Margin="14,10,0,0" VerticalAlignment="Top" Grid.Row="4" Height="26" Width="82"/>
|
||||
<TextBox x:Name="TxtPcbId" Text="{Binding PcbId, UpdateSourceTrigger=PropertyChanged}" Grid.ColumnSpan="2" HorizontalAlignment="Left" Height="26" Margin="24,10,0,0" IsEnabled="False" TextWrapping="Wrap" VerticalAlignment="Top" Width="190" Grid.Column="1" Grid.Row="5"/>
|
||||
<Label Content="PcbId" HorizontalAlignment="Left" Margin="14,10,0,0" VerticalAlignment="Top" Grid.Row="5" Height="26" Width="40"/>
|
||||
<Button Name="btnMarry" IsEnabled="{Binding CanMarry, UpdateSourceTrigger=PropertyChanged}" Grid.ColumnSpan="4" Content="verheiraten" Height="35" Margin="35,5,0,0" Grid.Row="6" VerticalAlignment="Top" Click="btnMarry_Click" HorizontalAlignment="Left" Width="395"/>
|
||||
</Grid>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100*"/>
|
||||
<ColumnDefinition Width="225*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
55
Common/CordonelAssemblyLine/Marriage.xaml.cs
Normal file
55
Common/CordonelAssemblyLine/Marriage.xaml.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using CordonelAssemblyLine.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CordonelAssemblyLine
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Marriage.xaml
|
||||
/// </summary>
|
||||
public partial class Marriage : Window
|
||||
{
|
||||
|
||||
|
||||
MarriageViewModel Model;
|
||||
CancellationToken GlobalCancellationToken;
|
||||
public Marriage(CancellationToken globalCancellationToken, int slot, string barcode)
|
||||
{
|
||||
GlobalCancellationToken = globalCancellationToken;
|
||||
|
||||
Model = new MarriageViewModel(barcode, slot);
|
||||
Model.OnMsgRaise += Model_OnMsgRaise;
|
||||
DataContext = Model;
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
private void Model_OnMsgRaise(object sender, string e)
|
||||
{
|
||||
MessageBox.Show(e,"Fehler beim Verheiraten");
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
Model.StartPicking(GlobalCancellationToken);
|
||||
}
|
||||
|
||||
private void btnMarry_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Model.StartStore();
|
||||
}
|
||||
}
|
||||
}
|
||||
341
Common/CordonelAssemblyLine/Model/LeakViewModel.cs
Normal file
341
Common/CordonelAssemblyLine/Model/LeakViewModel.cs
Normal file
@ -0,0 +1,341 @@
|
||||
using CordonelAssemblyLine.Data;
|
||||
using CordonelAssemblyLine.Event;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
using Xylem.Common.Utils.Logging;
|
||||
|
||||
namespace CordonelAssemblyLine.Model
|
||||
{
|
||||
public class LeakViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event EventHandler<StringArgs> OnStoreDone;
|
||||
public event EventHandler MeterDetectedHandler;
|
||||
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
private PressureResultDataNotifyable result = new PressureResultDataNotifyable();
|
||||
public PressureResultDataNotifyable Result
|
||||
{
|
||||
get { return result; }
|
||||
set
|
||||
{
|
||||
result = value;
|
||||
NotifyPropertyChanged(nameof(Result));
|
||||
}
|
||||
}
|
||||
private string testerName;
|
||||
public string TesterName
|
||||
{
|
||||
get { return testerName; }
|
||||
set
|
||||
{
|
||||
testerName = value;
|
||||
NotifyPropertyChanged(nameof(TesterName));
|
||||
}
|
||||
}
|
||||
|
||||
private bool inputIsEnabled = false;
|
||||
public bool InputIsEnabled
|
||||
{
|
||||
get { return inputIsEnabled; }
|
||||
set
|
||||
{
|
||||
inputIsEnabled = value;
|
||||
NotifyPropertyChanged(nameof(InputIsEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
private int intervalWithoutDetect = 1000;
|
||||
private int intervalWithDetect = 10000;
|
||||
private string _currentPcbID;
|
||||
private MeterBatch Batch = new MeterBatch();
|
||||
public GenesisMeter CurrentMeter { get; private set; }
|
||||
|
||||
public bool Locked { get; set; } = false;
|
||||
public int? StationID { get; set; } = null;
|
||||
private string toolTip;
|
||||
public string ToolTipInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return toolTip;
|
||||
}
|
||||
set
|
||||
{
|
||||
toolTip = value;
|
||||
|
||||
NotifyPropertyChanged(nameof(ToolTipInput));
|
||||
}
|
||||
}
|
||||
|
||||
public string CurrentPcbID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentPcbID;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currentPcbID = value;
|
||||
|
||||
NotifyPropertyChanged(nameof(CurrentPcbID));
|
||||
}
|
||||
}
|
||||
private Timer tmrAutoDetect;
|
||||
|
||||
public LeakViewModel(int slotNR, int? stationID = null)
|
||||
{
|
||||
_logger = NLogHelper.CreateOrGetLogger("ProductionUI");
|
||||
StationID = stationID;
|
||||
SlotNr = slotNR;
|
||||
tmrAutoDetect = new Timer(intervalWithoutDetect);
|
||||
tmrAutoDetect.Elapsed += TmrAutoDetect_Elapsed;
|
||||
tmrAutoDetect.Enabled = true;
|
||||
|
||||
ToolTipInput = $"Unterstützte Eingabeformate: {System.Environment.NewLine} " +
|
||||
$"2,00E-07 { System.Environment.NewLine} " +
|
||||
$"2E-07 { System.Environment.NewLine} " +
|
||||
$"2x10-7 { System.Environment.NewLine} " +
|
||||
$"2*10^-7 { System.Environment.NewLine} " +
|
||||
"0,0000002";
|
||||
|
||||
|
||||
}
|
||||
|
||||
public bool isHydraulicStaion()
|
||||
{
|
||||
|
||||
if (!StationID.HasValue || StationID.Value == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private readonly ILogger _logger;
|
||||
private readonly int SlotNr;
|
||||
|
||||
public void Log(string txt)
|
||||
{
|
||||
_logger?.Info(txt);
|
||||
}
|
||||
private bool Detect()
|
||||
{
|
||||
|
||||
Log("Start Detect");
|
||||
bool hasDetect = false;
|
||||
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentMeter == null)
|
||||
{
|
||||
Batch = new MeterBatch();
|
||||
var tryMeter = new GenesisMeter();
|
||||
try
|
||||
{
|
||||
tryMeter.SetupFromConfigFile(SlotNr);
|
||||
Batch.AddMeter(tryMeter);
|
||||
tryMeter.Logout();
|
||||
Log("Try to get PcbID");
|
||||
CurrentPcbID = tryMeter.GetPcbId();
|
||||
|
||||
hasDetect = !string.IsNullOrEmpty(CurrentPcbID);
|
||||
CurrentMeter = tryMeter;
|
||||
if (hasDetect)
|
||||
{
|
||||
MeterDetectedHandler?.Invoke(CurrentMeter, EventArgs.Empty);
|
||||
Log($"New PcbID detected {CurrentPcbID}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"No Meter found");
|
||||
DisposeAllConnections();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"Error occur.{ Environment.NewLine} {e.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Check if Meter is still connected");
|
||||
var ret = CurrentMeter.GetPcbId();
|
||||
if (string.IsNullOrEmpty(ret) || ret != CurrentPcbID)
|
||||
{
|
||||
Log("Meter connection lost");
|
||||
hasDetect = false;
|
||||
DisposeAllConnections();
|
||||
|
||||
CurrentPcbID = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Meter is still connected");
|
||||
hasDetect = true;
|
||||
}
|
||||
}
|
||||
return hasDetect;
|
||||
}
|
||||
|
||||
|
||||
private void DisposeAllConnections()
|
||||
{
|
||||
if (Batch != null)
|
||||
{
|
||||
MeterDetectedHandler?.Invoke(null, EventArgs.Empty);
|
||||
Batch.RemoveAllMeters();
|
||||
if (CurrentMeter != null)
|
||||
{
|
||||
CurrentMeter.Dispose();
|
||||
}
|
||||
Batch.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DisposeAllConnections();
|
||||
}
|
||||
|
||||
public void TmrAutoDetect_Elapsed(object sender, EventArgs e)
|
||||
{
|
||||
tmrAutoDetect.Enabled = false;
|
||||
var hasDetect = Detect();
|
||||
if (hasDetect)
|
||||
{
|
||||
tmrAutoDetect.Interval = intervalWithDetect;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmrAutoDetect.Interval = intervalWithoutDetect;
|
||||
}
|
||||
tmrAutoDetect.Enabled = true;
|
||||
}
|
||||
internal void ReloadData(bool reset)
|
||||
{
|
||||
|
||||
if (Result != null && Result.PcbId != CurrentPcbID)
|
||||
{
|
||||
InputIsEnabled = false;
|
||||
Result = new PressureResultDataNotifyable() { Remark = "loading", Testpoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
|
||||
Task<PressureResultDataNotifyable>.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = ServiceUrls.MeterProcessStateUrl();
|
||||
url = url + $"GetPressureStateDetailed?PcbId={CurrentPcbID}&TopCount=1";
|
||||
var tmp = 0;
|
||||
var retStr = LocalWebRequest.GetRequestWithError(url, out tmp);
|
||||
if (tmp != 200)
|
||||
{
|
||||
throw new ApplicationException("Keinen Auftrag gefunden. Kommissionierung prüfen!");
|
||||
}
|
||||
var pressureResultData = JsonConvert.DeserializeObject<List<PressureResultData>>(retStr);
|
||||
if (!pressureResultData.Any())
|
||||
{
|
||||
return new PressureResultDataNotifyable();
|
||||
}
|
||||
return new PressureResultDataNotifyable(pressureResultData.First());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log(ex.Message);
|
||||
return new PressureResultDataNotifyable();
|
||||
}
|
||||
|
||||
}).ContinueWith((a) =>
|
||||
{
|
||||
if (a == null)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var res = a.Result;
|
||||
res.PcbId = CurrentPcbID;
|
||||
|
||||
Result = res;
|
||||
InputIsEnabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void StoreData(bool successfull)
|
||||
{
|
||||
|
||||
if (Result != null && Result.PcbId == CurrentPcbID)
|
||||
{
|
||||
InputIsEnabled = false;
|
||||
var isStored = false;
|
||||
Result.TesterName = TesterName;
|
||||
Task.Run(() =>
|
||||
{
|
||||
var url = ServiceUrls.MeterProcessStateUrl();
|
||||
|
||||
var status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
|
||||
if (successfull)
|
||||
{
|
||||
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTested;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
url = url + $"SetPressureStateDetailed";
|
||||
var mutedResult = Result.ToBase();
|
||||
isStored = LocalWebRequest.PostRequestAsync(url, json: mutedResult);
|
||||
if (!isStored)
|
||||
{
|
||||
OnStoreDone?.Invoke(null, new StringArgs("Kann nicht gespeichert werden"));
|
||||
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
CurrentMeter.Login();
|
||||
CurrentMeter.SetProcessState(status);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log(ex.Message);
|
||||
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
|
||||
OnStoreDone?.Invoke(null, new StringArgs($"Kann nicht gespeichert werden.Fehler: {ex.Message}"));
|
||||
}
|
||||
|
||||
|
||||
if (status == Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTested)
|
||||
{
|
||||
OnStoreDone?.Invoke(null, new StringArgs("Ergebnis gespeichert der Zähler weiter bearbeitet werden."));
|
||||
return;
|
||||
}
|
||||
OnStoreDone?.Invoke(null, new StringArgs("Bitte erneut testen oder Linienleitung und QS informieren."));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
624
Common/CordonelAssemblyLine/Model/MarriageViewModel.cs
Normal file
624
Common/CordonelAssemblyLine/Model/MarriageViewModel.cs
Normal file
@ -0,0 +1,624 @@
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
using Xylem.Common.Utils.Logging;
|
||||
|
||||
namespace CordonelAssemblyLine.Model
|
||||
{
|
||||
internal class MarriageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event EventHandler<string> OnMsgRaise;
|
||||
public MarriageViewModel(string scannerPort, int slotNr)
|
||||
{
|
||||
_logger = NLogHelper.CreateOrGetLogger("ProductionUI");
|
||||
ScannerPort = scannerPort;
|
||||
SlotNr = slotNr;
|
||||
}
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private string state = "Warte auf Scanner";
|
||||
private string scanner = "keine Verbindung";
|
||||
private string slot = "-";
|
||||
private string result = "-";
|
||||
|
||||
private System.Windows.Media.Brush resultColor;
|
||||
public System.Windows.Media.Brush ResultColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return resultColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
resultColor = value;
|
||||
NotifyPropertyChanged(nameof(ResultColor));
|
||||
}
|
||||
}
|
||||
public string State
|
||||
{
|
||||
get
|
||||
{
|
||||
return state;
|
||||
}
|
||||
set
|
||||
{
|
||||
state = value;
|
||||
NotifyPropertyChanged(nameof(State));
|
||||
}
|
||||
}
|
||||
public string Scanner
|
||||
{
|
||||
get
|
||||
{
|
||||
return scanner;
|
||||
}
|
||||
set
|
||||
{
|
||||
scanner = value;
|
||||
NotifyPropertyChanged(nameof(Scanner));
|
||||
}
|
||||
}
|
||||
public string Slot
|
||||
{
|
||||
get
|
||||
{
|
||||
return slot;
|
||||
}
|
||||
set
|
||||
{
|
||||
slot = value;
|
||||
NotifyPropertyChanged(nameof(Slot));
|
||||
}
|
||||
}
|
||||
public string SerialNr
|
||||
{
|
||||
get
|
||||
{
|
||||
return serialNr;
|
||||
}
|
||||
set
|
||||
{
|
||||
serialNr = value;
|
||||
NotifyPropertyChanged(nameof(SerialNr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string Result
|
||||
{
|
||||
get
|
||||
{
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
result = value;
|
||||
NotifyPropertyChanged(nameof(Result));
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanMarry
|
||||
{
|
||||
get
|
||||
{
|
||||
return canMarry;
|
||||
}
|
||||
set
|
||||
{
|
||||
canMarry = value;
|
||||
NotifyPropertyChanged(nameof(CanMarry));
|
||||
}
|
||||
}
|
||||
|
||||
public string PcbId
|
||||
{
|
||||
get
|
||||
{
|
||||
return pcbId;
|
||||
}
|
||||
set
|
||||
{
|
||||
pcbId = value;
|
||||
NotifyPropertyChanged(nameof(PcbId));
|
||||
}
|
||||
}
|
||||
|
||||
private string pcbId;
|
||||
private bool canMarry = false;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
|
||||
{
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
public void StartStore()
|
||||
{
|
||||
sm = PickingStateMachine.Store;
|
||||
}
|
||||
public void StartPicking(CancellationToken cancle)
|
||||
{
|
||||
var s = new Task(() => { PickingLoop(cancle); }, cancle);
|
||||
s.Start();
|
||||
}
|
||||
public enum PickingStateMachine
|
||||
{
|
||||
Init,
|
||||
WaitForScanning,
|
||||
ScanningDone,
|
||||
WaitForDetect,
|
||||
GetMapping,
|
||||
Store,
|
||||
WaitForBuildingMeterReady,
|
||||
MappingError,
|
||||
Done
|
||||
}
|
||||
private PickingStateMachine sm = PickingStateMachine.Init;
|
||||
|
||||
private class BarScanner : IDisposable
|
||||
{
|
||||
public bool? IsRuning = null;
|
||||
public String Input = "";
|
||||
private String Port;
|
||||
private CancellationToken Cancellation;
|
||||
private Task WaitForScannerTask;
|
||||
public BarScanner(string port, CancellationToken cancellation)
|
||||
{
|
||||
Port = port;
|
||||
Cancellation = cancellation;
|
||||
}
|
||||
public void Start()
|
||||
{
|
||||
if (!IsRuning.HasValue || !IsRuning.Value)
|
||||
{
|
||||
if (Port == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WaitForScannerTask = new Task(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var a = new SerialPort(Port))
|
||||
{
|
||||
a.Open();
|
||||
a.NewLine = "\r";
|
||||
while (true)
|
||||
{
|
||||
if (Cancellation.IsCancellationRequested)
|
||||
{
|
||||
IsRuning = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsRuning = true;
|
||||
Input = a.ReadLine();
|
||||
a.Close();
|
||||
IsRuning = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
IsRuning = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, Cancellation);
|
||||
WaitForScannerTask.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (WaitForScannerTask.Status != TaskStatus.Faulted && WaitForScannerTask.Status != TaskStatus.RanToCompletion && WaitForScannerTask.Status != TaskStatus.Canceled)
|
||||
{
|
||||
WaitForScannerTask.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
|
||||
{
|
||||
using (var Batch = new MeterBatch())
|
||||
{
|
||||
|
||||
using (var meter = new GenesisMeter())
|
||||
{
|
||||
|
||||
meter.SetupFromConfigFile(SlotNr);
|
||||
Batch.AddMeter(meter);
|
||||
State = "Am Zähler anmelden";
|
||||
if ((bool)meter.Login())
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
|
||||
var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested);
|
||||
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={serialNr}";
|
||||
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
|
||||
|
||||
var result = false;
|
||||
if (bool.TryParse(RetString, out result))
|
||||
{
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool RunCheck(Dictionary<uint, uint> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent, GenesisMeter meter)
|
||||
{
|
||||
State = $"Üperprüfe Parameter";
|
||||
var FrequencyReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
|
||||
if (FrequencyReadOut != Frequency)
|
||||
{
|
||||
State = $"Falsche Frequenz! soll {Frequency}MHz ist {FrequencyReadOut}MHz";
|
||||
return false;
|
||||
}
|
||||
|
||||
var MeterSizeReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("GENESISFLOW_MeterSize"));
|
||||
if (MeterSizeReadOut != MeterSize)
|
||||
{
|
||||
State = $"Meter Dn falsch! soll {MeterSize}DN ist {MeterSizeReadOut}DN";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var PressureReadOut = RegisterConverter.ConvertTo<bool>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
|
||||
if (PressureReadOut != PressurePresent)
|
||||
{
|
||||
if (PressurePresent)
|
||||
{
|
||||
State = $"Pcb mit Drucksensor. Laut Auftrag keine verbaut";
|
||||
}
|
||||
else
|
||||
{
|
||||
State = $"Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden";
|
||||
}
|
||||
//todo raus
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var item in checkAppsIdVersion)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
|
||||
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
|
||||
{
|
||||
State = $"Falsche FW, bitte Updaten";
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
State = $"Fehler beim auslesen der FW";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
|
||||
Thread.Sleep(100);
|
||||
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
|
||||
if (!storeRet.All(a => a.Equals(0)))
|
||||
{
|
||||
State = $"Filesystem corrupt";
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
State = $"Fehler beim überprüfen des Filesystems";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private PickingCompareItem OrderDetails;
|
||||
private BarScanner barScanner;
|
||||
private string serialNr;
|
||||
|
||||
|
||||
|
||||
private readonly string ScannerPort;
|
||||
private readonly int SlotNr;
|
||||
//PickingState,PickingScanner,PickingSlot,PickingResult
|
||||
private void PickingLoop(CancellationToken token)
|
||||
{
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
switch (sm)
|
||||
{
|
||||
case PickingStateMachine.Init:
|
||||
CanMarry = false;
|
||||
State = "Initialisierung";
|
||||
Slot = $"Inaktiv EP {SlotNr}";
|
||||
Scanner = $"Geschlossen {ScannerPort}";
|
||||
//CheckAllPorts?
|
||||
Scanner = $"Öfffne {ScannerPort}";
|
||||
//CheckAllPorts?
|
||||
barScanner = new BarScanner(ScannerPort, token);
|
||||
barScanner.Start();
|
||||
|
||||
while (!barScanner.IsRuning.HasValue)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
if (barScanner.IsRuning.HasValue && barScanner.IsRuning.Value)
|
||||
{
|
||||
Scanner = $"Offen {ScannerPort}";
|
||||
sm = PickingStateMachine.WaitForScanning;
|
||||
}
|
||||
else
|
||||
{
|
||||
Scanner = $"Nicht geöffnet {ScannerPort}";
|
||||
sm = PickingStateMachine.Init;
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case PickingStateMachine.WaitForScanning:
|
||||
OrderDetails = null;
|
||||
|
||||
State = $"Warte auf Scannereingabe({ScannerPort})";
|
||||
if (barScanner != null && !String.IsNullOrEmpty(barScanner.Input))
|
||||
{
|
||||
SerialNr = barScanner.Input;
|
||||
Scanner = $"Geschlossen {ScannerPort}";
|
||||
barScanner = null;
|
||||
sm = PickingStateMachine.WaitForDetect;
|
||||
}
|
||||
|
||||
break;
|
||||
case PickingStateMachine.WaitForDetect:
|
||||
using (var Batch = new MeterBatch())
|
||||
{
|
||||
|
||||
using (var tryMeter = new GenesisMeter())
|
||||
{
|
||||
try
|
||||
{
|
||||
State = $"Warte auf Pcb";
|
||||
Slot = $"Öffne EP {SlotNr}";
|
||||
tryMeter.SetupFromConfigFile(SlotNr);
|
||||
Batch.AddMeter(tryMeter);
|
||||
tryMeter.Logout();
|
||||
Log("Try to get PcbID");
|
||||
PcbId = tryMeter.GetPcbId();
|
||||
|
||||
var hasDetect = !string.IsNullOrEmpty(PcbId);
|
||||
|
||||
if (hasDetect)
|
||||
{
|
||||
State = $"Pcb gefunden {PcbId}";
|
||||
Log($"New PcbID detected {PcbId}");
|
||||
sm = PickingStateMachine.GetMapping;
|
||||
}
|
||||
else
|
||||
{
|
||||
Slot = $"Keine Konnektivität EP {SlotNr}";
|
||||
Log($"No Meter found");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"Error occur.{ Environment.NewLine} {e.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case PickingStateMachine.GetMapping:
|
||||
|
||||
State = $"Lade Auftragsdaten {serialNr}";
|
||||
var retCode = 0;
|
||||
var str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.MarriageServiceUrl()}GetPreMarriageState?SerialNumber={serialNr}&PcbId={PcbId}", out retCode, 15000);
|
||||
var retInt = MarriagePossibleEnum.None;
|
||||
if (retCode != 200 || !MarriagePossibleEnum.TryParse(str, out retInt))
|
||||
{
|
||||
OnMsgRaise?.Invoke(this, $"Technisches Problem beim abfragen der Verfügbarkeit. Code ({retCode})");
|
||||
sm = PickingStateMachine.MappingError;
|
||||
}
|
||||
List<string> MappingText = new List<string>();
|
||||
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueAlredayMatch))
|
||||
{
|
||||
MappingText.Add("Pcb ist schon mit dieser Seriennummer verbunden.");
|
||||
}
|
||||
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDuePcblocked))
|
||||
{
|
||||
MappingText.Add("Pcb ist schon mit einer anderen Seriennummer verbunden.");
|
||||
}
|
||||
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueSerialNumberBlocked))
|
||||
{
|
||||
MappingText.Add("Seriennummer ist schon mit einer anderen Pcb verbunden.");
|
||||
}
|
||||
if (retInt.HasFlag(MarriagePossibleEnum.PcbNotMatchingOrder))
|
||||
{
|
||||
MappingText.Add("Die Pcb ist noch keinem Auftrag zugeordnet.");
|
||||
}
|
||||
if (retInt.HasFlag(MarriagePossibleEnum.Error))
|
||||
{
|
||||
MappingText.Add("Ein unbestimmter Fehler ist aufgetreten.");
|
||||
}
|
||||
|
||||
|
||||
if (MappingText.Any())
|
||||
{
|
||||
var MsgText = "";
|
||||
foreach (var item in MappingText)
|
||||
{
|
||||
MsgText = MsgText + Environment.NewLine + item;
|
||||
}
|
||||
OnMsgRaise?.Invoke(this, $"Diese Kombination ist nicht möglich.{MsgText}");
|
||||
sm = PickingStateMachine.MappingError;
|
||||
Log($"No Meter found");
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = PickingStateMachine.WaitForBuildingMeterReady;
|
||||
}
|
||||
|
||||
break;
|
||||
case PickingStateMachine.WaitForBuildingMeterReady:
|
||||
CanMarry = true;
|
||||
break;
|
||||
case PickingStateMachine.MappingError:
|
||||
State = $"Mapping nicht möglich, bitte erneut scannen";
|
||||
Log($"Mapping nicht möglich, bitte erneut scannen");
|
||||
Thread.Sleep(10000);
|
||||
sm = PickingStateMachine.Init;
|
||||
break;
|
||||
case PickingStateMachine.Store:
|
||||
CanMarry = false;
|
||||
var url = $"{ServiceUrls.MarriageServiceUrl()}SetPcbToSerial?PcbId={PcbId}&Scan={serialNr}&returnMetroData=0";
|
||||
try
|
||||
{
|
||||
string resp = "";
|
||||
try
|
||||
{
|
||||
resp = LocalWebRequest.GetRequest(url, 18000);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!ex.Message.Contains("Mapping already exist. check your marriage request"))
|
||||
{
|
||||
throw;
|
||||
}
|
||||
else
|
||||
{
|
||||
resp = "already store";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (resp.Trim().ToLower().Contains("store"))
|
||||
{
|
||||
using (var Batch = new MeterBatch())
|
||||
{
|
||||
using (var tryMeter = new GenesisMeter())
|
||||
{
|
||||
try
|
||||
{
|
||||
State = $"Warte auf Pcb";
|
||||
Slot = $"Öffne EP {SlotNr}";
|
||||
tryMeter.SetupFromConfigFile(SlotNr);
|
||||
Batch.AddMeter(tryMeter);
|
||||
tryMeter.Logout();
|
||||
Log("Try to get PcbID");
|
||||
PcbId = tryMeter.GetPcbId();
|
||||
|
||||
var hasDetect = !string.IsNullOrEmpty(PcbId);
|
||||
|
||||
if (hasDetect)
|
||||
{
|
||||
tryMeter.Login();
|
||||
State = $"Pcb gefunden {PcbId}";
|
||||
Log($"New PcbID detected {PcbId}");
|
||||
tryMeter.SetProcessState(DisplayCodes.Mounted);
|
||||
tryMeter.PushProgress("AssemblyLine", Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
|
||||
sm = PickingStateMachine.Done;
|
||||
}
|
||||
else
|
||||
{
|
||||
Slot = $"Keine Konnektivität EP {SlotNr}";
|
||||
Log($"No Meter found");
|
||||
}
|
||||
OnMsgRaise?.Invoke(this, $"Zähler verheiratet. Kann zur Prüfstation");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"Error occur.{ Environment.NewLine} {e.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OnMsgRaise?.Invoke(this, $"Fehler beim Speichern, bitte Support Kontaktieren.Response{resp}");
|
||||
}
|
||||
sm = PickingStateMachine.Init;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is WebException)
|
||||
{
|
||||
Log($"Error on Store {url}: {Environment.NewLine} {((WebException)ex).Message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case PickingStateMachine.Done:
|
||||
OnMsgRaise?.Invoke(this, $"Bitte Display überprüfen. {Environment.NewLine}Sollte etwas anderes als {DisplayCodes.Mounted} im Display erscheinen ist der Zähler nicht erfolgreich bearbeitet.");
|
||||
sm = PickingStateMachine.Init;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Log(string txt)
|
||||
{
|
||||
_logger?.Info(txt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
710
Common/CordonelAssemblyLine/Model/PickingModel.cs
Normal file
710
Common/CordonelAssemblyLine/Model/PickingModel.cs
Normal file
@ -0,0 +1,710 @@
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ui.ProductionControls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
using static Ui.ProductionControls.ctlPictureProgressBar;
|
||||
|
||||
namespace CordonelAssemblyLine.Model
|
||||
{
|
||||
internal class PickingViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private string state = "Warte auf Scanner";
|
||||
private string scanner = "keine Verbindung";
|
||||
private string slot = "-";
|
||||
private string result = "-";
|
||||
|
||||
private System.Windows.Media.Brush resultColor;
|
||||
public System.Windows.Media.Brush ResultColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return resultColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
resultColor = value;
|
||||
NotifyPropertyChanged(nameof(ResultColor));
|
||||
}
|
||||
}
|
||||
public string State
|
||||
{
|
||||
get
|
||||
{
|
||||
return state;
|
||||
}
|
||||
set
|
||||
{
|
||||
state = value;
|
||||
NotifyPropertyChanged(nameof(State));
|
||||
}
|
||||
}
|
||||
public string Scanner
|
||||
{
|
||||
get
|
||||
{
|
||||
return scanner;
|
||||
}
|
||||
set
|
||||
{
|
||||
scanner = value;
|
||||
NotifyPropertyChanged(nameof(Scanner));
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateLogText(string text, bool forceGuiUpdate = true)
|
||||
{
|
||||
logText = $"{text}{Environment.NewLine}{logText}";
|
||||
if (logText.Length > 2503)
|
||||
{
|
||||
logText = $"{logText.Substring(0, 2500)}...";
|
||||
}
|
||||
if (forceGuiUpdate)
|
||||
{
|
||||
LogText = logText;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private string historyText = "-";
|
||||
public string HistoryText
|
||||
{
|
||||
get
|
||||
{
|
||||
return historyText;
|
||||
}
|
||||
set
|
||||
{
|
||||
historyText = value;
|
||||
NotifyPropertyChanged(nameof(HistoryText));
|
||||
}
|
||||
}
|
||||
|
||||
private string logText = "Start";
|
||||
public string LogText
|
||||
{
|
||||
get
|
||||
{
|
||||
return logText;
|
||||
}
|
||||
set
|
||||
{
|
||||
logText = value;
|
||||
NotifyPropertyChanged(nameof(LogText));
|
||||
}
|
||||
}
|
||||
|
||||
public string Slot
|
||||
{
|
||||
get
|
||||
{
|
||||
return slot;
|
||||
}
|
||||
set
|
||||
{
|
||||
slot = value;
|
||||
NotifyPropertyChanged(nameof(Slot));
|
||||
}
|
||||
}
|
||||
public string Result
|
||||
{
|
||||
get
|
||||
{
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
result = value;
|
||||
NotifyPropertyChanged(nameof(Result));
|
||||
}
|
||||
}
|
||||
public PickingViewModel()
|
||||
{
|
||||
InitProgressBar();
|
||||
|
||||
}
|
||||
private void InitProgressBar()
|
||||
{
|
||||
ProgressBar = new List<ImageElement>();
|
||||
ProgressBar.Add(new ImageElement() { Name = "Init", Image = Ui.ProductionControls.Enums.Img.Waiting });
|
||||
ProgressBar.Add(new ImageElement() { Name = "Scan", Image = Ui.ProductionControls.Enums.Img.BarcodeScanner });
|
||||
ProgressBar.Add(new ImageElement() { Name = "Connect", Image = Ui.ProductionControls.Enums.Img.Plugin });
|
||||
ProgressBar.Add(new ImageElement() { Name = "Order data", Image = Ui.ProductionControls.Enums.Img.Cloud });
|
||||
ProgressBar.Add(new ImageElement() { Name = "Compare", Image = Ui.ProductionControls.Enums.Img.Compare });
|
||||
ProgressBar.Add(new ImageElement() { Name = "Compare Result", Image = Ui.ProductionControls.Enums.Img.Default });
|
||||
ProgressBar.Add(new ImageElement() { Name = "Scan Build", Image = Ui.ProductionControls.Enums.Img.BarcodeScanner });
|
||||
ProgressBar.Add(new ImageElement() { Name = "Scan Build Pressure", Image = Ui.ProductionControls.Enums.Img.BarcodeScanner });
|
||||
|
||||
}
|
||||
public List<ImageElement> ProgressBar { get; internal set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
|
||||
{
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void StartPicking(CancellationToken cancle, string scannerPort, int slotNr)
|
||||
{
|
||||
ScannerPort = scannerPort;
|
||||
SlotNr = slotNr;
|
||||
|
||||
var s = new Task(() => { PickingLoop(cancle); }, cancle);
|
||||
s.Start();
|
||||
}
|
||||
public enum PickingStateMachine
|
||||
{
|
||||
Init,
|
||||
WaitForScanning,
|
||||
ScanningDone,
|
||||
WaitForDetect,
|
||||
GetOrderDetails,
|
||||
Compare,
|
||||
MeterDone,
|
||||
MeterError,
|
||||
StartCom,
|
||||
WaitForBuildingMeterReady,
|
||||
WaitForBuildingPressureReady,
|
||||
}
|
||||
private PickingStateMachine sm = PickingStateMachine.Init;
|
||||
|
||||
private class BarScanner : IDisposable
|
||||
{
|
||||
private bool isRuning = false;
|
||||
public String Input = "";
|
||||
private String Port;
|
||||
private CancellationToken Cancellation;
|
||||
private Task WaitForScannerTask;
|
||||
public BarScanner(string port, CancellationToken cancellation)
|
||||
{
|
||||
Port = port;
|
||||
Cancellation = cancellation;
|
||||
}
|
||||
public void Start()
|
||||
{
|
||||
if (!isRuning)
|
||||
{
|
||||
if (Port == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WaitForScannerTask = new Task(() =>
|
||||
{
|
||||
using (var a = new SerialPort(Port))
|
||||
{
|
||||
try
|
||||
{
|
||||
a.Open();
|
||||
a.NewLine = "\r";
|
||||
while (true)
|
||||
{
|
||||
if (Cancellation.IsCancellationRequested)
|
||||
{
|
||||
isRuning = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Input = a.ReadLine();
|
||||
a.Close();
|
||||
isRuning = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Input = ex.Message;
|
||||
isRuning = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, Cancellation);
|
||||
WaitForScannerTask.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (WaitForScannerTask.Status != TaskStatus.Faulted && WaitForScannerTask.Status != TaskStatus.RanToCompletion && WaitForScannerTask.Status != TaskStatus.Canceled)
|
||||
{
|
||||
WaitForScannerTask.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void setState(string state)
|
||||
{
|
||||
State = state;
|
||||
UpdateLogText($"Status:{State}");
|
||||
}
|
||||
|
||||
public bool Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
|
||||
{
|
||||
using (var Batch = new MeterBatch())
|
||||
{
|
||||
|
||||
using (var meter = new GenesisMeter())
|
||||
{
|
||||
|
||||
meter.SetupFromConfigFile(SlotNr);
|
||||
Batch.AddMeter(meter);
|
||||
setState("Am Zähler anmelden");
|
||||
|
||||
if ((bool)meter.Login())
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
|
||||
var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested);
|
||||
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={Order}";
|
||||
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
|
||||
|
||||
var result = false;
|
||||
if (bool.TryParse(RetString, out result))
|
||||
{
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool RunCheck(Dictionary<uint, uint> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent, GenesisMeter meter)
|
||||
{
|
||||
setState($"Üperprüfe Parameter");
|
||||
var FrequencyReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
|
||||
if (FrequencyReadOut != Frequency)
|
||||
{
|
||||
|
||||
setState($"Falsche Frequenz! soll {Frequency}MHz ist {FrequencyReadOut}MHz");
|
||||
meter.WriteLog(State);
|
||||
return false;
|
||||
}
|
||||
//TODO: metersize check for bigger dn sizes!!!
|
||||
//var MeterSizeReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("GENESISFLOW_MeterSize"));
|
||||
//if (MeterSizeReadOut != MeterSize)
|
||||
//{
|
||||
// setState($"Meter Dn falsch! soll {MeterSize}DN ist {MeterSizeReadOut}DN");
|
||||
// meter.WriteLog(State);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
meter.WriteRegister("METROLOGYASST_PressurePresent", 0, true);
|
||||
var PressureReadOut = RegisterConverter.ConvertTo<bool>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
|
||||
if (!PressureReadOut)
|
||||
{
|
||||
meter.WriteRegister("METROLOGYASST_PressurePresent", 1, true);
|
||||
meter.WriteRegister("METROLOGYASST_PressureMeasure", 1, true);
|
||||
|
||||
|
||||
var pressure = RegisterConverter.ConvertTo<Int32>(meter.ReadRegister("METROLOGYASST_PressureMeasure"));
|
||||
setState($"Prüfe Drucksensor. {pressure}");
|
||||
|
||||
meter.WriteRegister("METROLOGYASST_PressureMeasure", 1, true);
|
||||
|
||||
|
||||
var pressureS = RegisterConverter.ConvertTo<Int32>(meter.ReadRegister("METROLOGYASST_PressureMeasure"));
|
||||
|
||||
|
||||
if (pressure - pressureS == 0)
|
||||
{
|
||||
PressureReadOut = false;
|
||||
|
||||
meter.WriteRegister("METROLOGYASST_PressurePresent", 0, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setState($"Pcb mit Drucksensor. Registerwert überschrieben");
|
||||
PressureReadOut = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (PressureReadOut != PressurePresent)
|
||||
{
|
||||
if (!PressurePresent)
|
||||
{
|
||||
setState($"Pcb mit Drucksensor. Laut Auftrag keine verbaut");
|
||||
meter.WriteLog(State);
|
||||
}
|
||||
else
|
||||
{
|
||||
setState($"Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden");
|
||||
meter.WriteLog(State);
|
||||
}
|
||||
//todo raus
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var item in checkAppsIdVersion)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
|
||||
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
|
||||
{
|
||||
setState($"Falsche FW, bitte Updaten AppId:{item.Key} sollte {item.Value} haben, hat aber {MeterFWApp.Version}");
|
||||
meter.WriteLog(State);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
setState($"Fehler beim auslesen der FW");
|
||||
meter.WriteLog(State);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
|
||||
Thread.Sleep(2500);
|
||||
meter.Logout();
|
||||
Thread.Sleep(2500);
|
||||
meter.ReLogin();
|
||||
|
||||
|
||||
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
|
||||
if (meter.PcbId != "18440026" && meter.PcbId != "193300058" && meter.PcbId != "194800276" && meter.PcbId != "201420255" && !storeRet.All(a => a.Equals(0)))
|
||||
{
|
||||
setState($"Filesystem corrupt");
|
||||
meter.WriteLog(State);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
setState($"Fehler beim überprüfen des Filesystems");
|
||||
meter.WriteLog(State);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private PickingCompareItem OrderDetails;
|
||||
private OrderOverViewCordonelWithPicking OrderOverview;
|
||||
private BarScanner barScanner;
|
||||
private string Order;
|
||||
private string PcbId;
|
||||
|
||||
|
||||
private string ScannerPort = "COM20";
|
||||
private int SlotNr = 1;
|
||||
//PickingState,PickingScanner,PickingSlot,PickingResult
|
||||
private void PickingLoop(CancellationToken token)
|
||||
{
|
||||
var converter = new System.Windows.Media.BrushConverter();
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
switch (sm)
|
||||
{
|
||||
case PickingStateMachine.Init:
|
||||
setState("Initialisierung");
|
||||
Slot = $"Inaktiv EP {SlotNr}";
|
||||
Scanner = $"Geschlossen {ScannerPort}";
|
||||
//CheckAllPorts?
|
||||
|
||||
sm = PickingStateMachine.StartCom;
|
||||
InitProgressBar();
|
||||
|
||||
break;
|
||||
case PickingStateMachine.StartCom:
|
||||
OrderDetails = null;
|
||||
OrderOverview = null;
|
||||
Scanner = $"Öfffne {ScannerPort}";
|
||||
//CheckAllPorts?
|
||||
barScanner = new BarScanner(ScannerPort, token);
|
||||
barScanner.Start();
|
||||
|
||||
sm = PickingStateMachine.WaitForScanning;
|
||||
var c = (System.Windows.Media.Brush)converter.ConvertFromString("Aquamarine");
|
||||
c.Freeze();
|
||||
ResultColor = c;
|
||||
ProgressBar.Where(n => n.Name == "Init").First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
ProgressBar.Where(n => n.Name == "Scan").First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
break;
|
||||
case PickingStateMachine.WaitForScanning:
|
||||
Scanner = $"Offen {ScannerPort}";
|
||||
setState($"Warte auf Scannereingabe({ScannerPort})");
|
||||
if (barScanner != null && !String.IsNullOrEmpty(barScanner.Input))
|
||||
{
|
||||
Order = barScanner.Input;
|
||||
Scanner = $"Geschlossen {ScannerPort}";
|
||||
barScanner = null;
|
||||
|
||||
|
||||
sm = PickingStateMachine.WaitForDetect;
|
||||
ProgressBar.Where(n => n.Name == "Scan").First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
ProgressBar.Where(n => n.Name == "Connect").First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case PickingStateMachine.WaitForDetect:
|
||||
using (var Batch = new MeterBatch())
|
||||
{
|
||||
|
||||
using (var tryMeter = new GenesisMeter())
|
||||
{
|
||||
try
|
||||
{
|
||||
setState($"Warte auf Pcb");
|
||||
Slot = $"Öffne EP {SlotNr}";
|
||||
tryMeter.SetupFromConfigFile(SlotNr);
|
||||
Batch.AddMeter(tryMeter);
|
||||
tryMeter.Logout();
|
||||
Log("Try to get PcbID");
|
||||
PcbId = tryMeter.GetPcbId();
|
||||
|
||||
var hasDetect = !string.IsNullOrEmpty(PcbId);
|
||||
|
||||
if (hasDetect)
|
||||
{
|
||||
|
||||
setState( $"Pcb gefunden {PcbId}");
|
||||
Log($"New PcbID detected {PcbId}");
|
||||
sm = PickingStateMachine.GetOrderDetails;
|
||||
ProgressBar.Where(n => n.Name == "Connect").First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
ProgressBar.Where(n => n.Name == "Order data").First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Slot = $"Keine Konnektivität EP {SlotNr}";
|
||||
Log($"No Meter found");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"Error occur.{ Environment.NewLine} {e.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case PickingStateMachine.GetOrderDetails:
|
||||
|
||||
setState($"Lade Auftragsdaten {Order}");
|
||||
var retCode = 0;
|
||||
var str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderOverview?ProductionOrderNumber={Order}&CheckPcbId={PcbId}", out retCode, 35000);
|
||||
if (retCode == 417)
|
||||
{
|
||||
sm = PickingStateMachine.MeterError;
|
||||
Result = "Keine Radio Parameter";
|
||||
UpdateLogText(Result, true);
|
||||
ProgressBar.Where(n => n.Name == "Compare Result").First().State = Ui.ProductionControls.Enums.ImgStatus.Error;
|
||||
ProgressBar.Where(n => n.Name == "Order data").First().State = Ui.ProductionControls.Enums.ImgStatus.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
OrderOverview = JsonConvert.DeserializeObject<OrderOverViewCordonelWithPicking>(str);
|
||||
OrderDetails = OrderOverview.PickingCompareItem;
|
||||
|
||||
if (OrderOverview.OrderOverViewCordonel.Count == OrderOverview.OrderOverViewCordonel.AssignedPicking)
|
||||
{
|
||||
Result = "Auftrag schon komplett";
|
||||
UpdateLogText(Result, true);
|
||||
sm = PickingStateMachine.MeterError;
|
||||
ProgressBar.Where(n => n.Name == "Compare Result").First().State = Ui.ProductionControls.Enums.ImgStatus.Error;
|
||||
ProgressBar.Where(n => n.Name == "Order data").First().State = Ui.ProductionControls.Enums.ImgStatus.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
setState($"Auftragsdaten geladen {Order}");
|
||||
|
||||
sm = PickingStateMachine.Compare;
|
||||
ProgressBar.Where(n => n.Name == "Order data").First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
ProgressBar.Where(n => n.Name == "Compare").First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case PickingStateMachine.Compare:
|
||||
//Compare
|
||||
setState($"Vergleiche Auftragsdaten {Order} mit Pcb Eigenschaften");
|
||||
|
||||
var minDate = DateTime.Now;
|
||||
minDate = minDate.AddMonths(OrderOverview.OrderOverViewCordonel.Count < 5 ? -9 : -3);
|
||||
setState($"Register wurde am {OrderOverview.KitronProductionDate } hergestellt, für diesen Auftrag ist muss das Register vor {minDate} hergestellt worden sein");
|
||||
if (OrderOverview.KitronProductionDate <= minDate)
|
||||
{
|
||||
setState($"Fehlgeschlagen Register ist zu alt! Bitte QS informieren. KitronProductionDate:{OrderOverview.KitronProductionDate }");
|
||||
|
||||
// sm = PickingStateMachine.MeterError;
|
||||
|
||||
var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FFFF00");
|
||||
b.Freeze();
|
||||
ResultColor = b;
|
||||
|
||||
//break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (Compare(OrderDetails.CheckAppsIdVersion, OrderDetails.FrequencyIndicator, OrderDetails.MeterSize, OrderDetails.PressurePresent))
|
||||
{
|
||||
//erfolg anzeigen und weiter
|
||||
ProgressBar.Where(n => n.Name == "Compare Result").First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
ProgressBar.Where(n => n.Name == "Compare").First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
sm = PickingStateMachine.MeterDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = PickingStateMachine.MeterError;
|
||||
ProgressBar.Where(n => n.Name == "Compare Result").First().State = Ui.ProductionControls.Enums.ImgStatus.Error;
|
||||
ProgressBar.Where(n => n.Name == "Compare").First().State = Ui.ProductionControls.Enums.ImgStatus.Error;
|
||||
var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000");
|
||||
b.Freeze();
|
||||
ResultColor = b;
|
||||
}
|
||||
break;
|
||||
case PickingStateMachine.MeterError:
|
||||
OrderDetails = null;
|
||||
OrderOverview = null;
|
||||
setState($"Vergleich abgeschlossen:{State}");
|
||||
Result = $"Vergleich fertig fehlgeschlagen";
|
||||
Thread.Sleep(10000);
|
||||
sm = PickingStateMachine.StartCom;
|
||||
|
||||
break;
|
||||
case PickingStateMachine.MeterDone:
|
||||
|
||||
|
||||
setState($"Vergleich abgeschlossen warten auf Montage Rückmeldung");
|
||||
Result = $"Pcb {PcbId} wurde dem Auftrag {Order} hinzugefügt";
|
||||
|
||||
Scanner = $"Öfffne {ScannerPort}";
|
||||
barScanner = new BarScanner(ScannerPort, token);
|
||||
HistoryText = $"{HistoryText} {Environment.NewLine}{Order}({OrderOverview.OrderOverViewCordonel.AssignedPicking + 1 }/{ OrderOverview.OrderOverViewCordonel.Count})";
|
||||
barScanner.Start();
|
||||
sm = PickingStateMachine.WaitForBuildingMeterReady;
|
||||
Thread.Sleep(10000);
|
||||
//CheckAllPorts?
|
||||
ProgressBar.Where(n => n.Name == "Scan Build").First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case PickingStateMachine.WaitForBuildingMeterReady:
|
||||
|
||||
if (barScanner != null && !String.IsNullOrEmpty(barScanner.Input))
|
||||
{
|
||||
|
||||
if (barScanner.Input == "%Cordonel_SAP_100%")
|
||||
{
|
||||
ProgressBar.Where(n => n.Name == "Scan Build").First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
|
||||
var url = ServiceUrls.MeterProcessStateUrl();
|
||||
url = url + $"setSapState?PcbID={PcbId}&code=100&version=1";
|
||||
try
|
||||
{
|
||||
LocalWebRequest.PostRequestAsync(url);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (OrderDetails.PressurePresent)
|
||||
{
|
||||
barScanner = new BarScanner(ScannerPort, token);
|
||||
|
||||
barScanner.Start();
|
||||
setState($"Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen");
|
||||
sm = PickingStateMachine.WaitForBuildingPressureReady;
|
||||
ProgressBar.Where(n => n.Name == "Scan Build Pressure").First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
|
||||
}
|
||||
else
|
||||
{
|
||||
setState($"Montage Rückmeldung erhalten, auftrag Scannen");
|
||||
sm = PickingStateMachine.StartCom;
|
||||
Thread.Sleep(5000);
|
||||
|
||||
|
||||
var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14");
|
||||
b.Freeze();
|
||||
ResultColor = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PickingStateMachine.WaitForBuildingPressureReady:
|
||||
|
||||
if (barScanner != null && !String.IsNullOrEmpty(barScanner.Input))
|
||||
{
|
||||
|
||||
if (barScanner.Input == "%Cordonel_SAP_101%")
|
||||
{
|
||||
var url = ServiceUrls.MeterProcessStateUrl();
|
||||
url = url + $"setSapState?PcbID={PcbId}&code=101&version=1";
|
||||
try
|
||||
{
|
||||
LocalWebRequest.PostRequestAsync(url);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14");
|
||||
b.Freeze();
|
||||
ResultColor = b;
|
||||
Thread.Sleep(5000);
|
||||
setState($"Montage Rückmeldung erhalten, auftrag Scannen");
|
||||
|
||||
sm = PickingStateMachine.StartCom;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Log(string v)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
55
Common/CordonelAssemblyLine/Picking.xaml
Normal file
55
Common/CordonelAssemblyLine/Picking.xaml
Normal file
@ -0,0 +1,55 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CordonelAssemblyLine"
|
||||
xmlns:ProductionControls="clr-namespace:Ui.ProductionControls;assembly=Ui.ProductionControls" x:Class="CordonelAssemblyLine.Picking"
|
||||
mc:Ignorable="d"
|
||||
Title="Kommissionierung" Height="450" Width="883.713" Background="Aquamarine" Loaded="Window_Loaded" FontSize="18" >
|
||||
<Grid Background="{Binding ResultColor}" Margin="0,0,18,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="150*" MinHeight="150"/>
|
||||
<RowDefinition Height="28"/>
|
||||
<RowDefinition Height="90"/>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="25*"/>
|
||||
<ColumnDefinition Width="22*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Content="Kommissionierung Cordonel" HorizontalAlignment="Left" Margin="11,0,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Height="36" Width="366" Grid.ColumnSpan="4" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="Scanner:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="36" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding Scanner, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="11,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Height="36" Width="126" Grid.ColumnSpan="2" />
|
||||
<Label Background="{Binding ResultColor}" Content="Ep:" HorizontalAlignment="Left" Margin="12,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="2" Height="36" Width="115" Grid.ColumnSpan="2" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding Slot, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="13,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="3" Height="36" Width="115" Grid.ColumnSpan="3" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="Medlung:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="36" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding State, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="37,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Height="36" Width="332" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="Ergebnis:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="36" Width="115" />
|
||||
|
||||
<Label Background="{Binding ResultColor}" Content="{Binding Result, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="11,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Height="36" Width="359" />
|
||||
<TextBlock Background="{Binding ResultColor}" Text="{Binding LogText, UpdateSourceTrigger=PropertyChanged}" FontSize="10" Grid.ColumnSpan="3" Grid.Column="1" HorizontalAlignment="Left" Height="218" Margin="11,10,0,-19" Grid.Row="4" TextWrapping="Wrap" VerticalAlignment="Top" Width="358" Grid.RowSpan="3"/>
|
||||
<Label Background="{Binding ResultColor}" Content="Log:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Grid.Row="4" Grid.Column="0" Height="36" Width="115" />
|
||||
<Label Background="{Binding ResultColor}" Content="Historie:" HorizontalAlignment="Left" Margin="22,9,0,0" VerticalAlignment="Top" Grid.Column="5" Height="36" Width="288" Grid.ColumnSpan="2" />
|
||||
<TextBlock Background="{Binding ResultColor}" Text="{Binding HistoryText, UpdateSourceTrigger=PropertyChanged}" FontSize="10" Grid.ColumnSpan="2" Grid.Column="5" HorizontalAlignment="Left" Height="313" Margin="22,10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="315" Grid.RowSpan="4"/>
|
||||
|
||||
<ProductionControls:ctlPictureProgressBar Name="progressBar" HorizontalAlignment="Left" Height="100" Margin="11,0,0,-44" Grid.Row="5" VerticalAlignment="Top" Width="837" Grid.RowSpan="2" Grid.ColumnSpan="7"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
52
Common/CordonelAssemblyLine/Picking.xaml.cs
Normal file
52
Common/CordonelAssemblyLine/Picking.xaml.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using CordonelAssemblyLine.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CordonelAssemblyLine
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Picking.xaml
|
||||
/// </summary>
|
||||
public partial class Picking : Window
|
||||
{
|
||||
|
||||
PickingViewModel Model = new PickingViewModel();
|
||||
CancellationToken GlobalCancellationToken;
|
||||
|
||||
string ScannerPort;
|
||||
int SlotNr;
|
||||
public Picking(CancellationToken globalCancellationToken, string scannerPort, int slotNr)
|
||||
{
|
||||
ScannerPort = scannerPort;
|
||||
SlotNr = slotNr;
|
||||
GlobalCancellationToken = globalCancellationToken;
|
||||
DataContext = Model;
|
||||
InitializeComponent();
|
||||
this.Left = SystemParameters.VirtualScreenLeft;
|
||||
this.Top = SystemParameters.VirtualScreenTop +250;
|
||||
this.Height = SystemParameters.VirtualScreenHeight * 0.90;
|
||||
this.Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth;
|
||||
}
|
||||
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
Model.StartPicking(GlobalCancellationToken, ScannerPort, SlotNr);
|
||||
progressBar.AddRange(Model.ProgressBar);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Common/CordonelAssemblyLine/Properties/AssemblyInfo.cs
Normal file
55
Common/CordonelAssemblyLine/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CordonelAssemblyLine")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CordonelAssemblyLine")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
Common/CordonelAssemblyLine/Properties/Resources.Designer.cs
generated
Normal file
71
Common/CordonelAssemblyLine/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CordonelAssemblyLine.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CordonelAssemblyLine.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Common/CordonelAssemblyLine/Properties/Resources.resx
Normal file
117
Common/CordonelAssemblyLine/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
Common/CordonelAssemblyLine/Properties/Settings.Designer.cs
generated
Normal file
30
Common/CordonelAssemblyLine/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CordonelAssemblyLine.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Common/CordonelAssemblyLine/Properties/Settings.settings
Normal file
7
Common/CordonelAssemblyLine/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
4
Common/CordonelAssemblyLine/packages.config
Normal file
4
Common/CordonelAssemblyLine/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" />
|
||||
</packages>
|
||||
18
Common/CordonelPreadjustmentUi/Const/DataErrorCodes.cs
Normal file
18
Common/CordonelPreadjustmentUi/Const/DataErrorCodes.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Const
|
||||
{
|
||||
public static class DataErrorCodes
|
||||
{
|
||||
public const Int32 NoError = 0;
|
||||
public const Int32 Pulsewidth = 0x0F0D;
|
||||
public const Int32 Amplitude = 0x0F0E;
|
||||
public const Int32 TofOutOfRange = 0x0F0F;
|
||||
public const Int32 DeltaTimeOfFlight = 0x0F10;
|
||||
public const Int32 TofTimeout = 0x0F11;
|
||||
public const Int32 Unknown = 0xFFFF;
|
||||
}
|
||||
}
|
||||
59
Common/CordonelPreadjustmentUi/Const/Formats.cs
Normal file
59
Common/CordonelPreadjustmentUi/Const/Formats.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Const
|
||||
{
|
||||
public static class Formats
|
||||
{
|
||||
#region Format strings for display
|
||||
#region Format strings for "Decoded Data"-display
|
||||
public const String TofDispString = "000000.00000000";
|
||||
public const String HccCorrectionValue = "0.00000";
|
||||
public const String PwDispString = "0.00";
|
||||
public const String AmpDispUpString = "000.0";
|
||||
public const String AmpDispDownString = "-000.0";
|
||||
public const String TempDispString = "0.00";
|
||||
public const String Flow = "0.00";
|
||||
#endregion
|
||||
#region Format strings for "Mean"-Display
|
||||
public const String MeanDispString = "0.00";
|
||||
#endregion
|
||||
#region Format strings for "Std-Deviation"-Display
|
||||
public const String StdDevDispString = "0.00";
|
||||
#endregion
|
||||
#endregion
|
||||
#region Format strings for CSV-Logging
|
||||
public const String TofLogString = "000000.00000000";
|
||||
public const String PwLogString = "0.00";
|
||||
public const String AmpLogString = "000.0";
|
||||
public const String TempLogString = "0.00";
|
||||
public const String CsvDateTimeLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
||||
public const String ErrorLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
||||
public const String RawDataDateTimeLogString = "yyyy-MM-dd HH:mm:ss:ff ";
|
||||
public const String CsvIndexLogString = "{0:D8}";
|
||||
public const String CsvFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
public const String TxtFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
public const String LogFileDateTimeString = "yyyyMMdd_HHmmss";
|
||||
public const String HeaderFileDateTimeString = "yyyy-MM-dd HH:mm:ss";
|
||||
public const String StatusDateTimeString = "HH:mm:ss";
|
||||
#endregion
|
||||
#region Date/ Time for raw file naming
|
||||
public const String RawFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
#endregion
|
||||
#region Date/ Time for image files naming
|
||||
public const String ImageFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
#endregion
|
||||
#region Date/ Time for reports
|
||||
public const String ReportDateTimeTitleString = "yyyy-MM-dd";
|
||||
public const String PdfDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
#endregion
|
||||
#region Format for GP30 first hit level adjustments
|
||||
public const String FirstHitLevelVoltage = "000.00";
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
273
Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj
Normal file
273
Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj
Normal file
@ -0,0 +1,273 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Unc</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>\\sla12file\auftrag\Aktuelle Anwendungen\CordonelPreadjustmentUiBETAV2\</InstallUrl>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>5CDF12D148BC9A7C8BD8C3C6BA581A97F25F3DDE</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>CordonelPreadjustmentUi_1_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PdfSharp, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PdfSharp.Charting, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.Charting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GenerateReport.cs" />
|
||||
<Compile Include="Helper\ActivityCheckMultiPathDataLogContainer.cs" />
|
||||
<Compile Include="Helper\Extensions\CuncurentBagExt.cs" />
|
||||
<Compile Include="Helper\Extensions\ListDoubleCalculationExt.cs" />
|
||||
<Compile Include="Helper\MultiPathDataLogContainer.cs" />
|
||||
<Compile Include="Const\DataErrorCodes.cs" />
|
||||
<Compile Include="Const\Formats.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MeterStateControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MeterStateControl.Designer.cs">
|
||||
<DependentUpon>MeterStateControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MsgBox.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MsgBox.Designer.cs">
|
||||
<DependentUpon>MsgBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Parameters\FlushParams.cs" />
|
||||
<Compile Include="PreAdjustmentControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PreAdjustmentControl.Designer.cs">
|
||||
<DependentUpon>PreAdjustmentControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PreAdjustmentSettingsContainer.cs" />
|
||||
<Compile Include="Processes\Actions\FlushProcess.cs" />
|
||||
<Compile Include="Processes\Actions\PrepareTestProcess.cs" />
|
||||
<Compile Include="Processes\Actions\AmplitudeTestProcess.cs" />
|
||||
<Compile Include="Processes\Actions\OffsetTestProcess.cs" />
|
||||
<Compile Include="Processes\Actions\CompletionProcess.cs" />
|
||||
<Compile Include="Processes\Actions\TemperatureCalibrationProcess.cs" />
|
||||
<Compile Include="Processes\Actions\PreparationProcess.cs" />
|
||||
<Compile Include="Processes\BaseProcess.cs" />
|
||||
<Compile Include="Processes\IProcess.cs" />
|
||||
<Compile Include="Processes\Actions\LoginProcess.cs" />
|
||||
<Compile Include="Processes\ProcessProgress.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TempMeterStateControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Watcher\IWatcher.cs" />
|
||||
<Compile Include="Watcher\IWatcherNeedCalibrationData.cs" />
|
||||
<Compile Include="Watcher\TempWatcher.cs" />
|
||||
<Compile Include="ZeroFlowGenesisMeter.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MeterStateControl.resx">
|
||||
<DependentUpon>MeterStateControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MsgBox.resx">
|
||||
<DependentUpon>MsgBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PreAdjustmentControl.resx">
|
||||
<DependentUpon>PreAdjustmentControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="..\Ui\GenesisToolBox\meterconfig.json">
|
||||
<Link>meterconfig.json</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="app.config" />
|
||||
<None Include="CordonelPreadjustmentUi_1_TemporaryKey.pfx" />
|
||||
<None Include="CordonelPreadjustmentUi_TemporaryKey.pfx" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonCore.Configuration\CommonCore.Configuration.csproj">
|
||||
<Project>{9EB1F659-6F73-4F65-BCAB-4114FD94F5FC}</Project>
|
||||
<Name>CommonCore.Configuration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CommonCore\CommonCore.csproj">
|
||||
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
|
||||
<Name>CommonCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\Interfaces\Ports\PortCore\PortCore.csproj">
|
||||
<Project>{2E139F63-B6FE-4EA9-A098-85364FE9B26C}</Project>
|
||||
<Name>PortCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\DataPackages\DataPackages.csproj">
|
||||
<Project>{0E524D43-7B66-45CD-AA74-41D51AFC3D99}</Project>
|
||||
<Name>DataPackages</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\GenesisConfig\GenesisConfig.csproj">
|
||||
<Project>{F013A56B-7BE6-4852-9CD8-B971CD1ADD0C}</Project>
|
||||
<Name>GenesisConfig</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
|
||||
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
||||
<Name>GenesisCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\Protocols\StreamingProtocol\StreamingProtocol.csproj">
|
||||
<Project>{29617814-313E-409E-AA5D-59C78A9D4DF1}</Project>
|
||||
<Name>StreamingProtocol</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\Registers\Registers.csproj">
|
||||
<Project>{F4AAF7E6-7333-4284-B735-E32DEB076C64}</Project>
|
||||
<Name>Registers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\WaterMeterCore\WaterMeterCore.csproj">
|
||||
<Project>{8203ABB8-38E5-472E-A742-33F38B7A74A6}</Project>
|
||||
<Name>WaterMeterCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\WaterMeterCore\WaterMeterRegisters\WaterMeterRegisters.csproj">
|
||||
<Project>{26afcf1e-1287-48b8-a506-32b1e8a0dd0e}</Project>
|
||||
<Name>WaterMeterRegisters</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logic.PrdoctionToProductMapper\Logic.ProductionToProductMapper.csproj">
|
||||
<Project>{D0C859D9-D55E-4E85-AC50-0FF31B1CE50D}</Project>
|
||||
<Name>Logic.ProductionToProductMapper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Metrology\Measurements\Measurements.csproj">
|
||||
<Project>{6CCDB656-C676-4360-BABA-C4596AAD175D}</Project>
|
||||
<Name>Measurements</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
||||
<Project>{A33E3C6D-EAAE-4A20-A0EE-F9E6922FD029}</Project>
|
||||
<Name>SoftwareAccessHelper</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\ErrorImage.gif" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Meter.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\NormalImage.gif" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\QuestionImage.gif" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Sensus-Xylem-lockup.jpg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\thermometer.GIF" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
419
Common/CordonelPreadjustmentUi/GenerateReport.cs
Normal file
419
Common/CordonelPreadjustmentUi/GenerateReport.cs
Normal file
@ -0,0 +1,419 @@
|
||||
using CordonelPreadjustmentUi.Const;
|
||||
using PdfSharp.Drawing;
|
||||
using PdfSharp.Drawing.Layout;
|
||||
using PdfSharp.Pdf;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Xylem.Common.Ui.CordonelPreadjustmentUi
|
||||
{
|
||||
public static class GenerateReport
|
||||
{
|
||||
private static class ReportParams
|
||||
{
|
||||
public const Int32 LogoXPos = 500;
|
||||
public const Int32 LogoYPos = 10;
|
||||
public const Int32 LogoXSize = 50;
|
||||
public const Int32 LogoYSize = 25;
|
||||
public const Int32 HeadlineXPos = 0;
|
||||
public const Int32 HeadlineYPos = 50;
|
||||
public const Int32 Headline2XPos = 128;
|
||||
public const Int32 Headline2YPos = 113;
|
||||
public const Int32 PageNumberXPosition = 220;
|
||||
public const Int32 PageNumberYPosition = -20;
|
||||
public const Int32 StandardTextXPos = 128;
|
||||
public const Int32 StandardTextYPos = 150;
|
||||
public const Int32 ImageXSize = 400;
|
||||
public const Int32 ImageYSize = 240;
|
||||
public const Int32 ImageXPos = 125;
|
||||
public const Int32 ImageYPos = 135;
|
||||
public const Int32 IntroductionXPos = 100;
|
||||
public const Int32 IntroductionYPos = 600;
|
||||
public static readonly XFont font20 = new XFont("Eras Bold ITC ", 20, XFontStyle.Bold);
|
||||
public static readonly XFont font14 = new XFont("Calibri", 14, XFontStyle.Bold);
|
||||
public static readonly XFont font12 = new XFont("Calibri", 12, XFontStyle.BoldItalic);
|
||||
public static readonly XFont fontStandard = new XFont("Calibri", 10, XFontStyle.Regular);
|
||||
public static readonly XFont fontSmall = new XFont("Calibri", 9, XFontStyle.Regular);
|
||||
public static readonly XFont fontVerySmall = new XFont("Calibri", 8, XFontStyle.Regular);
|
||||
public const Int32 Column1 = 0;
|
||||
public const Int32 Column2 = 1;
|
||||
public const Int32 Column3 = 2;
|
||||
public const Int32 Column4 = 3;
|
||||
public const Int32 Column5 = 4;
|
||||
}
|
||||
public static void GenerateReturnNote(int meterIndex, String pcbID, String reason, String logData, CultureInfo culture, Image Logo)
|
||||
{
|
||||
String UserName = Environment.UserName;
|
||||
DateTime Date = DateTime.Now;
|
||||
String Content = String.Empty;
|
||||
String Header = String.Empty;
|
||||
String Filename = String.Empty;
|
||||
String Headline = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
if (culture == CultureInfo.CreateSpecificCulture("de-DE"))
|
||||
{
|
||||
Headline = "Rückläuferschein";
|
||||
Header = $"ZÄHLER{meterIndex} fehlgeschlagen.\nLeiterplattennummer:\t{pcbID}\nGrund:\t{reason}\nDatum:\t{Date.ToString(Formats.HeaderFileDateTimeString)}\nBenutzername:\t{UserName}\n";
|
||||
Filename = $"Rückläuferschein_ZÄHLER{meterIndex}_{Date.ToString(Formats.LogFileDateTimeString, culture)}.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
Headline = "Return note";
|
||||
Header = $"METER{meterIndex} failed.\nPCB-ID\t{pcbID}\nReason:\t{reason}\nDate:\t{Date.ToString(Formats.HeaderFileDateTimeString)}\nUser name:\t{UserName}\n";
|
||||
Filename = $"Return note_METER{meterIndex}_{Date.ToString(Formats.LogFileDateTimeString, culture)}.pdf";
|
||||
}
|
||||
|
||||
using (PdfDocument Report = new PdfDocument())
|
||||
{
|
||||
MemoryStream strm = new MemoryStream();
|
||||
Logo.Save(strm, System.Drawing.Imaging.ImageFormat.Png);
|
||||
|
||||
XImage xLogo = XImage.FromStream(strm);
|
||||
|
||||
ReportPages.ReturnNote(Headline, $"{Header}\n\n{logData}", Report, xLogo);
|
||||
SavePdf(Report, $@"..\{Filename}", culture);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
MessageBox.Show("Return note generation failed", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static Boolean SavePdf(PdfDocument document, String fullpath, CultureInfo culture)
|
||||
{
|
||||
Boolean SavingOK = false;
|
||||
try
|
||||
{
|
||||
var t = new Task(() =>
|
||||
{
|
||||
document.Save(@fullpath);
|
||||
System.Diagnostics.Process.Start(@fullpath);
|
||||
});
|
||||
t.Start();
|
||||
SavingOK = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//ErrorLog.Log(LogErrReason.Exeption, "Files.SavePdf() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty, culture);
|
||||
}
|
||||
|
||||
return SavingOK;
|
||||
}
|
||||
|
||||
public static class ReportPages
|
||||
{
|
||||
public static void Logfile(String text, PdfDocument report, XImage logo)
|
||||
{
|
||||
#region CA1062
|
||||
if ((text == null) || (report == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
const Int32 LinesPerPage = 60;
|
||||
String[] Lines = text.Split('\n');
|
||||
Double NumberOfNewlines = (double)Lines.Count();
|
||||
Double aux = (NumberOfNewlines / LinesPerPage);
|
||||
Int32 NumberOfPages = (Int32)Math.Ceiling(aux);
|
||||
String[] StringArray = new String[NumberOfPages];
|
||||
|
||||
for (Int32 i = 0; i < (NumberOfNewlines); i++)
|
||||
{
|
||||
Int32 Pageindex = (Int32)Math.Floor(((Double)i / LinesPerPage));
|
||||
StringArray[Pageindex] = StringArray[Pageindex] + Lines[i] + "\n";
|
||||
}
|
||||
|
||||
//formatter.DrawString(text, ReportParams.fontStandard, XBrushes.Black, new XRect(50, 100, 0, 0), XStringFormats.TopLeft);
|
||||
//Logfile.DrawString(text, ReportParams.fontStandard, XBrushes.Black, new XRect(10, 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
|
||||
for (Int32 i = 0; i < NumberOfPages; i++)
|
||||
{
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics Logfile = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatter = new XTextFormatter(Logfile);
|
||||
var layoutRectangle = new XRect(1, 1, 1, 1);
|
||||
Logfile.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
formatter.DrawString(StringArray[i], ReportParams.fontSmall, XBrushes.Black, new XRect(50, 70, 600, 20), XStringFormats.TopLeft);
|
||||
}
|
||||
|
||||
}
|
||||
public static UInt16 TitlePage(UInt16 pagecounter, String introduction, String title, String date, String operatorName, String serialNo, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
#region CA1062
|
||||
if (report == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endregion
|
||||
try
|
||||
{
|
||||
#region Page "TITLEPAGE"
|
||||
#region Prepare data
|
||||
if (pagecounter < UInt16.MaxValue)
|
||||
{
|
||||
pagecounter++; // Pagenumber not on titlepage
|
||||
}
|
||||
|
||||
report.Info.Title = title;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics Titlepage = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatter = new XTextFormatter(Titlepage);
|
||||
var layoutRectangle = new XRect(1, 1, 1, 1);
|
||||
Titlepage.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
Titlepage.DrawString($"{title}\n\n\n", ReportParams.font20, XBrushes.Black, new XRect(0, -200, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString(date, ReportParams.font14, XBrushes.Black, new XRect(0, -100, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString("by", ReportParams.font12, XBrushes.Black, new XRect(0, -50, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString(operatorName, ReportParams.font14, XBrushes.Black, new XRect(0, 0, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString($"Serial number: {serialNo}", ReportParams.font14, XBrushes.Black, new XRect(0, 100, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
formatter.DrawString(introduction, ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.IntroductionXPos, ReportParams.IntroductionYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
//ErrorLog.Log(LogErrReason.Exeption, "ReportPages.TitlePage() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty, culture);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return value
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static void ReturnNote(String headline, String text, PdfDocument report, XImage logo)
|
||||
{
|
||||
#region CA1062
|
||||
if ((text == null) || (report == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
const Int32 LinesPerPage = 70;
|
||||
String[] Lines = text.Split('\n');
|
||||
Double NumberOfNewlines = (Double)Lines.Count();
|
||||
Double aux = (NumberOfNewlines / LinesPerPage);
|
||||
Int32 NumberOfPages = (Int32)Math.Ceiling(aux);
|
||||
String[] StringArray = new String[NumberOfPages];
|
||||
|
||||
for (Int32 i = 0; i < (NumberOfNewlines); i++)
|
||||
{
|
||||
Int32 Pageindex = (Int32)Math.Floor(((Double)i / LinesPerPage));
|
||||
StringArray[Pageindex] = $"{StringArray[Pageindex]}{Lines[i]}\n";
|
||||
}
|
||||
|
||||
//formatter.DrawString(text, ReportParams.fontStandard, XBrushes.Black, new XRect(50, 100, 0, 0), XStringFormats.TopLeft);
|
||||
//Logfile.DrawString(text, ReportParams.fontStandard, XBrushes.Black, new XRect(10, 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
|
||||
for (Int32 i = 0; i < NumberOfPages; i++)
|
||||
{
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics Logfile = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatter = new XTextFormatter(Logfile);
|
||||
var layoutRectangle = new XRect(1, 1, 1, 1);
|
||||
Logfile.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
if (i == 0)
|
||||
{
|
||||
formatter.DrawString(headline, ReportParams.font20, XBrushes.Black, new XRect(250, 20, 600, 20), XStringFormats.TopLeft);
|
||||
formatter.DrawString(StringArray[i], ReportParams.fontVerySmall, XBrushes.Black, new XRect(60, 50, 600, pdfPage.Height.Point - 30), XStringFormats.TopLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
formatter.DrawString(StringArray[i], ReportParams.fontVerySmall, XBrushes.Black, new XRect(50, 70, 600, pdfPage.Height.Point - 10), XStringFormats.TopLeft);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Int32 Settings(Int32 pagecounter, String textSoftwareVersion, String[] columns, Boolean enable, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
#region CA1062
|
||||
if ((report == null) || (columns == null))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endregion
|
||||
try
|
||||
{
|
||||
#region Page "SETTINGS"
|
||||
#region Generate page
|
||||
if (pagecounter < Int32.MaxValue)
|
||||
{
|
||||
pagecounter++;
|
||||
}
|
||||
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics Gp30Settings = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterGp30Settings = new XTextFormatter(Gp30Settings);
|
||||
var layoutRectangleGp30Settings = new XRect(1, 1, 1, 1);
|
||||
#endregion
|
||||
#region Set Image/ Logo
|
||||
Gp30Settings.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
#endregion
|
||||
#region Headline1
|
||||
Gp30Settings.DrawString("Settings", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Headline2 (first)
|
||||
Gp30Settings.DrawString("Software Version", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Data
|
||||
formatterGp30Settings.DrawString(textSoftwareVersion, ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region GP30 settings
|
||||
if (enable)
|
||||
{
|
||||
#region Headline2
|
||||
Gp30Settings.DrawString("Values obtained from register readout", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos + 150, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Data/ text
|
||||
formatterGp30Settings.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos, ReportParams.StandardTextYPos + 150, 400, 200), XStringFormats.TopLeft);
|
||||
formatterGp30Settings.DrawString(columns[ReportParams.Column2], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 140, ReportParams.StandardTextYPos + 150, 400, 200), XStringFormats.TopLeft);
|
||||
formatterGp30Settings.DrawString(columns[ReportParams.Column3], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 190, ReportParams.StandardTextYPos + 150, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Set page number
|
||||
Gp30Settings.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
//ErrorLog.Log(LogErrReason.Exeption, "ReportPages.Settings() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty, culture);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return values
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static UInt16 DecodedData(UInt16 pagecounter, String[] columns, Boolean enable, Boolean enableColumn2, Boolean enableColumn3, Boolean enableColumn4, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
const Int32 WaitingTime = 100;
|
||||
|
||||
#region CA1062
|
||||
if ((report == null) || (columns == null))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
#region Page "MEAN VALUES"
|
||||
if ((enable) && ((enableColumn2) || (enableColumn3) || (enableColumn4)))
|
||||
{
|
||||
#region All PATHs
|
||||
#region Prepare Data
|
||||
if (pagecounter < UInt16.MaxValue)
|
||||
{
|
||||
pagecounter++;
|
||||
}
|
||||
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics XMean = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterData = new XTextFormatter(XMean);
|
||||
var layoutRectangleData = new XRect(1, 1, 1, 1);
|
||||
int Xoffset = -20;
|
||||
#endregion
|
||||
#region Headline1
|
||||
XMean.DrawString("Decoded Data", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Set text (First column)
|
||||
if (!enableColumn2)
|
||||
{
|
||||
Xoffset = Xoffset + 40;
|
||||
}
|
||||
|
||||
if (!enableColumn3)
|
||||
{
|
||||
Xoffset = Xoffset + 40;
|
||||
}
|
||||
|
||||
if (!enableColumn4)
|
||||
{
|
||||
Xoffset = Xoffset + 40;
|
||||
}
|
||||
|
||||
formatterData.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 120;
|
||||
#endregion
|
||||
#region Set Image/Logo
|
||||
XMean.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
#endregion
|
||||
#region Add pagenumber
|
||||
XMean.DrawString("Page " + pagecounter.ToString(culture), ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
#region PATH0
|
||||
if (enableColumn2)
|
||||
{
|
||||
Thread.Sleep(WaitingTime);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH1", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column2], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 110;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region PATH1
|
||||
if (enableColumn3)
|
||||
{
|
||||
Thread.Sleep(WaitingTime);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH2", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column3], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 110;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region PATH2
|
||||
if (enableColumn4)
|
||||
{
|
||||
Thread.Sleep(WaitingTime);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH3", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column4], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
//ErrorLog.Log(LogErrReason.Exeption, "ReportPages.DecodedData() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty, culture);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return values
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Helper
|
||||
{
|
||||
public class ActivityCheckMultiPathDataLogContainer<T> : MultiPathDataLogContainer<T>
|
||||
{
|
||||
private ConcurrentDictionary<Int32, T> PathValueDic = new ConcurrentDictionary<Int32, T>();
|
||||
private DateTimeOffset? LastUpdate = null;
|
||||
public ActivityCheckMultiPathDataLogContainer(int NumberOfPaths) : base(NumberOfPaths)
|
||||
{
|
||||
setUpdateTime();
|
||||
}
|
||||
|
||||
|
||||
public double GetSecondsSinceLastUpdate()
|
||||
{
|
||||
if (!LastUpdate.HasValue)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (DateTimeOffset.UtcNow - LastUpdate.Value).TotalSeconds;
|
||||
}
|
||||
|
||||
private void setUpdateTime()
|
||||
{
|
||||
LastUpdate = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public new void Update(Int32? Path = null, T value = default(T))
|
||||
{
|
||||
setUpdateTime();
|
||||
base.Update(Path, value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xylem.Common.Ui.CordonelPreadjustmentUi.Helper.Extensions
|
||||
{
|
||||
internal static class ConcurrentQueueExtensions
|
||||
{
|
||||
public static void Clear<T>(this ConcurrentQueue<T> queue)
|
||||
{
|
||||
T item;
|
||||
while (queue.TryDequeue(out item))
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Helper.Extensions
|
||||
{
|
||||
public static class ListDoubleCalculationExt
|
||||
{
|
||||
public static double Mean(this List<double> values)
|
||||
{
|
||||
#region CA1062
|
||||
if (values == null)
|
||||
return 0;
|
||||
#endregion
|
||||
|
||||
return values.Count == 0 ? 0 : values.Mean(0, values.Count);
|
||||
}
|
||||
|
||||
public static double Mean(this List<double> values, int start, int end)
|
||||
{
|
||||
#region CA1062
|
||||
if (values == null)
|
||||
return 0;
|
||||
#endregion
|
||||
double s = 0;
|
||||
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
s += values[i];
|
||||
}
|
||||
|
||||
return s / (end - start);
|
||||
}
|
||||
|
||||
public static double Variance(this List<double> values)
|
||||
{
|
||||
#region CA1062
|
||||
if (values == null)
|
||||
return 0;
|
||||
#endregion
|
||||
|
||||
return values.Variance(values.Mean(), 0, values.Count);
|
||||
}
|
||||
|
||||
public static double Variance(this List<double> values, double mean)
|
||||
{
|
||||
#region CA1062
|
||||
if (values == null)
|
||||
return 0;
|
||||
#endregion
|
||||
|
||||
return values.Variance(mean, 0, values.Count);
|
||||
}
|
||||
|
||||
public static double Variance(this List<double> values, double mean, int start, int end)
|
||||
{
|
||||
#region CA1062
|
||||
if (values == null)
|
||||
return 0;
|
||||
#endregion
|
||||
|
||||
double variance = 0;
|
||||
|
||||
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
variance += (double)Math.Pow((values[i] - mean), 2);
|
||||
}
|
||||
|
||||
int n = end - start;
|
||||
if (start > 0) n -= 1;
|
||||
|
||||
return variance / (n);
|
||||
}
|
||||
|
||||
public static double StandardDeviation(this List<double> values)
|
||||
{
|
||||
#region CA1062
|
||||
if (values == null)
|
||||
return 0;
|
||||
#endregion
|
||||
|
||||
return values.Count == 0 ? 0 : values.StandardDeviation(0, values.Count);
|
||||
}
|
||||
|
||||
public static double StandardDeviation(this List<double> values, int start, int end)
|
||||
{
|
||||
double mean = values.Mean(start, end);
|
||||
double variance = values.Variance(mean, start, end);
|
||||
|
||||
return (double)Math.Sqrt(variance);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Helper
|
||||
{
|
||||
public class MultiPathDataLogContainer<T>
|
||||
{
|
||||
private ConcurrentDictionary<Int32, T> PathValueDic = new ConcurrentDictionary<Int32, T>();
|
||||
private int numberOfPaths;
|
||||
private int v;
|
||||
|
||||
public MultiPathDataLogContainer(int NumberOfPaths)
|
||||
{
|
||||
for (int i = 0; i < NumberOfPaths; i++)
|
||||
{
|
||||
PathValueDic.AddOrUpdate(i, default(T), (oldP, oldLineCont) => default(T));
|
||||
}
|
||||
}
|
||||
|
||||
public MultiPathDataLogContainer(int NumberOfPaths, T defaultVal)
|
||||
{
|
||||
for (int i = 0; i < NumberOfPaths; i++)
|
||||
{
|
||||
PathValueDic.AddOrUpdate(i, defaultVal, (oldP, oldLineCont) => defaultVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Update(Int32? Path = null, T value = default(T))
|
||||
{
|
||||
if (Path.HasValue)
|
||||
{
|
||||
PathValueDic.AddOrUpdate(Path.Value, value, (oldKey, oldValue) => value);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var val in PathValueDic)
|
||||
{
|
||||
PathValueDic.AddOrUpdate(val.Key, value, (oldKey, oldValue) => value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public T Get(Int32 Path)
|
||||
{
|
||||
if (PathValueDic.ContainsKey(Path))
|
||||
{
|
||||
return PathValueDic.First(f => f.Key == Path).Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PathValueDic.First(f => f.Key == Path).Value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Int32 GetPathCount()
|
||||
{
|
||||
return PathValueDic.Count;
|
||||
}
|
||||
|
||||
internal void Clear()
|
||||
{
|
||||
var tmpCount = GetPathCount();
|
||||
PathValueDic.Clear();
|
||||
for (int i = 0; i < tmpCount; i++)
|
||||
{
|
||||
PathValueDic.AddOrUpdate(i, default(T), (oldP, oldLineCont) => oldLineCont = default(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1810
Common/CordonelPreadjustmentUi/MainForm.Designer.cs
generated
Normal file
1810
Common/CordonelPreadjustmentUi/MainForm.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
253
Common/CordonelPreadjustmentUi/MainForm.cs
Normal file
253
Common/CordonelPreadjustmentUi/MainForm.cs
Normal file
@ -0,0 +1,253 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
|
||||
namespace CordonelPreadjustmentUi
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private PreAdjustmentControl preadjustCtl;
|
||||
private PreAdjustmentSettingsContainer mainSettings = new PreAdjustmentSettingsContainer();
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
preadjustCtl = new PreAdjustmentControl(mainSettings);
|
||||
tab_ZeroFlowCal.Controls.Add(preadjustCtl);
|
||||
|
||||
|
||||
|
||||
|
||||
cB_SinglePath.Checked = mainSettings.NumberOfPaths == 1 ? true : false;
|
||||
nUD_SettingsTempMonitorLowerValue.Value = (decimal)mainSettings.LowerTempLimit;
|
||||
nUD_SettingsTempMonitorUpperValue.Value = (decimal)mainSettings.UpperTempLimit;
|
||||
nUD_SettingsTempMonitorDeviation.Value = (decimal)mainSettings.TempDeviationLimit;
|
||||
// nUD_SettingsPreparationMetersize.Value = mainSettings.MeterSize.GetHashCode();
|
||||
|
||||
|
||||
cB_OffsetTestLogFiles.Checked = mainSettings.OffsetTestGenerateLogfiles;
|
||||
nUD_Settings_ZeroflowOffsetTestActivityCheckInterval.Value = mainSettings.OffsetTestActivityCheckInverval;
|
||||
nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value = mainSettings.OffsetTestNumberOfLines;
|
||||
nUD_Settings_ZeroflowOffsetTestSettlingTime.Value = mainSettings.OffsetTestSettlingTime;
|
||||
nUD_Settings_ZeroflowOffsetTestOffsetLimit.Value = mainSettings.OffsetTestOffsetLimitPS;
|
||||
nUD_Settings_ZeroflowOffsetTestLowerLimit.Value = mainSettings.OffsetTestLowerVoltageLimitMV;
|
||||
nUD_Settings_ZeroflowOffsetTestUpperLimit.Value = mainSettings.OffsetTestUpperVoltageLimitMV;
|
||||
|
||||
cB_AmpLogFiles.Checked = mainSettings.AmpTestGenerateLogfiles;
|
||||
nUD_Settings_AmplitudeActivityCheckInterval.Value = mainSettings.AmpTestActivityCheckInverval;
|
||||
cB_MeanAmplitudeFiles.Checked = mainSettings.AmpTestGenerateMeanValuesFile;
|
||||
nUD_PercentageStop.Value = mainSettings.AmpTestPercentageStop;
|
||||
nUD_PercentageStart.Value = mainSettings.AmpTestPercentageStart;
|
||||
nUD_Settings_AmplitudeTestMinDistance.Value = mainSettings.AmpTestAmpTestDistance;
|
||||
|
||||
nUD_Settings_AmplitudeTestLowerLimit.Value = mainSettings.AmpTestFirstHitLevelPropMin;
|
||||
nUD_Settings_AmplitudeTestUpperLimit.Value = mainSettings.AmpTestFirstHitLevelPropMax;
|
||||
|
||||
|
||||
nUD_Settings_Samplerate.Value = mainSettings.Samplerate;
|
||||
|
||||
}
|
||||
|
||||
private void tab_Maintab_Selected(object sender, TabControlEventArgs e)
|
||||
{
|
||||
if (e.TabPage.Name == tab_ZeroFlowCal.Name)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _serialConfigFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Genesis", ProgramConfig.SerialConfigFileName);
|
||||
|
||||
|
||||
SlotConfig[] meterConfigList;
|
||||
using (var tr = new StreamReader(_serialConfigFile))
|
||||
{
|
||||
var _fileString = tr.ReadToEnd();
|
||||
meterConfigList = JsonConvert.DeserializeObject<SlotConfig[]>(_fileString);
|
||||
}
|
||||
mainSettings.Meters = new List<int>();
|
||||
mainSettings.TempMeters = new List<int>();
|
||||
foreach (var item in meterConfigList)
|
||||
{
|
||||
if (item.Type != SlotType.TemperatureMeter)
|
||||
{
|
||||
mainSettings.Meters.Add(item.Slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
mainSettings.TempMeters.Add(item.Slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"use default meters because of {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mainSettings.NumberOfPaths = cB_SinglePath.Checked ? 1 : 3;
|
||||
mainSettings.LowerTempLimit = (double)nUD_SettingsTempMonitorLowerValue.Value;
|
||||
mainSettings.UpperTempLimit = (double)nUD_SettingsTempMonitorUpperValue.Value;
|
||||
mainSettings.TempDeviationLimit = (double)nUD_SettingsTempMonitorDeviation.Value;
|
||||
//mainSettings.MeterSize = (Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts.MeterSize)nUD_SettingsPreparationMetersize.Value;
|
||||
mainSettings.TempOnly = cB_TempOnly.Checked;
|
||||
mainSettings.TempMan = cB_TempManualAcquisition.Checked;
|
||||
|
||||
mainSettings.OffsetTestGenerateLogfiles = cB_OffsetTestLogFiles.Checked;
|
||||
mainSettings.OffsetTestActivityCheckInverval = (int)nUD_Settings_ZeroflowOffsetTestActivityCheckInterval.Value;
|
||||
mainSettings.OffsetTestNumberOfLines = (int)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
||||
mainSettings.OffsetTestSettlingTime = (int)nUD_Settings_ZeroflowOffsetTestSettlingTime.Value;
|
||||
mainSettings.OffsetTestOffsetLimitPS = (int)nUD_Settings_ZeroflowOffsetTestOffsetLimit.Value;
|
||||
mainSettings.OffsetTestLowerVoltageLimitMV = (int)nUD_Settings_ZeroflowOffsetTestLowerLimit.Value;
|
||||
mainSettings.OffsetTestUpperVoltageLimitMV = (int)nUD_Settings_ZeroflowOffsetTestUpperLimit.Value;
|
||||
|
||||
mainSettings.AmpTestGenerateLogfiles = cB_AmpLogFiles.Checked;
|
||||
mainSettings.AmpTestActivityCheckInverval = (int)nUD_Settings_AmplitudeActivityCheckInterval.Value;
|
||||
mainSettings.AmpTestGenerateMeanValuesFile = cB_MeanAmplitudeFiles.Checked;
|
||||
mainSettings.AmpTestPercentageStop = (int)nUD_PercentageStop.Value;
|
||||
mainSettings.AmpTestPercentageStart = (int)nUD_PercentageStart.Value;
|
||||
mainSettings.AmpTestAmpTestDistance = (int)nUD_Settings_AmplitudeTestMinDistance.Value;
|
||||
|
||||
|
||||
mainSettings.AmpTestFirstHitLevelPropMin = (int)nUD_Settings_AmplitudeTestLowerLimit.Value;
|
||||
mainSettings.AmpTestFirstHitLevelPropMax = (int)nUD_Settings_AmplitudeTestUpperLimit.Value;
|
||||
|
||||
mainSettings.Samplerate = (int)nUD_Settings_Samplerate.Value;
|
||||
|
||||
preadjustCtl.SetSettings(mainSettings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (preadjustCtl != null)
|
||||
{
|
||||
preadjustCtl.CloseConnections();
|
||||
preadjustCtl.Dispose();
|
||||
}
|
||||
if (ThermoMeterBatch != null)
|
||||
{
|
||||
ThermoMeterBatch.Dispose();
|
||||
}
|
||||
if (TempMeterStateCtls != null)
|
||||
{
|
||||
foreach (var item in TempMeterStateCtls)
|
||||
{
|
||||
item.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private MeterBatch ThermoMeterBatch = new MeterBatch();
|
||||
private List<MeterStateControl> TempMeterStateCtls = new List<MeterStateControl>();
|
||||
private void tmpStart(int slot, bool RaspiMode = false)
|
||||
{
|
||||
var ctlZehn = new TempMeterStateControl(slot);
|
||||
ctlZehn.Location = new Point(5 + ((TempMeterStateCtls.Count + 1) * ctlZehn.Width), 15);
|
||||
TempMeterStateCtls.Add(ctlZehn);
|
||||
gB_TempMeters.Controls.Add(ctlZehn);
|
||||
ctlZehn.Enabled = true;
|
||||
|
||||
|
||||
|
||||
|
||||
var currentMeter = new ZeroFlowGenesisMeter(ctlZehn.Slot, 3, !RaspiMode);
|
||||
|
||||
currentMeter.LogOnEnable = true;
|
||||
currentMeter.LoginFailed = false;
|
||||
currentMeter.PreparationFailed = false;
|
||||
currentMeter.AmplitudeFailed = false;
|
||||
currentMeter.ZeroFlowOffsetFailed = false;
|
||||
currentMeter.AmplitudeFailed = false;
|
||||
currentMeter.CompletionFailed = false;
|
||||
currentMeter.Ok = false;
|
||||
currentMeter.EmptyPipeCheckEnable = false;
|
||||
currentMeter.EmptyPipeCheckFailed = false;
|
||||
|
||||
ThermoMeterBatch.AddMeter(currentMeter);
|
||||
ctlZehn.IsEnabled = true;
|
||||
|
||||
|
||||
ctlZehn.Meter = currentMeter;
|
||||
ctlZehn.EnableOpening = true;
|
||||
|
||||
ctlZehn.Ok = ctlZehn.Meter.CheckStreamingPort();
|
||||
|
||||
ctlZehn.SetUi();
|
||||
|
||||
ctlZehn.Meter.StartRecordData();
|
||||
ctlZehn.Meter.LogRawData(true);
|
||||
if (RaspiMode)
|
||||
|
||||
{
|
||||
ctlZehn.StartTempWatch(MeterStateControl.TempMode.CalcTof);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ctlZehn.StartTempWatch(MeterStateControl.TempMode.Meter);
|
||||
}
|
||||
ctlZehn.SetTemperature(0);
|
||||
ctlZehn.DisableTemperatureinput(true);
|
||||
ctlZehn.IsEnabled = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void btn_LoadTempe_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
tmpStart((int)nudTempSlot.Value, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnTempRaspi_Click(object sender, EventArgs e)
|
||||
{
|
||||
tmpStart((int)nudTempSlot.Value, true);
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (TempMeterStateCtls != null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (var item in TempMeterStateCtls)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"##########Meter{item.Slot}#############");
|
||||
sb.Append(item.GetLog());
|
||||
sb.AppendLine();
|
||||
}
|
||||
richTextBox1.Text = sb.ToString();
|
||||
richTextBox1.ScrollToCaret();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void tab_ZeroFlowCal_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
65364
Common/CordonelPreadjustmentUi/MainForm.resx
Normal file
65364
Common/CordonelPreadjustmentUi/MainForm.resx
Normal file
File diff suppressed because it is too large
Load Diff
203
Common/CordonelPreadjustmentUi/MeterStateControl.Designer.cs
generated
Normal file
203
Common/CordonelPreadjustmentUi/MeterStateControl.Designer.cs
generated
Normal file
@ -0,0 +1,203 @@
|
||||
namespace CordonelPreadjustmentUi
|
||||
{
|
||||
partial class MeterStateControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.p_ZeroFlowCal_Meter = new System.Windows.Forms.Panel();
|
||||
this.l_TempField_Celsius = new System.Windows.Forms.Label();
|
||||
this.l_PcbId = new System.Windows.Forms.Label();
|
||||
this.nUD_TempField_Celsius = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_Srnr = new System.Windows.Forms.Label();
|
||||
this.pB_Meter = new System.Windows.Forms.PictureBox();
|
||||
this.l_ZeroFlowCal_Meter = new System.Windows.Forms.Label();
|
||||
this.cB_ZeroFlowCal_EnableMeter = new System.Windows.Forms.CheckBox();
|
||||
this.timBlink = new System.Windows.Forms.Timer(this.components);
|
||||
this.timWatch = new System.Windows.Forms.Timer(this.components);
|
||||
this.p_ZeroFlowCal_Meter.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUD_TempField_Celsius)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pB_Meter)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// p_ZeroFlowCal_Meter
|
||||
//
|
||||
this.p_ZeroFlowCal_Meter.BackColor = System.Drawing.Color.Cornsilk;
|
||||
this.p_ZeroFlowCal_Meter.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.p_ZeroFlowCal_Meter.Controls.Add(this.l_TempField_Celsius);
|
||||
this.p_ZeroFlowCal_Meter.Controls.Add(this.l_PcbId);
|
||||
this.p_ZeroFlowCal_Meter.Controls.Add(this.nUD_TempField_Celsius);
|
||||
this.p_ZeroFlowCal_Meter.Controls.Add(this.L_Srnr);
|
||||
this.p_ZeroFlowCal_Meter.Controls.Add(this.pB_Meter);
|
||||
this.p_ZeroFlowCal_Meter.Controls.Add(this.l_ZeroFlowCal_Meter);
|
||||
this.p_ZeroFlowCal_Meter.Location = new System.Drawing.Point(2, 2);
|
||||
this.p_ZeroFlowCal_Meter.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.p_ZeroFlowCal_Meter.Name = "p_ZeroFlowCal_Meter";
|
||||
this.p_ZeroFlowCal_Meter.Size = new System.Drawing.Size(85, 119);
|
||||
this.p_ZeroFlowCal_Meter.TabIndex = 26;
|
||||
//
|
||||
// l_TempField_Celsius
|
||||
//
|
||||
this.l_TempField_Celsius.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.l_TempField_Celsius.AutoSize = true;
|
||||
this.l_TempField_Celsius.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_TempField_Celsius.Location = new System.Drawing.Point(61, 89);
|
||||
this.l_TempField_Celsius.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_TempField_Celsius.Name = "l_TempField_Celsius";
|
||||
this.l_TempField_Celsius.Size = new System.Drawing.Size(20, 13);
|
||||
this.l_TempField_Celsius.TabIndex = 29;
|
||||
this.l_TempField_Celsius.Text = "°C";
|
||||
this.l_TempField_Celsius.Click += new System.EventHandler(this.l_TempField_Celsius_Click);
|
||||
//
|
||||
// l_PcbId
|
||||
//
|
||||
this.l_PcbId.AutoSize = true;
|
||||
this.l_PcbId.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_PcbId.Location = new System.Drawing.Point(2, 70);
|
||||
this.l_PcbId.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_PcbId.Name = "l_PcbId";
|
||||
this.l_PcbId.Size = new System.Drawing.Size(35, 13);
|
||||
this.l_PcbId.TabIndex = 59;
|
||||
this.l_PcbId.Text = "none";
|
||||
//
|
||||
// nUD_TempField_Celsius
|
||||
//
|
||||
this.nUD_TempField_Celsius.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.nUD_TempField_Celsius.DecimalPlaces = 1;
|
||||
this.nUD_TempField_Celsius.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.nUD_TempField_Celsius.Location = new System.Drawing.Point(2, 87);
|
||||
this.nUD_TempField_Celsius.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.nUD_TempField_Celsius.Maximum = new decimal(new int[] {
|
||||
50,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nUD_TempField_Celsius.Name = "nUD_TempField_Celsius";
|
||||
this.nUD_TempField_Celsius.Size = new System.Drawing.Size(55, 20);
|
||||
this.nUD_TempField_Celsius.TabIndex = 28;
|
||||
this.nUD_TempField_Celsius.Value = new decimal(new int[] {
|
||||
25,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// L_Srnr
|
||||
//
|
||||
this.L_Srnr.AutoSize = true;
|
||||
this.L_Srnr.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.L_Srnr.Location = new System.Drawing.Point(2, 57);
|
||||
this.L_Srnr.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.L_Srnr.Name = "L_Srnr";
|
||||
this.L_Srnr.Size = new System.Drawing.Size(35, 13);
|
||||
this.L_Srnr.TabIndex = 58;
|
||||
this.L_Srnr.Text = "none";
|
||||
//
|
||||
// pB_Meter
|
||||
//
|
||||
this.pB_Meter.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pB_Meter.Image = global::Xylem.Common.Ui.CordonelPreadjustmentUi.Properties.Resources.NormalImage;
|
||||
this.pB_Meter.Location = new System.Drawing.Point(18, 18);
|
||||
this.pB_Meter.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.pB_Meter.Name = "pB_Meter";
|
||||
this.pB_Meter.Size = new System.Drawing.Size(39, 37);
|
||||
this.pB_Meter.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pB_Meter.TabIndex = 57;
|
||||
this.pB_Meter.TabStop = false;
|
||||
this.pB_Meter.Click += new System.EventHandler(this.pB_Meter_Click);
|
||||
//
|
||||
// l_ZeroFlowCal_Meter
|
||||
//
|
||||
this.l_ZeroFlowCal_Meter.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Meter.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_Meter.Location = new System.Drawing.Point(2, 3);
|
||||
this.l_ZeroFlowCal_Meter.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Meter.Name = "l_ZeroFlowCal_Meter";
|
||||
this.l_ZeroFlowCal_Meter.Size = new System.Drawing.Size(50, 13);
|
||||
this.l_ZeroFlowCal_Meter.TabIndex = 25;
|
||||
this.l_ZeroFlowCal_Meter.Text = "METER";
|
||||
//
|
||||
// cB_ZeroFlowCal_EnableMeter
|
||||
//
|
||||
this.cB_ZeroFlowCal_EnableMeter.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.cB_ZeroFlowCal_EnableMeter.AutoSize = true;
|
||||
this.cB_ZeroFlowCal_EnableMeter.Location = new System.Drawing.Point(9, 125);
|
||||
this.cB_ZeroFlowCal_EnableMeter.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cB_ZeroFlowCal_EnableMeter.Name = "cB_ZeroFlowCal_EnableMeter";
|
||||
this.cB_ZeroFlowCal_EnableMeter.Size = new System.Drawing.Size(58, 17);
|
||||
this.cB_ZeroFlowCal_EnableMeter.TabIndex = 27;
|
||||
this.cB_ZeroFlowCal_EnableMeter.Text = "enable";
|
||||
this.cB_ZeroFlowCal_EnableMeter.UseVisualStyleBackColor = true;
|
||||
this.cB_ZeroFlowCal_EnableMeter.CheckedChanged += new System.EventHandler(this.cB_ZeroFlowCal_EnableMeter_CheckedChanged);
|
||||
//
|
||||
// timBlink
|
||||
//
|
||||
this.timBlink.Interval = 1000;
|
||||
this.timBlink.Tick += new System.EventHandler(this.timBlink_Tick);
|
||||
//
|
||||
// timWatch
|
||||
//
|
||||
this.timWatch.Enabled = true;
|
||||
this.timWatch.Interval = 5000;
|
||||
this.timWatch.Tick += new System.EventHandler(this.timWatch_Tick);
|
||||
//
|
||||
// MeterStateControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.p_ZeroFlowCal_Meter);
|
||||
this.Controls.Add(this.cB_ZeroFlowCal_EnableMeter);
|
||||
this.Name = "MeterStateControl";
|
||||
this.Size = new System.Drawing.Size(90, 142);
|
||||
this.p_ZeroFlowCal_Meter.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_Meter.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUD_TempField_Celsius)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pB_Meter)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel p_ZeroFlowCal_Meter;
|
||||
private System.Windows.Forms.PictureBox pB_Meter;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Meter;
|
||||
private System.Windows.Forms.CheckBox cB_ZeroFlowCal_EnableMeter;
|
||||
private System.Windows.Forms.Label l_PcbId;
|
||||
private System.Windows.Forms.Label L_Srnr;
|
||||
private System.Windows.Forms.Label l_TempField_Celsius;
|
||||
private System.Windows.Forms.NumericUpDown nUD_TempField_Celsius;
|
||||
private System.Windows.Forms.Timer timBlink;
|
||||
public System.Windows.Forms.Timer timWatch;
|
||||
}
|
||||
}
|
||||
574
Common/CordonelPreadjustmentUi/MeterStateControl.cs
Normal file
574
Common/CordonelPreadjustmentUi/MeterStateControl.cs
Normal file
@ -0,0 +1,574 @@
|
||||
using CordonelPreadjustmentUi.Processes.Itinerary;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
using Xylem.Common.Ui.CordonelPreadjustmentUi.Helper.Extensions;
|
||||
|
||||
namespace CordonelPreadjustmentUi
|
||||
{
|
||||
|
||||
public partial class MeterStateControl : UserControl
|
||||
{
|
||||
public EventHandler OnRequestDetails;
|
||||
public EventHandler<EventArgsDecimal> OnTempretureChangedHandler;
|
||||
public EventHandler OnWatcherFailed;
|
||||
private Int32 WatcherInvervalS = 2;
|
||||
|
||||
private decimal? minTemp;
|
||||
private decimal? maxTemp;
|
||||
private decimal? currentTemp;
|
||||
|
||||
private bool watcherFailed = false;
|
||||
|
||||
private decimal? watcherMinTemp;
|
||||
private decimal? watcherMaxTemp;
|
||||
private decimal? watcherMaxDeviation;
|
||||
|
||||
public void SetWatcher(decimal? MinTemp, decimal? MaxTemp, decimal? MaxDeviation)
|
||||
{
|
||||
watcherMinTemp = MinTemp;
|
||||
watcherMaxTemp = MaxTemp;
|
||||
watcherMaxDeviation = MaxDeviation;
|
||||
}
|
||||
|
||||
public MeterStateControl(string Text)
|
||||
{
|
||||
InitializeComponent();
|
||||
IsEnabled = cB_ZeroFlowCal_EnableMeter.Checked;
|
||||
Failed = false;
|
||||
setImage(Xylem.Common.Ui.CordonelPreadjustmentUi.Properties.Resources.NormalImage);
|
||||
Slot = -1;
|
||||
setSerialNumbersVisible(false);
|
||||
setTempinputVisible(false);
|
||||
nUD_TempField_Celsius.ValueChanged += delegate (Object sender, EventArgs args)
|
||||
{
|
||||
if (sender is NumericUpDown)
|
||||
{
|
||||
changedTempreture(((NumericUpDown)sender).Value);
|
||||
}
|
||||
};
|
||||
|
||||
l_ZeroFlowCal_Meter.Text = Text;
|
||||
}
|
||||
|
||||
public MeterStateControl(int slot)
|
||||
{
|
||||
InitializeComponent();
|
||||
IsEnabled = cB_ZeroFlowCal_EnableMeter.Checked;
|
||||
Failed = false;
|
||||
setImage(Xylem.Common.Ui.CordonelPreadjustmentUi.Properties.Resources.NormalImage);
|
||||
Slot = slot;
|
||||
setSerialNumbersVisible(false);
|
||||
setTempinputVisible(false);
|
||||
nUD_TempField_Celsius.ValueChanged += delegate (Object sender, EventArgs args)
|
||||
{
|
||||
if (sender is NumericUpDown)
|
||||
{
|
||||
changedTempreture(((NumericUpDown)sender).Value);
|
||||
}
|
||||
};
|
||||
|
||||
l_ZeroFlowCal_Meter.Text = $"METER {slot}";
|
||||
}
|
||||
|
||||
private void watcherIsFailed()
|
||||
{
|
||||
OnWatcherFailed?.Invoke(this, EventArgs.Empty);
|
||||
watcherFailed = true;
|
||||
Failed = true;
|
||||
}
|
||||
private void RunWatchActions()
|
||||
{
|
||||
try
|
||||
{
|
||||
var cRecords = Meter.CurrentRecords.ToList();
|
||||
Log($"cRecords.Count={cRecords.Count}");
|
||||
if (cRecords != null && cRecords.Any())
|
||||
{
|
||||
decimal checkTempMeter = 0;
|
||||
if (MeterTempMode == TempMode.CalcTof)
|
||||
{
|
||||
//
|
||||
|
||||
var sumTof = 0.0;
|
||||
var countTof = 0;
|
||||
foreach (var tofItem in cRecords.Where(c => c.Channel == 2))
|
||||
{
|
||||
|
||||
|
||||
if (tofItem.Channel == 2)
|
||||
{
|
||||
Log($"TotalTimeOfFlightS;{(tofItem.TotalTimeOfFlightS * 1000).ToString()}");
|
||||
Log($"RAWTEMP;{interPol(TempFromTofLUT, (tofItem.TotalTimeOfFlightS * 1000))}");
|
||||
sumTof = (tofItem.TotalTimeOfFlightS * 1000) + sumTof;
|
||||
countTof = countTof + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var x = (sumTof / countTof) / 1000;
|
||||
|
||||
|
||||
Log($"avgTof;{x}({sumTof}/{countTof})");
|
||||
|
||||
|
||||
checkTempMeter = interPol(TempFromTofLUT, x);
|
||||
Meter.CurrentRecords.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkTempMeter = (decimal)cRecords.Last().TemperatureDegC;
|
||||
}
|
||||
|
||||
currentTemp = checkTempMeter;
|
||||
Log($"{DateTime.UtcNow};currentTemp;{currentTemp};°C");
|
||||
if (!minTemp.HasValue || currentTemp < minTemp.Value)
|
||||
{
|
||||
minTemp = currentTemp;
|
||||
}
|
||||
if (!maxTemp.HasValue || currentTemp > maxTemp.Value)
|
||||
{
|
||||
maxTemp = currentTemp;
|
||||
}
|
||||
|
||||
SetTemperature(currentTemp.Value, false);
|
||||
|
||||
|
||||
if (watcherMinTemp.HasValue && minTemp < watcherMinTemp.Value)
|
||||
{
|
||||
watcherIsFailed();
|
||||
}
|
||||
if (watcherMaxTemp.HasValue && maxTemp > watcherMaxTemp.Value)
|
||||
{
|
||||
watcherIsFailed();
|
||||
}
|
||||
|
||||
if (watcherMaxDeviation.HasValue && Math.Abs(maxTemp.Value - minTemp.Value) > watcherMaxDeviation.Value)
|
||||
{
|
||||
watcherIsFailed();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"temp NA");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"temp NA - {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static decimal interPol(List<Tuple<double, double>> points, double x)
|
||||
{
|
||||
var x1 = 0.000;
|
||||
var y1 = 0.000;
|
||||
var x2 = 0.000;
|
||||
var y2 = 0.000;
|
||||
decimal checkTempMeter;
|
||||
if ((x <= points[0].Item1) && (x >= points.Last().Item1))
|
||||
{
|
||||
var i = 0;
|
||||
foreach (var val in points)
|
||||
{
|
||||
if (points[i].Item1 <= x)
|
||||
{
|
||||
x1 = points[i - 1].Item1;
|
||||
y1 = points[i - 1].Item2;
|
||||
x2 = points[i].Item1;
|
||||
y2 = points[i].Item2;
|
||||
break;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
checkTempMeter = (decimal)((y2 - y1) / (x2 - x1) * (x - x1) + y1);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkTempMeter = 1;
|
||||
}
|
||||
|
||||
return checkTempMeter;
|
||||
}
|
||||
|
||||
public void setImage(Bitmap img)
|
||||
{
|
||||
pB_Meter.Image = img;
|
||||
}
|
||||
private StringBuilder logSb = new StringBuilder();
|
||||
public bool EnableOpening { get; internal set; }
|
||||
public bool IsEnabled { get; internal set; }
|
||||
public bool IsDisabeldForRetry { get; private set; }
|
||||
public bool Ok { get; internal set; }
|
||||
public bool SetToUnknownStatus { get; internal set; }
|
||||
public int Slot { get; internal set; }
|
||||
public ZeroFlowGenesisMeter Meter { get; internal set; }
|
||||
public bool LoginFailed { get; internal set; }
|
||||
public string OverridePassword { get; internal set; }
|
||||
|
||||
internal decimal GetTemperature()
|
||||
{
|
||||
return nUD_TempField_Celsius.Value;
|
||||
}
|
||||
|
||||
public bool Failed { get; internal set; }
|
||||
private string idText = "";
|
||||
public string Id
|
||||
{
|
||||
get { return idText; }
|
||||
|
||||
internal set
|
||||
{
|
||||
idText = value;
|
||||
UpdateLbl(l_PcbId, idText);
|
||||
setSerialNumbersVisible(!string.IsNullOrEmpty(idText));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string srn = "";
|
||||
public string Srn
|
||||
{
|
||||
get { return srn; }
|
||||
|
||||
internal set
|
||||
{
|
||||
srn = value;
|
||||
UpdateLbl(L_Srnr, srn);
|
||||
setSerialNumbersVisible(!string.IsNullOrEmpty(Srn));
|
||||
}
|
||||
}
|
||||
|
||||
private void setSerialNumbersVisible(bool vis)
|
||||
{
|
||||
if (vis && !IsEnabled)
|
||||
{
|
||||
vis = false;
|
||||
}
|
||||
UpdateVisControl(l_PcbId, vis);
|
||||
UpdateVisControl(L_Srnr, vis);
|
||||
}
|
||||
|
||||
private void setTempinputVisible(bool vis)
|
||||
{
|
||||
UpdateVisControl(l_TempField_Celsius, vis);
|
||||
UpdateVisControl(nUD_TempField_Celsius, vis);
|
||||
UpdateEnableControl(nUD_TempField_Celsius, vis);
|
||||
|
||||
}
|
||||
|
||||
internal void StopTempWatch()
|
||||
{
|
||||
watchActiv = false;
|
||||
}
|
||||
public class CordonelTempLut
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int PcbId { get; set; }
|
||||
public double RefTempC { get; set; }
|
||||
public double AvgTof { get; set; }
|
||||
|
||||
public bool Active { get; set; }
|
||||
|
||||
|
||||
}
|
||||
private TempMode MeterTempMode;
|
||||
private List<Tuple<double, double>> TempFromTofLUT;
|
||||
internal void StartTempWatch(TempMode tempMode = TempMode.Hand)
|
||||
{
|
||||
Meter.WriteLog($"StartTempWatch with {tempMode}");
|
||||
|
||||
Meter.logAmpTest = true;
|
||||
if (tempMode == TempMode.CalcTof)
|
||||
{
|
||||
TempFromTofLUT = new List<Tuple<double, double>>();
|
||||
|
||||
var pcbid = "notFound";
|
||||
try
|
||||
{
|
||||
pcbid = Meter.GetPcbId();
|
||||
if (string.IsNullOrEmpty(pcbid))
|
||||
{
|
||||
pcbid = Meter.GetPcbId();
|
||||
if (string.IsNullOrEmpty(pcbid))
|
||||
{
|
||||
if (Meter.Slot == 11)
|
||||
{
|
||||
pcbid = "18370042";
|
||||
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 11");
|
||||
}
|
||||
else if (Meter.Slot == 12)
|
||||
{
|
||||
pcbid = "182100096";
|
||||
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 11");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var resp = LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TempFlange/GetLut?PcbId={pcbid}", 10000);
|
||||
var cordonelTempLut = JsonConvert.DeserializeObject<List<CordonelTempLut>>(resp);
|
||||
TempFromTofLUT = new List<Tuple<double, double>>();
|
||||
|
||||
foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC))
|
||||
{
|
||||
TempFromTofLUT.Add(new Tuple<double, double>(item.AvgTof, item.RefTempC));
|
||||
}
|
||||
var sb = new StringBuilder();
|
||||
foreach (var t in TempFromTofLUT)
|
||||
{
|
||||
sb.Append("Tof:");
|
||||
sb.Append(t.Item1);
|
||||
sb.Append("=Temp:");
|
||||
sb.Append(t.Item2);
|
||||
sb.Append(",");
|
||||
}
|
||||
|
||||
|
||||
Meter.WriteLog($"Load LUT { sb.ToString() } for meter {pcbid}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Meter.WriteLog($"StartTempWatch with LUT faild for meter {pcbid} with ex{ex.Message}");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
watchActiv = true;
|
||||
MeterTempMode = tempMode;
|
||||
|
||||
}
|
||||
public enum TempMode
|
||||
{
|
||||
Hand,
|
||||
Meter,
|
||||
CalcTof
|
||||
}
|
||||
|
||||
private void WatchTmrOnTick(Object sender, EventArgs e)
|
||||
{
|
||||
var t = new Task(() => { RunWatchActions(); });
|
||||
t.Start();
|
||||
}
|
||||
|
||||
internal void DisableTemperatureinput(bool v)
|
||||
{
|
||||
UpdateEnableControl(nUD_TempField_Celsius, !v);
|
||||
}
|
||||
|
||||
public void SetTemperature(decimal temp, bool setControls = true)
|
||||
{
|
||||
if (nUD_TempField_Celsius.InvokeRequired)
|
||||
{
|
||||
Invoke((Action<decimal, bool>)SetTemperature, temp, setControls);
|
||||
return;
|
||||
}
|
||||
|
||||
if (setControls)
|
||||
{
|
||||
if (!nUD_TempField_Celsius.Visible)
|
||||
{
|
||||
setTempinputVisible(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
nUD_TempField_Celsius.Value = temp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void changedTempreture(decimal newValue)
|
||||
{
|
||||
OnTempretureChangedHandler?.Invoke(this, new EventArgsDecimal(newValue));
|
||||
}
|
||||
|
||||
|
||||
private void UpdateLbl(Label lbl, string text)
|
||||
{
|
||||
if (lbl.InvokeRequired)
|
||||
{
|
||||
Invoke((Action<Label, string>)UpdateLbl, lbl, text);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
lbl.Text = text;
|
||||
}
|
||||
private void UpdateVisControl(Control lbl, bool vis)
|
||||
{
|
||||
if (lbl.InvokeRequired)
|
||||
{
|
||||
Invoke((Action<Control, bool>)UpdateVisControl, lbl, vis);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
lbl.Visible = vis;
|
||||
}
|
||||
|
||||
private void UpdateEnableControl(Control ctl, bool enab)
|
||||
{
|
||||
if (ctl.InvokeRequired)
|
||||
{
|
||||
Invoke((Action<Control, bool>)UpdateEnableControl, ctl, enab);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctl is NumericUpDown)
|
||||
{
|
||||
((NumericUpDown)ctl).ReadOnly = !enab;
|
||||
}
|
||||
|
||||
ctl.Enabled = enab;
|
||||
}
|
||||
|
||||
internal void Log(string v)
|
||||
{
|
||||
logSb?.AppendLine(v);
|
||||
Meter?.WriteLog(v);
|
||||
}
|
||||
public string GetLog()
|
||||
{
|
||||
if (logSb == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return logSb.ToString();
|
||||
}
|
||||
|
||||
|
||||
private void cB_ZeroFlowCal_EnableMeter_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
IsEnabled = ((CheckBox)sender).Checked;
|
||||
}
|
||||
|
||||
internal void SetChecked(bool v)
|
||||
{
|
||||
|
||||
if (cB_ZeroFlowCal_EnableMeter.InvokeRequired)
|
||||
{
|
||||
Invoke((Action<bool>)SetChecked, v);
|
||||
|
||||
return;
|
||||
}
|
||||
cB_ZeroFlowCal_EnableMeter.Checked = v;
|
||||
}
|
||||
|
||||
internal void SetUi(bool v = false)
|
||||
{
|
||||
if (p_ZeroFlowCal_Meter.InvokeRequired)
|
||||
{
|
||||
Invoke((Action<bool>)SetUi, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (SetToUnknownStatus || (!IsEnabled && !Failed))
|
||||
{
|
||||
p_ZeroFlowCal_Meter.BackColor = Color.Cornsilk;
|
||||
return;
|
||||
}
|
||||
if (Ok && !Failed)
|
||||
{
|
||||
p_ZeroFlowCal_Meter.BackColor = Color.LightGreen;
|
||||
//pB_Meter.Image = GenesisZeroFlow._GenesisZeroFlow.pB_AvailableImages.ErrorImage;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_ZeroFlowCal_Meter.BackColor = Color.LightPink;
|
||||
}
|
||||
}
|
||||
|
||||
private void numericUpDown1_EnabledChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void timBlink_Tick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private bool watchActiv = false;
|
||||
private Color failedBackgroundColor = Color.OrangeRed;
|
||||
private void timWatch_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
if (IsEnabled && watchActiv)
|
||||
{
|
||||
var t = new Task(() => { RunWatchActions(); });
|
||||
t.Start();
|
||||
|
||||
if (watcherFailed)
|
||||
{
|
||||
var tmp = p_ZeroFlowCal_Meter.BackColor;
|
||||
p_ZeroFlowCal_Meter.BackColor = failedBackgroundColor;
|
||||
failedBackgroundColor = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (watchActiv)
|
||||
{
|
||||
Log("watcher activ but ctl is disabled!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void SetDisableForRetry()
|
||||
{
|
||||
IsEnabled = false;
|
||||
IsDisabeldForRetry = true;
|
||||
}
|
||||
|
||||
internal void SetEnableAfterRetry()
|
||||
{
|
||||
if (IsDisabeldForRetry)
|
||||
{
|
||||
IsEnabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void EnabeldBoxEnabel(bool v)
|
||||
{
|
||||
UpdateEnableControl(cB_ZeroFlowCal_EnableMeter, v);
|
||||
}
|
||||
|
||||
private void pB_Meter_Click(object sender, EventArgs e)
|
||||
{
|
||||
OnRequestDetails?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private void l_TempField_Celsius_Click(object sender, EventArgs e)
|
||||
{
|
||||
Log("Click");
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Common/CordonelPreadjustmentUi/MeterStateControl.resx
Normal file
126
Common/CordonelPreadjustmentUi/MeterStateControl.resx
Normal file
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timBlink.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timWatch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>104, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
76
Common/CordonelPreadjustmentUi/MsgBox.Designer.cs
generated
Normal file
76
Common/CordonelPreadjustmentUi/MsgBox.Designer.cs
generated
Normal file
@ -0,0 +1,76 @@
|
||||
namespace Xylem.Common.Ui.CordonelPreadjustmentUi
|
||||
{
|
||||
partial class MsgBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txt = new System.Windows.Forms.TextBox();
|
||||
this.btn = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txt
|
||||
//
|
||||
this.txt.Location = new System.Drawing.Point(15, 10);
|
||||
this.txt.Multiline = true;
|
||||
this.txt.Name = "txt";
|
||||
this.txt.Size = new System.Drawing.Size(236, 63);
|
||||
this.txt.TabIndex = 0;
|
||||
//
|
||||
// btn
|
||||
//
|
||||
this.btn.Location = new System.Drawing.Point(15, 72);
|
||||
this.btn.Name = "btn";
|
||||
this.btn.Size = new System.Drawing.Size(236, 30);
|
||||
this.btn.TabIndex = 1;
|
||||
this.btn.Text = "button1";
|
||||
this.btn.UseVisualStyleBackColor = true;
|
||||
this.btn.Click += new System.EventHandler(this.btn_Click);
|
||||
//
|
||||
// MsgBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(259, 104);
|
||||
this.Controls.Add(this.btn);
|
||||
this.Controls.Add(this.txt);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(275, 143);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(275, 143);
|
||||
this.Name = "MsgBox";
|
||||
this.Text = "MsgBox";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txt;
|
||||
private System.Windows.Forms.Button btn;
|
||||
}
|
||||
}
|
||||
32
Common/CordonelPreadjustmentUi/MsgBox.cs
Normal file
32
Common/CordonelPreadjustmentUi/MsgBox.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Xylem.Common.Ui.CordonelPreadjustmentUi
|
||||
{
|
||||
public partial class MsgBox : Form
|
||||
{
|
||||
public event EventHandler ButtonClicked;
|
||||
public MsgBox( string Title,string Msg, string ButtonText = "Ok", Icon Icon = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (Icon == null)
|
||||
{
|
||||
Icon = SystemIcons.Information;
|
||||
}
|
||||
this.Icon = Icon;
|
||||
this.Text = Title;
|
||||
txt.Text = Msg;
|
||||
btn.Text = ButtonText;
|
||||
}
|
||||
|
||||
private void btn_Click(object sender, EventArgs e)
|
||||
{
|
||||
ButtonClicked?.Invoke(sender, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
123
Common/CordonelPreadjustmentUi/MsgBox.resx
Normal file
123
Common/CordonelPreadjustmentUi/MsgBox.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
38
Common/CordonelPreadjustmentUi/Parameters/FlushParams.cs
Normal file
38
Common/CordonelPreadjustmentUi/Parameters/FlushParams.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Parameters
|
||||
{
|
||||
public class FlushParams
|
||||
{
|
||||
public int DurationS { get; private set; }
|
||||
public int FlowrateQmH { get; private set; }
|
||||
|
||||
public string Message { get; private set; }
|
||||
|
||||
public FlushParams(MeterSize meterSize)
|
||||
{
|
||||
switch (meterSize)
|
||||
{
|
||||
|
||||
case MeterSize.DN50:
|
||||
FlowrateQmH = 40;
|
||||
DurationS = 120;
|
||||
break;
|
||||
|
||||
default:
|
||||
Message = $"Warning no parameter for meter size {meterSize.GetHashCode()} use default!{Environment.NewLine}";
|
||||
FlowrateQmH = 40;
|
||||
DurationS = 120;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Message))
|
||||
{
|
||||
Message = $"{Message} Flush for meter size {meterSize.GetHashCode()}: {Environment.NewLine} Flow {FlowrateQmH}m³/h for {DurationS}S";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
670
Common/CordonelPreadjustmentUi/PreAdjustmentControl.Designer.cs
generated
Normal file
670
Common/CordonelPreadjustmentUi/PreAdjustmentControl.Designer.cs
generated
Normal file
@ -0,0 +1,670 @@
|
||||
namespace CordonelPreadjustmentUi
|
||||
{
|
||||
partial class PreAdjustmentControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Erforderliche Designervariable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Verwendete Ressourcen bereinigen.
|
||||
/// </summary>
|
||||
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Vom Komponenten-Designer generierter Code
|
||||
|
||||
/// <summary>
|
||||
/// Erforderliche Methode für die Designerunterstützung.
|
||||
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PreAdjustmentControl));
|
||||
this.pB_Logo1 = new System.Windows.Forms.PictureBox();
|
||||
this.gB_Meters = new System.Windows.Forms.GroupBox();
|
||||
this.pB_Bubbles1 = new System.Windows.Forms.PictureBox();
|
||||
this.l_ZeroFlowCal_Status = new System.Windows.Forms.Label();
|
||||
this.gB_Progress = new System.Windows.Forms.GroupBox();
|
||||
this.p_ZeroFlowCal_Completion = new System.Windows.Forms.Panel();
|
||||
this.l_ZeroFlowCal_Completion = new System.Windows.Forms.Label();
|
||||
this.p_ZeroFlowCal_Offset = new System.Windows.Forms.Panel();
|
||||
this.l_ZeroFlowCal_Offset = new System.Windows.Forms.Label();
|
||||
this.cB_ZeroFlowOffsetTestEnable = new System.Windows.Forms.CheckBox();
|
||||
this.cB_AmplitudeTestEnable = new System.Windows.Forms.CheckBox();
|
||||
this.cB_TempCalEnable = new System.Windows.Forms.CheckBox();
|
||||
this.p_ZeroFlowCal_Detect = new System.Windows.Forms.Panel();
|
||||
this.l_ZeroFlowCal_Detect = new System.Windows.Forms.Label();
|
||||
this.p_ZeroFlowCal_TempCal = new System.Windows.Forms.Panel();
|
||||
this.l_ZeroFlowCal_TempCal = new System.Windows.Forms.Label();
|
||||
this.p_ZeroFlowCal_Prepare = new System.Windows.Forms.Panel();
|
||||
this.l_ZeroFlowCal_Prepare = new System.Windows.Forms.Label();
|
||||
this.p_ZeroFlowCal_Amplitude = new System.Windows.Forms.Panel();
|
||||
this.l_ZeroFlowCal_Amplitude = new System.Windows.Forms.Label();
|
||||
this.gB_TempMeters = new System.Windows.Forms.GroupBox();
|
||||
this.btn_StoreTempe = new System.Windows.Forms.Button();
|
||||
this.pB_ZeroFlowCal_Progress = new System.Windows.Forms.ProgressBar();
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue = new System.Windows.Forms.Label();
|
||||
this.l_ZeroFlowCal_Resttime = new System.Windows.Forms.Label();
|
||||
this.btn_ZeroFlowCal_Abort = new System.Windows.Forms.Button();
|
||||
this.btn_ZeroFlowCal_Start = new System.Windows.Forms.Button();
|
||||
this.btn_ZeroFlowCal_Pdf = new System.Windows.Forms.Button();
|
||||
this.btn_ZeroFlowCal_Save = new System.Windows.Forms.Button();
|
||||
this.btn_ZeroFlowCal_Clear = new System.Windows.Forms.Button();
|
||||
this.btn_ZeroFlowCal_Detect = new System.Windows.Forms.Button();
|
||||
this.gB_MeterLog = new System.Windows.Forms.GroupBox();
|
||||
this.btn_ShowAll = new System.Windows.Forms.Button();
|
||||
this.rTB_ZeroFlowCalMeter = new System.Windows.Forms.RichTextBox();
|
||||
this.pB_ZeroFlowCal_SubProgress = new System.Windows.Forms.ProgressBar();
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.rTB_ZeroFlowCal = new System.Windows.Forms.RichTextBox();
|
||||
this.l_SettingsPreparationMetersize = new System.Windows.Forms.Label();
|
||||
this.cb_Metersize = new System.Windows.Forms.ComboBox();
|
||||
this.lblBuildDate = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pB_Logo1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pB_Bubbles1)).BeginInit();
|
||||
this.gB_Progress.SuspendLayout();
|
||||
this.p_ZeroFlowCal_Completion.SuspendLayout();
|
||||
this.p_ZeroFlowCal_Offset.SuspendLayout();
|
||||
this.p_ZeroFlowCal_Detect.SuspendLayout();
|
||||
this.p_ZeroFlowCal_TempCal.SuspendLayout();
|
||||
this.p_ZeroFlowCal_Prepare.SuspendLayout();
|
||||
this.p_ZeroFlowCal_Amplitude.SuspendLayout();
|
||||
this.gB_TempMeters.SuspendLayout();
|
||||
this.gB_MeterLog.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pB_Logo1
|
||||
//
|
||||
this.pB_Logo1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pB_Logo1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.pB_Logo1.Image = ((System.Drawing.Image)(resources.GetObject("pB_Logo1.Image")));
|
||||
this.pB_Logo1.InitialImage = null;
|
||||
this.pB_Logo1.Location = new System.Drawing.Point(781, 0);
|
||||
this.pB_Logo1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.pB_Logo1.Name = "pB_Logo1";
|
||||
this.pB_Logo1.Size = new System.Drawing.Size(158, 86);
|
||||
this.pB_Logo1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pB_Logo1.TabIndex = 69;
|
||||
this.pB_Logo1.TabStop = false;
|
||||
//
|
||||
// gB_Meters
|
||||
//
|
||||
this.gB_Meters.Location = new System.Drawing.Point(1, 98);
|
||||
this.gB_Meters.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.gB_Meters.Name = "gB_Meters";
|
||||
this.gB_Meters.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.gB_Meters.Size = new System.Drawing.Size(950, 174);
|
||||
this.gB_Meters.TabIndex = 71;
|
||||
this.gB_Meters.TabStop = false;
|
||||
this.gB_Meters.Text = "Meters";
|
||||
//
|
||||
// pB_Bubbles1
|
||||
//
|
||||
this.pB_Bubbles1.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.pB_Bubbles1.Image = ((System.Drawing.Image)(resources.GetObject("pB_Bubbles1.Image")));
|
||||
this.pB_Bubbles1.Location = new System.Drawing.Point(20, 2);
|
||||
this.pB_Bubbles1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.pB_Bubbles1.Name = "pB_Bubbles1";
|
||||
this.pB_Bubbles1.Size = new System.Drawing.Size(267, 93);
|
||||
this.pB_Bubbles1.TabIndex = 70;
|
||||
this.pB_Bubbles1.TabStop = false;
|
||||
this.pB_Bubbles1.Visible = false;
|
||||
//
|
||||
// l_ZeroFlowCal_Status
|
||||
//
|
||||
this.l_ZeroFlowCal_Status.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Status.Font = new System.Drawing.Font("Microsoft Sans Serif", 22.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_Status.Location = new System.Drawing.Point(10, 478);
|
||||
this.l_ZeroFlowCal_Status.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Status.Name = "l_ZeroFlowCal_Status";
|
||||
this.l_ZeroFlowCal_Status.Size = new System.Drawing.Size(243, 36);
|
||||
this.l_ZeroFlowCal_Status.TabIndex = 72;
|
||||
this.l_ZeroFlowCal_Status.Text = "Press \'DETECT\'";
|
||||
//
|
||||
// gB_Progress
|
||||
//
|
||||
this.gB_Progress.Controls.Add(this.p_ZeroFlowCal_Completion);
|
||||
this.gB_Progress.Controls.Add(this.p_ZeroFlowCal_Offset);
|
||||
this.gB_Progress.Controls.Add(this.p_ZeroFlowCal_Detect);
|
||||
this.gB_Progress.Controls.Add(this.p_ZeroFlowCal_TempCal);
|
||||
this.gB_Progress.Controls.Add(this.p_ZeroFlowCal_Prepare);
|
||||
this.gB_Progress.Controls.Add(this.p_ZeroFlowCal_Amplitude);
|
||||
this.gB_Progress.Location = new System.Drawing.Point(8, 517);
|
||||
this.gB_Progress.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.gB_Progress.Name = "gB_Progress";
|
||||
this.gB_Progress.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.gB_Progress.Size = new System.Drawing.Size(744, 89);
|
||||
this.gB_Progress.TabIndex = 80;
|
||||
this.gB_Progress.TabStop = false;
|
||||
//
|
||||
// p_ZeroFlowCal_Completion
|
||||
//
|
||||
this.p_ZeroFlowCal_Completion.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.p_ZeroFlowCal_Completion.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.p_ZeroFlowCal_Completion.Controls.Add(this.l_ZeroFlowCal_Completion);
|
||||
this.p_ZeroFlowCal_Completion.Location = new System.Drawing.Point(607, 17);
|
||||
this.p_ZeroFlowCal_Completion.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.p_ZeroFlowCal_Completion.Name = "p_ZeroFlowCal_Completion";
|
||||
this.p_ZeroFlowCal_Completion.Size = new System.Drawing.Size(117, 65);
|
||||
this.p_ZeroFlowCal_Completion.TabIndex = 32;
|
||||
//
|
||||
// l_ZeroFlowCal_Completion
|
||||
//
|
||||
this.l_ZeroFlowCal_Completion.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Completion.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_Completion.ForeColor = System.Drawing.Color.Gray;
|
||||
this.l_ZeroFlowCal_Completion.Location = new System.Drawing.Point(0, 22);
|
||||
this.l_ZeroFlowCal_Completion.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Completion.Name = "l_ZeroFlowCal_Completion";
|
||||
this.l_ZeroFlowCal_Completion.Size = new System.Drawing.Size(108, 17);
|
||||
this.l_ZeroFlowCal_Completion.TabIndex = 40;
|
||||
this.l_ZeroFlowCal_Completion.Text = "COMPLETION";
|
||||
this.l_ZeroFlowCal_Completion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// p_ZeroFlowCal_Offset
|
||||
//
|
||||
this.p_ZeroFlowCal_Offset.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.p_ZeroFlowCal_Offset.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.p_ZeroFlowCal_Offset.Controls.Add(this.l_ZeroFlowCal_Offset);
|
||||
this.p_ZeroFlowCal_Offset.Controls.Add(this.cB_ZeroFlowOffsetTestEnable);
|
||||
this.p_ZeroFlowCal_Offset.Controls.Add(this.cB_AmplitudeTestEnable);
|
||||
this.p_ZeroFlowCal_Offset.Controls.Add(this.cB_TempCalEnable);
|
||||
this.p_ZeroFlowCal_Offset.Location = new System.Drawing.Point(486, 17);
|
||||
this.p_ZeroFlowCal_Offset.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.p_ZeroFlowCal_Offset.Name = "p_ZeroFlowCal_Offset";
|
||||
this.p_ZeroFlowCal_Offset.Size = new System.Drawing.Size(121, 65);
|
||||
this.p_ZeroFlowCal_Offset.TabIndex = 94;
|
||||
//
|
||||
// l_ZeroFlowCal_Offset
|
||||
//
|
||||
this.l_ZeroFlowCal_Offset.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Offset.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_Offset.ForeColor = System.Drawing.Color.Gray;
|
||||
this.l_ZeroFlowCal_Offset.Location = new System.Drawing.Point(24, 12);
|
||||
this.l_ZeroFlowCal_Offset.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Offset.Name = "l_ZeroFlowCal_Offset";
|
||||
this.l_ZeroFlowCal_Offset.Size = new System.Drawing.Size(68, 34);
|
||||
this.l_ZeroFlowCal_Offset.TabIndex = 40;
|
||||
this.l_ZeroFlowCal_Offset.Text = "OFFSET\r\nTEST";
|
||||
this.l_ZeroFlowCal_Offset.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// cB_ZeroFlowOffsetTestEnable
|
||||
//
|
||||
this.cB_ZeroFlowOffsetTestEnable.AutoSize = true;
|
||||
this.cB_ZeroFlowOffsetTestEnable.Checked = true;
|
||||
this.cB_ZeroFlowOffsetTestEnable.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cB_ZeroFlowOffsetTestEnable.Enabled = false;
|
||||
this.cB_ZeroFlowOffsetTestEnable.Location = new System.Drawing.Point(24, 15);
|
||||
this.cB_ZeroFlowOffsetTestEnable.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cB_ZeroFlowOffsetTestEnable.Name = "cB_ZeroFlowOffsetTestEnable";
|
||||
this.cB_ZeroFlowOffsetTestEnable.Size = new System.Drawing.Size(58, 17);
|
||||
this.cB_ZeroFlowOffsetTestEnable.TabIndex = 90;
|
||||
this.cB_ZeroFlowOffsetTestEnable.Text = "enable";
|
||||
this.cB_ZeroFlowOffsetTestEnable.UseVisualStyleBackColor = true;
|
||||
this.cB_ZeroFlowOffsetTestEnable.Visible = false;
|
||||
//
|
||||
// cB_AmplitudeTestEnable
|
||||
//
|
||||
this.cB_AmplitudeTestEnable.AutoSize = true;
|
||||
this.cB_AmplitudeTestEnable.Checked = true;
|
||||
this.cB_AmplitudeTestEnable.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cB_AmplitudeTestEnable.Enabled = false;
|
||||
this.cB_AmplitudeTestEnable.Location = new System.Drawing.Point(-216, 48);
|
||||
this.cB_AmplitudeTestEnable.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cB_AmplitudeTestEnable.Name = "cB_AmplitudeTestEnable";
|
||||
this.cB_AmplitudeTestEnable.Size = new System.Drawing.Size(58, 17);
|
||||
this.cB_AmplitudeTestEnable.TabIndex = 92;
|
||||
this.cB_AmplitudeTestEnable.Text = "enable";
|
||||
this.cB_AmplitudeTestEnable.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cB_TempCalEnable
|
||||
//
|
||||
this.cB_TempCalEnable.AutoSize = true;
|
||||
this.cB_TempCalEnable.Checked = true;
|
||||
this.cB_TempCalEnable.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cB_TempCalEnable.Enabled = false;
|
||||
this.cB_TempCalEnable.Location = new System.Drawing.Point(-96, 48);
|
||||
this.cB_TempCalEnable.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cB_TempCalEnable.Name = "cB_TempCalEnable";
|
||||
this.cB_TempCalEnable.Size = new System.Drawing.Size(58, 17);
|
||||
this.cB_TempCalEnable.TabIndex = 94;
|
||||
this.cB_TempCalEnable.Text = "enable";
|
||||
this.cB_TempCalEnable.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// p_ZeroFlowCal_Detect
|
||||
//
|
||||
this.p_ZeroFlowCal_Detect.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.p_ZeroFlowCal_Detect.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.p_ZeroFlowCal_Detect.Controls.Add(this.l_ZeroFlowCal_Detect);
|
||||
this.p_ZeroFlowCal_Detect.Location = new System.Drawing.Point(4, 17);
|
||||
this.p_ZeroFlowCal_Detect.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.p_ZeroFlowCal_Detect.Name = "p_ZeroFlowCal_Detect";
|
||||
this.p_ZeroFlowCal_Detect.Size = new System.Drawing.Size(121, 65);
|
||||
this.p_ZeroFlowCal_Detect.TabIndex = 40;
|
||||
//
|
||||
// l_ZeroFlowCal_Detect
|
||||
//
|
||||
this.l_ZeroFlowCal_Detect.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Detect.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_Detect.ForeColor = System.Drawing.Color.Gray;
|
||||
this.l_ZeroFlowCal_Detect.Location = new System.Drawing.Point(24, 22);
|
||||
this.l_ZeroFlowCal_Detect.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Detect.Name = "l_ZeroFlowCal_Detect";
|
||||
this.l_ZeroFlowCal_Detect.Size = new System.Drawing.Size(69, 17);
|
||||
this.l_ZeroFlowCal_Detect.TabIndex = 39;
|
||||
this.l_ZeroFlowCal_Detect.Text = "DETECT";
|
||||
//
|
||||
// p_ZeroFlowCal_TempCal
|
||||
//
|
||||
this.p_ZeroFlowCal_TempCal.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.p_ZeroFlowCal_TempCal.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.p_ZeroFlowCal_TempCal.Controls.Add(this.l_ZeroFlowCal_TempCal);
|
||||
this.p_ZeroFlowCal_TempCal.Location = new System.Drawing.Point(365, 17);
|
||||
this.p_ZeroFlowCal_TempCal.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.p_ZeroFlowCal_TempCal.Name = "p_ZeroFlowCal_TempCal";
|
||||
this.p_ZeroFlowCal_TempCal.Size = new System.Drawing.Size(121, 65);
|
||||
this.p_ZeroFlowCal_TempCal.TabIndex = 41;
|
||||
//
|
||||
// l_ZeroFlowCal_TempCal
|
||||
//
|
||||
this.l_ZeroFlowCal_TempCal.AutoSize = true;
|
||||
this.l_ZeroFlowCal_TempCal.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_TempCal.ForeColor = System.Drawing.Color.Gray;
|
||||
this.l_ZeroFlowCal_TempCal.Location = new System.Drawing.Point(0, 12);
|
||||
this.l_ZeroFlowCal_TempCal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_TempCal.Name = "l_ZeroFlowCal_TempCal";
|
||||
this.l_ZeroFlowCal_TempCal.Size = new System.Drawing.Size(123, 34);
|
||||
this.l_ZeroFlowCal_TempCal.TabIndex = 40;
|
||||
this.l_ZeroFlowCal_TempCal.Text = "TEMPERATURE\r\nCALIBRATION";
|
||||
this.l_ZeroFlowCal_TempCal.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// p_ZeroFlowCal_Prepare
|
||||
//
|
||||
this.p_ZeroFlowCal_Prepare.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.p_ZeroFlowCal_Prepare.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.p_ZeroFlowCal_Prepare.Controls.Add(this.l_ZeroFlowCal_Prepare);
|
||||
this.p_ZeroFlowCal_Prepare.Location = new System.Drawing.Point(124, 17);
|
||||
this.p_ZeroFlowCal_Prepare.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.p_ZeroFlowCal_Prepare.Name = "p_ZeroFlowCal_Prepare";
|
||||
this.p_ZeroFlowCal_Prepare.Size = new System.Drawing.Size(121, 65);
|
||||
this.p_ZeroFlowCal_Prepare.TabIndex = 31;
|
||||
//
|
||||
// l_ZeroFlowCal_Prepare
|
||||
//
|
||||
this.l_ZeroFlowCal_Prepare.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Prepare.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_Prepare.ForeColor = System.Drawing.Color.Gray;
|
||||
this.l_ZeroFlowCal_Prepare.Location = new System.Drawing.Point(18, 22);
|
||||
this.l_ZeroFlowCal_Prepare.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Prepare.Name = "l_ZeroFlowCal_Prepare";
|
||||
this.l_ZeroFlowCal_Prepare.Size = new System.Drawing.Size(80, 17);
|
||||
this.l_ZeroFlowCal_Prepare.TabIndex = 39;
|
||||
this.l_ZeroFlowCal_Prepare.Text = "PREPARE";
|
||||
//
|
||||
// p_ZeroFlowCal_Amplitude
|
||||
//
|
||||
this.p_ZeroFlowCal_Amplitude.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.p_ZeroFlowCal_Amplitude.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.p_ZeroFlowCal_Amplitude.Controls.Add(this.l_ZeroFlowCal_Amplitude);
|
||||
this.p_ZeroFlowCal_Amplitude.Location = new System.Drawing.Point(244, 17);
|
||||
this.p_ZeroFlowCal_Amplitude.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.p_ZeroFlowCal_Amplitude.Name = "p_ZeroFlowCal_Amplitude";
|
||||
this.p_ZeroFlowCal_Amplitude.Size = new System.Drawing.Size(121, 65);
|
||||
this.p_ZeroFlowCal_Amplitude.TabIndex = 32;
|
||||
//
|
||||
// l_ZeroFlowCal_Amplitude
|
||||
//
|
||||
this.l_ZeroFlowCal_Amplitude.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Amplitude.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.l_ZeroFlowCal_Amplitude.ForeColor = System.Drawing.Color.Gray;
|
||||
this.l_ZeroFlowCal_Amplitude.Location = new System.Drawing.Point(12, 15);
|
||||
this.l_ZeroFlowCal_Amplitude.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Amplitude.Name = "l_ZeroFlowCal_Amplitude";
|
||||
this.l_ZeroFlowCal_Amplitude.Size = new System.Drawing.Size(95, 34);
|
||||
this.l_ZeroFlowCal_Amplitude.TabIndex = 39;
|
||||
this.l_ZeroFlowCal_Amplitude.Text = "AMPLITUDE\r\nTEST";
|
||||
this.l_ZeroFlowCal_Amplitude.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// gB_TempMeters
|
||||
//
|
||||
this.gB_TempMeters.Controls.Add(this.btn_StoreTempe);
|
||||
this.gB_TempMeters.Location = new System.Drawing.Point(8, 275);
|
||||
this.gB_TempMeters.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.gB_TempMeters.Name = "gB_TempMeters";
|
||||
this.gB_TempMeters.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.gB_TempMeters.Size = new System.Drawing.Size(403, 193);
|
||||
this.gB_TempMeters.TabIndex = 72;
|
||||
this.gB_TempMeters.TabStop = false;
|
||||
this.gB_TempMeters.Text = "Temp. Meters";
|
||||
//
|
||||
// btn_StoreTempe
|
||||
//
|
||||
this.btn_StoreTempe.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_StoreTempe.Enabled = false;
|
||||
this.btn_StoreTempe.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_StoreTempe.Location = new System.Drawing.Point(4, 158);
|
||||
this.btn_StoreTempe.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btn_StoreTempe.Name = "btn_StoreTempe";
|
||||
this.btn_StoreTempe.Size = new System.Drawing.Size(395, 31);
|
||||
this.btn_StoreTempe.TabIndex = 95;
|
||||
this.btn_StoreTempe.Text = "SAVE TEMP";
|
||||
this.btn_StoreTempe.UseVisualStyleBackColor = true;
|
||||
this.btn_StoreTempe.Click += new System.EventHandler(this.btn_StoreTempe_Click);
|
||||
//
|
||||
// pB_ZeroFlowCal_Progress
|
||||
//
|
||||
this.pB_ZeroFlowCal_Progress.Location = new System.Drawing.Point(8, 634);
|
||||
this.pB_ZeroFlowCal_Progress.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.pB_ZeroFlowCal_Progress.Name = "pB_ZeroFlowCal_Progress";
|
||||
this.pB_ZeroFlowCal_Progress.Size = new System.Drawing.Size(724, 18);
|
||||
this.pB_ZeroFlowCal_Progress.Step = 1;
|
||||
this.pB_ZeroFlowCal_Progress.TabIndex = 35;
|
||||
//
|
||||
// l_ZeroFlowCal_ResttimeDisplayValue
|
||||
//
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue.AutoSize = true;
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue.Location = new System.Drawing.Point(843, 634);
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue.Name = "l_ZeroFlowCal_ResttimeDisplayValue";
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue.Size = new System.Drawing.Size(49, 13);
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue.TabIndex = 37;
|
||||
this.l_ZeroFlowCal_ResttimeDisplayValue.Text = "00:00:00";
|
||||
//
|
||||
// l_ZeroFlowCal_Resttime
|
||||
//
|
||||
this.l_ZeroFlowCal_Resttime.AutoSize = true;
|
||||
this.l_ZeroFlowCal_Resttime.Location = new System.Drawing.Point(736, 634);
|
||||
this.l_ZeroFlowCal_Resttime.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_Resttime.Name = "l_ZeroFlowCal_Resttime";
|
||||
this.l_ZeroFlowCal_Resttime.Size = new System.Drawing.Size(54, 13);
|
||||
this.l_ZeroFlowCal_Resttime.TabIndex = 36;
|
||||
this.l_ZeroFlowCal_Resttime.Text = "Est. total: ";
|
||||
//
|
||||
// btn_ZeroFlowCal_Abort
|
||||
//
|
||||
this.btn_ZeroFlowCal_Abort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_ZeroFlowCal_Abort.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_ZeroFlowCal_Abort.Location = new System.Drawing.Point(672, 44);
|
||||
this.btn_ZeroFlowCal_Abort.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btn_ZeroFlowCal_Abort.Name = "btn_ZeroFlowCal_Abort";
|
||||
this.btn_ZeroFlowCal_Abort.Size = new System.Drawing.Size(102, 52);
|
||||
this.btn_ZeroFlowCal_Abort.TabIndex = 84;
|
||||
this.btn_ZeroFlowCal_Abort.Text = "STOP";
|
||||
this.btn_ZeroFlowCal_Abort.UseVisualStyleBackColor = true;
|
||||
this.btn_ZeroFlowCal_Abort.Click += new System.EventHandler(this.btn_ZeroFlowCal_Abort_Click);
|
||||
//
|
||||
// btn_ZeroFlowCal_Start
|
||||
//
|
||||
this.btn_ZeroFlowCal_Start.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_ZeroFlowCal_Start.Enabled = false;
|
||||
this.btn_ZeroFlowCal_Start.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_ZeroFlowCal_Start.Location = new System.Drawing.Point(566, 44);
|
||||
this.btn_ZeroFlowCal_Start.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btn_ZeroFlowCal_Start.Name = "btn_ZeroFlowCal_Start";
|
||||
this.btn_ZeroFlowCal_Start.Size = new System.Drawing.Size(102, 51);
|
||||
this.btn_ZeroFlowCal_Start.TabIndex = 83;
|
||||
this.btn_ZeroFlowCal_Start.Text = "START";
|
||||
this.btn_ZeroFlowCal_Start.UseVisualStyleBackColor = true;
|
||||
this.btn_ZeroFlowCal_Start.Click += new System.EventHandler(this.btn_ZeroFlowCal_Start_Click);
|
||||
//
|
||||
// btn_ZeroFlowCal_Pdf
|
||||
//
|
||||
this.btn_ZeroFlowCal_Pdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_ZeroFlowCal_Pdf.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_ZeroFlowCal_Pdf.Location = new System.Drawing.Point(846, 529);
|
||||
this.btn_ZeroFlowCal_Pdf.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btn_ZeroFlowCal_Pdf.Name = "btn_ZeroFlowCal_Pdf";
|
||||
this.btn_ZeroFlowCal_Pdf.Size = new System.Drawing.Size(63, 38);
|
||||
this.btn_ZeroFlowCal_Pdf.TabIndex = 91;
|
||||
this.btn_ZeroFlowCal_Pdf.Text = "PDF";
|
||||
this.btn_ZeroFlowCal_Pdf.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_ZeroFlowCal_Save
|
||||
//
|
||||
this.btn_ZeroFlowCal_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_ZeroFlowCal_Save.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_ZeroFlowCal_Save.Location = new System.Drawing.Point(779, 529);
|
||||
this.btn_ZeroFlowCal_Save.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btn_ZeroFlowCal_Save.Name = "btn_ZeroFlowCal_Save";
|
||||
this.btn_ZeroFlowCal_Save.Size = new System.Drawing.Size(63, 38);
|
||||
this.btn_ZeroFlowCal_Save.TabIndex = 90;
|
||||
this.btn_ZeroFlowCal_Save.Text = "Save";
|
||||
this.btn_ZeroFlowCal_Save.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_ZeroFlowCal_Clear
|
||||
//
|
||||
this.btn_ZeroFlowCal_Clear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_ZeroFlowCal_Clear.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_ZeroFlowCal_Clear.Location = new System.Drawing.Point(779, 571);
|
||||
this.btn_ZeroFlowCal_Clear.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btn_ZeroFlowCal_Clear.Name = "btn_ZeroFlowCal_Clear";
|
||||
this.btn_ZeroFlowCal_Clear.Size = new System.Drawing.Size(130, 28);
|
||||
this.btn_ZeroFlowCal_Clear.TabIndex = 89;
|
||||
this.btn_ZeroFlowCal_Clear.Text = "Clear";
|
||||
this.btn_ZeroFlowCal_Clear.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_ZeroFlowCal_Detect
|
||||
//
|
||||
this.btn_ZeroFlowCal_Detect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_ZeroFlowCal_Detect.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_ZeroFlowCal_Detect.Location = new System.Drawing.Point(291, 44);
|
||||
this.btn_ZeroFlowCal_Detect.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btn_ZeroFlowCal_Detect.Name = "btn_ZeroFlowCal_Detect";
|
||||
this.btn_ZeroFlowCal_Detect.Size = new System.Drawing.Size(102, 51);
|
||||
this.btn_ZeroFlowCal_Detect.TabIndex = 82;
|
||||
this.btn_ZeroFlowCal_Detect.Text = "DETECT";
|
||||
this.btn_ZeroFlowCal_Detect.UseVisualStyleBackColor = true;
|
||||
this.btn_ZeroFlowCal_Detect.Click += new System.EventHandler(this.btn_ZeroFlowCal_Detect_Click);
|
||||
//
|
||||
// gB_MeterLog
|
||||
//
|
||||
this.gB_MeterLog.Controls.Add(this.btn_ShowAll);
|
||||
this.gB_MeterLog.Controls.Add(this.rTB_ZeroFlowCalMeter);
|
||||
this.gB_MeterLog.Location = new System.Drawing.Point(419, 275);
|
||||
this.gB_MeterLog.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.gB_MeterLog.Name = "gB_MeterLog";
|
||||
this.gB_MeterLog.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.gB_MeterLog.Size = new System.Drawing.Size(532, 193);
|
||||
this.gB_MeterLog.TabIndex = 72;
|
||||
this.gB_MeterLog.TabStop = false;
|
||||
this.gB_MeterLog.Text = "Meters";
|
||||
this.gB_MeterLog.Visible = false;
|
||||
//
|
||||
// btn_ShowAll
|
||||
//
|
||||
this.btn_ShowAll.Location = new System.Drawing.Point(5, 14);
|
||||
this.btn_ShowAll.Name = "btn_ShowAll";
|
||||
this.btn_ShowAll.Size = new System.Drawing.Size(123, 20);
|
||||
this.btn_ShowAll.TabIndex = 97;
|
||||
this.btn_ShowAll.Text = "ShowAll";
|
||||
this.btn_ShowAll.UseVisualStyleBackColor = true;
|
||||
this.btn_ShowAll.Click += new System.EventHandler(this.btn_ShowAll_Click);
|
||||
//
|
||||
// rTB_ZeroFlowCalMeter
|
||||
//
|
||||
this.rTB_ZeroFlowCalMeter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.rTB_ZeroFlowCalMeter.Location = new System.Drawing.Point(4, 39);
|
||||
this.rTB_ZeroFlowCalMeter.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.rTB_ZeroFlowCalMeter.Name = "rTB_ZeroFlowCalMeter";
|
||||
this.rTB_ZeroFlowCalMeter.ReadOnly = true;
|
||||
this.rTB_ZeroFlowCalMeter.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.rTB_ZeroFlowCalMeter.Size = new System.Drawing.Size(516, 139);
|
||||
this.rTB_ZeroFlowCalMeter.TabIndex = 96;
|
||||
this.rTB_ZeroFlowCalMeter.Text = "";
|
||||
//
|
||||
// pB_ZeroFlowCal_SubProgress
|
||||
//
|
||||
this.pB_ZeroFlowCal_SubProgress.Location = new System.Drawing.Point(8, 612);
|
||||
this.pB_ZeroFlowCal_SubProgress.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.pB_ZeroFlowCal_SubProgress.Name = "pB_ZeroFlowCal_SubProgress";
|
||||
this.pB_ZeroFlowCal_SubProgress.Size = new System.Drawing.Size(724, 18);
|
||||
this.pB_ZeroFlowCal_SubProgress.Step = 1;
|
||||
this.pB_ZeroFlowCal_SubProgress.TabIndex = 92;
|
||||
//
|
||||
// l_ZeroFlowCal_SubResttimeDisplayValue
|
||||
//
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue.AutoSize = true;
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue.Location = new System.Drawing.Point(845, 617);
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue.Name = "l_ZeroFlowCal_SubResttimeDisplayValue";
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue.Size = new System.Drawing.Size(49, 13);
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue.TabIndex = 94;
|
||||
this.l_ZeroFlowCal_SubResttimeDisplayValue.Text = "00:00:00";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(736, 616);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(105, 13);
|
||||
this.label2.TabIndex = 93;
|
||||
this.label2.Text = "Est. finish Proccess: ";
|
||||
//
|
||||
// rTB_ZeroFlowCal
|
||||
//
|
||||
this.rTB_ZeroFlowCal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.rTB_ZeroFlowCal.Location = new System.Drawing.Point(419, 280);
|
||||
this.rTB_ZeroFlowCal.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.rTB_ZeroFlowCal.Name = "rTB_ZeroFlowCal";
|
||||
this.rTB_ZeroFlowCal.ReadOnly = true;
|
||||
this.rTB_ZeroFlowCal.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.rTB_ZeroFlowCal.Size = new System.Drawing.Size(528, 193);
|
||||
this.rTB_ZeroFlowCal.TabIndex = 101;
|
||||
this.rTB_ZeroFlowCal.Text = "";
|
||||
//
|
||||
// l_SettingsPreparationMetersize
|
||||
//
|
||||
this.l_SettingsPreparationMetersize.AutoSize = true;
|
||||
this.l_SettingsPreparationMetersize.Location = new System.Drawing.Point(416, 64);
|
||||
this.l_SettingsPreparationMetersize.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_SettingsPreparationMetersize.Name = "l_SettingsPreparationMetersize";
|
||||
this.l_SettingsPreparationMetersize.Size = new System.Drawing.Size(55, 13);
|
||||
this.l_SettingsPreparationMetersize.TabIndex = 104;
|
||||
this.l_SettingsPreparationMetersize.Text = "Metersize:";
|
||||
//
|
||||
// cb_Metersize
|
||||
//
|
||||
this.cb_Metersize.FormattingEnabled = true;
|
||||
this.cb_Metersize.Location = new System.Drawing.Point(476, 64);
|
||||
this.cb_Metersize.Name = "cb_Metersize";
|
||||
this.cb_Metersize.Size = new System.Drawing.Size(73, 21);
|
||||
this.cb_Metersize.TabIndex = 105;
|
||||
//
|
||||
// lblBuildDate
|
||||
//
|
||||
this.lblBuildDate.AutoSize = true;
|
||||
this.lblBuildDate.Location = new System.Drawing.Point(779, 88);
|
||||
this.lblBuildDate.Name = "lblBuildDate";
|
||||
this.lblBuildDate.Size = new System.Drawing.Size(10, 13);
|
||||
this.lblBuildDate.TabIndex = 106;
|
||||
this.lblBuildDate.Text = "-";
|
||||
//
|
||||
// PreAdjustmentControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.lblBuildDate);
|
||||
this.Controls.Add(this.cb_Metersize);
|
||||
this.Controls.Add(this.l_SettingsPreparationMetersize);
|
||||
this.Controls.Add(this.rTB_ZeroFlowCal);
|
||||
this.Controls.Add(this.l_ZeroFlowCal_SubResttimeDisplayValue);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.pB_ZeroFlowCal_SubProgress);
|
||||
this.Controls.Add(this.gB_MeterLog);
|
||||
this.Controls.Add(this.gB_TempMeters);
|
||||
this.Controls.Add(this.btn_ZeroFlowCal_Pdf);
|
||||
this.Controls.Add(this.btn_ZeroFlowCal_Save);
|
||||
this.Controls.Add(this.btn_ZeroFlowCal_Clear);
|
||||
this.Controls.Add(this.btn_ZeroFlowCal_Abort);
|
||||
this.Controls.Add(this.l_ZeroFlowCal_ResttimeDisplayValue);
|
||||
this.Controls.Add(this.pB_ZeroFlowCal_Progress);
|
||||
this.Controls.Add(this.btn_ZeroFlowCal_Start);
|
||||
this.Controls.Add(this.l_ZeroFlowCal_Resttime);
|
||||
this.Controls.Add(this.btn_ZeroFlowCal_Detect);
|
||||
this.Controls.Add(this.l_ZeroFlowCal_Status);
|
||||
this.Controls.Add(this.gB_Progress);
|
||||
this.Controls.Add(this.pB_Logo1);
|
||||
this.Controls.Add(this.gB_Meters);
|
||||
this.Controls.Add(this.pB_Bubbles1);
|
||||
this.Name = "PreAdjustmentControl";
|
||||
this.Size = new System.Drawing.Size(970, 674);
|
||||
this.Load += new System.EventHandler(this.PreAdjustmentControl_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pB_Logo1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pB_Bubbles1)).EndInit();
|
||||
this.gB_Progress.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_Completion.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_Completion.PerformLayout();
|
||||
this.p_ZeroFlowCal_Offset.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_Offset.PerformLayout();
|
||||
this.p_ZeroFlowCal_Detect.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_Detect.PerformLayout();
|
||||
this.p_ZeroFlowCal_TempCal.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_TempCal.PerformLayout();
|
||||
this.p_ZeroFlowCal_Prepare.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_Prepare.PerformLayout();
|
||||
this.p_ZeroFlowCal_Amplitude.ResumeLayout(false);
|
||||
this.p_ZeroFlowCal_Amplitude.PerformLayout();
|
||||
this.gB_TempMeters.ResumeLayout(false);
|
||||
this.gB_MeterLog.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.PictureBox pB_Logo1;
|
||||
private System.Windows.Forms.GroupBox gB_Meters;
|
||||
private System.Windows.Forms.PictureBox pB_Bubbles1;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Status;
|
||||
private System.Windows.Forms.GroupBox gB_Progress;
|
||||
private System.Windows.Forms.Panel p_ZeroFlowCal_Completion;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Completion;
|
||||
private System.Windows.Forms.ProgressBar pB_ZeroFlowCal_Progress;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_ResttimeDisplayValue;
|
||||
private System.Windows.Forms.Panel p_ZeroFlowCal_Offset;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Offset;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Resttime;
|
||||
private System.Windows.Forms.Panel p_ZeroFlowCal_Detect;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Detect;
|
||||
private System.Windows.Forms.Panel p_ZeroFlowCal_TempCal;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_TempCal;
|
||||
private System.Windows.Forms.Panel p_ZeroFlowCal_Prepare;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Prepare;
|
||||
private System.Windows.Forms.Panel p_ZeroFlowCal_Amplitude;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_Amplitude;
|
||||
private System.Windows.Forms.Button btn_ZeroFlowCal_Abort;
|
||||
private System.Windows.Forms.Button btn_ZeroFlowCal_Start;
|
||||
private System.Windows.Forms.Button btn_ZeroFlowCal_Pdf;
|
||||
private System.Windows.Forms.Button btn_ZeroFlowCal_Save;
|
||||
private System.Windows.Forms.Button btn_ZeroFlowCal_Clear;
|
||||
private System.Windows.Forms.Button btn_ZeroFlowCal_Detect;
|
||||
private System.Windows.Forms.GroupBox gB_TempMeters;
|
||||
private System.Windows.Forms.CheckBox cB_ZeroFlowOffsetTestEnable;
|
||||
private System.Windows.Forms.CheckBox cB_TempCalEnable;
|
||||
private System.Windows.Forms.CheckBox cB_AmplitudeTestEnable;
|
||||
private System.Windows.Forms.Button btn_StoreTempe;
|
||||
private System.Windows.Forms.GroupBox gB_MeterLog;
|
||||
private System.Windows.Forms.RichTextBox rTB_ZeroFlowCalMeter;
|
||||
private System.Windows.Forms.ProgressBar pB_ZeroFlowCal_SubProgress;
|
||||
private System.Windows.Forms.Label l_ZeroFlowCal_SubResttimeDisplayValue;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button btn_ShowAll;
|
||||
private System.Windows.Forms.RichTextBox rTB_ZeroFlowCal;
|
||||
private System.Windows.Forms.Label l_SettingsPreparationMetersize;
|
||||
private System.Windows.Forms.ComboBox cb_Metersize;
|
||||
private System.Windows.Forms.Label lblBuildDate;
|
||||
}
|
||||
}
|
||||
2057
Common/CordonelPreadjustmentUi/PreAdjustmentControl.cs
Normal file
2057
Common/CordonelPreadjustmentUi/PreAdjustmentControl.cs
Normal file
File diff suppressed because it is too large
Load Diff
2261
Common/CordonelPreadjustmentUi/PreAdjustmentControl.resx
Normal file
2261
Common/CordonelPreadjustmentUi/PreAdjustmentControl.resx
Normal file
File diff suppressed because it is too large
Load Diff
139
Common/CordonelPreadjustmentUi/PreAdjustmentSettingsContainer.cs
Normal file
139
Common/CordonelPreadjustmentUi/PreAdjustmentSettingsContainer.cs
Normal file
@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
|
||||
namespace CordonelPreadjustmentUi
|
||||
{
|
||||
public class PreAdjustmentSettingsContainer
|
||||
{
|
||||
#region prep
|
||||
public Int32 CalFactor1 { get; internal set; } = 15625;
|
||||
public Int32 CalFactor2 { get; internal set; } = 15625;
|
||||
public Int32 CalFactor3 { get; internal set; } = 15625;
|
||||
public Int32 ZeroOffset1 { get; internal set; } = 0;
|
||||
public Int32 ZeroOffset2 { get; internal set; } = 0;
|
||||
public Int32 ZeroOffset3 { get; internal set; } = 0;
|
||||
public Int32 Samplerate { get; internal set; } = 10;
|
||||
public MeterSize MeterSize { get; internal set; } = MeterSize.DN50;
|
||||
public LedMode LedMode { get; internal set; } = LedMode.CalibData;
|
||||
#endregion
|
||||
|
||||
#region ProcessesEnabled
|
||||
//todo read from checkbox
|
||||
public bool doOffsetTest { get; internal set; } = true;
|
||||
public bool doAmplTest { get; internal set; } = true;
|
||||
#endregion
|
||||
|
||||
#region TempControl
|
||||
public Double UpperTempLimit { get; internal set; } = 35;
|
||||
public Double LowerTempLimit { get; internal set; } = 15;
|
||||
public Double TempDeviationLimit { get; internal set; } = 1;
|
||||
#endregion
|
||||
#region AmpTest
|
||||
public Int32 AmpTestTofRecordingTime { get; internal set; } = 6;
|
||||
public Double AmpTestTriggerValue { get; internal set; } = 0.5;
|
||||
public bool AmpTestGenerateLogfiles { get; internal set; } = true;
|
||||
public bool AmpTestGenerateMeanValuesFile { get; internal set; } = true;
|
||||
public Int32 AmpTestFirstHitLevelPropMin { get; internal set; } = 12;//(Int32)nUD_Settings_AmplitudeTestLowerLimit.Value,
|
||||
public Int32 AmpTestFirstHitLevelPropMax { get; internal set; } = 32;//(Int32)nUD_Settings_AmplitudeTestUpperLimit.Value,
|
||||
public Int32 AmpTestAmpTestDistance { get; internal set; } = 7;//(Int32)nUD_Settings_AmplitudeTestMinDistance.Value
|
||||
public Int32 AmpTestPercentageStart { get; internal set; } = 5;//(Int32)nUD_Settings_AmplitudeTestMinDistance.Value
|
||||
public Int32 AmpTestPercentageStop { get; internal set; } = 35;//(Int32)nUD_Settings_AmplitudeTestMinDistance.Value
|
||||
public Int32 AmpTestActivityCheckInverval { get; internal set; } = 6;//(Int32)nUD_Settings_AmplitudeTestMinDistance.Value
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region OffsetTest
|
||||
|
||||
public bool OffsetTestGenerateLogfiles { get; internal set; } = true;
|
||||
public Int32 OffsetTestUpperVoltageLimitMV { get; internal set; } = 650;//(Int32)nUD_Settings_AmplitudeTestLowerLimit.Value,
|
||||
public Int32 OffsetTestLowerVoltageLimitMV { get; internal set; } = 200;//(Int32)nUD_Settings_AmplitudeTestUpperLimit.Value,
|
||||
public Int32 OffsetTestOffsetLimitPS { get; internal set; } = 300;//(Int32)nUD_Settings_AmplitudeTestMinDistance.Value
|
||||
public Int32 OffsetTestSettlingTime { get; internal set; } = 60;//(Int32)nUD_Settings_AmplitudeTestMinDistance.Value
|
||||
public Int32 OffsetTestNumberOfLines { get; internal set; } = 9000;
|
||||
public Int32 OffsetTestActivityCheckInverval { get; internal set; } = 2;
|
||||
|
||||
public Int32 OffsetTestBadDataLimit { get; internal set; } = 3;
|
||||
#endregion
|
||||
|
||||
|
||||
private string CultureStr;
|
||||
public List<Int32> TempMeters = new List<Int32>() { 1,10 };
|
||||
public List<Int32> Meters = new List<Int32>() { 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
|
||||
public CultureInfo Culture
|
||||
{
|
||||
get { return CultureInfo.CreateSpecificCulture(CultureStr); }
|
||||
set { CultureStr = value.Name; }
|
||||
}
|
||||
|
||||
public Int32 NumberOfPaths { get; internal set; }
|
||||
public bool TempOnly { get; internal set; } = false;
|
||||
public bool TempMan { get; internal set; } = false;
|
||||
|
||||
public PreAdjustmentSettingsContainer(int numberOfPaths = 3, Int32[] meters = null, string cultureStr = "de-DE", Int32[] tempMeters = null, MeterSize meterSize = MeterSize.DN50, Double upperTempLimit = 35, Double lowerTempLimit = 15, Double tempDeviationLimit = 1, Int32 ampTestTofRecordingTime = 2, Double ampTestTriggerValue = 0.5, bool ampTestGenerateLogfiles = true, bool ampTestGenerateMeanValuesFile = true, Int32 ampTestFirstHitLevelPropMin = 12, Int32 ampTestFirstHitLevelPropMax = 32, Int32 ampTestAmpTestDistance = 7, Int32 ampTestPercentageStart = 5, Int32 ampTestPercentageStop = 35, Int32 ampTestActivityCheckInverval = 6, bool offsetTestGenerateLogfiles = true, Int32 offsetTestUpperVoltageLimitMV = 650, Int32 offsetTestLowerVoltageLimitMV = 200, Int32 offsetTestOffsetLimitPS = 300, Int32 offsetTestSettlingTime = 60, Int32 offsetTestZeroflowOffsetTestNumberOfLines = 9000, Int32 offsetTestActivityCheckInverval = 2, Int32 offsetTestBadDataLimit = 3, Int32 samplerate = 16)
|
||||
{
|
||||
NumberOfPaths = numberOfPaths;
|
||||
|
||||
CultureStr = cultureStr;//"en-US"
|
||||
MeterSize = meterSize;
|
||||
if (meters != null)
|
||||
{
|
||||
Meters = meters.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
Meters = new List<int>() { 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
}
|
||||
if (tempMeters != null)
|
||||
{
|
||||
TempMeters = tempMeters.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
TempMeters = new List<int>() { 1, 10 };
|
||||
}
|
||||
UpperTempLimit = upperTempLimit;
|
||||
LowerTempLimit = lowerTempLimit;
|
||||
TempDeviationLimit = tempDeviationLimit;
|
||||
AmpTestTofRecordingTime = ampTestTofRecordingTime;
|
||||
AmpTestTriggerValue = ampTestTriggerValue;
|
||||
AmpTestGenerateLogfiles = ampTestGenerateLogfiles;
|
||||
AmpTestGenerateMeanValuesFile = ampTestGenerateMeanValuesFile;
|
||||
AmpTestFirstHitLevelPropMin = ampTestFirstHitLevelPropMin;
|
||||
AmpTestFirstHitLevelPropMax = ampTestFirstHitLevelPropMax;
|
||||
AmpTestAmpTestDistance = ampTestAmpTestDistance;
|
||||
AmpTestPercentageStart = ampTestPercentageStart;
|
||||
AmpTestPercentageStop = ampTestPercentageStop;
|
||||
AmpTestActivityCheckInverval = ampTestActivityCheckInverval;
|
||||
OffsetTestGenerateLogfiles = offsetTestGenerateLogfiles;
|
||||
OffsetTestUpperVoltageLimitMV = offsetTestUpperVoltageLimitMV;
|
||||
OffsetTestLowerVoltageLimitMV = offsetTestLowerVoltageLimitMV;
|
||||
OffsetTestOffsetLimitPS = offsetTestOffsetLimitPS;
|
||||
OffsetTestSettlingTime = offsetTestSettlingTime;
|
||||
OffsetTestNumberOfLines = offsetTestZeroflowOffsetTestNumberOfLines;
|
||||
OffsetTestActivityCheckInverval = offsetTestActivityCheckInverval;
|
||||
OffsetTestBadDataLimit = offsetTestBadDataLimit;
|
||||
Samplerate = samplerate;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var p in this.GetType().GetProperties().Where(p => !p.GetGetMethod().GetParameters().Any()))
|
||||
{
|
||||
sb.Append($"{p.Name}={p.GetValue(this, null).ToString()}");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,540 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using CordonelPreadjustmentUi.Processes.Itinerary;
|
||||
using System.Threading;
|
||||
using static CordonelPreadjustmentUi.PreAdjustmentControl;
|
||||
using System.Threading.Tasks;
|
||||
using CordonelPreadjustmentUi.Helper;
|
||||
using CordonelPreadjustmentUi.Const;
|
||||
using CordonelPreadjustmentUi.Helper.Extensions;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
{
|
||||
public class AmplitudeTestProcess : BaseProcess
|
||||
{
|
||||
public AmplitudeTestProcess(string processName, StatusPanelItems panelState, string performMessage, string failedMessage, int? expectedTimeS) : base(processName, panelState, performMessage, failedMessage, expectedTimeS)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<Task> StartWork()
|
||||
{
|
||||
return doWorkProcess(base.CurrentProcessProgress);
|
||||
}
|
||||
|
||||
private List<Task> doWorkProcess(ProcessProgress pp)
|
||||
{
|
||||
var MetersToProcess = MeterStateCtls.Where(e => e.IsEnabled).ToList();
|
||||
|
||||
var listOfProcessTask = new List<Task>();
|
||||
|
||||
foreach (var meterctl in MetersToProcess)
|
||||
{
|
||||
listOfProcessTask.Add(new Task<bool>(() =>
|
||||
{
|
||||
|
||||
pp.DebugMessage($"Performing {ProcessName} procedure", null , "CC");
|
||||
|
||||
#region Definitions and initializations
|
||||
const Int32 FirstHitShiftValue = 4;
|
||||
const Int32 FirstHitShiftValueEnd = 4;
|
||||
const Int32 FirstHitUpdatePeriodeValue = 1;
|
||||
const Int32 FirstHitUpdatePeriodeValueEnd = 10;
|
||||
const Int32 WaitBeforeLogging = 5;
|
||||
String DebugMessage = String.Empty;
|
||||
|
||||
var TofAvgMean = new MultiPathDataLogContainer<Double>(pp.Setting.NumberOfPaths);
|
||||
var OptimalPoint = new MultiPathDataLogContainer<Int32>(pp.Setting.NumberOfPaths);
|
||||
var TofAvgMeanTotal = new MultiPathDataLogContainer<List<Double>>(pp.Setting.NumberOfPaths);
|
||||
TofAvgMeanTotal.Update(null,new List<Double>());
|
||||
|
||||
Boolean Ok = false;
|
||||
#endregion
|
||||
#region StartLogging
|
||||
if (pp.Setting.AmpTestGenerateLogfiles)
|
||||
{
|
||||
String time = System.DateTime.Now.ToString(Formats.LogFileDateTimeString);
|
||||
String Header = $"Genesis ZeroFlowOffsetCalibration {meterctl.Meter.Slot}; PCB ID = {meterctl.Meter.PcbId}; Date = {time}; Operator = {Environment.UserName}\n";
|
||||
meterctl.Meter.DataLog(Header);
|
||||
//GenesisZeroFlow._GenesisZeroFlow.SetLoggingPathAmplitudeTest(this.MeterNumber, $"{DataLogging.DefaultPath}AmplitudeTest_RawData_{TempPcbID}_{time}.txt");
|
||||
meterctl.Meter.logAmpTest = true;
|
||||
pp.DebugMessage($" Start logging", meterctl.Meter.Slot, "DC",meterctl.Meter.PcbId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Ok = false;
|
||||
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "First hit update period", Register.Genesisflow.FirstHitUpdatePeriod, FirstHitUpdatePeriodeValue);
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
|
||||
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
|
||||
Ok = false;
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "WorkAround TriggerIdle", Register.Genesisflow.TriggerIdle, 1, false);
|
||||
Thread.Sleep(150);
|
||||
|
||||
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
|
||||
Ok = false;
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "first hit shift", Register.Genesisflow.FirstHitShift, FirstHitShiftValueEnd);
|
||||
|
||||
Thread.Sleep(150);
|
||||
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
|
||||
Ok = false;
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "WorkAround TriggerActive", Register.Genesisflow.TriggerActive, 1, false);
|
||||
Thread.Sleep(150);
|
||||
|
||||
#region Set first hit level percentage from 5 to 35
|
||||
pp.DebugMessage($"Start first hit level percentage sweep ", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
for (Int32 FirstHitLevelPercentage = pp.Setting.AmpTestPercentageStart; FirstHitLevelPercentage <= pp.Setting.AmpTestPercentageStop; FirstHitLevelPercentage++)
|
||||
{
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
|
||||
pp.StatusLabel = $"{PredefinedMessages.WaitUntilPercentageSweepFinished(pp.Setting.Culture)} {FirstHitLevelPercentage.ToString(pp.Setting.Culture)}/{pp.Setting.AmpTestPercentageStop.ToString(pp.Setting.Culture)}";
|
||||
#region Write to percentage register PATH0
|
||||
|
||||
Ok = false;
|
||||
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "Percentage", Register.Genesisflow.FirstHitPercent1, FirstHitLevelPercentage);
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
#endregion
|
||||
#region Write to percentage register PATH1
|
||||
if (pp.Setting.NumberOfPaths > 1)
|
||||
{
|
||||
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "Percentage", Register.Genesisflow.FirstHitPercent2, FirstHitLevelPercentage);
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
}
|
||||
#endregion
|
||||
#region Write to percentage register PATH2
|
||||
if (pp.Setting.NumberOfPaths > 2)
|
||||
{
|
||||
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "Percentage", Register.Genesisflow.FirstHitPercent3, FirstHitLevelPercentage);
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
}
|
||||
#endregion
|
||||
#region Wait for 1 second
|
||||
for (Int32 i = 0; i < WaitBeforeLogging; i++)
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
#endregion
|
||||
#region Record TOF
|
||||
|
||||
|
||||
Ok = RecordData(pp, meterctl, Ok, FirstHitLevelPercentage);
|
||||
|
||||
bool retryRecord = false;
|
||||
|
||||
for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++)
|
||||
{
|
||||
if (!meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).Any())
|
||||
{
|
||||
pp.StatusLabel = $"No Data for Path {Path}. Start one recollect";
|
||||
|
||||
retryRecord = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (retryRecord)
|
||||
{
|
||||
Ok = RecordData(pp, meterctl, Ok, FirstHitLevelPercentage);
|
||||
}
|
||||
|
||||
|
||||
pp.StatusLabel = $"{PredefinedMessages.WaitUntilPercentageSweepFinished(pp.Setting.Culture)} {FirstHitLevelPercentage.ToString(pp.Setting.Culture)}/{ pp.Setting.AmpTestPercentageStop.ToString(pp.Setting.Culture)}; 0s";
|
||||
Ok = true;
|
||||
#endregion
|
||||
#region Calculate mean value
|
||||
|
||||
|
||||
for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++)
|
||||
{
|
||||
var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).ToList().Mean();
|
||||
pp.DebugMessage($"Calculate mean value {meanVal} at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
//earlier TofAvgMeanTotal
|
||||
//TofAvgMean.Update(Path, meanVal);
|
||||
|
||||
if (meanVal == 0)
|
||||
{
|
||||
pp.DebugMessage($"Mean value is zero at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
meterctl.Meter.calibrationResult.AddAditonlaLog($"" +
|
||||
$"PATH {Path + 1}", Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture));
|
||||
|
||||
if (CheckAbort(false, meterctl)) { return false; }
|
||||
}
|
||||
|
||||
pp.DebugMessage($"Mean value at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
|
||||
meterctl.Meter.calibrationResult.AddAditonlaLog($"Amp. Test Mean value PATH {Path + 1}", $"at {FirstHitLevelPercentage}={Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}");
|
||||
var cTofAvgMeanTotal = TofAvgMeanTotal.Get(Path).ToList();
|
||||
|
||||
cTofAvgMeanTotal.Add(meanVal);
|
||||
TofAvgMeanTotal.Update(Path, cTofAvgMeanTotal);
|
||||
//meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List<Double>());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Write raw data to files
|
||||
//if (this.GenerateLogFiles)
|
||||
//{
|
||||
// GenesisZeroFlow._GenesisZeroFlow.SetLoggingIndicatorAmpTest(this.MeterNumber, false);
|
||||
// String temp = GenesisZeroFlow._GenesisZeroFlow.GetDataToLog()[this.MeterNumber];
|
||||
// pp.DebugMessage =$"{meterctl.Meter.PcbId}\tAPPLICATION:\t\t Write data to files at {meterctl.Meter.Slot}\n";
|
||||
// Logging.WriteToFile(temp, GenesisZeroFlow._GenesisZeroFlow.GetLoggingPathAmplitudeTest()[this.MeterNumber]);
|
||||
//}
|
||||
#endregion
|
||||
#region Write mean values to file
|
||||
//String DateTime = System.DateTime.Now.ToString(Formats.LogFileDateTimeString;
|
||||
//if (this.GenerateMeanFiles)
|
||||
//{
|
||||
// for (UInt16 Path = Constants.PATH0; Path < Constants.NumberOfPaths; Path++)
|
||||
// Logging.WriteToFile(GenesisZeroFlow._GenesisZeroFlow.GetAmpValuesToLog()[this.MeterNumber][Constants.PATH0], $@"..\ZeroflowCalibrationTool_MeanAmplitude_{meterctl.Meter.Slot}_PATH{Path + 1}_{TempPcbID}_{DateTime}.csv");
|
||||
//}
|
||||
|
||||
|
||||
//this.ClearData();
|
||||
//#endregion
|
||||
#region Calculate optimal point
|
||||
|
||||
var DistanceLeft = new MultiPathDataLogContainer<double>(pp.Setting.NumberOfPaths);
|
||||
var DistanceRight = new MultiPathDataLogContainer<double>(pp.Setting.NumberOfPaths);
|
||||
|
||||
var CalculationFailed = new MultiPathDataLogContainer<bool>(pp.Setting.NumberOfPaths);
|
||||
|
||||
pp.DebugMessage($"Start calculating optimal points", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
|
||||
for (UInt16 Path = 0; Path < TofAvgMeanTotal.GetPathCount(); Path++)
|
||||
{
|
||||
var tmpOptimalPoint = 0;
|
||||
var tmpDistanceLeft = 0.0;
|
||||
var tmpDistanceRight = 0.0;
|
||||
|
||||
var r = CalculateOptimalPoint(pp, meterctl.Meter.Slot, TofAvgMeanTotal.Get(Path).ToList(),out tmpDistanceLeft, out tmpDistanceRight, out tmpOptimalPoint);
|
||||
OptimalPoint.Update(Path, tmpOptimalPoint);
|
||||
DistanceLeft.Update(Path, tmpDistanceLeft);
|
||||
DistanceRight.Update(Path, tmpDistanceRight);
|
||||
|
||||
CalculationFailed.Update(Path, r);
|
||||
|
||||
if (!r)
|
||||
{
|
||||
meterctl.Meter.calibrationResult.AddAditonlaLog($"Amp. Test OptimalPoint PATH {Path + 1}", OptimalPoint.Get(Path).ToString(pp.Setting.Culture));
|
||||
pp.DebugMessage($"Optimal point calculation successful PATH{Path + 1}; Value = {OptimalPoint.Get(Path).ToString(pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
}
|
||||
else
|
||||
{
|
||||
meterctl.Meter.calibrationResult.AddAditonlaLog($"Amp. Test OptimalPoint PATH {Path + 1}", "NaN");
|
||||
pp.DebugMessage($"Optimal point calculation failed, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
if (CheckAbort(!r, meterctl)) { return !r; }
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region Check value
|
||||
pp.DebugMessage($"Start optimal point values check", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
|
||||
Boolean OptimalPointOK = true;
|
||||
for (UInt16 Path = 0; Path < OptimalPoint.GetPathCount(); Path++)
|
||||
{
|
||||
if (!this.CheckOptimalPoint(pp,OptimalPoint.Get(Path), out DebugMessage, meterctl.Meter.Slot))
|
||||
OptimalPointOK = false;
|
||||
|
||||
pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
}
|
||||
|
||||
if (CheckAbort(OptimalPointOK, meterctl)) { return OptimalPointOK; }
|
||||
#endregion
|
||||
#region Check distance
|
||||
Boolean CheckDistOK = true;
|
||||
for (UInt16 Path = 0; Path < DistanceLeft.GetPathCount(); Path++)
|
||||
{
|
||||
if (!this.CheckDistance(pp,DistanceLeft.Get(Path), DistanceRight.Get(Path), out DebugMessage, meterctl.Meter.Slot ))
|
||||
CheckDistOK = false;
|
||||
|
||||
pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
}
|
||||
if (CheckAbort(CheckDistOK, meterctl)) { return CheckDistOK; }
|
||||
|
||||
#endregion
|
||||
#region Set first hit level percentage registers
|
||||
pp.DebugMessage($"Start writing to percentage registers", meterctl.Meter.Slot, "CC", meterctl.Meter.PcbId);
|
||||
for (UInt16 Path = 0; Path < OptimalPoint.GetPathCount(); Path++)
|
||||
{
|
||||
pp.StatusLabel = ($"{PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture)}");
|
||||
Ok = false;
|
||||
String RegValue = String.Empty;
|
||||
switch (Path)
|
||||
{
|
||||
case 0:
|
||||
RegValue = Register.Genesisflow.FirstHitPercent1;
|
||||
break;
|
||||
case 1:
|
||||
RegValue = Register.Genesisflow.FirstHitPercent2;
|
||||
break;
|
||||
case 2:
|
||||
RegValue = Register.Genesisflow.FirstHitPercent3;
|
||||
break;
|
||||
default:
|
||||
RegValue = Register.Genesisflow.FirstHitPercent1;
|
||||
break;
|
||||
};
|
||||
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "Percentage", RegValue, OptimalPoint.Get(Path));
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
//here
|
||||
|
||||
#region Set first hit update period to 10
|
||||
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
|
||||
Ok = false;
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "first hit update period", Register.Genesisflow.FirstHitUpdatePeriod, FirstHitUpdatePeriodeValueEnd);
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
#endregion
|
||||
|
||||
#region Wait for 1 second
|
||||
for (Int32 i = 0; i < WaitBeforeLogging; i++)
|
||||
{
|
||||
Thread.Sleep(300);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Set first hit shift to 4
|
||||
//Frost, Alex <AFrost@sentec.co.uk> Do 02.07.2020 17:12
|
||||
//RE: Writing 4 to 'First hit shift'-register failed
|
||||
//I think a workaround would be to go into idle mode before changing this register then back to active mode after.I haven’t tried this out yet
|
||||
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
|
||||
Ok = false;
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "WorkAround TriggerIdle", Register.Genesisflow.TriggerIdle, 1, false);
|
||||
Thread.Sleep(150);
|
||||
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
|
||||
Ok = false;
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "first hit shift", Register.Genesisflow.FirstHitShift, FirstHitShiftValueEnd);
|
||||
Thread.Sleep(150);
|
||||
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
|
||||
Ok = false;
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, "WorkAround TriggerActive", Register.Genesisflow.TriggerActive, 1, false);
|
||||
Thread.Sleep(150);
|
||||
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
#endregion
|
||||
#endregion
|
||||
return Ok;
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
return listOfProcessTask;
|
||||
|
||||
}
|
||||
|
||||
private bool RecordData(ProcessProgress pp, MeterStateControl meterctl, bool Ok, int FirstHitLevelPercentage)
|
||||
{
|
||||
meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(null, new List<Double>());
|
||||
meterctl.Meter.logAmpTest = true;
|
||||
|
||||
pp.DebugMessage($"Start collecting data", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
var LinecounterFollowing = new MultiPathDataLogContainer<Int32>(pp.Setting.NumberOfPaths);
|
||||
|
||||
|
||||
for (Int32 Seconds = 0; Seconds < pp.Setting.AmpTestTofRecordingTime; Seconds++) // eight seconds remove /2
|
||||
{
|
||||
if (Int32.Equals((Seconds % pp.Setting.AmpTestActivityCheckInverval), 0))
|
||||
{
|
||||
pp.StatusLabel = $"{PredefinedMessages.WaitUntilPercentageSweepFinished(pp.Setting.Culture)} {FirstHitLevelPercentage.ToString(pp.Setting.Culture)}/{ pp.Setting.AmpTestPercentageStop.ToString(pp.Setting.Culture)}; {(pp.Setting.AmpTestTofRecordingTime - Seconds).ToString(pp.Setting.Culture)}s";
|
||||
|
||||
Thread.Sleep(1000);
|
||||
Ok = ActivityCheck(pp, meterctl.Meter.listOfTotalTimeOfFlightSPerPath, pp.Setting.AmpTestTofRecordingTime);
|
||||
if (!Ok)
|
||||
{
|
||||
pp.DebugMessage($"Activity check failed", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
||||
// if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
private Boolean CalculateOptimalPoint(ProcessProgress pp,int Slot, List<Double> TofAvg, out Double left, out Double right, out Int32 xAtOptimalPoint)
|
||||
{
|
||||
|
||||
List<Double> ValuesLeft = new List<Double>();
|
||||
List<Double> ValuesRight = new List<Double>();
|
||||
List<Double> MinDistance = new List<Double>();
|
||||
xAtOptimalPoint = 0;
|
||||
Boolean SubError = true;
|
||||
left = 0;
|
||||
right = 0;
|
||||
|
||||
ValuesLeft = this.CalculateNearestDistanceLeft(pp,TofAvg, out left);
|
||||
ValuesRight = this.CalculateNearestDistanceRight(pp,TofAvg, out right);
|
||||
|
||||
for (UInt16 i = 0; i < ValuesLeft.Count(); i++)
|
||||
{
|
||||
Double temp1 = ValuesLeft.ElementAt(i);
|
||||
Double temp2 = ValuesRight.ElementAt(i);
|
||||
Thread.Sleep(10);
|
||||
MinDistance.Add(Math.Min(temp1, temp2));
|
||||
}
|
||||
|
||||
//String mindistance = $"mindistance: PATH{path.ToString(GlobalCulture)}\n";
|
||||
//for (Int16 i = 0; i < MinDistance.Count(); i++)
|
||||
//{
|
||||
// Double temp = MinDistance.ElementAt(i);
|
||||
// Misc.WaitNMilliseconds(10);
|
||||
// mindistance = $"{mindistance}{temp.ToString(GlobalCulture)}\n";
|
||||
//}
|
||||
//Logging.WriteToFile(mindistance, @"..\mindistance_PATH"+ path.ToString() + ".txt");
|
||||
|
||||
Double Maximum = 0;
|
||||
|
||||
for (Int16 i = 0; i < MinDistance.Count(); i++)
|
||||
{
|
||||
if ((!Int16.Equals(i, 0)) && (!Int16.Equals(i, (Int16)(TofAvg.Count() - 1))))
|
||||
{
|
||||
if (MinDistance.ElementAt(i) > Maximum)
|
||||
{
|
||||
Maximum = MinDistance.ElementAt(i);
|
||||
xAtOptimalPoint = (Int32)i + pp.Setting.AmpTestPercentageStart;
|
||||
;
|
||||
SubError = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SubError;
|
||||
}
|
||||
private List<Double> CalculateNearestDistanceLeft(ProcessProgress pp, List<Double> TofAvg, out Double left)
|
||||
{
|
||||
List<Double> Distance = new List<Double>();
|
||||
Double NearestDistance = 0;
|
||||
Boolean Detected = false;
|
||||
left = 0;
|
||||
|
||||
for (Int32 Percentage = pp.Setting.AmpTestFirstHitLevelPropMin; Percentage <= pp.Setting.AmpTestFirstHitLevelPropMax ; Percentage++)
|
||||
{
|
||||
Detected = false;
|
||||
for (Int32 PercentageFollowing = Percentage; PercentageFollowing <= pp.Setting.AmpTestFirstHitLevelPropMax; PercentageFollowing++)
|
||||
{
|
||||
if ((TofAvg.ElementAt(PercentageFollowing - pp.Setting.AmpTestFirstHitLevelPropMin) - TofAvg.ElementAt(Percentage - pp.Setting.AmpTestFirstHitLevelPropMin)) > pp.Setting.AmpTestTriggerValue)
|
||||
{
|
||||
NearestDistance = PercentageFollowing - Percentage;
|
||||
Detected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!Detected)
|
||||
NearestDistance = pp.Setting.AmpTestFirstHitLevelPropMax - Percentage;
|
||||
|
||||
Distance.Add(NearestDistance);
|
||||
}
|
||||
|
||||
for (Int16 i = 0; i < (Int16)Distance.Count(); i++)
|
||||
{
|
||||
if (Distance.ElementAt(i) >= left)
|
||||
{
|
||||
left = Distance.ElementAt(i);
|
||||
}
|
||||
}
|
||||
return Distance;
|
||||
}
|
||||
private List<Double> CalculateNearestDistanceRight(ProcessProgress pp, List<Double> TofAvg, out Double right)
|
||||
{
|
||||
List<Double> Distance = new List<Double>();
|
||||
Double NearestDistance = 0;
|
||||
Boolean Detected = false;
|
||||
right = 0;
|
||||
|
||||
for (Int32 Percentage = pp.Setting.AmpTestFirstHitLevelPropMax; Percentage >= (pp.Setting.AmpTestFirstHitLevelPropMin); Percentage--)
|
||||
{
|
||||
Detected = false;
|
||||
|
||||
for (Int32 ProportionFollowing = Percentage; ProportionFollowing >= pp.Setting.AmpTestFirstHitLevelPropMin; ProportionFollowing--)
|
||||
{
|
||||
if ((TofAvg.ElementAt(ProportionFollowing - pp.Setting.AmpTestFirstHitLevelPropMin)) - (TofAvg.ElementAt(Percentage - pp.Setting.AmpTestFirstHitLevelPropMin)) < -pp.Setting.AmpTestTriggerValue)
|
||||
{
|
||||
NearestDistance = Percentage - ProportionFollowing;
|
||||
Detected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Detected)
|
||||
NearestDistance = Percentage - pp.Setting.AmpTestFirstHitLevelPropMin;
|
||||
|
||||
Distance.Add(NearestDistance);
|
||||
}
|
||||
|
||||
|
||||
Distance.Reverse();
|
||||
|
||||
for (Int16 i = 0; i < Distance.Count(); i++)
|
||||
{
|
||||
if (Distance.ElementAt(i) >= right)
|
||||
{
|
||||
right = Distance.ElementAt(i);
|
||||
}
|
||||
}
|
||||
return Distance;
|
||||
}
|
||||
private Boolean CheckOptimalPoint(ProcessProgress pp, Int32 optimalPoint, out String debugMessage, int Slot)
|
||||
{
|
||||
Boolean Ok = true;
|
||||
debugMessage = $"Optimal point check successful at {Slot}";
|
||||
// ampTestLowerLimit, ampTestUpperLimit, ampTestDistance
|
||||
if (optimalPoint > pp.Setting.AmpTestFirstHitLevelPropMax)
|
||||
{
|
||||
debugMessage = $"Optimal point maximum check failed at {Slot}";
|
||||
Ok = false;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
if (optimalPoint < pp.Setting.AmpTestFirstHitLevelPropMin)
|
||||
{
|
||||
debugMessage = $"Optimal point minimum check failed at {Slot}";
|
||||
Ok = false;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
private Boolean CheckDistance(ProcessProgress pp,Double left, Double right, out String debugMessage, int Slot)
|
||||
{
|
||||
Boolean Ok = true;
|
||||
debugMessage = $"Distance check successful at {Slot}";
|
||||
|
||||
if (left < pp.Setting.AmpTestFirstHitLevelPropMin)
|
||||
{
|
||||
Ok = false;
|
||||
debugMessage = $"Distance check failed at {Slot}";
|
||||
return Ok;
|
||||
}
|
||||
|
||||
if (right < pp.Setting.AmpTestFirstHitLevelPropMin)
|
||||
{
|
||||
Ok = false;
|
||||
debugMessage = $"Distance check failed at {Slot}";
|
||||
return Ok;
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user