Compare commits

...
Author SHA1 Message Date
michal 5313f0a04b Version iteration 3.9.3135.0 2026-07-31 14:04:59 +02:00
michal 9557df0cef Added detailed debug logging for CLI command execution and adjusted debug path in SerialPortData. 2026-07-28 14:02:01 +02:00
michal 71ff74122e camera send implemenatation, dialog support, ver 3.9.3134 2026-07-15 16:12:21 +02:00
michal 34141481e3 Camera ProcedureParams - Added new parameters in Proces Camera Tab 2026-07-14 14:42:47 +02:00
michal f2e6807349 camera advance fix, ver 3.9.3133.0 2026-07-14 14:31:01 +02:00
michal 977cd4ec95 new version number 3.9.3132.0, safe grab image reading 2026-07-13 22:20:13 +02:00
michal 585a199f53 camera image grabber improved - takes more attempts and retries, 2026-07-13 21:34:49 +02:00
michal 50298d493d Verson Iterantion 3.9.3131.0 2026-07-13 13:47:54 +02:00
michal 785c8c1881 GrabImage in Detect Camera to warm up step 3.1 2026-07-13 13:45:50 +02:00
michal 08e1ba695e Live Stream Woring - ConnectCameraAsync - more atepts 2026-07-13 12:59:02 +02:00
michal 38abca2e8a fix camera functionality now using CameraLineReader for quick buffered read 2026-07-13 09:03:53 +02:00
michal 7129960b12 store temp changes 2026-07-02 16:45:57 +02:00
michal 1fddd87f2b Update DataSource in gci_config.json to new server and database configuration 2026-06-18 11:14:10 +02:00
michal 19ff06b01e PreAdjustment preparation 2026-06-09 16:23:00 +02:00
michal d73eac8332 Merge branch 'develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode_special 2026-06-08 09:17:46 +02:00
michal 63041c0fc9 Increment assembly version to 3.9.3130.0, replace iPerl_Communication_in_progress with Meter_Communication_in_progress across resources and sequences, and update string resources for improved clarity and consistency. 2026-06-04 14:56:56 +02:00
michal 77c131f414 Increment assembly version to 3.9.3129.0, streamline context menu options in iPerlCommunicationForm, consolidate unused menu items, improve PBC_Read_Build_Async with retry logic for slot and PCB ID operations, and optimize GenesisSmartReader communication and debugging. 2026-06-04 11:00:20 +02:00
michal 4173512ecc Increment assembly version to 3.9.3128.0, enhance thread handling for iPerlCommunicationForm with improved delay logic and UI checks, and replace ReadRegisterAsync with ReadRegisterWithRetryAsync for more robust Genesis register operations. 2026-06-04 08:16:13 +02:00
michal c991d530d5 Increment assembly version to 3.9.3126.0. 2026-06-03 12:46:18 +02:00
michal 2ba0bfe2b1 Enhance PrepareSlotQ3Calibration and WriteSlotQ3Calibration methods with improved logging, refined error handling, and additional debug details for iHead operations. 2026-06-03 12:45:03 +02:00
michal 13490009a3 Increment assembly version to 3.9.3125.3. 2026-06-03 10:43:22 +02:00
michal c6849deaef Improve Q3Channel handling by refining water meter result copying logic, enhancing error handling, and updating calibration factor processing for multi-channel scenarios. 2026-06-03 10:27:45 +02:00
michal 0b7dd2bafa Store Q3Channel to DB
Refine water meter processing logic by adding Q3Channel checks and adjusting removal and test result evaluation conditions.
2026-06-03 09:50:31 +02:00
michal 2d8cc912a3 Increment assembly version to 3.9.3124.3, implement GetEachMeterTestRslt method, enhance error handling in calibration-related methods, refine Q3 calibration data simulation and storage logic, and improve debug logging across Genesis operations. 2026-06-03 09:49:34 +02:00
michal 0b246b2ff5 Merge branch 'develop/SLM-PT50_genesisDirectDecode_special_3121_17969' into develop/SLM-PT50_genesisDirectDecode_special
# Conflicts:
#	TBF/Rig/RegisterReaders/GenesisRegReader/communication/OptoHeadTest.cs
2026-05-29 15:52:16 +02:00
michal 8b025a0fca Increment assembly version to 3.9.3121.3, enhance debug logging in PrepareQ3Calibration and related methods, improve calibration factor handling with multi-value support, add exception handling for simulated DB responses, and refine Q3 calibration logic in GenesisSmartReader. 2026-05-29 15:40:20 +02:00
michal 0f407920ac Update predefined calibration value in PrepareMeterSizeAndCalibration from 15625 to 17969. 2026-05-29 08:51:51 +02:00
michal 347a8798b8 Enhance Q3 calibration logic by refining PrepareSlotQ3Calibration and WriteSlotQ3Calibration methods, improving handling of TestRsltCalibFactor storage across multiple channels, and extending exception handling and debug logging for Genesis operations. 2026-05-28 14:29:02 +02:00
michal 3cd488fc76 Increment assembly version to 3.9.3121.1, add FailedPrepare error constant and handling in iPerlCommunicationForm, enhance PrepareSlotQ3Calibration and WriteSlotQ3Calibration with exception handling and logging, introduce IsCalibFactorValid property and mappings for calibration logic, and extend debug logging across Genesis operations. 2026-05-27 14:00:40 +02:00
michal e88e441875 Refactor preadjustmenActionsViewButton to preadjustmentActionsViewButton, add Q3Channel property to entities and mappings, implement schema migrations for Q3Channel, update GenesisSmartReader Q3Channel logic, replace file paths for clarity, upgrade projects to .NET Framework 4.8, and extend debug logging. 2026-05-25 09:21:32 +02:00
michal 89cfcb75e8 Merge branch 'develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode_special
# Conflicts:
#	GenesisCordonelInterface/UI/LaatzenAPI_CordonelPreadjustmentUI/FrmCordonelPreadjustmentUI.cs
#	TBF/TBF.csproj
2026-05-22 12:58:48 +02:00
michal db90a096e3 Add calibration factor support to Genesis, implement TestRsltCalibFactor entity, related mappings, table creation logic, and data persistence methods. Extend GenesisSmartReader with Q3 calibration enhancements and introduce new debug logging. 2026-05-22 09:18:41 +02:00
michal 6f919ede9b Increment assembly version to 3.9.3104.1, add CheckMeterPrepare functionality and CheckMeterPrepareStr constant in iPerlCommunicationForm, implement error handling and UI safeguarding for communication events, introduce TriggerIdle constant in RadioService, and enhance GenesisSmartReader with CheckMeterPrepare logic and improved debug logging. 2026-05-19 15:21:20 +02:00
michal 44b6060113 Increment assembly version to 3.9.3103.1, add HoldSlotStr constant and HoldOn functionality in iPerlCommunicationForm, implement message box synchronization for multi-threaded operations, enhance slot operation handling with ProcessWaterMetersDialogConfirmation, and improve debug logging and error management in Genesis operations. 2026-05-18 16:23:00 +02:00
michal fde090c437 Increment assembly version to 3.9.3102.1, enhance FlyingStartMassCollectionSeq by removing unused code, improve error handling for flow calculations in FlyingStartSeq, extend GenesisSmartReader integration, and introduce WaterMeterParentCopy method for multi-channel handling in test sequences. 2026-05-15 13:02:09 +02:00
michal 0af975f670 Increment assembly version to 3.9.3101.1, increase thread support to 10 across relevant configurations, extend Genesis communication ranges, enhance debug logging for slot initialization, and update Genesis configuration controls with parallel access parameters. 2026-05-15 10:39:37 +02:00
michal 6d0d2cd34e Increment assembly version to 3.9.3100.1. 2026-05-15 08:02:46 +02:00
michal d9a14ea3e1 Increment assembly version to 3.9.3098.1, add Q3 calibration support in iPerlCommunicationForm, implement PrepareSlotQ3Calibration and WriteSlotQ3Calibration methods in OptoHeadTest, extend GenesisSmartReader with Q3 calibration logic, and update slot operation and test sequence handling to include calibration-related data. 2026-05-15 08:02:28 +02:00
michal 2526e997e3 Increment assembly version to 3.9.3097.1, add SlotGroupedLogin support in iPerlCommunicationForm, implement GroupedLoginSlot method in OptoHeadTest, and update slot operation logic with enhanced error messaging. 2026-05-13 12:57:23 +02:00
michal d346dcfa03 Merge branch 'develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode_special
# Conflicts:
#	GenesisCordonelInterface/API/InterfaceGCIToLaatzen.cs
#	TBF/Rig/BridgeComponents/GciBridge/GciBridge.cs
#	TBF/TBF.csproj
2026-05-13 10:03:46 +02:00
michal 8437952478 Increment assembly version to 3.9.3095.1, expand iPerlCommunicationForm with new slot-related constants and error definitions, implement slot handling methods in OptoHeadTest, introduce PcbReadResult for PCB reading flow, and enhance connection and slot operation logic. 2026-05-13 09:48:41 +02:00
michal 34bf5d5473 Increment assembly version to 3.9.3094.1, extend iPerlCommunicationForm with new context menu options and associated slot handling, introduce bend detection support in Genesis streaming protocol, add data members for radio configuration, and enhance asynchronous operations in JSON handling. 2026-05-12 16:03:28 +02:00
michal 6c4c7e73bb Merge branch 'develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode_special 2026-05-12 14:00:42 +02:00
michal f97c406ae8 Update DLL references for Xylem.Common components across hardware and metrology modules. 2026-05-12 07:51:02 +02:00
michal 9cfadb8075 Merge remote-tracking branch 'private-origin/develop/SLM-PT50_genesisDirectDecode_special' into develop/SLM-PT50_genesisDirectDecode_special 2026-05-12 07:50:18 +02:00
michal 1709ef842d Refactor iPerlCommunication module to integrate GenesisSmartReader, update related logic and methods, optimize asynchronous operations, and increment assembly version to 3.9.3091.1. 2026-05-12 07:50:03 +02:00
michal 8e694dc910 Refactor iPerlCommunication module to integrate GenesisSmartReader, update related logic and methods, optimize asynchronous operations, and increment assembly version to 3.9.3091.1. 2026-05-12 07:49:13 +02:00
michal 0b1e09e0df Merge branch 'develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode_special
# Conflicts:
#	TBF/TBF.csproj
2026-05-11 17:29:13 +02:00
michal 84307f4bf4 Merge branch 'develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode_special 2026-05-08 12:25:23 +02:00
michal 463fb16b23 Remove iPerlCommunication module entirely.
Deleted all related classes, configurations, and implementations for the `iPerlCommunication` module, including `TestMethod`, `TestMethodCfg`, and associated components. This cleanup reflects either a deprecated or unused feature.
2026-05-08 12:24:42 +02:00
michal b4c0384b57 Refactor RadioService for improved asynchronous handling, consolidate unused namespaces, update OptoHeadTest logic, and increment assembly version to 3.9.3085.1. 2026-05-08 10:44:27 +02:00
michal f4b8e42f59 Merge branch 'develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode_special
# Conflicts:
#	TBF/Rig/RegisterReaders/GenesisRegReader/communication/RadioService.cs
2026-05-07 21:37:05 +02:00
michal abee5fa6b1 Update DLL references for Xylem.Common components across multiple modules. 2026-05-07 21:33:41 +02:00
michal b8926ef93f Add unit tests for OptoHeadTest handling simulated Genesis readers, refine project references, and increment assembly version to 3.9.3079.1. 2026-05-07 21:30:19 +02:00
michal 502804c2de Merge remote-tracking branch 'private-origin/develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode 2026-05-06 15:32:41 +02:00
michal 296621a590 * Increment assembly version to 3.9.3069.1
* Logs update
2026-05-06 15:32:33 +02:00
michal cfc52f195b Merge remote-tracking branch 'private-origin/develop/SLM-PT50_genesisDirectDecode' into develop/SLM-PT50_genesisDirectDecode
# Conflicts:
#	TBF/TBF.csproj
2026-05-06 10:26:15 +02:00
michal 68a1eb9941 Update project references and paths to replace project dependencies with direct DLL references. Standardize formatting in GenesisImplHeadTestCtrl and refine Operations enum declarations. 2026-05-06 10:24:33 +02:00
265 changed files with 44941 additions and 182833 deletions
+2 -2
View File
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>AppDiagnostic</RootNamespace>
<AssemblyName>AppDiagnostic</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
@@ -102,4 +102,4 @@
<None Include="Resources\TBF_icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -114,4 +114,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Config</RootNamespace>
<AssemblyName>Config</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -150,4 +150,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataMatrix4Net</RootNamespace>
<AssemblyName>DataMatrix4Net</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -58,4 +58,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataStreamInterface</RootNamespace>
<AssemblyName>DataStreamInterface</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -61,4 +61,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Decrypt</RootNamespace>
<AssemblyName>Decrypt</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -63,4 +63,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DeviceTest</RootNamespace>
<AssemblyName>DeviceTest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -114,4 +114,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Dirichlet.Numerics</RootNamespace>
<AssemblyName>Dirichlet.Numerics</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
@@ -51,4 +51,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Encrypt</RootNamespace>
<AssemblyName>Encrypt</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -63,4 +63,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EventViewer</RootNamespace>
<AssemblyName>EventViewer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -142,4 +142,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FeatureVectorCalculator</RootNamespace>
<AssemblyName>FeatureVectorCalculator</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -97,4 +97,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -28,7 +28,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -180,4 +180,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -35,7 +35,7 @@
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
@@ -146,4 +146,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GenericTest</RootNamespace>
<AssemblyName>GenericTest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -160,4 +160,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
@@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
using static GenesisCordonelInterface.API.InterfaceOutsideToGCI;
using static Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.GenesisMeter;
namespace GenesisCordonelInterface.API
{
+21 -1
View File
@@ -11,7 +11,27 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.CommonCore" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.17954" newVersion="2.8.18.17954" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11157" newVersion="2.8.18.11157" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.CommonCore.Configuration" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Hardware.Interfaces.Ports.PortCore" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Logic.SoftwareAccessHelper" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Utils.Crc16Ccitt" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Utils.Logging" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -14,7 +14,7 @@
"Name": "MeterLoginPasswords",
"Type": "LocalDatabase",
"DataSource": "Server=(localdb)\\MojaDB;Database=UnionTownCalibAndSkeleton;Integrated Security=True;",
"DataSource": "Server=LBUMI_23\\MSSQLSERVER01; Database=TestGenesisReader; Integrated Security=True;",
"QueryTemplate": "SELECT [Password] FROM [dbo].[SkeletonKeys] WHERE [PcbId] = QUERYPARAM"
},
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -35,8 +35,14 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common">
<HintPath>..\packages\Common\Common.dll</HintPath>
</Reference>
<Reference Include="Logic.ProductionToProductMapper">
<HintPath>..\packages\Common\Logic.ProductionToProductMapper.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.2.2\lib\net46\NLog.dll</HintPath>
@@ -54,6 +60,57 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Xylem.Common.CommonCore">
<HintPath>..\packages\Common\Xylem.Common.CommonCore.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.CommonCore.Configuration">
<HintPath>..\packages\Common\Xylem.Common.CommonCore.Configuration.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.CommonCore.ThreadWatcher">
<HintPath>..\packages\Common\Xylem.Common.CommonCore.ThreadWatcher.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.Interfaces.Ports.PortCore">
<HintPath>..\packages\Common\Xylem.Common.Hardware.Interfaces.Ports.PortCore.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.Interfaces.Ports.SerialPorts">
<HintPath>..\packages\Common\Xylem.Common.Hardware.Interfaces.Ports.SerialPorts.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.WaterMeter.Genesis.Applications">
<HintPath>..\packages\Common\Xylem.Common.Hardware.WaterMeter.Genesis.Applications.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig">
<HintPath>..\packages\Common\Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.WaterMeter.Genesis.Registers">
<HintPath>..\packages\Common\Xylem.Common.Hardware.WaterMeter.Genesis.Registers.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol">
<HintPath>..\packages\Common\Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.RequestProtocol.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.WaterMeter.WaterMeterCore">
<HintPath>..\packages\Common\Xylem.Common.Hardware.WaterMeter.WaterMeterCore.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Hardware.WaterMeter.WaterMeterRegisters">
<HintPath>..\packages\Common\Xylem.Common.Hardware.WaterMeter.WaterMeterRegisters.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Logic.ProductionOrderCore">
<HintPath>..\packages\Common\Xylem.Common.Logic.ProductionOrderCore.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Logic.SoftwareAccessHelper">
<HintPath>..\packages\Common\Xylem.Common.Logic.SoftwareAccessHelper.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Utils.ByteArrayStyle">
<HintPath>..\packages\Common\Xylem.Common.Utils.ByteArrayStyle.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Utils.Crc16Ccitt">
<HintPath>..\packages\Common\Xylem.Common.Utils.Crc16Ccitt.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Utils.Logging">
<HintPath>..\packages\Common\Xylem.Common.Utils.Logging.dll</HintPath>
</Reference>
<Reference Include="Xylem.Common.Utils.ProcessExec">
<HintPath>..\packages\Common\Xylem.Common.Utils.ProcessExec.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="API\ModelsMapping.cs" />
@@ -245,74 +302,18 @@
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\CommonCore.Configuration\CommonCore.Configuration.csproj">
<Project>{9eb1f659-6f73-4f65-bcab-4114fd94f5fc}</Project>
<Name>CommonCore.Configuration</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\CommonCore\CommonCore.csproj">
<Project>{1b02c79e-0b19-43e2-8f6b-71ef0c786c97}</Project>
<Name>CommonCore</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\CordonelPreadjustmentUi\CordonelPreadjustmentUi.csproj">
<Project>{d0c8d887-ed52-40ab-a069-90bce0e801e2}</Project>
<Name>CordonelPreadjustmentUi</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\Interfaces\Ports\PortCore\PortCore.csproj">
<Project>{2e139f63-b6fe-4ea9-a098-85364fe9b26c}</Project>
<Name>PortCore</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\Interfaces\Ports\SerialPorts\SerialPorts.csproj">
<Project>{72037e89-4f63-4b3f-beff-4138e578ce99}</Project>
<Name>SerialPorts</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\WaterMeter\Genesis\Applications\Applications.csproj">
<Project>{315e94b8-b82f-4b25-b5bd-297df3bc1d54}</Project>
<Name>Applications</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\WaterMeter\Genesis\GenesisConfig\GenesisConfig.csproj">
<Project>{f013a56b-7be6-4852-9cd8-b971cd1add0c}</Project>
<Name>GenesisConfig</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
<Project>{04201e95-90a0-4b73-a72f-379739b2a3ae}</Project>
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
<Name>GenesisCore</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\WaterMeter\Genesis\Registers\Registers.csproj">
<Project>{f4aaf7e6-7333-4284-b735-e32deb076c64}</Project>
<Name>Registers</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\WaterMeter\WaterMeterCore\WaterMeterCore.csproj">
<Project>{8203abb8-38e5-472e-a742-33f38b7a74a6}</Project>
<Name>WaterMeterCore</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Hardware\WaterMeter\WaterMeterCore\WaterMeterRegisters\WaterMeterRegisters.csproj">
<Project>{26afcf1e-1287-48b8-a506-32b1e8a0dd0e}</Project>
<Name>WaterMeterRegisters</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Logic.PrdoctionToProductMapper\Logic.ProductionToProductMapper.csproj">
<Project>{d0c859d9-d55e-4e85-ac50-0ff31b1ce50d}</Project>
<Name>Logic.ProductionToProductMapper</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Logic\ProductionOrderCore\ProductionOrderCore.csproj">
<Project>{6d2777bb-7a88-466d-a49b-3266f9bf0160}</Project>
<Name>ProductionOrderCore</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
<Project>{a33e3c6d-eaae-4a20-a0ee-f9e6922fd029}</Project>
<Name>SoftwareAccessHelper</Name>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\CordonelPreadjustmentUi\CordonelPreadjustmentUi.csproj">
<Project>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</Project>
<Name>CordonelPreadjustmentUi</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Ui\GenesisToolBox\GenesisToolBox.csproj">
<Project>{95a50087-99ee-4349-9a17-c547290db42f}</Project>
<Project>{95A50087-99EE-4349-9A17-C547290DB42F}</Project>
<Name>GenesisToolBox</Name>
</ProjectReference>
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\Utils\Logging\Logging.csproj">
<Project>{4b88b0d3-e791-4774-9521-eabeacdc420e}</Project>
<Name>Logging</Name>
</ProjectReference>
</ItemGroup>
<!-- Import custom GCI runtime packaging logic -->
<Import Project="RuntimePackage\Build\Copy.targets.xml" />
@@ -1,5 +1,4 @@
using CordonelPreadjustmentUi;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -14,6 +13,7 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Ui.CordonelPreadjustmentUi;
using CordonelPreadjustmentUi;
using static Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.GenesisMeter;
using System.Linq;//...MF
@@ -14,12 +14,11 @@ using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore.EventArguments;
using Xylem.Common.Hardware.Interfaces.Ports.SerialPorts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Utils.Logging;
using NLog;
using GenesisCordonelInterface.API;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
namespace GenesisCordonelInterface.UI.LaatzenAPI_GenesisToolBox
{
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
<package id="NLog" version="5.2.2" targetFramework="net48" />
</packages>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ClassLibrary1</RootNamespace>
<AssemblyName>GraphLib</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
@@ -115,4 +115,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LabelPrinting</RootNamespace>
<AssemblyName>LabelPrinting</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -174,4 +174,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MergeResultsDBs</RootNamespace>
<AssemblyName>MergeResultsDBs</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -82,4 +82,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+1 -1
View File
@@ -23,7 +23,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="System.IO.Ports" Version="10.0.0-rc.1.25451.107" />
<PackageReference Include="System.Security.Cryptography.Cng" Version="5.0.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OrderManagement</RootNamespace>
<AssemblyName>OrderManagement</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -179,4 +179,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ProductionTracing</RootNamespace>
<AssemblyName>ProductionTracing</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -204,4 +204,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RecordProcessing</RootNamespace>
<AssemblyName>RFPowerCommon</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -81,4 +81,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResetBatchNr</RootNamespace>
<AssemblyName>ResetBatchNr</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -66,4 +66,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+5 -5
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RestClient</RootNamespace>
<AssemblyName>RestClient</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -32,8 +32,8 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -56,4 +56,4 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
</packages>
+9
View File
@@ -188,6 +188,15 @@ namespace Results
}
return null;
}
public MeterTestRslt GetEachMeterTestRslt(string name, int wmNr0, CompoundMeterId meterId)
{
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0)
{
return Batch.WaterMeters[wmNr0].GetMeterTestRslt(name, meterId);
}
return null;
}
/// <summary>
+70 -2
View File
@@ -11,6 +11,7 @@ using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using Common;
using Results.Entities;
using Results.Entities.helpers;
namespace Results
{
@@ -107,7 +108,11 @@ namespace Results
throw new Exception("Connection string was not specified");
}
if (SessionFactory == null) SessionFactory = CreateSessionFactory();
if (SessionFactory == null)
{
DatabaseMigrationHelper.EnsureSchema(dbType, connectionString);
SessionFactory = CreateSessionFactory();
}
return SessionFactory.OpenSession();
}
@@ -267,9 +272,17 @@ namespace Results
{
log.Debug(tstRslt.ToString(1));
}
// Save batch, TestRslt, WaterMeter, MeterTestRslt, etc.
session.SaveOrUpdate(batch);
// Important: after this, TestRslt.Id should be generated
session.Flush();
// Optional table support
SolveSaveCalibFactors(batch, session);
//Commit - store results
transaction.Commit();
}
catch (Exception exc)
@@ -290,6 +303,52 @@ namespace Results
return true;
}
private static void SolveSaveCalibFactors(Batch batch, ISession session)
{
bool hasCalibrationFactors = false;
try
{
foreach (var tstRslt in batch.TestRslts)
{
if (tstRslt.CalibFactorResultsToSave != null &&
tstRslt.CalibFactorResultsToSave.Count > 0)
{
hasCalibrationFactors = true;
break;
}
}
if (hasCalibrationFactors)
{
TestRsltCalibFactorHelper.CreateTableIfNotExists(session);
foreach (var tstRslt in batch.TestRslts)
{
if (tstRslt.CalibFactorResultsToSave == null ||
tstRslt.CalibFactorResultsToSave.Count == 0)
{
continue;
}
TestRsltCalibFactorHelper.DeleteByTestRsltIdNoTransaction(session, tstRslt.Id);
foreach (var calib in tstRslt.CalibFactorResultsToSave)
{
calib.TestRslt = tstRslt;
calib.ErrorStr = TestRsltCalibFactorHelper.Truncate(calib.ErrorStr, 240);
session.SaveOrUpdate(calib);
}
}
}
}catch(Exception exc)
{
log.ErrorFormat("DB - Cannot save calibration factors: {0}", exc.Message);
}
}
public static Batch LoadBatch(int batchNr)
{
@@ -316,6 +375,15 @@ namespace Results
batch.WaterMeters = session.QueryOver<WaterMeter>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
TestRsltCalibFactorHelper.CreateTableIfNotExists(session);
foreach (var tstRslt in batch.TestRslts)
{
tstRslt.CalibFactorResultsToSave = TestRsltCalibFactorHelper.GetByTestRsltId( session, tstRslt.Id);
}
}
return (batches.Count > 0) ? batches[0] : null;
@@ -0,0 +1,37 @@
namespace Results.Entities
{
public class MeterTestCalibFactorRslt
{
public virtual int Id { get; protected set; }
public virtual MeterTestRslt MeterTestRslt { get; set; }
/// 1, 2, 3 - calculated calib factor index
public virtual int CalibFactorIndex { get; set; }
/// Base calib factor originally set in meter
public virtual int BaseCalibFactor { get; set; }
/// Newly calculated calib factor
public virtual int CalculatedCalibFactor { get; set; }
/// true = calculated value was stored/written to meter
public virtual bool Stored { get; set; }
public virtual string ErrorStr { get; set; } // max 240 chars
public virtual double TimeStart { get; set; }
public virtual double TimeEnd { get; set; }
public virtual double CalibRawStart { get; set; }
public virtual double CalibRawEnd { get; set; }
public virtual double Error { get; set; }
public MeterTestCalibFactorRslt()
{
Stored = false;
ErrorStr = string.Empty;
}
}
}
+6 -1
View File
@@ -58,7 +58,11 @@ namespace Results.Entities
#endif
public virtual WaterMeter WaterMeter { get; set; } /// reference to the WaterMeter entity
public virtual TestRslt TestRslt { get; set; } /// reference to the TestRslt entity
public virtual TestRslt TestRslt { get; set; }
/// reference to the TestRslt entity
public virtual int Q3Channel { get; set; }
/// Wrappers
public virtual string Name() { return TestRslt.Name(); }
@@ -97,6 +101,7 @@ namespace Results.Entities
public virtual WaterMeterData WaterMeterData() { return WaterMeter.WaterMeterData; }
public virtual Batch Batch() { return WaterMeter.Batch; }
public virtual bool IsPilotRslt()
{
+18 -1
View File
@@ -151,6 +151,11 @@ namespace Results.Entities
public virtual int Counter3 { get; set; }
public virtual int Counter4 { get; set; }
public virtual int Counter5 { get; set; }
/// <summary>
/// Not maped table - exist only in Genesis DB !!
/// </summary>
public virtual IList<TestRsltCalibFactor> CalibFactorResultsToSave { get; set; }
/// Wrappers
public virtual string Name() { return Common.Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
@@ -266,15 +271,27 @@ namespace Results.Entities
MethodClass = string.Empty;
Remark = string.Empty;
CalibFactorResultsToSave = new List<TestRsltCalibFactor>();
}
public TestRslt(Batch batch, TestData testData, int part, int repetitionNr)
public TestRslt(
Batch batch,
TestData testData,
int part,
int repetitionNr)
: this(batch, testData, part, repetitionNr, null)
{
}
public TestRslt(Batch batch, TestData testData, int part, int repetitionNr, List<TestRsltCalibFactor> calibFactor)
: this()
{
Batch = batch;
TestData = testData;
Part = part;
RepetitionNr = repetitionNr;
CalibFactorResultsToSave = calibFactor != null ? new List<TestRsltCalibFactor>(calibFactor) : new List<TestRsltCalibFactor>();
}
public virtual void CopyContentFrom(TestRslt src)
+37
View File
@@ -0,0 +1,37 @@
namespace Results.Entities
{
public class TestRsltCalibFactor
{
public virtual int Id { get; protected set; }
public virtual TestRslt TestRslt { get; set; }
public virtual int CalibFactorIndex { get; set; } // 1, 2, 3
public virtual bool IsCalibFactorValid { get; set; }
public virtual int BaseCalibFactor { get; set; }
public virtual int CalculatedCalibFactor { get; set; }
public virtual bool Stored { get; set; }
public virtual string ErrorStr { get; set; } // varchar(240)
public virtual double TimeStart { get; set; }
public virtual double TimeEnd { get; set; }
public virtual double CalibRawStart { get; set; }
public virtual double CalibRawEnd { get; set; }
public virtual double Error { get; set; }
public virtual double VolumeStart { get; set; }
public virtual double VolumeEnd { get; set; }
public TestRsltCalibFactor()
{
Stored = false;
ErrorStr = string.Empty;
IsCalibFactorValid = false;
}
}
}
+20 -3
View File
@@ -110,6 +110,9 @@ namespace Results.Entities
public virtual string Workflow { get; set; } /// Not mapped to DB !!! Production tracing workflow name
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual bool PrintLabel { get; set; } /// Not mapped to DB !!!
/// mapped to DB !!! Q3 channel number
public virtual int Q3Channel { get; set; }
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; }
@@ -493,6 +496,7 @@ namespace Results.Entities
FWVersion = string.Empty;
#endif
PrintLabel = true;
Q3Channel = 0; //No Q3 calibration by default
}
@@ -556,7 +560,8 @@ namespace Results.Entities
Workflow = src.Workflow; /// Not mapped to DB
LastRecordIsNok = src.LastRecordIsNok; /// Not mapped to DB
PrintLabel = src.PrintLabel; /// Not mapped to DB
Q3Channel = src.Q3Channel; /// Mapped to DB
foreach (var mtr in MeterTestRslts)
{
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (CompoundMeterId)mtr.CompoundMeterId);
@@ -597,9 +602,10 @@ namespace Results.Entities
foreach (var mtr in MeterTestRslts)
{
if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound || mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy)
&& mtr.TestDone
&& (mtr.Q3Channel != 0 ||
(mtr.TestDone
&& (mtr.Publish() != Publish.Never)
&& (mtr.Publish() != Publish.Internal))
&& (mtr.Publish() != Publish.Internal))))
{
testNames.Add(mtr.Name());
}
@@ -771,6 +777,10 @@ namespace Results.Entities
{
MeterTestRslts[i].WriteBinary(writer);
}
//New Q3 calibration adds
writer.Write(2);//version number
writer.Write(Q3Channel);
}
public virtual void ReadBinary(BinaryReader reader, IList<WaterMeterData> wmDatasRetrievedSoFar, IList<TestRslt> testRslts)
@@ -879,6 +889,13 @@ namespace Results.Entities
mtr.ReadBinary(reader, testRslts);
MeterTestRslts.Add(mtr);
}
//New Q3 calibration adds
int version = reader.ReadInt32();
if (version == 2)
{
Q3Channel = reader.ReadInt32();
}
}
}
}
+15
View File
@@ -51,6 +51,7 @@ namespace Results.Entities
public virtual bool Compound { get; set; }
public virtual bool HeatMeter { get; set; }
public virtual int WMTypeId { get; set; } /// Mapped to DB only when ORACLE_DB is defined
public virtual int Q3Channel { get; set; } /// Q3 Channel = 0 no set > 0 is Q3 calibration
/// <summary>
/// Default constructor, safe values
@@ -59,6 +60,7 @@ namespace Results.Entities
{
PulsesPerLtr = 1;
PulsesPerLtrAux = 1;
Q3Channel = 0;
}
/// <summary>
@@ -101,6 +103,7 @@ namespace Results.Entities
Compound = oriWMData.Compound;
HeatMeter = oriWMData.HeatMeter;
WMTypeId = oriWMData.WMTypeId;
Q3Channel = oriWMData.Q3Channel;
}
@@ -146,6 +149,7 @@ namespace Results.Entities
if (Compound != wmd.Compound) return false;
if (HeatMeter != wmd.HeatMeter) return false;
if (WMTypeId != wmd.WMTypeId) return false;
if (Q3Channel != wmd.Q3Channel) return false;
return true;
}
@@ -206,6 +210,8 @@ namespace Results.Entities
writer.Write(Compound);
writer.Write(HeatMeter);
writer.Write(WMTypeId);
writer.Write(2); //Version of the binary format
writer.Write(Q3Channel);
}
public virtual void ReadBinary(BinaryReader reader)
@@ -246,6 +252,15 @@ namespace Results.Entities
Compound = reader.ReadBoolean();
HeatMeter = reader.ReadBoolean();
WMTypeId = reader.ReadInt32();
//Version 2 of the binary format introduced Q3Channel
int Version = 0;
Q3Channel = 0;
try { Version = reader.ReadInt32(); }catch(Exception) { Version = 0; }
if (Version == 2)
{
try { Q3Channel = reader.ReadInt32(); } catch (Exception) { Q3Channel = 0; }
}
}
}
}
@@ -0,0 +1,134 @@
using System;
using MySql.Data.MySqlClient;
using Common;
namespace Results.Entities.helpers
{
public static class DatabaseMigrationHelper
{
public static void EnsureSchema(DBType dbType, string connectionString)
{
switch (dbType)
{
case DBType.MySql:
EnsureMySqlSchema(connectionString);
break;
case DBType.SQLite:
EnsureSQLiteSchema(connectionString);
break;
}
}
private static void EnsureMySqlSchema(string connectionString)
{
using (var conn = new MySqlConnection(connectionString))
{
conn.Open();
EnsureColumnMySql(conn, "WaterMeterData", "Q3Channel", "INT NOT NULL DEFAULT 0");
EnsureColumnMySql(conn, "WaterMeter", "Q3Channel", "INT NOT NULL DEFAULT 0");
EnsureColumnMySql(conn, "MeterTestRslt", "Q3Channel", "INT NOT NULL DEFAULT 0");
}
}
private static void EnsureColumnMySql(
MySqlConnection conn,
string tableName,
string columnName,
string columnDefinition)
{
using (var transaction = conn.BeginTransaction())
{
try
{
bool exists;
using (var cmd = conn.CreateCommand())
{
cmd.Transaction = transaction;
cmd.CommandText = @"
SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = @tableName
AND COLUMN_NAME = @columnName";
cmd.Parameters.AddWithValue("@tableName", tableName);
cmd.Parameters.AddWithValue("@columnName", columnName);
exists = Convert.ToInt32(cmd.ExecuteScalar()) > 0;
}
if (!exists)
{
using (var alter = conn.CreateCommand())
{
alter.Transaction = transaction;
alter.CommandText = "ALTER TABLE `" + tableName + "` ADD COLUMN `" + columnName + "` " + columnDefinition;
alter.ExecuteNonQuery();
}
}
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
}
private static void EnsureSQLiteSchema(string databaseFile)
{
using (var conn = new System.Data.SQLite.SQLiteConnection("Data Source=" + databaseFile))
{
conn.Open();
EnsureColumnSQLite(conn, "WaterMeterData", "Q3Channel", "INTEGER NOT NULL DEFAULT 0");
EnsureColumnSQLite(conn, "WaterMeter", "Q3Channel", "INTEGER NOT NULL DEFAULT 0");
EnsureColumnSQLite(conn, "MeterTestRslt", "Q3Channel", "INTEGER NOT NULL DEFAULT 0");
}
}
private static void EnsureColumnSQLite(
System.Data.SQLite.SQLiteConnection conn,
string tableName,
string columnName,
string columnDefinition)
{
bool exists = false;
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "PRAGMA table_info(" + tableName + ")";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (string.Equals(reader["name"].ToString(), columnName, StringComparison.OrdinalIgnoreCase))
{
exists = true;
break;
}
}
}
}
if (!exists)
{
using (var alter = conn.CreateCommand())
{
alter.CommandText =
"ALTER TABLE " + tableName + " ADD COLUMN " + columnName + " " + columnDefinition;
alter.ExecuteNonQuery();
}
}
}
}
}
@@ -0,0 +1,117 @@
using System.Collections.Generic;
using log4net;
using NHibernate;
namespace Results.Entities.helpers
{
public static class TestRsltCalibFactorHelper
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestRsltCalibFactorHelper));
public static bool TableExists(ISession session)
{
try
{
session.CreateSQLQuery( "SELECT 1 FROM TestRsltCalibFactor LIMIT 1")
.UniqueResult();
return true;
}
catch
{
return false;
}
}
public static void DeleteByTestRsltIdNoTransaction(
ISession session,
int testRsltId)
{
log.DebugFormat("Deleting TestRsltCalibFactor records for TestRsltId: {0}", testRsltId);
session.CreateSQLQuery(@" DELETE FROM TestRsltCalibFactor WHERE TestRsltId = :testRsltId")
.SetParameter("testRsltId", testRsltId)
.ExecuteUpdate();
}
public static IList<TestRsltCalibFactor> GetByTestRsltId(
ISession session,
int testRsltId)
{
return session.QueryOver<TestRsltCalibFactor>()
.Where(x => x.TestRslt.Id == testRsltId)
.OrderBy(x => x.CalibFactorIndex).Asc
.List();
}
public static string Truncate(string value, int maxLength)
{
if (string.IsNullOrEmpty(value))
return string.Empty;
return value.Length <= maxLength
? value
: value.Substring(0, maxLength);
}
public static void CreateTableIfNotExists(ISession session)
{
if (TableExists(session))
return;
string sql;
if (DB.DbType == Common.DBType.MySql)
{
sql = @"
CREATE TABLE IF NOT EXISTS TestRsltCalibFactor (
Id INT NOT NULL AUTO_INCREMENT,
TestRsltId INT NOT NULL,
CalibFactorIndex INT NOT NULL,
BaseCalibFactor INT NOT NULL,
CalculatedCalibFactor INT NOT NULL,
IsCalibFactorValid BIT NOT NULL,
Stored BIT NOT NULL,
ErrorStr VARCHAR(240) NULL,
TimeStart DOUBLE NOT NULL,
TimeEnd DOUBLE NOT NULL,
CalibRawStart DOUBLE NOT NULL,
CalibRawEnd DOUBLE NOT NULL,
Error DOUBLE NOT NULL,
VolumeStart DOUBLE NOT NULL,
VolumeEnd DOUBLE NOT NULL,
PRIMARY KEY (Id),
INDEX IX_TestRsltCalibFactor_TestRsltId (TestRsltId),
CONSTRAINT FK_TestRsltCalibFactor_TestRslt
FOREIGN KEY (TestRsltId) REFERENCES TestRslt(Id)
ON DELETE CASCADE
);";
}
else
{
sql = @"
CREATE TABLE IF NOT EXISTS TestRsltCalibFactor (
Id INTEGER PRIMARY KEY AUTOINCREMENT,
TestRsltId INTEGER NOT NULL,
CalibFactorIndex INTEGER NOT NULL,
BaseCalibFactor INTEGER NOT NULL,
CalculatedCalibFactor INTEGER NOT NULL,
IsCalibFactorValid INTEGER NOT NULL,
Stored INTEGER NOT NULL,
ErrorStr VARCHAR(240) NULL,
TimeStart DOUBLE NOT NULL,
TimeEnd DOUBLE NOT NULL,
CalibRawStart DOUBLE NOT NULL,
CalibRawEnd DOUBLE NOT NULL,
Error DOUBLE NOT NULL,
VolumeStart DOUBLE NOT NULL,
VolumeEnd DOUBLE NOT NULL,
FOREIGN KEY (TestRsltId) REFERENCES TestRslt(Id) ON DELETE CASCADE
);";
}
log.InfoFormat("Creating TestRsltCalibFactor table: {0}", sql);
session.CreateSQLQuery(sql).ExecuteUpdate();
}
}
}
+1 -1
View File
@@ -69,7 +69,7 @@ namespace Results.Forms
public void Update(Results.Entities.WaterMeter wMtr)
{
if (wMtr == null || wMtr.Disabled)
if (wMtr == null || (wMtr.Disabled && wMtr.Q3Channel == 0))
{
/// Water meter position is disabled
this.disabled = true;
+6 -3
View File
@@ -81,7 +81,7 @@ namespace Results.Forms
public void Update(Results.Entities.WaterMeter wMtr)
{
if (wMtr == null || wMtr.Disabled)
if (wMtr == null || (wMtr.Disabled && wMtr.Q3Channel == 0))
{
/// Water meter position is disabled
this.disabled = true;
@@ -114,8 +114,11 @@ namespace Results.Forms
lView.Items.Clear();
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Publish.Never
&& mtr.Publish() != Publish.Internal)
if (mtr != null && mtr.IsPilotRslt() &&
(mtr.Q3Channel!=0 || (mtr.TestDone &&
mtr.Publish() != Publish.Never &&
mtr.Publish() != Publish.Internal)
) )
{
ListViewItem lvi = new ListViewItem(testNames[ix++]);
@@ -0,0 +1,36 @@
using FluentNHibernate.Mapping;
using Results.Entities;
namespace Results.Mappings
{
public class MeterTestCalibFactorRsltMap : ClassMap<MeterTestCalibFactorRslt>
{
public MeterTestCalibFactorRsltMap()
{
Id(x => x.Id);
References(x => x.MeterTestRslt)
.Not.Nullable()
.Cascade.None();
Map(x => x.CalibFactorIndex).Not.Nullable();
Map(x => x.BaseCalibFactor).Not.Nullable();
Map(x => x.CalculatedCalibFactor).Not.Nullable();
Map(x => x.Stored).Not.Nullable();
Map(x => x.ErrorStr)
.Length(240)
.Nullable();
Map(x => x.TimeStart).Not.Nullable();
Map(x => x.TimeEnd).Not.Nullable();
Map(x => x.CalibRawStart).Not.Nullable();
Map(x => x.CalibRawEnd).Not.Nullable();
Map(x => x.Error).Not.Nullable();
}
}
}
+1
View File
@@ -49,6 +49,7 @@ namespace Results.Mappings
#endif
References(x => x.WaterMeter);
References(x => x.TestRslt);
Map(x => x.Q3Channel);
}
}
}
@@ -0,0 +1,42 @@
using FluentNHibernate.Mapping;
using Results.Entities;
namespace Results.Mappings
{
class TestRsltCalibFactorMap : ClassMap<TestRsltCalibFactor>
{
public TestRsltCalibFactorMap()
{
Id(x => x.Id);
References(x => x.TestRslt)
.Column("TestRsltId")
.Not.Nullable();
Map(x => x.CalibFactorIndex).Not.Nullable();
Map(x => x.IsCalibFactorValid).Not.Nullable();
Map(x => x.BaseCalibFactor).Not.Nullable();
Map(x => x.CalculatedCalibFactor).Not.Nullable();
Map(x => x.Stored).Not.Nullable();
Map(x => x.ErrorStr)
.Length(240)
.Nullable();
Map(x => x.TimeStart).Not.Nullable();
Map(x => x.TimeEnd).Not.Nullable();
Map(x => x.CalibRawStart).Not.Nullable();
Map(x => x.CalibRawEnd).Not.Nullable();
Map(x => x.Error).Not.Nullable();
Map(x => x.VolumeStart).Not.Nullable();
Map(x => x.VolumeEnd).Not.Nullable();
}
}
}
+3 -1
View File
@@ -58,6 +58,8 @@ namespace Results.Mappings
#if ORACLE_DB
Map(x => x.WMTypeId);
#endif
}
Map(x => x.Q3Channel);
}
}
}
+1
View File
@@ -65,6 +65,7 @@ namespace Results.Mappings
Map(x => x.Pruefindex);
Map(x => x.HydrPruefung);
#endif
Map(x => x.Q3Channel);// Genesis meter identification
References(x => x.WaterMeterData);
References(x => x.Batch);
HasMany(x => x.MeterTestRslts)
+12 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Results</RootNamespace>
<AssemblyName>Results</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -53,6 +53,9 @@
<Reference Include="NHibernate">
<HintPath>..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.2.0.3\lib\net471\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
@@ -69,12 +72,16 @@
<Compile Include="DBase.cs" />
<Compile Include="Entities\Batch.cs" />
<Compile Include="Entities\Components.cs" />
<Compile Include="Entities\helpers\DatabaseMigrationHelper.cs" />
<Compile Include="Entities\helpers\TestRsltCalibFactorHelper.cs" />
<Compile Include="Entities\MeterTestCalibFactorRslt.cs" />
<Compile Include="Entities\MeterTestRslt.cs" />
<Compile Include="Entities\PurchaseBox.cs" />
<Compile Include="Entities\PurchaseOrder.cs" />
<Compile Include="Entities\PurchaseWaterMeterData.cs" />
<Compile Include="Entities\TestData.cs" />
<Compile Include="Entities\TestRslt.cs" />
<Compile Include="Entities\TestRsltCalibFactor.cs" />
<Compile Include="Entities\WaterMeterData.cs" />
<Compile Include="Entities\WaterMeter.cs" />
<Compile Include="DB.cs" />
@@ -132,11 +139,13 @@
<Compile Include="ManualEntryItemSpec.cs" />
<Compile Include="Mappings\BatchMap.cs" />
<Compile Include="Mappings\ComponentsMap.cs" />
<Compile Include="Mappings\MeterTestCalibFactorRsltMap.cs" />
<Compile Include="Mappings\MeterTestRsltMap.cs" />
<Compile Include="Mappings\PurchaseBoxMap.cs" />
<Compile Include="Mappings\PurchaseOrderMap.cs" />
<Compile Include="Mappings\PurchaseWaterMeterDataMap.cs" />
<Compile Include="Mappings\TestDataMap.cs" />
<Compile Include="Mappings\TestRsltCalibFactorMap.cs" />
<Compile Include="Mappings\TestRsltMap.cs" />
<Compile Include="Mappings\WaterMeterDataMap.cs" />
<Compile Include="Mappings\WaterMeterMap.cs" />
@@ -266,4 +275,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResultsBrowser</RootNamespace>
<AssemblyName>ResultsBrowser</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -327,4 +327,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+1 -1
View File
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>S640TestApp</RootNamespace>
<AssemblyName>S640TestApp</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SchematicDrawing</RootNamespace>
<AssemblyName>SchematicDrawing</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -217,4 +217,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SharedDatabase</RootNamespace>
<AssemblyName>SharedDatabase</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -232,4 +232,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+3 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Statistics</RootNamespace>
<AssemblyName>Statistics</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -146,4 +146,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+5177 -183
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.9.3063.1")]
[assembly: AssemblyFileVersion("3.9.3063.1")]
[assembly: AssemblyVersion("3.9.3135.0")]
[assembly: AssemblyFileVersion("3.9.3135.0")]
+36 -9
View File
@@ -1427,6 +1427,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Delay between pictures.
/// </summary>
internal static string DelaySendImage {
get {
return ResourceManager.GetString("DelaySendImage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Density.
/// </summary>
@@ -2723,15 +2732,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to iPerl Communication in progress.
/// </summary>
internal static string iPerl_Communication_in_progress {
get {
return ResourceManager.GetString("iPerl_Communication_in_progress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ITS-27 calibration coefficients.
/// </summary>
@@ -3101,6 +3101,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Meter Communication in progress.
/// </summary>
internal static string Meter_Communication_in_progress {
get {
return ResourceManager.GetString("Meter_Communication_in_progress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sensors.
/// </summary>
@@ -3839,6 +3848,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Pictures Count.
/// </summary>
internal static string PictureCouts {
get {
return ResourceManager.GetString("PictureCouts", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PID.
/// </summary>
@@ -4640,6 +4658,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Radio Communication failed.
/// </summary>
internal static string Radio_Communication_failed {
get {
return ResourceManager.GetString("Radio_Communication_failed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Rate of change [%].
/// </summary>
+9 -9
View File
@@ -1931,15 +1931,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to iPERL Komunikace probíhá.
/// </summary>
internal static string iPerl_Communication_in_progress {
get {
return ResourceManager.GetString("iPerl_Communication_in_progress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Jazyk.
/// </summary>
@@ -2147,6 +2138,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Komunikace s vodemerem probíhá.
/// </summary>
internal static string Meter_Communication_in_progress {
get {
return ResourceManager.GetString("Meter_Communication_in_progress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Testované typy měřičů.
/// </summary>
+2 -2
View File
@@ -1020,8 +1020,8 @@
<data name="Simultaneous_with_previous_step" xml:space="preserve">
<value>Současně s předchozím krokem</value>
</data>
<data name="iPerl_Communication_in_progress" xml:space="preserve">
<value>iPERL Komunikace probíhá</value>
<data name="Meter_Communication_in_progress" xml:space="preserve">
<value>Komunikace s vodemerem probíhá</value>
</data>
<data name="Language" xml:space="preserve">
<value>Jazyk</value>
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1023,8 +1023,8 @@
<data name="Simultaneous_with_previous_step" xml:space="preserve">
<value>Prallel mit vorherigem Schritt</value>
</data>
<data name="iPerl_Communication_in_progress" xml:space="preserve">
<value>iPerl Kommunikation läuft</value>
<data name="Meter_Communication_in_progress" xml:space="preserve">
<value>Meter Kommunikation läuft</value>
</data>
<data name="Language" xml:space="preserve">
<value>Sprache</value>
+2 -2
View File
@@ -1020,8 +1020,8 @@
<data name="Simultaneous_with_previous_step" xml:space="preserve">
<value>Simultanée étape précédente</value>
</data>
<data name="iPerl_Communication_in_progress" xml:space="preserve">
<value>iPerl Communication en cours</value>
<data name="Meter_Communication_in_progress" xml:space="preserve">
<value>Meter Communication en cours</value>
</data>
<data name="Language" xml:space="preserve">
<value>Langue</value>
+2 -2
View File
@@ -1017,8 +1017,8 @@
<data name="Simultaneous_with_previous_step" xml:space="preserve">
<value>simultaneo con il passo precedente</value>
</data>
<data name="iPerl_Communication_in_progress" xml:space="preserve">
<value>iPerl comunicazioni in corso</value>
<data name="Meter_Communication_in_progress" xml:space="preserve">
<value>Meter comunicazioni in corso</value>
</data>
<data name="Language" xml:space="preserve">
<value>lingua</value>
+2 -2
View File
@@ -1011,8 +1011,8 @@
<data name="Simultaneous_with_previous_step" xml:space="preserve">
<value>Jednocześnie z poprzednim krokiem</value>
</data>
<data name="iPerl_Communication_in_progress" xml:space="preserve">
<value>Komunikacja z iPERL w toku</value>
<data name="Meter_Communication_in_progress" xml:space="preserve">
<value>Komunikacja z vodomera w toku</value>
</data>
<data name="Language" xml:space="preserve">
<value>Język</value>
+11 -2
View File
@@ -543,6 +543,12 @@
<data name="PulsesPerLtr" xml:space="preserve">
<value>Pulses per liter</value>
</data>
<data name="DelaySendImage" xml:space="preserve">
<value>Delay between pictures</value>
</data>
<data name="PictureCouts" xml:space="preserve">
<value>Pictures Count</value>
</data>
<data name="Component" xml:space="preserve">
<value>Component</value>
</data>
@@ -1042,8 +1048,8 @@
<data name="Simultaneous_with_previous_step" xml:space="preserve">
<value>Simultaneous with previous step</value>
</data>
<data name="iPerl_Communication_in_progress" xml:space="preserve">
<value>iPerl Communication in progress</value>
<data name="Meter_Communication_in_progress" xml:space="preserve">
<value>Meter Communication in progress</value>
</data>
<data name="Language" xml:space="preserve">
<value>Language</value>
@@ -1732,6 +1738,9 @@
<data name="RFID_communication_failed" xml:space="preserve">
<value>RFID communication failed</value>
</data>
<data name="Radio_Communication_failed" xml:space="preserve">
<value>Radio Communication failed</value>
</data>
<data name="Head_was_disabled_by_the_user" xml:space="preserve">
<value>Disabled by user</value>
</data>
+2 -2
View File
@@ -1011,8 +1011,8 @@
<data name="Simultaneous_with_previous_step" xml:space="preserve">
<value>Одновременно с предыдущим шагом</value>
</data>
<data name="iPerl_Communication_in_progress" xml:space="preserve">
<value>Осуществляется связь с iPerl </value>
<data name="Meter_Communication_in_progress" xml:space="preserve">
<value>Осуществляется связь с водомером </value>
</data>
<data name="Language" xml:space="preserve">
<value>Язык</value>
@@ -285,14 +285,30 @@ namespace TBF.Rig.BridgeComponents.GciBridge
GciPublicModels.GciInitSlotRequest request,
CancellationToken token = default)
{
EnsureExternalInterface();
if (request == null)
throw new ArgumentNullException(nameof(request));
if (request.SlotId <= 0)
throw new ArgumentException("Invalid slot id.", nameof(request));
if (string.Equals(request.RequestPort?.Type, "SIMULATE", StringComparison.OrdinalIgnoreCase))
{
log.InfoFormat("{0}: InitSlotAsync invoked. {1}, SIMULATE", Name, request);
await Task.Delay(500);
log.InfoFormat("{0}: InitSlotAsync SIMULATE finished.", Name);
return new GciPublicModels.GciInitSlotResult()
{
SlotId = request.SlotId,
Success = true,
AlreadyExists = false,
Updated = false,
Message = "Simulated",
};
}
EnsureExternalInterface();
var result = await gciExternalInterface
.InitSlotAsync(request, token)
.ConfigureAwait(false);
@@ -366,18 +382,36 @@ namespace TBF.Rig.BridgeComponents.GciBridge
GciPublicModels.GciInitSlotRequest request,
CancellationToken token = default)
{
EnsureExternalInterface();
if (request == null)
throw new ArgumentNullException(nameof(request));
if (request.SlotId <= 0)
throw new ArgumentException("Invalid slot id.", nameof(request));
if (string.Equals(request.RequestPort?.Type, "SIMULATE", StringComparison.OrdinalIgnoreCase))
{
log.InfoFormat("{0}: UpdateSlotAsync invoked. {1}, SIMULATE", Name, request);
await Task.Delay(500);
log.InfoFormat("{0}: UpdateSlotAsync SIMULATE finished.", Name);
return new GciPublicModels.GciInitSlotResult()
{
SlotId = request.SlotId,
Success = true,
AlreadyExists = false,
Updated = true,
Message = "Simulated",
};
}
EnsureExternalInterface();
var result = await gciExternalInterface
.UpdateSlotAsync(request, token)
.ConfigureAwait(false);
log.InfoFormat("{0}: UpdateSlotAsync invoked. {1}, Result={2}", Name, request, result);
return result;
}
@@ -888,6 +922,8 @@ namespace TBF.Rig.BridgeComponents.GciBridge
int slotId,
CancellationToken token = default)
{
log.InfoFormat("{0}: DisconnectAsync({1}) invoked.", Name, slotId);
EnsureExternalInterface();
if (slotId <= 0)
@@ -3,8 +3,6 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
+11 -11
View File
@@ -44,7 +44,7 @@
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.ScenariousViewButton = new System.Windows.Forms.Button();
this.preadjustmenActionsViewButton = new System.Windows.Forms.Button();
this.preadjustmentActionsViewButton = new System.Windows.Forms.Button();
this.slotsComPortsRegistersActionsViewButton = new System.Windows.Forms.Button();
this.uniDataSorageActionsViewButton = new System.Windows.Forms.Button();
this.combinedActionsViewButton = new System.Windows.Forms.Button();
@@ -191,7 +191,7 @@
// groupBox5
//
this.groupBox5.Controls.Add(this.ScenariousViewButton);
this.groupBox5.Controls.Add(this.preadjustmenActionsViewButton);
this.groupBox5.Controls.Add(this.preadjustmentActionsViewButton);
this.groupBox5.Controls.Add(this.slotsComPortsRegistersActionsViewButton);
this.groupBox5.Controls.Add(this.uniDataSorageActionsViewButton);
this.groupBox5.Controls.Add(this.combinedActionsViewButton);
@@ -211,15 +211,15 @@
this.ScenariousViewButton.Text = "Scenarious";
this.ScenariousViewButton.UseVisualStyleBackColor = true;
//
// preadjustmenActionsViewButton
// preadjustmentActionsViewButton
//
this.preadjustmenActionsViewButton.Location = new System.Drawing.Point(6, 127);
this.preadjustmenActionsViewButton.Name = "preadjustmenActionsViewButton";
this.preadjustmenActionsViewButton.Size = new System.Drawing.Size(150, 30);
this.preadjustmenActionsViewButton.TabIndex = 2;
this.preadjustmenActionsViewButton.Text = "Preadjustment";
this.preadjustmenActionsViewButton.UseVisualStyleBackColor = true;
this.preadjustmenActionsViewButton.Click += new System.EventHandler(this.preadjustmenActionsViewButton_Click);
this.preadjustmentActionsViewButton.Location = new System.Drawing.Point(6, 127);
this.preadjustmentActionsViewButton.Name = "preadjustmentActionsViewButton";
this.preadjustmentActionsViewButton.Size = new System.Drawing.Size(150, 30);
this.preadjustmentActionsViewButton.TabIndex = 2;
this.preadjustmentActionsViewButton.Text = "Preadjustment";
this.preadjustmentActionsViewButton.UseVisualStyleBackColor = true;
this.preadjustmentActionsViewButton.Click += new System.EventHandler(this.preadjustmentActionsViewButton_Click);
//
// slotsComPortsRegistersActionsViewButton
//
@@ -412,7 +412,7 @@
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Button combinedActionsViewButton;
private System.Windows.Forms.Button btnDiagTablesConfigurationButton;
private System.Windows.Forms.Button preadjustmenActionsViewButton;
private System.Windows.Forms.Button preadjustmentActionsViewButton;
private System.Windows.Forms.Button ScenariousViewButton;
}
}
@@ -502,11 +502,11 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI
new ConfigurationView(this));
}
private void preadjustmenActionsViewButton_Click(object sender, EventArgs e)
private void preadjustmentActionsViewButton_Click(object sender, EventArgs e)
{
SwitchGciView(
"PreadjustmenActionsView",
new PreadjustmentActionsView(this, _bridge, AddSlotRow, SaveSlots));
"PreadjustmentActionsView",
new PreadjustmentActionsView(this, _bridge, AddSlotRow, SaveSlots));
}
}
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using log4net;
@@ -70,6 +71,9 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
int lastWmNr1;
Bitmap lastImage; /// non-zoomed image
Bitmap zoomedImage;
private readonly List<string> currentImageGroup = new List<string>();//multiple pictures
private int currentImageGroupIndex;
private bool mouseOverPictureBox;
Thread imageProcessingThread; /// Thread to process images
public delegate void OcrTextObtainedDelegate(int ix, bool isEnd, string text);
@@ -96,6 +100,12 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
public TestStartEndForm()
{
InitializeComponent();
KeyPreview = true;
pictureBox1.MouseWheel += pictureBox1_MouseWheel;
pictureBox1.MouseEnter += pictureBox1_MouseEnter;
pictureBox1.MouseLeave += pictureBox1_MouseLeave;
this.Icon = Properties.Resources.TBF_icon;
@@ -483,15 +493,46 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
startTextBoxes[i].TextChanged += new System.EventHandler(this.startTextBoxX_TextChanged);
startTextBoxes[i].KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.startTextBoxX_KeyPress);
startTextBoxes[i].MouseDown += new System.Windows.Forms.MouseEventHandler(this.startTextBoxX_MouseDown);
startTextBoxes[i].Enter += startTextBoxX_Enter;
}
private void startTextBoxX_Enter(object sender, EventArgs e)
{
var textBox = sender as TextBox;
if (textBox == null) { return; }
int physPos = PhysPos(textBox, startTextBoxes);
if (physPos >= 0)
{
LoadImage(sender, Tst.Start, physPos);
}
}
private void EndTextBox_EnableHanders(int i)
{
endTextBoxes[i].AcceptsTabChanged += new System.EventHandler(this.endTextBoxX_AcceptsTabChanged);
endTextBoxes[i].TextChanged += new System.EventHandler(this.endTextBoxX_TextChanged);
endTextBoxes[i].KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.endTextBoxX_KeyPress);
endTextBoxes[i].MouseDown += new System.Windows.Forms.MouseEventHandler(this.endTextBoxX_AcceptsTabChanged);
endTextBoxes[i].Enter += endTextBoxX_Enter;
}
private void endTextBoxX_Enter(object sender, EventArgs e)
{
var textBox = sender as TextBox;
if (textBox == null) { return; }
int physPos = PhysPos(textBox, endTextBoxes);
if (physPos >= 0)
{
LoadImage(sender, Tst.End, physPos);
}
}
private void TestStartEndForm_FormClosed(object sender, FormClosedEventArgs e)
{
@@ -763,7 +804,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
TextBox clickedTextBox = sender as TextBox;
if (clickedTextBox != null)
{
var physPos = PhysPos(clickedTextBox, startTextBoxes);
var physPos = PhysPos(clickedTextBox, endTextBoxes);//startTextBoxes);
if (physPos < 0)
{
@@ -1069,7 +1110,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
TextBox clickedTextBox = sender as TextBox;
if (clickedTextBox != null)
{
var physPos = PhysPos(clickedTextBox, startTextBoxes);
var physPos = PhysPos(clickedTextBox, endTextBoxes);//startTextBoxes);
if (physPos < 0)
{
@@ -1134,65 +1175,479 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
/// </summary>
/// <param name="startOrEnd">Tst.Start or Tst.End</param>
/// <param name="physPos">0..23</param>
void LoadImage(object sender, Tst startOrEnd, int physPos)
{
int wmNr1b = phys2wm[physPos]; /// 0 means no WM
if (wmNr1b <= 0) return;
void LoadImage( object sender, Tst startOrEnd, int physPos)
{
if (physPos < 0 || physPos >= phys2wm.Length)
{
return;
}
wmNr0b = wmNr1b - 1;
int wmNr1b = phys2wm[physPos];
string imageFileName;
if (startOrEnd == Tst.Start && startImages[wmNr0b] != null)
imageFileName = startImages[wmNr0b];
else if (startOrEnd == Tst.End && endImages[wmNr0b] != null)
imageFileName = endImages[wmNr0b];
else
imageFileName = string.Empty;
// Hodnota 0 znamená, že na tejto fyzickej pozícii nie je vodomer.
if (wmNr1b <= 0)
{
return;
}
if (imageFileName == lastImageName)
{
return;
}
wmNr0b = wmNr1b - 1;
lastImageName = imageFileName;
lastWmNr1 = wmNr1b;
string imageFileName = GetBaseImageFileName(
startOrEnd,
wmNr0b);
if (string.IsNullOrEmpty(imageFileName) || !File.Exists(imageFileName))
{
lastImage = null;
}
else
{
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
lastWmNr1 = wmNr1b;
if (string.IsNullOrWhiteSpace(imageFileName))
{
ClearImageGroup();
LoadImageFile(null);
return;
}
/*
* Ak používateľ zvolil iný vodomer alebo Start/End obrázok,
* vytvoríme novú skupinu:
*
* TestAdvance-1-start.bmp
* TestAdvance-1-start_img01_....bmp
* TestAdvance-1-start_img02_....bmp
*/
if (!string.Equals(
imageFileName,
lastImageName,
StringComparison.OrdinalIgnoreCase))
{
lastImageName = imageFileName;
LoadImageGroup(imageFileName);
// Pôvodný kompatibilný obrázok bude zobrazený ako prvý.
currentImageGroupIndex = 0;
}
else
{
/*
* Súbory mohli vzniknúť až po prvom otvorení dialógu,
* preto skupinu pri opätovnom výbere obnovíme.
*/
RefreshCurrentImageGroup();
}
if (currentImageGroup.Count == 0)
{
LoadImageFile(null);
return;
}
currentImageGroupIndex = Math.Max(
0,
Math.Min(
currentImageGroupIndex,
currentImageGroup.Count - 1));
LoadImageFile(
currentImageGroup[currentImageGroupIndex]);
}
/// <summary>
/// base name of image file
/// </summary>
/// <param name="startOrEnd"></param>
/// <param name="waterMeterIndex"></param>
/// <returns></returns>
private string GetBaseImageFileName(
Tst startOrEnd,
int waterMeterIndex)
{
if (waterMeterIndex < 0 ||
waterMeterIndex >= WaterMetersCount)
{
return null;
}
if (startOrEnd == Tst.Start)
{
if (startImages == null ||
waterMeterIndex >= startImages.Length)
{
Rectangle rect;
if (tempBmp.Height < tempBmp.Width)
return null;
}
return startImages[waterMeterIndex];
}
if (startOrEnd == Tst.End)
{
if (endImages == null ||
waterMeterIndex >= endImages.Length)
{
return null;
}
return endImages[waterMeterIndex];
}
return null;
}
/// <summary>
/// load group of images
/// </summary>
/// <param name="baseImageFileName"></param>
private void LoadImageGroup(
string baseImageFileName)
{
currentImageGroup.Clear();
currentImageGroupIndex = 0;
if (string.IsNullOrWhiteSpace(baseImageFileName))
{
return;
}
string fullBaseFileName;
try
{
fullBaseFileName =
Path.GetFullPath(baseImageFileName);
}
catch (Exception exc)
{
log.Warn(
$"Cannot create image group from invalid path: " +
$"file='{baseImageFileName}', " +
$"error={exc.Message}");
return;
}
string directory =
Path.GetDirectoryName(fullBaseFileName);
string baseName =
Path.GetFileNameWithoutExtension(fullBaseFileName);
string extension =
Path.GetExtension(fullBaseFileName);
if (string.IsNullOrWhiteSpace(directory) ||
string.IsNullOrWhiteSpace(baseName))
{
return;
}
/*
* Pôvodný obrázok pridáme ako prvý.
*/
if (File.Exists(fullBaseFileName))
{
currentImageGroup.Add(fullBaseFileName);
}
if (!Directory.Exists(directory))
{
return;
}
string searchPattern =
$"{baseName}_img*{extension}";
try
{
List<string> timedImages =
Directory
.GetFiles(
directory,
searchPattern,
SearchOption.TopDirectoryOnly)
.OrderBy(GetTimedImageIndex)
.ThenBy(
fileName => fileName,
StringComparer.OrdinalIgnoreCase)
.ToList();
foreach (string timedImage in timedImages)
{
if (!currentImageGroup.Contains(
timedImage,
StringComparer.OrdinalIgnoreCase))
{
int hght = tempBmp.Height;
int leftMargin = (tempBmp.Width - hght) / 2;
rect = new Rectangle(leftMargin, 0, hght, hght);
}
else
{
int hght = tempBmp.Height;
int wdth = tempBmp.Width;
int margin = (hght - wdth) / 2;
rect = new Rectangle(0, margin, wdth, wdth);
}
//int hght = tempBmp.Height;
//int leftMargin = (tempBmp.Width - hght) / 2;
//lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
lastImage = new Bitmap(tempBmp.Clone(rect, tempBmp.PixelFormat));
if (isZoomed[wmNr0b])
{
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
currentImageGroup.Add(timedImage);
}
}
}
ShowImage();
}
log.Debug(
$"Image group loaded: " +
$"baseFile='{fullBaseFileName}', " +
$"searchPattern='{searchPattern}', " +
$"imagesCount={currentImageGroup.Count}");
}
catch (Exception exc)
{
log.Warn(
$"Cannot load image group: " +
$"baseFile='{fullBaseFileName}', " +
$"pattern='{searchPattern}', " +
$"error={exc.Message}");
}
}
/// <summary>
/// grouping by time
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
private static int GetTimedImageIndex(
string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
{
return int.MaxValue;
}
string nameWithoutExtension =
Path.GetFileNameWithoutExtension(fileName);
Match match = Regex.Match(
nameWithoutExtension,
@"_img(?<index>\d+)_",
RegexOptions.IgnoreCase);
if (!match.Success)
{
return int.MaxValue;
}
int imageIndex;
return int.TryParse(
match.Groups["index"].Value,
out imageIndex)
? imageIndex
: int.MaxValue;
}
/// <summary>
/// refreshing current image group
/// </summary>
private void RefreshCurrentImageGroup()
{
if (string.IsNullOrWhiteSpace(lastImageName))
{
return;
}
string currentlySelectedFile =
currentImageGroupIndex >= 0 &&
currentImageGroupIndex < currentImageGroup.Count
? currentImageGroup[currentImageGroupIndex]
: null;
LoadImageGroup(lastImageName);
if (string.IsNullOrWhiteSpace(currentlySelectedFile))
{
return;
}
int restoredIndex =
currentImageGroup.FindIndex(
fileName =>
string.Equals(
fileName,
currentlySelectedFile,
StringComparison.OrdinalIgnoreCase));
if (restoredIndex >= 0)
{
currentImageGroupIndex = restoredIndex;
}
}
/// --- picture load ---
private void LoadImageFile(
string imageFileName)
{
DisposeLoadedImages();
if (string.IsNullOrWhiteSpace(imageFileName) ||
!File.Exists(imageFileName))
{
log.Debug(
$"Image cannot be displayed because the file does not exist: " +
$"file='{imageFileName}'");
ShowImage();
return;
}
try
{
using (var tempBmp =
new Bitmap(imageFileName))
{
Rectangle rect =
CreateSquareCropRectangle(tempBmp);
using (Bitmap croppedImage =
tempBmp.Clone(
rect,
tempBmp.PixelFormat))
{
lastImage =
new Bitmap(croppedImage);
}
}
if (isZoomed[wmNr0b])
{
zoomedImage =
MakeZoomedImage(
lastImage,
zoomCenterLoc[wmNr0b]);
}
log.Debug(
$"Image displayed from group: " +
$"waterMeter={lastWmNr1}, " +
$"groupIndex={currentImageGroupIndex + 1}/" +
$"{currentImageGroup.Count}, " +
$"file='{imageFileName}'");
}
catch (Exception exc)
{
log.Error(
$"Cannot load image: " +
$"file='{imageFileName}', " +
$"error={exc.Message}",
exc);
DisposeLoadedImages();
}
ShowImage();
}
/// --- block picture Crop help method ---
private static Rectangle CreateSquareCropRectangle( Bitmap bitmap)
{
int size = Math.Min( bitmap.Width, bitmap.Height);
int x = (bitmap.Width - size) / 2;
int y = (bitmap.Height - size) / 2;
return new Rectangle( x, y, size, size);
}
// --- block release old pictures ---
private void DisposeLoadedImages()
{
if (lastImage != null)
{
lastImage.Dispose();
lastImage = null;
}
if (zoomedImage != null)
{
zoomedImage.Dispose();
zoomedImage = null;
}
}
private void ClearImageGroup()
{
currentImageGroup.Clear();
currentImageGroupIndex = 0;
lastImageName = null;
}
// --- block picture exchange ---
private void ShowPreviousImageFromGroup()
{
ShowImageFromGroup(-1);
}
private void ShowNextImageFromGroup()
{
ShowImageFromGroup(1);
}
private void ShowImageFromGroup(
int direction)
{
if (direction == 0 ||
currentImageGroup.Count <= 1)
{
return;
}
int newIndex =
currentImageGroupIndex + direction;
/*
* Cyklické prepínanie:
*
* posledný -> prvý
* prvý -> posledný
*/
if (newIndex < 0)
{
newIndex =
currentImageGroup.Count - 1;
}
else if (newIndex >= currentImageGroup.Count)
{
newIndex = 0;
}
currentImageGroupIndex = newIndex;
LoadImageFile(
currentImageGroup[currentImageGroupIndex]);
}
// --- mouse events ---
private void pictureBox1_MouseEnter(
object sender,
EventArgs e)
{
mouseOverPictureBox = true;
/*
* PictureBox štandardne nemusí mať focus.
* Focus pomôže zachytiť klávesy aj koliesko.
*/
pictureBox1.Focus();
}
private void pictureBox1_MouseLeave(
object sender,
EventArgs e)
{
mouseOverPictureBox = false;
}
private void pictureBox1_MouseWheel(
object sender,
MouseEventArgs e)
{
if (!mouseOverPictureBox ||
currentImageGroup.Count <= 1)
{
return;
}
if (e.Delta > 0)
{
ShowPreviousImageFromGroup();
}
else if (e.Delta < 0)
{
ShowNextImageFromGroup();
}
}
/// <summary>
/// Left click = Zoom, Right click = Unzoom
@@ -1276,7 +1731,9 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
if (lastImage == null)
{
Image previousImage = pictureBox1.Image;
pictureBox1.Image = new Bitmap(TBF.Properties.Resources.Empty);
previousImage?.Dispose();
return;
}
@@ -1312,10 +1769,108 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
Brush brush = (brightness > 160) ? darkBrush : lightBrush;
grph.DrawString(lastWmNr1.ToString(), font, brush, margin, margin);
DrawImageInfo(grph, tempBmp);
}
Image oldPictureBoxImage = pictureBox1.Image;
pictureBox1.Image = tempBmp;
oldPictureBoxImage?.Dispose();
}
private void DrawImageInfo( Graphics graphics, Bitmap bitmap)
{
if (graphics == null)
{
throw new ArgumentNullException(nameof(graphics));
}
if (bitmap == null)
{
throw new ArgumentNullException(nameof(bitmap));
}
string currentImageFileName = GetCurrentImageFileName();
if (string.IsNullOrWhiteSpace(currentImageFileName))
{
return;
}
string fileName = Path.GetFileName(currentImageFileName);
string displayText = fileName;
Match match = Regex.Match( fileName, @"_img(?<index>\d+)_(?<date>\d{8})_(?<time>\d{6})_(?<ms>\d{3})", RegexOptions.IgnoreCase);
if (match.Success)
{
string imageIndex = match.Groups["index"].Value;
string date = match.Groups["date"].Value;
string time = match.Groups["time"].Value;
string milliseconds = match.Groups["ms"].Value;
string formattedDate =
$"{date.Substring(6, 2)}." +
$"{date.Substring(4, 2)}." +
$"{date.Substring(0, 4)}";
string formattedTime =
$"{time.Substring(0, 2)}:" +
$"{time.Substring(2, 2)}:" +
$"{time.Substring(4, 2)}." +
milliseconds;
string baseFileName =
Regex.Replace(
fileName,
@"_img\d+_\d{8}_\d{6}_\d{3}",
string.Empty,
RegexOptions.IgnoreCase);
displayText =
$"{baseFileName} [img{imageIndex}]" +
Environment.NewLine +
$"{formattedDate} {formattedTime}";
}
using (Font font = new Font( "Arial", isZoomed[wmNr0b] ? 8 : 10, FontStyle.Bold))
{
SizeF textSize =
graphics.MeasureString(
displayText,
font);
float margin = 5;
float x = bitmap.Width - textSize.Width - margin;
float y = bitmap.Height - textSize.Height - margin;
graphics.DrawString( displayText, font, Brushes.Black, x + 1, y + 1);
graphics.DrawString( displayText, font, Brushes.White, x, y);
}
}
private string GetCurrentImageFileName()
{
if (currentImageGroup == null ||
currentImageGroup.Count == 0)
{
return lastImageName;
}
if (currentImageGroupIndex < 0 ||
currentImageGroupIndex >= currentImageGroup.Count)
{
return lastImageName;
}
return currentImageGroup[currentImageGroupIndex];
}
private void checkBoxEnableStartBox_CheckStateChanged(object sender, EventArgs e)
@@ -1345,5 +1900,35 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
}
}
}
//Page Down/Up evenst
protected override bool ProcessCmdKey(
ref Message msg,
Keys keyData)
{
if (mouseOverPictureBox &&
currentImageGroup.Count > 1)
{
if (keyData == Keys.PageUp)
{
ShowPreviousImageFromGroup();
return true;
}
if (keyData == Keys.PageDown)
{
ShowNextImageFromGroup();
return true;
}
}
return base.ProcessCmdKey(
ref msg,
keyData);
}
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
/// * mark test method from smart family devices
/// * (this Test method is used for devices that support smart reader)
/// </summary>
public interface ITestMethodSmart
public interface ITestMethodSmart : ITestMethod
{
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,154 @@
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TBF.Rig.Network.Camera.CJMS11
{
internal sealed class CameraLineReader
{
private readonly Stream stream;
private readonly byte[] receiveBuffer;
private int bufferStart;
private int bufferEnd;
public CameraLineReader(
Stream stream,
int bufferSize = 64 * 1024)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
if (!stream.CanRead)
throw new ArgumentException(
"Stream must be readable.",
nameof(stream));
if (bufferSize <= 0)
throw new ArgumentOutOfRangeException(
nameof(bufferSize));
this.stream = stream;
receiveBuffer = new byte[bufferSize];
}
public async Task<string> ReadLineAsync(
int timeoutMs,
CancellationToken cancellationToken)
{
if (timeoutMs <= 0)
throw new ArgumentOutOfRangeException(
nameof(timeoutMs));
using (var lineBuffer = new MemoryStream())
{
while (true)
{
int newLineIndex = FindNewLine();
if (newLineIndex >= 0)
{
int count = newLineIndex - bufferStart;
if (count > 0)
{
lineBuffer.Write(
receiveBuffer,
bufferStart,
count);
}
bufferStart = newLineIndex + 1;
return ConvertLineToString(lineBuffer);
}
if (bufferStart < bufferEnd)
{
lineBuffer.Write(
receiveBuffer,
bufferStart,
bufferEnd - bufferStart);
}
bufferStart = 0;
bufferEnd = 0;
int read = await ReadChunkAsync(
timeoutMs,
cancellationToken)
.ConfigureAwait(false);
if (read == 0)
{
throw new IOException(
"Camera connection was closed.");
}
bufferStart = 0;
bufferEnd = read;
}
}
}
private int FindNewLine()
{
for (int i = bufferStart; i < bufferEnd; i++)
{
if (receiveBuffer[i] == (byte)'\n')
return i;
}
return -1;
}
private async Task<int> ReadChunkAsync(
int timeoutMs,
CancellationToken cancellationToken)
{
using (var timeoutCts =
CancellationTokenSource.CreateLinkedTokenSource(
cancellationToken))
{
timeoutCts.CancelAfter(timeoutMs);
try
{
return await stream.ReadAsync(
receiveBuffer,
0,
receiveBuffer.Length,
timeoutCts.Token)
.ConfigureAwait(false);
}
catch (OperationCanceledException)
when (!cancellationToken.IsCancellationRequested)
{
throw new TimeoutException(
$"Camera read timeout after {timeoutMs} ms.");
}
}
}
private static string ConvertLineToString(
MemoryStream lineBuffer)
{
int length = checked((int)lineBuffer.Length);
if (length == 0)
return string.Empty;
byte[] data = lineBuffer.GetBuffer();
if (data[length - 1] == (byte)'\r')
length--;
return Encoding.ASCII.GetString(
data,
0,
length);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,3 +1,4 @@
using System;
using TBF.Rig.Network.Camera.CJMS11.POJO;
namespace TBF.Rig.Network.Camera.CJMS11
@@ -11,6 +12,7 @@ namespace TBF.Rig.Network.Camera.CJMS11
private string orig_status;
private string orig_command;
private string orig_payload;
private DateTime timeStamp;
public POJO.MessageStatus Status
{
@@ -35,6 +37,12 @@ namespace TBF.Rig.Network.Camera.CJMS11
public string OrigCommand => orig_command;
public string OrigPayload => orig_payload;
public DateTime TimeStamp
{
get => timeStamp;
set => timeStamp = value;
}
public JmsMessage(string status, string command, string payload)
{
+41 -14
View File
@@ -1,6 +1,7 @@
using System;
using System.Text.RegularExpressions;
using log4net;
using Newtonsoft.Json;
using TBF.Rig.Network.Camera.CJMS11.POJO;
namespace TBF.Rig.Network.Camera.CJMS11
@@ -44,6 +45,16 @@ namespace TBF.Rig.Network.Camera.CJMS11
if (message.Length < 1) return false;
this.jmsMessage = JmsMessageFromString(message);
try
{
CameraResponse response =
JsonConvert.DeserializeObject<CameraResponse>(jmsMessage.Payload);
jmsMessage.TimeStamp = response.timeStamp;
}catch(Exception e)
{
log.Debug("Error parsing message timestamp: " + e.Message);
}
return true;
}
@@ -70,23 +81,39 @@ namespace TBF.Rig.Network.Camera.CJMS11
return null;
}
public static ParsedImage ImageParser(string payloadImage)
public static ParsedImage ImageParser(
string payloadImage)
{
// Equivalent regex pattern
var imagePattern = new Regex(@"IMAGE:([A-Z0-9_]+):\s*(.*?)\s*~IMAGE_END", RegexOptions.Singleline);
const string prefix = "IMAGE:";
const string endMarker = "~IMAGE_END";
var match = imagePattern.Match(payloadImage);
if (match.Success)
{
string encoding = match.Groups[1].Value;
string imageData = match.Groups[2].Value;
int prefixIndex = payloadImage.IndexOf( prefix, StringComparison.Ordinal);
if (prefixIndex < 0)
throw new ArgumentException( "IMAGE prefix was not found.");
return new ParsedImage(ImageTypeEnum.GetCommandM(encoding), imageData);
}
else
{
throw new ArgumentException($"Payload does not match expected image format: {payloadImage}");
}
int encodingStart =
prefixIndex + prefix.Length;
int encodingEnd =
payloadImage.IndexOf(
':',
encodingStart);
if (encodingEnd < 0)
throw new ArgumentException(
"Image encoding separator was not found.");
int dataStart = encodingEnd + 1;
int dataEnd = payloadImage.IndexOf( endMarker, dataStart, StringComparison.Ordinal);
if (dataEnd < 0)
throw new ArgumentException( "IMAGE_END marker was not found.");
string encoding = payloadImage .Substring( encodingStart, encodingEnd - encodingStart) .Trim();
string imageData = payloadImage.Substring( dataStart,dataEnd - dataStart).Trim();
return new ParsedImage( ImageTypeEnum.GetCommandM(encoding), imageData);
}
public override string ToString()
@@ -0,0 +1,12 @@
using System;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class CameraResponse
{
public string message { get; set; }
public DateTime timeStamp { get; set; }
}
}
@@ -0,0 +1,37 @@
using Newtonsoft.Json;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class SendImagePayload
{
[JsonProperty("frameGap")]
public int FrameGap { get; set; }
[JsonProperty("frameTime")]
public string FrameTime { get; set; }
[JsonProperty("frameTimeMillis")]
public long FrameTimeMillis { get; set; }
[JsonProperty("pictureBase64")]
public string PictureBase64 { get; set; }
[JsonProperty("picturesComplete")]
public int PicturesComplete { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("taskId")]
public string TaskId { get; set; }
[JsonProperty("taskPath")]
public string TaskPath { get; set; }
[JsonProperty("taskTime")]
public string TaskTime { get; set; }
[JsonProperty("workerId")]
public int WorkerId { get; set; }
}
}
@@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class SendImagesRequest
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("delay")]
public int Delay { get; set; }
[JsonProperty("taskId")]
public string TaskId { get; set; }
}
}
@@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class SendSummaryPayload
{
[JsonProperty("delay")]
public int Delay { get; set; }
[JsonProperty("pic_count")]
public int PictureCount { get; set; }
[JsonProperty("timeStamp")]
public string TimeStamp { get; set; }
}
}
@@ -0,0 +1,20 @@
using System;
using System.Drawing;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class TimedCameraImage
{
public int Index { get; set; }
public string TaskId { get; set; }
public DateTimeOffset? FrameTime { get; set; }
public long FrameTimeMillis { get; set; }
public int FrameGap { get; set; }
public Image Image { get; set; }
}
}
@@ -20,17 +20,36 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcedureParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public double PulsesPerLtr; /// [l^-1]
public override void InitializeAll()
{
PulsesPerLtr = 1.0;
}
///PulsePerMeter [l^-1]
public double PulsesPerLtr;
/// <summary>
/// delta time gap for send parameter
/// </summary>
/// <description>delta time for send parameter 500ms is minimum</description>
public int RoiDeltaTimeMs;
/// <summary>
/// count of picture for send > 1 / grabImage == 0|1 parameter - switch method
/// </summary>
/// <description>count of picture for send > 1 / grabImage == 0|1 parameter - switch method</description>
public int RoiPicCount;
string[] paramNames = new string[]
{
Strings.PulsesPerLtr,
Strings.PictureCouts,
Strings.DelaySendImage,
};
public override void InitializeAll()
{
PulsesPerLtr = 1.0;
RoiPicCount = 1; //default value 1 => grab Image
RoiDeltaTimeMs = 500; //delta time for send parameter 500ms is minimum
}
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
@@ -39,6 +58,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
switch (i)
{
case 0: return PulsesPerLtr.ToString();
case 1: return RoiPicCount.ToString();
case 2: return RoiDeltaTimeMs.ToString();
default: return string.Empty;
}
}
@@ -49,6 +70,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
switch (i)
{
case 0: PulsesPerLtr = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
case 1: RoiPicCount = Int32.Parse(strValue); return CfgUpdateFlags.None;
case 2: RoiDeltaTimeMs = Int32.Parse(strValue); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
@@ -59,11 +82,26 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
message = string.Empty;
double dummy;
int dummyInt;
switch (i)
{
case 0:
if (Utils.TryParseUDouble(strValue, out dummy)) return true;
break;
case 1:
if (!Int32.TryParse(strValue, out dummyInt) || (dummyInt < 0 || dummyInt > 50))
{
message = ParamName(i) + " is invalid. Param must be between 0 and 50!";
return false;
}
return true;
case 2:
if (!Int32.TryParse(strValue, out dummyInt) || (dummyInt < 500 || dummyInt < 5500))
{
message = ParamName(i) + " is invalid. Param must be between 500 and 5500!";
return false;
}
return true;
default:
message = "Invalid index";
return false;
@@ -76,6 +114,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
void CopyContentTo(ProcedureParams prms)
{
prms.PulsesPerLtr = this.PulsesPerLtr;
prms.RoiDeltaTimeMs = this.RoiDeltaTimeMs;
prms.RoiPicCount = this.RoiPicCount;
}
public IParamsProvider Clone()
@@ -3,6 +3,7 @@
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using log4net;
using Common;
@@ -41,6 +42,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
get { return roiCfg.ProcParams.PulsesPerLtr; }
set { roiCfg.ProcParams.PulsesPerLtr = value; }
}
public int RoiDeltaTimeMs { get { return roiCfg.ProcParams.RoiDeltaTimeMs; } }
public int RoiPicCount { get { return roiCfg.ProcParams.RoiPicCount; } }
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
public string QuantityUnits { get; set; }
@@ -123,26 +126,65 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
return GrabImageOp(imageFileName, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
}
public IOperation GrabImageOp(string imageFileName,
bool blackAndWhite, bool lowResolution, ImageRotation imageRotation)
// Roi.cs
public IOperation GrabImageOp(
string imageFileName,
bool blackAndWhite,
bool lowResolution,
ImageRotation imageRotation)
{
if (NetCamera != null)
if (NetCamera == null)
{
///TODO BUMI - implementing grabing multiple images
/// 1. Create a list of image file names
string[] imageNames = new string[roiCfg.ImageOpacity.Count];
for (int i = 0; i < imageNames.Length; i++)
{
imageNames[i] = imageFileName + string.Format("{0}_{1}",imageNames.Length, i);
}
/// 2. implement count of images to grab
/// 3. implement grabing multiple images
/// TODO: Implement support for sharing one camera by multiple ROI-s
return NetCamera.GrabImagesOp(new string[] { imageFileName }, blackAndWhite, lowResolution, imageRotation);
}
else
return null;
}
int imageCount = Math.Max(1, RoiPicCount);
string[] imageNames = CreateImageFileNames(
imageFileName,
imageCount);
return NetCamera.GrabImagesOp(
imageNames,
blackAndWhite,
lowResolution,
imageRotation);
}
private static string[] CreateImageFileNames(
string originalFileName,
int imageCount)
{
if (imageCount <= 1)
{
return new[] { originalFileName };
}
string directory = Path.GetDirectoryName(originalFileName);
string baseName = Path.GetFileNameWithoutExtension(originalFileName);
string extension = Path.GetExtension(originalFileName);
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss_fff");
var result = new string[imageCount];
// Prvý obrázok zostáva kompatibilný s dialógom.
result[0] = originalFileName;
for (int i = 1; i < imageCount; i++)
{
string fileName = string.Format(
"{0}_{1}_{2:D2}{3}",
baseName,
timestamp,
i + 1,
extension);
result[i] = string.IsNullOrEmpty(directory)
? fileName
: Path.Combine(directory, fileName);
}
return result;
}
public IValve GetValve()
+15 -8
View File
@@ -94,17 +94,24 @@ namespace TBF.Rig.Network.Telnet
public class PromptReceivedImagesEventArgs : EventArgs
{
public Image image; /// server image.
public int idxCamera; /// camera index.
public int idxImage; /// image index.
public int imageCounts; /// number of images.
public PromptReceivedImagesEventArgs(int idxCamera, Image image, int idxImage, int imageCounts)
public int idxCamera;
public int idxImage;
public int imageCount;
public Image image;
public DateTimeOffset? frameTime;
public PromptReceivedImagesEventArgs(
int idxCamera,
int idxImage,
int imageCount,
Image image,
DateTimeOffset? frameTime)
{
this.image = image;
this.idxCamera = idxCamera;
this.idxImage = idxImage;
this.imageCounts = imageCounts;
this.imageCount = imageCount;
this.image = image;
this.frameTime = frameTime;
}
}
@@ -16,18 +16,18 @@ namespace TBF.Rig.RegisterReaders.CommonRR.IPerl
public int DfltQ2c_15_rl { get; set; }
public int DfltQ2c_15_lr { get; set; }
public int DfltQ2c_20_rl { get; set; }
public int DfltQ2c_20_lr { get; set; }
public int DfltQ2c_25_63_rl { get; set; }
public int DfltQ2c_25_63_lr { get; set; }
public int DfltQ2c_25_10_rl { get; set; }
public int DfltQ2c_25_10_lr { get; set; }
public int DfltQ2c_32_rl { get; set; }
public int DfltQ2c_32_lr { get; set; }
public int DfltQ2c_40_rl { get; set; }
public int DfltQ2c_40_lr { get; set; }
public int CalibFactor1InchCh1 { get; set; }
public int CalibFactor1InchCh2 { get; set; }
public int CalibFactor2InchCh1 { get; set; }
public int CalibFactor2InchCh2 { get; set; }
public int CalibFactor3InchCh1 { get; set; }
public int CalibFactor3InchCh2 { get; set; }
public int CalibFactor4InchCh1 { get; set; }
public int CalibFactor4InchCh2 { get; set; }
public int CalibFactor6InchCh1 { get; set; }
public int CalibFactor6InchCh2 { get; set; }
public int CalibFactor6MoreInchCh1 { get; set; }
public int CalibFactor6MoreInchCh2 { get; set; }
public bool UseWebService { get; set; }
public string BaseUrl { get; set; }
@@ -26,7 +26,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
public int HeadCommunicationComPortNr;
public int OptoComPortNr;
public int RfidComPortNr; /// 0 = use MuxBoardNr
public int MuxBoardNr; /// 0 = use RfidComPort(Nr), otherwise mux. board nr. 1 .. 4
public int MuxBoardNr; /// 0 = use RfidComPort(Nr), otherwise mux. board nr. 1 .. 4 in new 1 .. 10 - paralel genesis access
public int Group; /// Number written to QuidoRS to connct the watermeter to RfidComPort, 1 .. 10
//public CommunicationInterface CommunicationInterface; /// Communication Interface: RFID or NFC
public string CommunicationInterfaceBridge; /// Communication Interface: RFID or NFC
@@ -157,7 +157,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
message += Environment.NewLine + "'Head communication serial port nr.' is not valid";
}
if (!int.TryParse(muxBoardNrTextBox.Text, out dummy) || dummy < 1 || dummy > 4)
if (!int.TryParse(muxBoardNrTextBox.Text, out dummy) || dummy < 1 || dummy > 10)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, muxBoardNrLabel.Text);
@@ -76,11 +76,11 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(3, 4);
this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tabControl1.Location = new System.Drawing.Point(2, 3);
this.tabControl1.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(687, 540);
this.tabControl1.Size = new System.Drawing.Size(458, 351);
this.tabControl1.TabIndex = 0;
//
// tabPage1
@@ -99,40 +99,42 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
this.tabPage1.Controls.Add(this.nameTextBox);
this.tabPage1.Controls.Add(this.nameLabel);
this.tabPage1.Controls.Add(this.classNameLabel);
this.tabPage1.Location = new System.Drawing.Point(4, 29);
this.tabPage1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tabPage1.Size = new System.Drawing.Size(679, 507);
this.tabPage1.Padding = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.tabPage1.Size = new System.Drawing.Size(450, 325);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Config";
this.tabPage1.UseVisualStyleBackColor = true;
//
// label5
//
this.label5.Location = new System.Drawing.Point(372, 55);
this.label5.Location = new System.Drawing.Point(248, 36);
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(100, 23);
this.label5.Size = new System.Drawing.Size(67, 15);
this.label5.TabIndex = 28;
this.label5.Text = "Slot Nr:";
//
// textBoxSlotNr
//
this.textBoxSlotNr.Enabled = false;
this.textBoxSlotNr.Location = new System.Drawing.Point(480, 55);
this.textBoxSlotNr.Location = new System.Drawing.Point(320, 36);
this.textBoxSlotNr.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.textBoxSlotNr.Name = "textBoxSlotNr";
this.textBoxSlotNr.Size = new System.Drawing.Size(74, 26);
this.textBoxSlotNr.Size = new System.Drawing.Size(51, 20);
this.textBoxSlotNr.TabIndex = 27;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.headPortNrTextBox);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Location = new System.Drawing.Point(11, 450);
this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox2.Location = new System.Drawing.Point(7, 292);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox2.Size = new System.Drawing.Size(621, 52);
this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.groupBox2.Size = new System.Drawing.Size(414, 34);
this.groupBox2.TabIndex = 26;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Head Communication";
@@ -140,41 +142,37 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
// headPortNrTextBox
//
this.headPortNrTextBox.Enabled = false;
this.headPortNrTextBox.Location = new System.Drawing.Point(494, 19);
this.headPortNrTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.headPortNrTextBox.Location = new System.Drawing.Point(329, 12);
this.headPortNrTextBox.Name = "headPortNrTextBox";
this.headPortNrTextBox.Size = new System.Drawing.Size(49, 26);
this.headPortNrTextBox.Size = new System.Drawing.Size(34, 20);
this.headPortNrTextBox.TabIndex = 8;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(361, 22);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Location = new System.Drawing.Point(241, 14);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(107, 20);
this.label2.Size = new System.Drawing.Size(72, 13);
this.label2.TabIndex = 7;
this.label2.Text = "Serial port nr.:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(234, 126);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Location = new System.Drawing.Point(156, 82);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(52, 20);
this.label4.Size = new System.Drawing.Size(37, 13);
this.label4.TabIndex = 25;
this.label4.Text = "1 .. 10";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(234, 90);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Location = new System.Drawing.Point(156, 58);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(43, 20);
this.label3.Size = new System.Drawing.Size(37, 13);
this.label3.TabIndex = 24;
this.label3.Text = "1 .. 4";
this.label3.Text = "1 .. 10";
//
// groupBox1
//
@@ -182,11 +180,9 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.rfidPortNrTextBox);
this.groupBox1.Controls.Add(this.rfidSerialPortNrLabel);
this.groupBox1.Location = new System.Drawing.Point(11, 363);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Location = new System.Drawing.Point(7, 236);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Size = new System.Drawing.Size(621, 85);
this.groupBox1.Size = new System.Drawing.Size(414, 55);
this.groupBox1.TabIndex = 23;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "RFID / NFC communication (in case mux. board is not used)";
@@ -195,38 +191,35 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
//
this.comboBoxCommunicationInterface.Enabled = false;
this.comboBoxCommunicationInterface.FormattingEnabled = true;
this.comboBoxCommunicationInterface.Location = new System.Drawing.Point(202, 34);
this.comboBoxCommunicationInterface.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.comboBoxCommunicationInterface.Location = new System.Drawing.Point(135, 22);
this.comboBoxCommunicationInterface.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.comboBoxCommunicationInterface.Name = "comboBoxCommunicationInterface";
this.comboBoxCommunicationInterface.Size = new System.Drawing.Size(152, 28);
this.comboBoxCommunicationInterface.Size = new System.Drawing.Size(103, 21);
this.comboBoxCommunicationInterface.TabIndex = 9;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 38);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Location = new System.Drawing.Point(5, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(187, 20);
this.label1.Size = new System.Drawing.Size(124, 13);
this.label1.TabIndex = 8;
this.label1.Text = "Communication Interface";
//
// rfidPortNrTextBox
//
this.rfidPortNrTextBox.Enabled = false;
this.rfidPortNrTextBox.Location = new System.Drawing.Point(494, 32);
this.rfidPortNrTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rfidPortNrTextBox.Location = new System.Drawing.Point(329, 21);
this.rfidPortNrTextBox.Name = "rfidPortNrTextBox";
this.rfidPortNrTextBox.Size = new System.Drawing.Size(49, 26);
this.rfidPortNrTextBox.Size = new System.Drawing.Size(34, 20);
this.rfidPortNrTextBox.TabIndex = 7;
//
// rfidSerialPortNrLabel
//
this.rfidSerialPortNrLabel.AutoSize = true;
this.rfidSerialPortNrLabel.Location = new System.Drawing.Point(361, 38);
this.rfidSerialPortNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.rfidSerialPortNrLabel.Location = new System.Drawing.Point(241, 25);
this.rfidSerialPortNrLabel.Name = "rfidSerialPortNrLabel";
this.rfidSerialPortNrLabel.Size = new System.Drawing.Size(107, 20);
this.rfidSerialPortNrLabel.Size = new System.Drawing.Size(72, 13);
this.rfidSerialPortNrLabel.TabIndex = 6;
this.rfidSerialPortNrLabel.Text = "Serial port nr.:";
//
@@ -243,11 +236,9 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
this.optoDataGroupBox.Controls.Add(this.radioButton2);
this.optoDataGroupBox.Controls.Add(this.optoSerialPortLabel);
this.optoDataGroupBox.Controls.Add(this.optoSerialPortTextBox);
this.optoDataGroupBox.Location = new System.Drawing.Point(11, 164);
this.optoDataGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.optoDataGroupBox.Location = new System.Drawing.Point(7, 107);
this.optoDataGroupBox.Name = "optoDataGroupBox";
this.optoDataGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.optoDataGroupBox.Size = new System.Drawing.Size(621, 189);
this.optoDataGroupBox.Size = new System.Drawing.Size(414, 123);
this.optoDataGroupBox.TabIndex = 18;
this.optoDataGroupBox.TabStop = false;
this.optoDataGroupBox.Text = "Opto-data";
@@ -257,9 +248,10 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
this.checkBox_EnableShowChanels.Checked = true;
this.checkBox_EnableShowChanels.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox_EnableShowChanels.Enabled = false;
this.checkBox_EnableShowChanels.Location = new System.Drawing.Point(351, 147);
this.checkBox_EnableShowChanels.Location = new System.Drawing.Point(234, 96);
this.checkBox_EnableShowChanels.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.checkBox_EnableShowChanels.Name = "checkBox_EnableShowChanels";
this.checkBox_EnableShowChanels.Size = new System.Drawing.Size(238, 24);
this.checkBox_EnableShowChanels.Size = new System.Drawing.Size(159, 16);
this.checkBox_EnableShowChanels.TabIndex = 10;
this.checkBox_EnableShowChanels.Text = "Enable Show Channels";
this.checkBox_EnableShowChanels.UseVisualStyleBackColor = true;
@@ -267,58 +259,56 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
// tBBeginDataFlush
//
this.tBBeginDataFlush.Enabled = false;
this.tBBeginDataFlush.Location = new System.Drawing.Point(474, 105);
this.tBBeginDataFlush.Location = new System.Drawing.Point(316, 68);
this.tBBeginDataFlush.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.tBBeginDataFlush.MaxLength = 8;
this.tBBeginDataFlush.Name = "tBBeginDataFlush";
this.tBBeginDataFlush.Size = new System.Drawing.Size(69, 26);
this.tBBeginDataFlush.Size = new System.Drawing.Size(47, 20);
this.tBBeginDataFlush.TabIndex = 9;
this.tBBeginDataFlush.Text = "2000";
this.tBBeginDataFlush.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// labelFlush
//
this.labelFlush.Location = new System.Drawing.Point(328, 109);
this.labelFlush.Location = new System.Drawing.Point(219, 71);
this.labelFlush.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.labelFlush.Name = "labelFlush";
this.labelFlush.Size = new System.Drawing.Size(140, 22);
this.labelFlush.Size = new System.Drawing.Size(93, 14);
this.labelFlush.TabIndex = 8;
this.labelFlush.Text = "Begin Data Flush:";
//
// tcpipPortLabel
//
this.tcpipPortLabel.AutoSize = true;
this.tcpipPortLabel.Location = new System.Drawing.Point(46, 109);
this.tcpipPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.tcpipPortLabel.Location = new System.Drawing.Point(31, 71);
this.tcpipPortLabel.Name = "tcpipPortLabel";
this.tcpipPortLabel.Size = new System.Drawing.Size(68, 20);
this.tcpipPortLabel.Size = new System.Drawing.Size(47, 13);
this.tcpipPortLabel.TabIndex = 4;
this.tcpipPortLabel.Text = "Port nr..:";
//
// tcpipPortTextBox
//
this.tcpipPortTextBox.Enabled = false;
this.tcpipPortTextBox.Location = new System.Drawing.Point(161, 105);
this.tcpipPortTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tcpipPortTextBox.Location = new System.Drawing.Point(107, 68);
this.tcpipPortTextBox.Name = "tcpipPortTextBox";
this.tcpipPortTextBox.Size = new System.Drawing.Size(57, 26);
this.tcpipPortTextBox.Size = new System.Drawing.Size(39, 20);
this.tcpipPortTextBox.TabIndex = 5;
//
// ipAddressLabel
//
this.ipAddressLabel.AutoSize = true;
this.ipAddressLabel.Location = new System.Drawing.Point(46, 74);
this.ipAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.ipAddressLabel.Location = new System.Drawing.Point(31, 48);
this.ipAddressLabel.Name = "ipAddressLabel";
this.ipAddressLabel.Size = new System.Drawing.Size(93, 20);
this.ipAddressLabel.Size = new System.Drawing.Size(63, 13);
this.ipAddressLabel.TabIndex = 2;
this.ipAddressLabel.Text = "IP address.:";
//
// ipAddressTextBox
//
this.ipAddressTextBox.Enabled = false;
this.ipAddressTextBox.Location = new System.Drawing.Point(161, 69);
this.ipAddressTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.ipAddressTextBox.Location = new System.Drawing.Point(107, 45);
this.ipAddressTextBox.Name = "ipAddressTextBox";
this.ipAddressTextBox.Size = new System.Drawing.Size(145, 26);
this.ipAddressTextBox.Size = new System.Drawing.Size(98, 20);
this.ipAddressTextBox.TabIndex = 3;
//
// radioButton1
@@ -326,10 +316,9 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Enabled = false;
this.radioButton1.Location = new System.Drawing.Point(33, 29);
this.radioButton1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButton1.Location = new System.Drawing.Point(22, 19);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(109, 24);
this.radioButton1.Size = new System.Drawing.Size(83, 17);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Use TCP/IP";
@@ -339,10 +328,9 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
//
this.radioButton2.AutoSize = true;
this.radioButton2.Enabled = false;
this.radioButton2.Location = new System.Drawing.Point(351, 29);
this.radioButton2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButton2.Location = new System.Drawing.Point(234, 19);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(129, 24);
this.radioButton2.Size = new System.Drawing.Size(92, 17);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "Use serial port";
this.radioButton2.UseVisualStyleBackColor = true;
@@ -350,108 +338,98 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader
// optoSerialPortLabel
//
this.optoSerialPortLabel.AutoSize = true;
this.optoSerialPortLabel.Location = new System.Drawing.Point(361, 69);
this.optoSerialPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.optoSerialPortLabel.Location = new System.Drawing.Point(241, 45);
this.optoSerialPortLabel.Name = "optoSerialPortLabel";
this.optoSerialPortLabel.Size = new System.Drawing.Size(107, 20);
this.optoSerialPortLabel.Size = new System.Drawing.Size(72, 13);
this.optoSerialPortLabel.TabIndex = 6;
this.optoSerialPortLabel.Text = "Serial port nr.:";
//
// optoSerialPortTextBox
//
this.optoSerialPortTextBox.Enabled = false;
this.optoSerialPortTextBox.Location = new System.Drawing.Point(494, 65);
this.optoSerialPortTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.optoSerialPortTextBox.Location = new System.Drawing.Point(329, 42);
this.optoSerialPortTextBox.Name = "optoSerialPortTextBox";
this.optoSerialPortTextBox.Size = new System.Drawing.Size(49, 26);
this.optoSerialPortTextBox.Size = new System.Drawing.Size(34, 20);
this.optoSerialPortTextBox.TabIndex = 7;
//
// groupTextBox
//
this.groupTextBox.Enabled = false;
this.groupTextBox.Location = new System.Drawing.Point(172, 121);
this.groupTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupTextBox.Location = new System.Drawing.Point(115, 79);
this.groupTextBox.Name = "groupTextBox";
this.groupTextBox.Size = new System.Drawing.Size(49, 26);
this.groupTextBox.Size = new System.Drawing.Size(34, 20);
this.groupTextBox.TabIndex = 22;
//
// groupLabel
//
this.groupLabel.AutoSize = true;
this.groupLabel.Location = new System.Drawing.Point(7, 126);
this.groupLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.groupLabel.Location = new System.Drawing.Point(5, 82);
this.groupLabel.Name = "groupLabel";
this.groupLabel.Size = new System.Drawing.Size(67, 20);
this.groupLabel.Size = new System.Drawing.Size(45, 13);
this.groupLabel.TabIndex = 21;
this.groupLabel.Text = "Group 2";
//
// muxBoardNrTextBox
//
this.muxBoardNrTextBox.Enabled = false;
this.muxBoardNrTextBox.Location = new System.Drawing.Point(172, 86);
this.muxBoardNrTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.muxBoardNrTextBox.Location = new System.Drawing.Point(115, 56);
this.muxBoardNrTextBox.Name = "muxBoardNrTextBox";
this.muxBoardNrTextBox.Size = new System.Drawing.Size(49, 26);
this.muxBoardNrTextBox.Size = new System.Drawing.Size(34, 20);
this.muxBoardNrTextBox.TabIndex = 20;
//
// muxBoardNrLabel
//
this.muxBoardNrLabel.AutoSize = true;
this.muxBoardNrLabel.Location = new System.Drawing.Point(7, 90);
this.muxBoardNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.muxBoardNrLabel.Location = new System.Drawing.Point(5, 58);
this.muxBoardNrLabel.Name = "muxBoardNrLabel";
this.muxBoardNrLabel.Size = new System.Drawing.Size(159, 20);
this.muxBoardNrLabel.Size = new System.Drawing.Size(106, 13);
this.muxBoardNrLabel.TabIndex = 19;
this.muxBoardNrLabel.Text = "Group 1 (mux. board)";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(172, 50);
this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nameTextBox.Location = new System.Drawing.Point(115, 32);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(180, 26);
this.nameTextBox.Size = new System.Drawing.Size(121, 20);
this.nameTextBox.TabIndex = 17;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(7, 55);
this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.nameLabel.Location = new System.Drawing.Point(5, 36);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(51, 20);
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 16;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(168, 14);
this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.classNameLabel.Location = new System.Drawing.Point(112, 9);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(90, 20);
this.classNameLabel.Size = new System.Drawing.Size(60, 13);
this.classNameLabel.TabIndex = 15;
this.classNameLabel.Text = "ClassName";
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 29);
this.tabPage2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tabPage2.Size = new System.Drawing.Size(679, 507);
this.tabPage2.Padding = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.tabPage2.Size = new System.Drawing.Size(450, 325);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Test";
this.tabPage2.UseVisualStyleBackColor = true;
//
// GenesisCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tabControl1);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "GenesisCfgCtrl";
this.Size = new System.Drawing.Size(694, 548);
this.Size = new System.Drawing.Size(463, 356);
this.Load += new System.EventHandler(this.WaterMeterCfgCtrl_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
@@ -0,0 +1,49 @@
using System.Threading;
using System.Threading.Tasks;
using GenesisCordonelInterface.API;
using GenesisCordonelInterface.Core.Threading;
using TBF.Rig.BridgeComponents.GciBridge;
namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
{
public class GciBridgeClient : IGciBridgeClient
{
private readonly GciBridge bridge;
public GciBridgeClient(GciBridge bridge)
{
this.bridge = bridge;
}
public Task<RetryResult<PublicModels.RegisterReadResult>>
ReadRegisterWithRetryAsync(
int slotId,
string registerName,
CancellationToken token = default)
{
return bridge.ReadRegisterWithRetryAsync(
slotId,
registerName,
token);
}
public Task<RetryResult<PublicModels.RegisterWriteResult>>
WriteRegisterWithRetryAsync(
int slotId,
string registerName,
ushort value,
bool verify,
bool throwOnError,
CancellationToken token = default)
{
return bridge.WriteRegisterWithRetryAsync(
slotId,
registerName,
value,
verify,
throwOnError,
token);
}
}
}
@@ -0,0 +1,25 @@
using System.Threading;
using System.Threading.Tasks;
using GenesisCordonelInterface.API;
using GenesisCordonelInterface.Core.Threading;
namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
{
public interface IGciBridgeClient
{
Task<RetryResult<PublicModels.RegisterReadResult>>
ReadRegisterWithRetryAsync(
int slotId,
string registerName,
CancellationToken token = default);
Task<RetryResult<PublicModels.RegisterWriteResult>>
WriteRegisterWithRetryAsync(
int slotId,
string registerName,
ushort value,
bool verify,
bool throwOnError,
CancellationToken token = default);
}
}
File diff suppressed because it is too large Load Diff
@@ -1,176 +1,533 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using GenesisCordonelInterface.API;
using log4net;
using TBF.Rig.BridgeComponents.GciBridge;
using TBF.Rig.RegisterReaders.GenesisRegReader.common;
using TBF.Rig.RegisterReaders.GenesisRegReader.communication.common;
using TBF.Rig.RegisterReaders.GenesisRegReader.implementations;
using TBF.Rig.TestMethods.iPerlCommunication.communication.C4.diagnosticLed;
using TBF.Rig.TestMethods.iPerlCommunication.communication.C4.protocolCommons;
using PublicModels = TBF.Rig.BridgeComponents.GciBridge.Interfaces.PublicModels;
namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
{
public class ReadPcbResult
{
public bool IsConnected { get; set; }
public bool IsLoggedOn { get; set; }
public bool IsValidPcb { get; set; }
public string PcbId { get; set; }
public string Message { get; set; }
}
public class RadioService
{
private static readonly ILog log = LogManager.GetLogger(typeof(RadioService));
static string okResponse = "Command complete, no errors";
static string errorResponse = "Unable to execute";
private bool bConnected = false;
private GciBridge _bridge;
public RadioService(GciBridge genesisHeadCommInterfaceBridgeComponent)
{
this._bridge = genesisHeadCommInterfaceBridgeComponent;
log.Debug("RadioService created with GciBridge= " + genesisHeadCommInterfaceBridgeComponent + "");
this._bridge = genesisHeadCommInterfaceBridgeComponent;
log.Debug("RadioService created with GciBridge= " + genesisHeadCommInterfaceBridgeComponent + "");
}
public async Task<string> ReadRequest_PCBAsync(GenesisSmartReader iHead)
private async Task<ReadPcbResult> EnsureConnectedAsync(
GenesisSmartReader head,
CancellationToken token = default)
{
if (iHead?.CommInterfaceBridge == null)
return null;
var connectTask = iHead.CommInterfaceBridge.ConnectAsync(iHead.GetSlotNr);
// Wait either for ConnectAsync or timeout
if (await Task.WhenAny(connectTask, Task.Delay(TimeSpan.FromMinutes(1))) != connectTask)
log.Debug("EnsureConnectedAsync called for iHead: " + head);
if (head?.CommInterfaceBridge == null)
{
// Timed out
return null;
return new ReadPcbResult
{
IsConnected = false,
IsLoggedOn = false,
IsValidPcb = false,
Message = "CommInterfaceBridge is null."
};
}
var slotInfo = await _bridge.GetSlotAsync(head.GetSlotNr);
if (slotInfo == null || !slotInfo.Success)
{
//just no definet yet ?
log.Debug("EnsureConnectedAsync() - SlotInfo is null.");
}
else if (slotInfo.IsConnected)
{
log.Debug("EnsureConnectedAsync() - Slot: " + slotInfo);
return new ReadPcbResult
{
IsConnected = true,
IsLoggedOn = slotInfo.IsLoggedOn,
IsValidPcb = false,
PcbId = slotInfo.PcbId,
Message = "Already connected."
};
}
log.Debug("EnsureConnectedAsync() - Connecting...");
var connectTask = head.CommInterfaceBridge.ConnectAsync(head.GetSlotNr, token);
var timeoutTask = Task.Delay(TimeSpan.FromMinutes(1), token);
var completedTask = await Task.WhenAny(connectTask, timeoutTask);
if (completedTask != connectTask)
{
return new ReadPcbResult
{
IsConnected = false,
IsLoggedOn = false,
IsValidPcb = false,
Message = "Connect timeout."
};
}
var result = await connectTask;
if (result == null || !result.Success || !result.IsConnected)
return null;
string pcbId = result.PcbId;
if (!string.IsNullOrEmpty(pcbId))
if (result == null || !result.Success)
{
if (iHead.ConfigStruct != null)
iHead.ConfigStruct.PCBNumberString = pcbId;
return pcbId;
return new ReadPcbResult
{
IsConnected = false,
IsLoggedOn = false,
IsValidPcb = false,
Message = result == null ? "Connect result is null." : "Connect failed."
};
}
return null;
return new ReadPcbResult
{
IsConnected = result.IsConnected,
IsLoggedOn = false,
IsValidPcb = false,
Message = "Connected OK."
};
}
public async Task<PublicModels.UdsPasswordResult> FindKeyStone(
string txtPCBId,
CancellationToken token = default)
{
string pcbId = txtPCBId?.Trim();
if (string.IsNullOrWhiteSpace(pcbId))
throw new Exception("PCB ID is empty.");
token.ThrowIfCancellationRequested();
PublicModels.UdsPasswordResult result = await _bridge.GetPasswordAsync(pcbId, token);
log.Debug("GetPasswordAsync PCB=" + pcbId + " Result: " + result);
return result;
}
public async Task<GenesisCordonelInterface.API.PublicModels.GciLoginResult> LoginByPasswordAsync(
int slotId, string txtPassword,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(txtPassword))
throw new Exception("LoginByPasswordAsync() - PASSWORD is empty.");
token.ThrowIfCancellationRequested();
log.Debug($"LoginByPasswordAsync( Slot: {slotId}) - set password to: " + txtPassword.Substring(0, 4) + "************");
var gciSetPasswordResult = await _bridge.SetPasswordAsync(slotId,txtPassword, token);
log.Debug($"LoginByPasswordAsync( Slot: {slotId}) - SetPasswordAsync Result: " + gciSetPasswordResult);
// LOGIN
log.Debug($"LoginByPasswordAsync( Slot: {slotId}) - START LOGIN");
var gciSlotInfo = await _bridge.GetSlotAsync(slotId);
log.Debug($"LoginByPasswordAsync( Checked before Login() Slot: {slotId}) - START LOGIN Slot: {gciSlotInfo}");
GenesisCordonelInterface.API.PublicModels.GciLoginResult result = await _bridge.LoginAsync(slotId, token);
log.Debug($"LoginByPasswordAsync( Slot: {slotId}) Result: " + result);
log.Debug($"LoginByPasswordAsync( Slot: {slotId}) - END LOGIN, Success: {result.Success}");
// ~ LOGIN
return result;
}
public string ReadRequest_PCB(ref GenesisSmartReader iHead)
public async Task<ReadPcbResult> ReadRequest_PCBAsync( GenesisSmartReader head, bool bReload = false)
{
log.Debug("ReadRequest_PCB called for iHead: " + iHead.ToString());
if (iHead?.CommInterfaceBridge == null)
return null;
log.Debug("ReadRequest_PCB called for iHead: " + head);
// -- connection --
var connectTask = iHead.CommInterfaceBridge.ConnectAsync(iHead.GetSlotNr);
log.Debug("ReadRequest_PCB() - ConnectAsync created, Now waiting for result");
var completedTask = Task.WhenAny(
connectTask,
Task.Delay(TimeSpan.FromMinutes(1))
).GetAwaiter().GetResult();
log.Debug("ReadRequest_PCB() - CompletedTask: " + completedTask);
// Timeout happened
if (completedTask != connectTask)
if (head?.CommInterfaceBridge == null)
{
log.Debug("ReadRequest_PCB() - Timeout happened");
return null;
return new ReadPcbResult
{
IsConnected = false,
IsValidPcb = false,
Message = "CommInterfaceBridge is null."
};
}
var result = connectTask.GetAwaiter().GetResult();
log.Debug("ReadRequest_PCB() - ConnectAsync completed");
if (result == null || !result.Success || !result.IsConnected)
return null;
log.Debug("ReadRequest_PCB() - result: " + result);
//~ -- connection --
string pcbId = result.PcbId;
log.Debug("ReadRequest_PCB() - pcbId: " + pcbId);
if (!string.IsNullOrEmpty(pcbId))
try
{
if (iHead.ConfigStruct != null)
// CONNECT ONLY IF NEEDED
var connectResult = await EnsureConnectedAsync(head);
if (!connectResult.IsConnected)
{
iHead.ConfigStruct.PCBNumberString = pcbId;
log.Debug("ReadRequest_PCB() - iHead.ConfigStruct.PCBNumberString: " + iHead.ConfigStruct.PCBNumberString);
return connectResult;
}
return pcbId;
log.Debug($"ReadRequest_PCB() connect - {connectResult.Message}");
//Check if exist PCB
if (!bReload)
{
var gciSlotInfo = await head.CommInterfaceBridge.GetSlotAsync(head.GetSlotNr);
if (gciSlotInfo == null && gciSlotInfo.Success && string.IsNullOrEmpty(gciSlotInfo.PcbId))
{
log.Debug(
$"BuildConnection() - SlotNr: {head.GetSlotNr} already exist PCB: {gciSlotInfo.PcbId}");
return new ReadPcbResult
{
IsConnected = gciSlotInfo.IsConnected,
IsValidPcb = true,
PcbId = gciSlotInfo.PcbId,
Message = "PCB already exist."
};
}
}
// PCB READ LOOP
string validPcbId = null;
int maxAttempts = 5;
DateTime startTime = DateTime.UtcNow;
TimeSpan maxDuration = TimeSpan.FromSeconds(30);
//LOOP
for (int attempt = 1; attempt <= maxAttempts; attempt++)
{
if (DateTime.UtcNow - startTime > maxDuration)
{
log.Debug($"ReadRequest_PCB({head.GetSlotNr}) - PCB max duration exceeded");
break;
}
log.Debug($"ReadRequest_PCB({head.GetSlotNr}) - PCB attempt {attempt}/{maxAttempts}");
var pcbTask = head.CommInterfaceBridge.GetPcbIdAsync(head.GetSlotNr);
var timeoutTaskPcb = Task.Delay(TimeSpan.FromSeconds(5));
var completedTaskPcb = await Task.WhenAny(pcbTask, timeoutTaskPcb);
if (completedTaskPcb != pcbTask)
{
log.Debug($"ReadRequest_PCB() PCB attempt {attempt} - Timeout");
continue;
}
var resultPCB = await pcbTask;
// VALIDATION BLOCK
{
if (resultPCB == null)
{
log.Debug($"ReadRequest_PCB({head.GetSlotNr}) PCB attempt {attempt} - result is null");
continue;
}
if (!resultPCB.Success)
{
log.Debug($"ReadRequest_PCB({head.GetSlotNr}) PCB attempt {attempt} - Success=false");
continue;
}
string pcbId = resultPCB.PcbId;
if (string.IsNullOrWhiteSpace(pcbId))
{
log.Debug($"ReadRequest_PCB({head.GetSlotNr}) PCB attempt {attempt} - PCB empty");
continue;
}
pcbId = pcbId.Trim();
if (pcbId.Length != 9)
{
log.Debug( $"ReadRequest_PCB({head.GetSlotNr}) PCB attempt {attempt} - Invalid PCB length: '{pcbId}', len={pcbId.Length}");
continue;
}
validPcbId = pcbId;
log.Debug($"ReadRequest_PCB({head.GetSlotNr}) PCB valid: {validPcbId}");
break;
}
}
if (string.IsNullOrEmpty(validPcbId))
{
return new ReadPcbResult
{
IsConnected = connectResult.IsConnected,
IsValidPcb = false,
PcbId = null,
Message = "Valid PCB not found."
};
}
if (head.ConfigStruct != null)
{
head.ConfigStruct.PCBNumberString = validPcbId;
}
return new ReadPcbResult
{
IsConnected = connectResult.IsConnected,
IsValidPcb = true,
PcbId = validPcbId,
Message = "PCB OK"
};
}
log.Debug("ReadRequest_PCB() - pcbId is empty");
return null;
}
public ProtocolStatuses GetActivityStatusMode(GenesisSmartReader iHead)
{
if (iHead?.CommInterfaceBridge == null)
return ProtocolStatuses.Unknown;
var connectResult = iHead.CommInterfaceBridge
.ConnectAsync(iHead.GetSlotNr)
.GetAwaiter()
.GetResult();
if (connectResult == null || !connectResult.Success || !connectResult.IsConnected)
return ProtocolStatuses.Unknown;
var pcbResult = iHead.CommInterfaceBridge
.GetPcbIdAsync(iHead.GetSlotNr)
.GetAwaiter()
.GetResult();
if (pcbResult == null || !pcbResult.Success || string.IsNullOrWhiteSpace(pcbResult.PcbId))
return ProtocolStatuses.Unknown;
if (iHead.ConfigStruct != null)
catch (Exception ex)
{
iHead.ConfigStruct.PCBNumberString = pcbResult.PcbId;
}
log.Error("ReadRequest_PCBAsync() failed", ex);
return ProtocolStatuses.Active;
return new ReadPcbResult
{
IsConnected = false,
IsValidPcb = false,
PcbId = null,
Message = ex.Message
};
}
}
public DiagnosticLedState SetOptoStatusMode(GenesisSmartReader iHead, DiagnosticLedState opthoStatusMode)
public async Task<bool> PrepareLoginAdnConnect_Async(
GenesisSmartReader iHead,
bool isConnected,
CancellationToken token = default)
{
log.Debug("PrepareLoginAdnConnect_Async called for iHead: " + iHead + " isConnected: " + isConnected);
if (iHead?.CommInterfaceBridge == null)
return DiagnosticLedState.StatusUnknown;
return false;
var connectResult = iHead.CommInterfaceBridge
.ConnectAsync(iHead.GetSlotNr)
.GetAwaiter()
.GetResult();
if (connectResult == null || !connectResult.Success || !connectResult.IsConnected)
return DiagnosticLedState.StatusUnknown;
//SetDiagnosticLEDState
var pcbResult = iHead.CommInterfaceBridge
.GetPcbIdAsync(iHead.GetSlotNr)
.GetAwaiter()
.GetResult();
if (pcbResult == null || !pcbResult.Success || string.IsNullOrWhiteSpace(pcbResult.PcbId))
return DiagnosticLedState.StatusUnknown;
if (iHead.ConfigStruct != null)
try
{
iHead.ConfigStruct.PCBNumberString = pcbResult.PcbId;
}
token.ThrowIfCancellationRequested();
var connectResult = await EnsureConnectedAsync(iHead, token);
return DiagnosticLedState.StatusUnknown;
if (!connectResult.IsConnected)
return false;
log.Debug($"PrepareLoginAdnConnect_Async() connect - {connectResult.Message}");
if (connectResult.IsLoggedOn)
return true;
//get stored PCB - Keystone
log.Debug("Have we PCB stored?");
string pcb = iHead.ConfigStruct?.PCBNumberString;
if (string.IsNullOrWhiteSpace(pcb))
{
pcb = connectResult.PcbId;
if (string.IsNullOrWhiteSpace(pcb))
{
pcb = iHead.SerialNr;
}
//GET PCB FROM Meter
if (string.IsNullOrWhiteSpace(pcb))
{
log.Debug("PrepareLoginAdnConnect_Async() No PCB stored. Trying to get PCB from Meter");
var pcbResult = await ReadRequest_PCBAsync(iHead);
if (pcbResult.IsValidPcb)
{
pcb = pcbResult.PcbId;
iHead.SerialNr = pcb;
if (iHead.ConfigStruct != null)
{
iHead.ConfigStruct.PCBNumberString = pcb;
}
}
}
}
if (string.IsNullOrWhiteSpace(pcb))
{
log.Debug("PrepareLoginAdnConnect_Async() No PCB stored. MISSING PCB!!!!!");
return false;
}
log.Debug( $"PrepareLoginAdnConnect_Async() Start Find Keystone Slot: {iHead.GetSlotNr} PCB:{iHead.SerialNr} Calib PCB:{pcb} - find keystone");
var keyStoneResult = await FindKeyStone(pcb, token);
if (keyStoneResult == null || !keyStoneResult.Success)
return false;
//LOGIN
log.Debug( $"PrepareLoginAdnConnect_Async() Start Login Slot: {iHead.GetSlotNr} PCB:{iHead.SerialNr} Calib PCB:{pcb} - login");
GenesisCordonelInterface.API.PublicModels.GciLoginResult loginByPasswordAsync =
await LoginByPasswordAsync(iHead.GetSlotNr, keyStoneResult.Password, token);
if (loginByPasswordAsync == null || !loginByPasswordAsync.Success)
{
return false;
}
log.Debug($"PrepareLoginAdnConnect_Async() Login OK");
return true;
}
catch (OperationCanceledException)
{
log.Debug("PrepareLoginAdnConnect_Async() canceled.");
return false;
}
}
public static readonly String LedMode = "GENESISFLOW_LedMode";
public static readonly String SampleRate = "GENESISFLOW_SampleRate";
public static readonly String CalFactor1 = "GENESISFLOW_CalFactor1";
public static readonly String CalFactor2 = "GENESISFLOW_CalFactor2";
public static readonly String CalFactor3 = "GENESISFLOW_CalFactor3";
public static readonly String ResetAccumulators = "GENESISFLOW_ResetAccumulators";
public static readonly String ForwardArrow = "GENESISFLOW_ForwardArrow";
public static readonly String StoreCalibration = "GENESISFLOW_StoreCalibration";
public static readonly String TriggerIdle = "GENESISFLOW_TriggerIdle";
public static readonly String MeterSize = "GENESISFLOW_MeterSize";
public async Task<LedState> GetActivityLedStatusMode_Async(
GenesisSmartReader iHead,
bool isConnected,
CancellationToken token = default)
{
log.Debug("GetActivityLedStatusMode_Async called for iHead: " + iHead + " isConnected: " + isConnected);
if (iHead?.CommInterfaceBridge == null)
return LedState.Unknown;
try
{
var loginAdnConnectAsync = await PrepareLoginAdnConnect_Async(iHead, isConnected, token);
if (!loginAdnConnectAsync)
return LedState.Unknown;
//Get Activity Status
var registerReadResult =
await _bridge.ReadRegisterWithRetryAsync(iHead.GetSlotNr,LedMode, token);
if (registerReadResult == null || !registerReadResult.Success)
{
return LedState.Unknown;
}
log.Debug($"GetActivityStatusMode() Read Register OK Response: {registerReadResult}");
try
{
byte[] bytes = HexFormatter.HexStringToByteArray(registerReadResult.Result.RawHex);
//Convert byte array to int
if (bytes == null || bytes.Length < 4)
{
log.Debug("Invalid byte array length");
return LedState.Unknown;
}
int value = BitConverter.ToInt32(bytes, 0);
// continue your real status logic here...
return value == 6 ? LedState.active : LedState.inactive;
}catch(Exception ex)
{
log.Error("GetActivityStatusMode() failed", ex);
return LedState.Unknown;
}
}
catch (OperationCanceledException)
{
log.Debug("GetActivityLedStatusMode_Async() canceled.");
return LedState.Unknown;
}
catch (Exception ex)
{
log.Error("GetActivityLedStatusMode_Async() failed", ex);
return LedState.Unknown;
}
}
public async Task<bool> SetLedMode_Async(GenesisSmartReader iHead, LedState ledMode, bool isConnected,
CancellationToken token = default)
{
log.Debug("SetLedMode_Async called for iHead: " + iHead + " isConnected: " + isConnected);
if (iHead?.CommInterfaceBridge == null)
return false;
try
{
var loginAdnConnectAsync = await PrepareLoginAdnConnect_Async(iHead, isConnected, token);
if (!loginAdnConnectAsync)
return false;
//Get Activity Status
byte valueLed = (ledMode == LedState.active) ? (byte)6 : (byte)0;
log.Debug($"SetLedMode_Async() Set Led Mode: {valueLed}");
var registerWriteResult =
await _bridge.WriteRegisterAsync(iHead.GetSlotNr, LedMode, valueLed, false, false, token);
if (registerWriteResult == null || !registerWriteResult.Success)
{
return false;
}
log.Debug($"SetLedMode_Async() Write Register OK Response: {registerWriteResult}");
return true;
}
catch (OperationCanceledException)
{
log.Debug("GetActivityLedStatusMode_Async() canceled.");
return false;
}
catch (Exception ex)
{
log.Error("GetActivityLedStatusMode_Async() failed", ex);
return false;
}
finally
{
log.Debug("SetLedMode_Async() - End - DO DISCONNECT");
var gciDisconnectResult = await _bridge.DisconnectAsync(iHead.GetSlotNr);
log.Debug($"SetLedMode_Async() Disconnect Result: {gciDisconnectResult}");
}
}
public async Task<bool> Disconnect_Async(GenesisSmartReader iHead)
{
try
{
log.Debug("Disconnect_Async() - Start");
var gciSlotInfo = await _bridge.GetSlotAsync(iHead.GetSlotNr);
log.Debug($"Disconnect_Async() - Slot: {iHead.GetSlotNr} - SlotInfo: {gciSlotInfo}");
log.Debug("Disconnect_Async() - DO DISCONNECT");
var gciDisconnectResult = await _bridge.DisconnectAsync(iHead.GetSlotNr);
log.Debug($"Disconnect_Async() Disconnect Result: {gciDisconnectResult}");
return gciDisconnectResult.Success;
}catch(Exception ex)
{
log.Error("Disconnect_Async() failed", ex);
return false;
}
}
private static ushort SafeIntToUShort(int value)
{
if (value < ushort.MinValue || value > ushort.MaxValue)
@@ -179,7 +536,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
return (ushort)value;
}
public string GetVersion(GenesisSmartReader iHead)
{
if (iHead?.CommInterfaceBridge == null)
@@ -201,38 +558,50 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
// }
// return version;
// }
return string.Empty;
}
public bool SetActivityMode_Active(GenesisSmartReader iHead)
public async Task<bool> SetActivityMode_Active(GenesisSmartReader iHead,
bool isConnected, CancellationToken token = default)
{
log.Debug("SetActivityMode_Active called for iHead: " + iHead + " isConnected: " + isConnected);
if (iHead?.CommInterfaceBridge == null)
return false;
var connectResult = iHead.CommInterfaceBridge
.ConnectAsync(iHead.GetSlotNr)
.GetAwaiter()
.GetResult();
try
{
token.ThrowIfCancellationRequested();
if (connectResult == null || !connectResult.Success || !connectResult.IsConnected)
var connectResult = await EnsureConnectedAsync(iHead, token);
if (!connectResult.IsConnected)
return false;
isConnected = connectResult.IsConnected;
log.Debug($"SetActivityMode_Active() connect - {connectResult.Message}");
//Set LED to state 4
// string version = _bridge?.GciExternalInterface?.GetPcbId(iHead.GetSlotNr);
// if (!string.IsNullOrEmpty(version))
// {
// if (iHead.ConfigStruct != null) // store mechanism
// {
// iHead.ConfigStruct.Version = version;
// }
// return true;
// }
}catch(OperationCanceledException)
{
return false;
//Set LED to state 4
// string version = _bridge?.GciExternalInterface?.GetPcbId(iHead.GetSlotNr);
// if (!string.IsNullOrEmpty(version))
// {
// if (iHead.ConfigStruct != null) // store mechanism
// {
// iHead.ConfigStruct.Version = version;
// }
// return true;
// }
}
return false;
}
public bool SetActivityMode_Idle(GenesisSmartReader iHead)
{
if (iHead?.CommInterfaceBridge == null)
@@ -245,7 +614,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
if (connectResult == null || !connectResult.Success || !connectResult.IsConnected)
return false;
//Set Activity State Idle
// string version = _bridge?.GciExternalInterface?.GetPcbId(iHead.GetSlotNr);
// if (!string.IsNullOrEmpty(version))
@@ -256,10 +625,10 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
// }
// return true;
// }
return false;
}
public bool SetOptTestMode(GenesisSmartReader iHead)
{
if (iHead?.CommInterfaceBridge == null)
@@ -272,7 +641,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
if (connectResult == null || !connectResult.Success || !connectResult.IsConnected)
return false;
//Set LED to state 4
// string version = _bridge?.GciExternalInterface?.GetPcbId(iHead.GetSlotNr);
// if (!string.IsNullOrEmpty(version))
@@ -283,9 +652,8 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
// }
// return true;
// }
return false;
}
/// <summary>
@@ -316,7 +684,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
// }
// return true;
// }
return false;
}
@@ -342,7 +710,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
// }
// return version;
// }
return string.Empty;
}
}
@@ -0,0 +1,9 @@
namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication.common
{
public enum LedState : int
{
Unknown = -1,
inactive = 0,
active = 1,
}
}
@@ -16,11 +16,15 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
{
private static readonly ILog log = LogManager.GetLogger(typeof(GenesisSmartReader));
private static readonly ILog logStream = LogManager.GetLogger("StreamData");
Thread optoThread;
//GenesisSmartReader _genesiHead;
public GenesisSmartReader Head { get { return ISmartReader as GenesisSmartReader;} }
public GenesisSmartReader Head
{
get { return ISmartReader as GenesisSmartReader; }
}
public ISmartReader ISmartReader { get; set; }
public bool stopWorkerThread { get; set; }
@@ -36,13 +40,18 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
public void Destroy()
{
if(Head != null && Head.OptoHeadTest != null)
{
Head.OptoHeadTest.CloseConnection();
}
stopWorkerThread = true;
if (optoThread != null)
{
optoThread.Abort();
}
}
private const string StrReadPcbCmd = "ReadPCB";
private const string StrSetTestModeCmd = "SetTestMode";
private const string StrSetActiveModeCmd = "SetActiveMode";
@@ -55,33 +64,33 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
public enum Operations
{
[Description(StrReadPcbCmd)]ReadPcbCmd,
[Description(StrSetTestModeCmd)]SetTestModeCmd,
[Description(StrSetActiveModeCmd)]SetActiveModeCmd,
[Description(StrReadOptoDataCmd)]ReadOptoDataCmd,
[Description(StrStopReadOptoDataCmd)]StopReadOptoDataCmd,
[Description(StrResetNfcHeadCmd)]ResetNfcHeadCmd,
[Description(StrSetNfcHeadCmd)]SetNfcHeadCmd,
[Description(StrSetRfidHeadCmd)]SetRfidHeadCmd,
[Description(StrEmptyCmd)]EmptyCmd
[Description(StrReadPcbCmd)] ReadPcbCmd,
[Description(StrSetTestModeCmd)] SetTestModeCmd,
[Description(StrSetActiveModeCmd)] SetActiveModeCmd,
[Description(StrReadOptoDataCmd)] ReadOptoDataCmd,
[Description(StrStopReadOptoDataCmd)] StopReadOptoDataCmd,
[Description(StrResetNfcHeadCmd)] ResetNfcHeadCmd,
[Description(StrSetNfcHeadCmd)] SetNfcHeadCmd,
[Description(StrSetRfidHeadCmd)] SetRfidHeadCmd,
[Description(StrEmptyCmd)] EmptyCmd
}
private static readonly Dictionary<string, Operations> ItemsForIperlOperations = new Dictionary<string, Operations>
{
{"Read PCB", Operations.ReadPcbCmd},
{"Set Test Mode", Operations.SetTestModeCmd},
{"Set Active Mode", Operations.SetActiveModeCmd},
private static readonly Dictionary<string, Operations> ItemsForIperlOperations =
new Dictionary<string, Operations>
{
{ "Read PCB", Operations.ReadPcbCmd },
{ "Set Test Mode", Operations.SetTestModeCmd },
{ "Set Active Mode", Operations.SetActiveModeCmd },
#if TRUE
{"Start Read Opto Data", Operations.ReadOptoDataCmd},
{"Stop Read Opto Data", Operations.StopReadOptoDataCmd},
{ "Start Read Opto Data", Operations.ReadOptoDataCmd },
{ "Stop Read Opto Data", Operations.StopReadOptoDataCmd },
#endif
{" ", Operations.EmptyCmd},
{"Reset NFC Head", Operations.ResetNfcHeadCmd},
{"Set NFC Head Interface", Operations.SetNfcHeadCmd},
{"Set RFID Head interface", Operations.SetRfidHeadCmd}
};
{ " ", Operations.EmptyCmd },
{ "Reset NFC Head", Operations.ResetNfcHeadCmd },
{ "Set NFC Head Interface", Operations.SetNfcHeadCmd },
{ "Set RFID Head interface", Operations.SetRfidHeadCmd }
};
public (string Name, string Value)[] GetComboOperationsPairs()
{
@@ -94,16 +103,17 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
a.RfidOutputListBox.Items.Clear();
log.Debug($"CommandTestButtonClick called: {a?.RfidCommandComboBox?.SelectedValue}");
using (Tools.LogChecker logChecker = new Tools.LogChecker("RfidData", log4net.Core.Level.Debug))
{
ListItem rfidListItem = new ListItem();
rfidListItem.Attributes.Add("style", "font-weight:bold");
Operations selectedOperation;
if(!ItemsForIperlOperations.TryGetValue((string)a.RfidCommandComboBox.SelectedValue, out selectedOperation))
if (!ItemsForIperlOperations.TryGetValue((string)a.RfidCommandComboBox.SelectedValue,
out selectedOperation))
selectedOperation = Operations.EmptyCmd;
bool isTestModeSuccessful = false;
switch (selectedOperation)
switch (selectedOperation)
{
case Operations.ReadPcbCmd:
rfidListItem.Text = $"PCB: {Head.OptoHeadTest.ReadRequest_PCB()}";
@@ -121,7 +131,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
break;
case Operations.SetActiveModeCmd:
rfidListItem.Text = Head.OptoHeadTest.SetActiveMode( ref isTestModeSuccessful);
rfidListItem.Text = Head.OptoHeadTest.SetActiveMode(ref isTestModeSuccessful);
stopWorkerThread = true;
a.ISmartReader.StopDataStreamProcessing(); // close opto port
break;
@@ -215,6 +215,8 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
public int ChannelsCount { get => iChanelsCount; }
private static int iChanelsCount = 3;
private int firstChanel;
@@ -1338,16 +1340,6 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
void DataStreamPostProcessing()
{
PrepareCalculatedChannelData();
try
{
log.DebugFormat("DataStreamPostProcessing() - harcoded call GetQ3Calibration(200.0, 120.0, 15625.0);");
SetQ3Calibration(new double[]{15625.0,15625.0,15625.0 });
CalculateQ3Calibration(200.0, 120.0);
}
catch (Exception ex)
{
log.Error($"DataStreamPostProcessing -- Q3 CALIBRATION -- failed: {ex}");
}
}
/// <summary>
@@ -1881,7 +1873,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
_readLoopTask = Task.Run(() =>
{
log.Debug($"OPTHO {OptoComPortNr} background read loop started.");
logStream.Debug($"OPTHO {OptoComPortNr} background read loop started.");
while (!token.IsCancellationRequested)
{
@@ -1937,12 +1929,12 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
catch (Exception ex)
{
log.Error($"OPTHO {OptoComPortNr} background read error: {ex.Message}");
logStream.Error($"OPTHO {OptoComPortNr} background read error: {ex.Message}");
Thread.Sleep(100);
}
}
log.Debug($"OPTHO {OptoComPortNr} background read loop stopped.");
logStream.Debug($"OPTHO {OptoComPortNr} background read loop stopped.");
}, token);
}
@@ -2023,7 +2015,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
{
try
{
log.Debug($"OPTHO {OptoComPortNr} processing loop started.");
logStream.Debug($"OPTHO {OptoComPortNr} processing loop started.");
while (!token.IsCancellationRequested)
{
@@ -2053,14 +2045,14 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
if (blockCompleted)
{
log.Debug("Processing loop completed flow block detected.");
logStream.Debug("Processing loop completed flow block detected.");
if (resetSerialBuffersOnCompletedFlowBlock)
ResetDataBuffer();
}
}
catch (Exception ex)
{
log.Error($"Processing loop failed: {ex}");
logStream.Error($"Processing loop failed: {ex}");
}
continue;
@@ -2074,16 +2066,16 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
catch (Exception ex)
{
log.Error($"OPTHO {OptoComPortNr} processing loop error: {ex}");
logStream.Error($"OPTHO {OptoComPortNr} processing loop error: {ex}");
Thread.Sleep(50);
}
}
log.Debug($"OPTHO {OptoComPortNr} processing loop stopped.");
logStream.Debug($"OPTHO {OptoComPortNr} processing loop stopped.");
}
catch (Exception ex)
{
log.Error($"StartProcessingLoop fatal error: {ex}");
logStream.Error($"StartProcessingLoop fatal error: {ex}");
}
}, token);
}
@@ -2112,13 +2104,13 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
// 🔴 STEP 1: Check if we should start processing
if (startDataProcessing && optoState == DataStreamState.ProcessAndSave)
{
log.DebugFormat("Read Opto Data Line timestamp:{0} to process from queue: {1}",timestamp.ToString("HH:mm:ss.fff") , line);
logStream.DebugFormat("Read Opto Data Line timestamp:{0} to process from queue: {1}",timestamp.ToString("HH:mm:ss.fff") , line);
bool blockCompleted;
ProcessOptoLine(line, optoState, out blockCompleted);
if (blockCompleted)
{
log.Debug("ReadOptoData() completed flow block detected.");
logStream.Debug("ReadOptoData() completed flow block detected.");
if (resetSerialBuffersOnCompletedFlowBlock) // DO NOT call ResetDataBuffer() here
ResetDataBuffer();
}
@@ -2126,7 +2118,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
catch (Exception ex)
{
log.Error($"OPTHO {OptoComPortNr} processing queued line failed: {ex.Message}");
logStream.Error($"OPTHO {OptoComPortNr} processing queued line failed: {ex.Message}");
}
}
}
@@ -2142,7 +2134,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
var encoding = optoSerialPort?.Encoding ?? Encoding.ASCII;
byte[] bytes = encoding.GetBytes(line);
log.Debug("ComPort: " + OptoComPortNr + " OPTHO RX ← " + HexFormatter.ToSerialHex(bytes));
logStream.Debug("ComPort: " + OptoComPortNr + " OPTHO RX ← " + HexFormatter.ToSerialHex(bytes));
var streamingDecode = new StreamingDecoder(true);
streamingDecode.DecodeMsg(line);
@@ -2152,14 +2144,14 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
if (streamingDecode.DataFlowTest != null && streamingDecode.DataFlowTest.IsValid)
{
blockCompleted = HandleFlowMarker();
log.Debug("ComPort: " + OptoComPortNr + " Decoded Flow data: " + streamingDecode.DataFlowTest +
" OPTHO RX ← " + HexFormatter.ToSerialHex(bytes));
logStream.Debug("ComPort: " + OptoComPortNr + " Decoded Flow data: " + streamingDecode.DataFlowTest +
" OPTHO RX ← " + HexFormatter.ToSerialHex(bytes));
}
if (calibData != null && calibData.IsValid)
{
log.Debug("ComPort: " + OptoComPortNr + " Decoded Calib: " + calibData + " OPTHO RX ← " +
HexFormatter.ToSerialHex(bytes));
logStream.Debug("ComPort: " + OptoComPortNr + " Decoded Calib: " + calibData + " OPTHO RX ← " +
HexFormatter.ToSerialHex(bytes));
MarkCalibrationChannelSeen(calibData.Channel);
}
@@ -2179,7 +2171,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
if (optoData[bufferIx] == null)
{
log.ErrorFormat("{0}: optoData[{1}] was null, recreating.", Name, bufferIx);
logStream.ErrorFormat("{0}: optoData[{1}] was null, recreating.", Name, bufferIx);
optoData[bufferIx] = new OptoTelegramRaw();
}
@@ -2192,7 +2184,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
int iChanel = calibData.Channel - 1;
if (iChanel >= 0 && iChanel < iChanelsCount)
{
log.Debug(
logStream.Debug(
$"Before UpdateFromSmart ch={iChanel + 1}: " +
$"volumeRawExtLast={volumeRawExtLast[iChanel]}, " +
$"timestampExtLast={timestampExtLast[iChanel]}, " +
@@ -2260,7 +2252,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
var encoding = optoSerialPort?.Encoding ?? Encoding.ASCII;
byte[] bytes = encoding.GetBytes(line);
received = HexFormatter.ToSerialHex(bytes);
log.Debug("RX ← " + received);
logStream.Debug("RX ← " + received);
try
{
@@ -2269,19 +2261,19 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
CalibrationRecord data = _streamingDecode.DataCalib;
if (data != null && data.IsValid)
{
log.Info($"OPTHO {OptoComPortNr} DataCalib Parsed opto data: " + data + " RX ← " +
received);
logStream.Info($"OPTHO {OptoComPortNr} DataCalib Parsed opto data: " + data + " RX ← " +
received);
MarkCalibrationChannelSeen(data.Channel);
}
FlowTestRecord dataFlow = _streamingDecode.DataFlowTest;
if (dataFlow != null && dataFlow.IsValid)
{
log.Info($"OPTHO {OptoComPortNr} FLOW Parsed opto data: " + dataFlow + " RX ← " + received);
logStream.Info($"OPTHO {OptoComPortNr} FLOW Parsed opto data: " + dataFlow + " RX ← " + received);
if (HandleFlowMarker())
{
log.Debug("ReadOptoData() completed flow block detected.");
logStream.Debug("ReadOptoData() completed flow block detected.");
if (resetSerialBuffersOnCompletedFlowBlock)
ResetDataBuffer(); // no ResetDataBuffer() here
}
@@ -2290,7 +2282,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
catch (Exception ex)
{
log.Error($"OPTHO {OptoComPortNr} Read error: {ex.Message}");
logStream.Error($"OPTHO {OptoComPortNr} Read error: {ex.Message}");
}
// string line = optoSerialPort.ReadExisting();
@@ -2335,11 +2327,11 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
catch (TimeoutException)
{
log.Debug($"ReadOptoData() OPTHO {OptoComPortNr} timeout - continuing.");
logStream.Debug($"ReadOptoData() OPTHO {OptoComPortNr} timeout - continuing.");
}
catch (Exception ex)
{
log.Error($"ReadOptoData() OPTHO {OptoComPortNr} Read error: {ex.Message}");
logStream.Error($"ReadOptoData() OPTHO {OptoComPortNr} Read error: {ex.Message}");
}
}
@@ -2355,11 +2347,11 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
{
optoSerialPort.DiscardInBuffer();
optoSerialPort.DiscardOutBuffer();
log.Debug("-- Reaset Data Buffer --");
logStream.Debug("-- Reaset Data Buffer --");
return;
}
}
log.Debug("-- Reaset Data Buffer - no serial port --");
logStream.Debug("-- Reaset Data Buffer - no serial port --");
}
void ISmartReader.SetNfcInterface()
@@ -2385,17 +2377,17 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
byte[] bytes = optoSerialPort.Encoding.GetBytes(line);
string received = HexFormatter.ToSerialHex(bytes);
log.Debug("RX ← " + received);
logStream.Debug("RX ← " + received);
return line;
}
}
catch (TimeoutException)
{
log.Debug($"ReadOptoData() OPTHO {OptoComPortNr} ReadLine timeout (3s) - continuing.");
logStream.Debug($"ReadOptoData() OPTHO {OptoComPortNr} ReadLine timeout (3s) - continuing.");
}
catch (Exception ex)
{
log.Error($"ReadOptoData() OPTHO {OptoComPortNr} Read error: {ex.Message}");
logStream.Error($"ReadOptoData() OPTHO {OptoComPortNr} Read error: {ex.Message}");
}
return string.Empty;
@@ -2406,7 +2398,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
if (completedTask == readTask)
return await readTask;
log.Debug("ReadOptoData timeout after " + timeoutMs + " ms");
logStream.Debug("ReadOptoData timeout after " + timeoutMs + " ms");
return string.Empty;
}
@@ -2955,7 +2947,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
if (data == null || !data.IsValid)
continue;
log.Info($"OPTHO {OptoComPortNr} Parsed optho data:" + data);
logStream.Info($"OPTHO {OptoComPortNr} Parsed optho data:" + data);
int dch = data.Channel - 1;
if (dch >= 0 && dch < iChanelsCount)
@@ -2968,7 +2960,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
catch (Exception ex)
{
log.Warn($"Parsing DiagnosticLedState4Data: {ex.Message}");
logStream.Warn($"Parsing DiagnosticLedState4Data: {ex.Message}");
}
}
}
@@ -2979,7 +2971,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
log.Debug($"Try get End Volume! COM: {this.OptoComPortNr}, Volume: {volumeLtr}");
logStream.Debug($"Try get End Volume! COM: {this.OptoComPortNr}, Volume: {volumeLtr}");
if (optoSerialPort != null && optoSerialPort.IsOpen) CloseOptoSerialPort();
if (!Double.IsNaN(volumeLtr[channel0]))
@@ -2990,12 +2982,12 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
//Solve roll over
if (endWMState < beginWMState)
{
log.Debug($"Solve roll over! endWMState: {endWMState} < beginWMState: {beginWMState}");
logStream.Debug($"Solve roll over! endWMState: {endWMState} < beginWMState: {beginWMState}");
const double VOL_RANGE_LITERS = 16777216.0 * 0.00025; // 4,194.304 l
endWMState += VOL_RANGE_LITERS;
volumeLtr[channel0] = endWMState;
ReadPulses();
log.Debug(
logStream.Debug(
$"Solve roll over! Upgraded endWMState: {endWMState}, beginWMState: {beginWMState}");
}
}
@@ -3004,7 +2996,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
//}
log.Warn("Default NaN value returned! Data Opto stream reading failed!");
logStream.Warn("Default NaN value returned! Data Opto stream reading failed!");
return Double.NaN;
}).ConfigureAwait(false);
}
@@ -3014,14 +3006,14 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
{
if (ConfigStruct == null)
{
log.Debug("ConfigStruct is null - created new in ReadSerialNr()");
logStream.Debug("ConfigStruct is null - created new in ReadSerialNr()");
ConfigStruct = new ConfigStruct();
}
return await Task.Run(() =>
{
log.Debug($"Try get Start Volume! COM: {this.OptoComPortNr}");
logStream.Debug($"Try get Start Volume! COM: {this.OptoComPortNr}");
Start();
@@ -3042,7 +3034,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
StreamingDecoder _streamingDecode = new StreamingDecoder(true);
_streamingDecode.DecodeMsg(readOptoDataWithTimeout);
CalibrationRecord data = _streamingDecode.DataCalib;
log.Info($"OPTHO {OptoComPortNr} Parsed optho data:" + data);
logStream.Info($"OPTHO {OptoComPortNr} Parsed optho data:" + data);
if (data == null || !data.IsValid)
continue;
@@ -3058,7 +3050,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
catch (Exception ex)
{
log.Warn($"Parsing DiagnosticLedState4Data: {ex.Message}");
logStream.Warn($"Parsing DiagnosticLedState4Data: {ex.Message}");
}
}
}
@@ -3068,7 +3060,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
}
log.Debug($"Try get Start Volume! COM: {this.OptoComPortNr}, Volume: {volumeLtr0}");
logStream.Debug($"Try get Start Volume! COM: {this.OptoComPortNr}, Volume: {volumeLtr0}");
if (optoSerialPort != null && optoSerialPort.IsOpen) CloseOptoSerialPort();
if (!Double.IsNaN(volumeLtr0[ch]))
@@ -3079,7 +3071,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
//}
log.Warn("Default NaN value returned! Data Opto stream reading failed!");
logStream.Warn("Default NaN value returned! Data Opto stream reading failed!");
return Double.NaN;
}).ConfigureAwait(false);
}
@@ -3091,7 +3083,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
if (ConfigStruct == null)
{
log.Debug("ConfigStruct is null - created new in ReadSerialNr()");
logStream.Debug("ConfigStruct is null - created new in ReadSerialNr()");
ConfigStruct = new ConfigStruct();
}
@@ -3101,11 +3093,11 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
return await Task.Run(() =>
{
log.Debug($"Try get ReadSerialNr! COM: {this.RfidComPortNr}");
logStream.Debug($"Try get ReadSerialNr! COM: {this.RfidComPortNr}");
SerialNr = OptoHeadTest.ReadRequest_PCB();
if (string.IsNullOrEmpty(SerialNr))
{
log.Debug("ReadSerialNr successful");
logStream.Debug("ReadSerialNr successful");
}
//optoHeadTest.CloseConnection();
@@ -3890,7 +3882,8 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
_startupFlushActive = false;
log.WarnFormat(
"Startup flush finished. Ignored {0} incoming opto lines.",
"Startup flush finished. ({0}) Ignored {1} incoming opto lines.",
Name,
_startupFlushIgnoredLines);
}
}
@@ -3907,7 +3900,8 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
_startupFlushActive = false;
log.WarnFormat(
"Startup flush finished. Ignored {0} incoming opto lines. Window: {1:HH:mm:ss.fff} - {2:HH:mm:ss.fff}",
"Startup flush finished. ({0}) Ignored {1} incoming opto lines. Window: {2:HH:mm:ss.fff} - {3:HH:mm:ss.fff}",
Name,
_startupFlushIgnoredLines,
_startupFlushFirstIgnoredUtc,
_startupFlushLastIgnoredUtc);
@@ -3929,6 +3923,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
private double[] q3CalibInitial = {Double.NaN,Double.NaN,Double.NaN};
private bool[] isChQ3CalibValid = { false,false,false};
private double[] q3CalibCh = {Double.NaN,Double.NaN,Double.NaN};
private double[] q3DiffPercentageCalibCh = {Double.NaN,Double.NaN,Double.NaN};
public bool Q3CalibValid
@@ -3946,6 +3941,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
}
public double[] Q3CalibValue { get => q3CalibInitial; }
public double[] Q3CalibDiffPercentageValue { get => q3DiffPercentageCalibCh; }
public bool Q3Calib_Ch1Valid { get => isChQ3CalibValid[0]; }
public bool Q3Calib_Ch2Valid { get => isChQ3CalibValid[1]; }
@@ -3956,14 +3952,33 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
public int GetSlotNr { get => genesisHeadCfg?.SlotNr ?? -1; }
void SetQ3Calibration(double[] q3CalibInitial) { this.q3CalibInitial = q3CalibInitial; }
//TODO BUMI implement variable values for Q3Channel!
public void SetQ3Calibration(double[] q3CalibInitial) { this.q3CalibInitial = q3CalibInitial; }
public void CalculateQ3Calibration(double refVolume, double refTime)
private double refVolume = double.NaN;
private double refTime = double.NaN;
public double RefVolume { get => refVolume; set => refVolume = value; }
public double RefTime { get => refTime; set => refTime = value; }
public bool CalculateQ3Calibration()
{
GetQ3Calibration(refVolume, refTime, q3CalibInitial, ref isChQ3CalibValid, ref q3CalibCh);
if (Double.IsNaN(refVolume) || Double.IsNaN((refTime)))
{
log.Debug("RefVolume or RefTime is NaN");
return false;
}
CalculateQ3Calibration( refVolume, refTime);
return true;
}
public void GetQ3Calibration(double refVolume, double refTime, double[] initCalibFactor, ref bool[] isChQ3CalibValid, ref double[] q3CalibCh)
public void CalculateQ3Calibration(double refVolume, double refTime)
{
GetQ3Calibration(refVolume, refTime, q3CalibInitial, ref isChQ3CalibValid,ref q3DiffPercentageCalibCh, ref q3CalibCh);
}
public void GetQ3Calibration(double refVolume, double refTime, double[] initCalibFactor, ref bool[] isChQ3CalibValid, ref double[] calibDiffPercent, ref double[] q3CalibCh)
{
log.Debug("=== Q3 CALIBRATION START ===");
@@ -3982,8 +3997,8 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
return;
}
}
log.Debug($"Inputs: refVolume={refVolume}, refTime={refTime}, initCalibFactor={initCalibFactor}");
log.Debug($"Inputs: refVolume={refVolume}, refTime={refTime}, initCalibFactors={string.Join(",", initCalibFactor)}");
if (_rawStartEndByChannel == null)
{
@@ -4073,25 +4088,13 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.implementations
q3CalibCh[iChannel] = (refVolume / recalculatedDeltaVolume) * initCalibFactor[iChannel];
double diffPercent = Math.Abs((initCalibFactor[iChannel] - q3CalibCh[iChannel] ) / initCalibFactor[iChannel]) * 100.0;
isChQ3CalibValid[iChannel] = diffPercent <= 5.0;
isChQ3CalibValid[iChannel] = diffPercent <= 5.0 && diffPercent >= -5.0;
calibDiffPercent[iChannel] = diffPercent;
log.Debug($"Calculated Q3Calib Ch[{iChannel}] ={q3CalibCh[iChannel]} DiffPercent={diffPercent}% isValid[{isChQ3CalibValid[iChannel]}] IninitCalibFactor={initCalibFactor}");
}
log.Debug("=== Q3 CALIBRATION END ===");
}
void newPokus()
{
//TODO BUMI implement genesis communication
//volat z GCI Bridge
//vybere sa component - GCI bridge
// - rozhranie
// - database
}
}
}
@@ -290,6 +290,9 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
public void AddRunAndCaptureJsonAsync<T>(string fileName, string args) where T : new()
{
log.Debug($"CLI: {fileName}");
log.Debug($"ARGS: {args}");
ResetStartTime();
var cts = new CancellationTokenSource();
@@ -323,6 +326,12 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
try
{
log.Debug($"FileName = '{psi.FileName}'");
log.Debug($"Arguments = '{psi.Arguments}'");
log.Debug($"WorkingDirectory = '{psi.WorkingDirectory}'");
log.Debug($"Exists = {System.IO.File.Exists(psi.FileName)}");
process.Start();
var stdoutTask = process.StandardOutput.ReadToEndAsync();
@@ -17,7 +17,7 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
#if DEBUG
get { return Path.Combine("C:\\","TBF","Cli", CmdClientName);}
#else
get { return Path.Combine("..","Cli", CmdClientName);}
get { return Path.Combine("C:\\","TBF","Cli", CmdClientName);}
#endif
}
public string CmdClientName { get; set; } = "HalCli.exe";
@@ -37,7 +37,7 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI
MaxCommRetries = 4;
WaitTimeAfterFailure = 2200;
PassThroughWaitTime = 1500;
NrThreads = 2; /// 1, 2 or 4 threads
NrThreads = 10; /// 1, 2 or 4 threads / 10 threads for genesis
IperlCheckErrorsToStop = 10;
MciTimeoutMs = 4000; // ms, NFC interface
BaudRate = 57600; // NFC Interface
@@ -1,10 +1,9 @@
using Config.Resources;
using log4net;
using Sensus.iPerl.RfidCom.Helper;
using System;
using TBF.Rig.RegisterReaders.CommonRR;
using TBF.Rig.RegisterReaders.CommonRR.IPerl;
using TBF.Rig.TestMethods.iPerlCommunication;
using TBF.Rig.TestMethods.GenesisCommunication;
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication;
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication.common;
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication.implementations;

Some files were not shown because too many files have changed in this diff Show More