progress over omnis

This commit is contained in:
Stoyan Zlatev
2023-11-29 09:20:28 +01:00
parent 38486e0e5d
commit a3c59f9847
60 changed files with 7757 additions and 610 deletions
+133 -66
View File
@@ -183,7 +183,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmniPlus", "OmniPlus\OmniPl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmniPlus.UI", "OmniPlus.UI\OmniPlus.UI.csproj", "{6518211A-E83F-4171-97C4-A61FCF66D6E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignalRClient", "SignalRClient\SignalRClient.csproj", "{5C16DAC4-71E5-49B4-A087-36C704AADCF1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExchangeHub", "ExchangeHub\ExchangeHub.csproj", "{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmniFeaturesTest", "OmniFeaturesTest\OmniFeaturesTest.csproj", "{46657E9A-8885-4EBB-9300-6F9658AA0273}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -4251,70 +4253,134 @@ Global
{6518211A-E83F-4171-97C4-A61FCF66D6E0}.XP32bit|x64.Build.0 = Release|Any CPU
{6518211A-E83F-4171-97C4-A61FCF66D6E0}.XP32bit|x86.ActiveCfg = Release|Any CPU
{6518211A-E83F-4171-97C4-A61FCF66D6E0}.XP32bit|x86.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|Any CPU.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|Any CPU.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|Mixed Platforms.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|x64.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|x64.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|x86.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.COM|x86.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|x64.ActiveCfg = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|x64.Build.0 = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Debug|x86.Build.0 = Debug|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|Any CPU.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|x64.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|x64.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|x86.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.PerformTest|x86.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|Any CPU.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|x64.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|x64.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|x86.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.Release|x86.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|x64.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|x64.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|x86.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.ReleaseTest|x86.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|Any CPU.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|x64.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|x64.Build.0 = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|x86.ActiveCfg = Release|Any CPU
{5C16DAC4-71E5-49B4-A087-36C704AADCF1}.XP32bit|x86.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|Any CPU.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|Any CPU.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|Mixed Platforms.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|x64.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|x64.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|x86.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.COM|x86.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|x64.ActiveCfg = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|x64.Build.0 = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|x86.ActiveCfg = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Debug|x86.Build.0 = Debug|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|Any CPU.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|x64.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|x64.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|x86.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.PerformTest|x86.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|Any CPU.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|x64.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|x64.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|x86.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.Release|x86.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|x64.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|x64.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|x86.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.ReleaseTest|x86.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|Any CPU.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|x64.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|x64.Build.0 = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|x86.ActiveCfg = Release|Any CPU
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}.XP32bit|x86.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|Any CPU.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|Any CPU.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|Mixed Platforms.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|x64.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|x64.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|x86.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.COM|x86.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|x64.ActiveCfg = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|x64.Build.0 = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|x86.ActiveCfg = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Debug|x86.Build.0 = Debug|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|Any CPU.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|x64.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|x64.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|x86.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.PerformTest|x86.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|Any CPU.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|x64.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|x64.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|x86.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.Release|x86.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|x64.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|x64.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|x86.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.ReleaseTest|x86.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|Any CPU.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|x64.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|x64.Build.0 = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|x86.ActiveCfg = Release|Any CPU
{46657E9A-8885-4EBB-9300-6F9658AA0273}.XP32bit|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -4397,7 +4463,8 @@ Global
{F14940F8-3C86-4BB7-A915-B021E4B3052D} = {B4F8545B-F379-42A5-BDE9-763FD7B79598}
{F8D84B9A-0FCF-4083-B067-8C39B7314152} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{6518211A-E83F-4171-97C4-A61FCF66D6E0} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{5C16DAC4-71E5-49B4-A087-36C704AADCF1} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{46657E9A-8885-4EBB-9300-6F9658AA0273} = {68323534-4337-4E3A-89BC-11D8BB55343A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}
-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+14 -11
View File
@@ -8,10 +8,11 @@
<OutputType>Exe</OutputType>
<RootNamespace>CommonConsole</RootNamespace>
<AssemblyName>CommonConsole</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -33,8 +34,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<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>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -42,7 +44,6 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
@@ -50,10 +51,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="bin\Debug\CommonConsole.exe" />
<Content Include="bin\Debug\CommonConsole.pdb" />
<Content Include="bin\Debug\test.txt" />
<Content Include="temperature_calibrations_26_10_2023\193400032_aggregations.txt" />
<Content Include="temperature_calibrations_26_10_2023\193400032_backwards.txt" />
<Content Include="temperature_calibrations_26_10_2023\193400032_messurements.txt" />
@@ -63,10 +63,13 @@
<Content Include="temperature_calibrations_26_10_2023\temp.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SignalRClient\SignalRClient.csproj">
<Project>{5C16DAC4-71E5-49B4-A087-36C704AADCF1}</Project>
<Name>SignalRClient</Name>
<ProjectReference Include="..\ExchangeHub\ExchangeHub.csproj">
<Project>{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}</Project>
<Name>ExchangeHub</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="bin\Debug\CommonConsole.exe.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+47 -14
View File
@@ -1,29 +1,62 @@
using SignalRClient;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace CommonConsole
{
public class Program
{
static double value = 0.1;
static ExchangeHub exchangeI;
public static void Main()
{
exchangeI = new ExchangeHub();
exchangeI.ExchangeQ += q => Console.WriteLine(q);
exchangeI.Connect("http://localhost:52822/");
var aggregatedValues = new Dictionary<double, double[]>();
Console.WriteLine($"{nameof(ExchangeHub)} - connected: {exchangeI.Connected}");
while (Console.ReadKey().Key == ConsoleKey.Enter)
foreach (var line in File.ReadAllLines("test.txt"))
{
value += 0.1D;
exchangeI.SendExchangeQ(value);
if (string.IsNullOrWhiteSpace(line))
{
continue;
}
exchangeI.Dispose();
var tokens = line.Split(new[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (tokens.Length != 2)
{
continue;
}
if (!double.TryParse(tokens[0], out var temperature) || !double.TryParse(tokens[1], out var timeOfFlight))
{
continue;
}
if (temperature < 0 || temperature > 40 || timeOfFlight < 0 || timeOfFlight > 1)
{
continue;
}
if (!aggregatedValues.ContainsKey(temperature))
{
aggregatedValues[temperature] = new [] { double.MaxValue, double.MinValue };
}
var values = aggregatedValues[temperature];
if (values[0] > timeOfFlight)
{
values[0] = timeOfFlight;
}
if (values[1] < timeOfFlight)
{
values[1] = timeOfFlight;
}
}
File.WriteAllText("test.json", JsonConvert.SerializeObject(aggregatedValues
.Select(x => new double[] { x.Key, x.Value[0], x.Value[1] })
.ToArray(), Formatting.Indented));
}
}
}
@@ -0,0 +1,79 @@
using System;
using System.Runtime.InteropServices;
namespace ExchangeHub.Contracts
{
public interface IExchangeHubSlave
{
event VoidEventHandler Disposed;
event DoubleEventHandler StartQ;
event VoidEventHandler StopQ;
event VoidEventHandler StartRef;
event DoubleEventHandler StopRef;
}
[Guid("21EA6C57-A004-456E-8D99-7DCAD3481205")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IExchangeHubMaster : IExchangeHubSlave
{
bool Connect(string url);
void Dispose();
void NotifyStartQ(double value = double.MaxValue);
void NotifyStopQ();
void NotifyStartRef();
void NotifyStopRef(double value = double.MaxValue);
}
/// <summary>
/// Only for COM usage.
/// Exposes event handlers for the (VB6) master.
/// </summary>
[Guid("9FAA6100-E33F-46F7-9151-C85903472388")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IExchangeEvents
{
/// <summary>
/// VB6 should start given flow.
/// </summary>
void StartQ(double valueM3);
/// <summary>
/// VB6 should stop any flow.
/// </summary>
void StopQ();
/// <summary>
/// VB6 should start reference volume messuring.
/// </summary>
void StartRef();
/// <summary>
/// VB6 should stop reference volume messuring.
/// </summary>
void StopRef(double valueM3);
/// <summary>
/// VB6 should stop all running tasks.
/// </summary>
void Disposed();
}
/// <summary>
/// <para>Only for the SignalR host.</para>
/// <para>Exposes used events as methods.</para>
/// </summary>
public interface IExchangeHub : IExchangeEvents
{
}
public delegate void VoidEventHandler();
public delegate void DoubleEventHandler(double volumeM3);
}
+143
View File
@@ -0,0 +1,143 @@
using ExchangeHub.Contracts;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.AspNet.SignalR.Client;
namespace ExchangeHub
{
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IExchangeEvents))]
[Guid("2ABFAC6C-9F3C-4702-9E08-4979A26577EF")]
[ProgId("ExchangeHub.ExchangeConnection")]
public class ExchangeConnection : IExchangeHubMaster
{
public const string HUB_DIR = ".\\SignalRClient";
public const string HUB_NAME = "ExchangeHub";
private readonly ICollection<IDisposable> disposables;
private HubConnection connection;
private IHubProxy proxy;
public ExchangeConnection()
{
Directory.CreateDirectory(HUB_DIR);
this.disposables = new List<IDisposable>();
}
public event VoidEventHandler Disposed;
public event DoubleEventHandler StartQ;
public event VoidEventHandler StopQ;
public event VoidEventHandler StartRef;
public event DoubleEventHandler StopRef;
public bool Connect(string url)
{
this.connection = new HubConnection(url);
this.connection.Closed += this.Connection_Closed;
this.connection.ConnectionSlow += Connection_ConnectionSlow;
this.connection.Error += this.Connection_Error;
this.connection.Received += this.Connection_Received;
this.connection.Reconnected += this.Connection_Reconnected;
this.connection.Reconnecting += this.Connection_Reconnecting;
this.connection.StateChanged += this.Connection_StateChanged;
this.proxy = this.connection.CreateHubProxy(HUB_NAME);
this.disposables.Add(this.proxy.On(nameof(this.StopQ), () => this.StopQ?.Invoke()));
this.disposables.Add(this.proxy.On(nameof(this.Disposed), () => this.Disposed?.Invoke()));
this.disposables.Add(this.proxy.On(nameof(this.StartRef), () => this.StartRef?.Invoke()));
this.disposables.Add(this.proxy.On<double>(nameof(this.StartQ), volumeM3 => this.StartQ?.Invoke(volumeM3)));
this.disposables.Add(this.proxy.On<double>(nameof(this.StopRef), volumeM3 => this.StopRef?.Invoke(volumeM3)));
try
{
this.connection
.Start()
.Wait();
}
catch (Exception e)
{
this.FileAppendLine(e.ToString());
}
return this.connection.State == ConnectionState.Connected;
}
public void Dispose()
{
if (this.connection.State == ConnectionState.Connected)
{
this.proxy.Invoke(nameof(this.Disposed));
}
foreach (var disposable in this.disposables)
{
disposable?.Dispose();
}
this.connection.Stop();
}
public void NotifyStartQ(double value = double.MaxValue)
{
if (this.connection.State == ConnectionState.Connected)
{
this.proxy.Invoke(nameof(this.StartQ), value);
}
}
public void NotifyStartRef()
{
if (this.connection.State == ConnectionState.Connected)
{
this.proxy.Invoke(nameof(this.StartRef));
}
}
public void NotifyStopQ()
{
if (this.connection.State == ConnectionState.Connected)
{
this.proxy.Invoke(nameof(this.StopQ));
}
}
public void NotifyStopRef(double value = double.MaxValue)
{
if (this.connection.State == ConnectionState.Connected)
{
this.proxy.Invoke(nameof(this.StopRef), value);
}
}
private void Connection_Closed()
=> this.FileAppendLine("HubConnection closed!");
private void Connection_ConnectionSlow()
=> this.FileAppendLine("HubConnection is about to timeout!");
private void Connection_Error(Exception e)
=> this.FileAppendLine(e.ToString());
private void Connection_Received(string data)
=> this.FileAppendLine(data);
private void Connection_Reconnected()
=> this.FileAppendLine("HubConnection reconnected!");
private void Connection_Reconnecting()
=> this.FileAppendLine("HubConnection reconnecting!");
private void Connection_StateChanged(StateChange state)
=> this.FileAppendLine($"{state.OldState} -> {state.NewState}");
private void FileAppendLine(string text)
=> File.AppendAllText($"{HUB_DIR}\\{DateTime.Now:yyyy_MM_dd}.txt", $"[{DateTime.Now:HH:mm:ss}] {text}{Environment.NewLine}");
}
}
@@ -4,11 +4,11 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5C16DAC4-71E5-49B4-A087-36C704AADCF1}</ProjectGuid>
<ProjectGuid>{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SignalRClient</RootNamespace>
<AssemblyName>SignalRClient</AssemblyName>
<RootNamespace>ExchangeHub</RootNamespace>
<AssemblyName>ExchangeHub</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
@@ -34,8 +34,8 @@
<Reference Include="Microsoft.AspNet.SignalR.Client, Version=2.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.SignalR.Client.2.4.3\lib\net40\Microsoft.AspNet.SignalR.Client.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\net40\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -47,17 +47,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Contracts\IExchangeHub.cs" />
<Compile Include="ExchangeHub.cs" />
<Compile Include="ExchangeConnection.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetFileName) C:\Temp
copy Newtonsoft.Json.dll C:\Temp
copy Microsoft.AspNet.SignalR.Client.dll C:\Temp</PostBuildEvent>
</PropertyGroup>
</Project>
@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SignalRClient")]
[assembly: AssemblyTitle("ExchangeHub")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SignalRClient")]
[assembly: AssemblyProduct("ExchangeHub")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5c16dac4-71e5-49b4-a087-36c704aadcf1")]
[assembly: Guid("6033ff0c-cf32-4bc5-8efe-4774ccdc663d")]
// Version information for an assembly consists of the following four values:
//
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.SignalR.Client" version="2.4.3" targetFramework="net40" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net40" />
</packages>
+111
View File
@@ -0,0 +1,111 @@
using System;
using System.IO;
using System.IO.Ports;
using System.Threading;
namespace OmniFeaturesTest
{
internal class Connection
{
private readonly SerialPort serialPort;
private readonly Thread readingThread;
private Stream readingStream;
public Connection(string portNr)
{
this.serialPort = new SerialPort(portNr)
{
BaudRate = 112500,
Parity = Parity.None,
StopBits = StopBits.One,
DataBits = 8,
};
this.readingThread = new Thread(this.ConnectionBeginRead);
}
public Action<byte[]> ResponseReceived;
public void Close()
{
try
{
this.readingThread?.Abort();
this.readingStream?.Close();
this.serialPort?.Close();
Console.WriteLine("serial port disconnected.");
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
public void Open()
{
this.serialPort.Open();
if (this.serialPort.IsOpen)
{
this.readingStream = this.serialPort.BaseStream;
this.readingThread.Start();
Console.WriteLine("serial port connected.");
}
else
{
this.Close();
}
}
public void Send(params byte[] command)
{
if (this.serialPort.IsOpen)
{
lock (this.serialPort)
{
this.serialPort.Write(command, 0, command.Length);
}
}
}
private void ConnectionBeginRead()
{
const int length = 128;
byte[] buffer = new byte[length];
AsyncCallback asyncResultCallback = _asyncResult =>
{
if (_asyncResult.AsyncState is Stream _readingStream)
{
try
{
var bytesReaded = _readingStream.EndRead(_asyncResult);
if (bytesReaded > 0)
{
var data = new byte[bytesReaded];
Buffer.BlockCopy(buffer, 0, data, 0, bytesReaded);
this.ResponseReceived?.Invoke(data);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
};
while (this.readingStream.CanRead)
{
this.readingStream
.BeginRead(buffer, 0, length, asyncResultCallback, this.readingStream)
.AsyncWaitHandle
.WaitOne();
}
}
}
}
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{46657E9A-8885-4EBB-9300-6F9658AA0273}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>OmniFeaturesTest</RootNamespace>
<AssemblyName>OmniFeaturesTest</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Connection.cs" />
<Compile Include="OmniPlusExtensions.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,415 @@
using System;
using System.Data.SqlClient;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace OmniFeaturesTest
{
internal static class OmniPlusExtensions
{
public const int BYTE_BITS = 8;
public const byte OxOO = 0x00;
public const byte OxO1 = 0x01;
public const byte OxO2 = 0x02;
public const byte OxO3 = 0x03;
public const byte UNIPRO_START = 0x53;
public const byte UNIPRO_PC2REG = 0x57;
public const byte UNIPRO_REG2PC = 0x52;
public const byte UNIPRO_STOP = 0x0D;
public const byte UNIPRO_MIN_LENGTH = 4;
public const byte UI1236_START = 0x0D;
public const byte UI1236_MIN_LENGTH = 5;
public const byte UI1236_HED_LENGTH = 3;
public const byte IRDA_START = 0x9B;
public const byte IRDA_PC2REG = 0x33;
public const byte IRDA_REG2PC = 0x43;
public const byte IRDA_MIN_LENGTH = 5;
public const byte IRDA_CRC_LENGTH = 2;
/// <summary>
/// <para>UI1236 structure:</para>
/// <para> 0. 0x0D - Start byte</para>
/// <para> 1. .... - Length: max. 254</para>
/// <para> 2. .... - Control byte</para>
/// <para>3+n. .... - Payload</para>
/// <para>n-2. .... - Checksum 0 </para>
/// <para>n-1. .... - Checksum 1 </para>
/// </summary>
public static byte[] ToUI1236Message(this byte[] bytes)
{
var bytesLength = bytes.Length;
var payloadLength = bytes.Length + UI1236_MIN_LENGTH;
payloadLength += payloadLength % OxO2;
var index = OxOO;
var message = new byte[payloadLength];
message[index++] = UI1236_START;
message[index++] = (byte)(bytesLength + UI1236_HED_LENGTH);
message[index++] = 0x08;
bytes.CopyTo(message, index);
var checksum = message.CalculateCheckSUM(message.Length - OxO2);
var checksumIndex = bytesLength + UI1236_HED_LENGTH;
message[checksumIndex++] = checksum[OxO1];
message[checksumIndex++] = checksum[OxOO];
return message;
}
/// <summary>
/// <para>UI1236 structure:</para>
/// <para> 0. 0x0D - Start byte</para>
/// <para> 1. .... - Length: max. 254</para>
/// <para> 2. .... - Control byte</para>
/// <para>3+n. .... - Payload</para>
/// <para>n-2. .... - Checksum 0 </para>
/// <para>n-1. .... - Checksum 1 </para>
/// </summary>
public static byte[] FromUI1236Message(this byte[] bytes)
{
var payload = new byte[OxOO];
if (bytes is null)
{
return payload;
}
var payloadLength = bytes.Length - UI1236_MIN_LENGTH;
if (payloadLength <= OxOO)
{
return payload;
}
payload = new byte[payloadLength];
Array.Copy(bytes, OxO3, payload, OxOO, payloadLength);
return payload;
}
/// <summary>
/// <para>UniPro structure:</para>
/// <para> 0. .... - Start byte</para>
/// <para> 1. .... - Direction</para>
/// <para> 2. .... - Length</para>
/// <para> .. .... - Payload</para>
/// <para>n-1. .... - Stop byte</para>
/// </summary>
public static byte[] ToUniProMessage(this byte[] bytes)
{
var messageLength = (byte)(bytes.Length + UNIPRO_MIN_LENGTH);
var message = new byte[messageLength];
var index = OxOO;
message[index++] = UNIPRO_START;
message[index++] = UNIPRO_PC2REG;
message[index++] = messageLength;
message[messageLength - OxO1] = UNIPRO_STOP;
bytes.CopyTo(message, index);
return message;
}
/// <summary>
/// <para>UniPro structure:</para>
/// <para> 0. .... - Start byte</para>
/// <para> 1. .... - Direction</para>
/// <para> 2. .... - Length</para>
/// <para> .. .... - Payload</para>
/// <para>n-1. .... - Stop byte</para>
/// </summary>
public static byte[] FromUniProMessage(this byte[] bytes)
{
var payload = new byte[OxOO];
if (bytes is null)
{
return payload;
}
var payloadLength = bytes.Length - UNIPRO_MIN_LENGTH;
if (payloadLength <= OxOO)
{
return payload;
}
payload = new byte[payloadLength];
Array.Copy(bytes, OxO3, payload, OxOO, payloadLength);
return payload;
}
/// <summary>
/// <para>Irda structure:</para>
/// <para> 0. .... - Start byte</para>
/// <para> 1. .... - Direction</para>
/// <para> 2. .... - Length / 2</para>
/// <para>3+n. .... - Payload</para>
/// <para>n-3. .... - aligned byte</para>
/// <para>n-2. .... - CRC16 0 </para>
/// <para>n-1. .... - CRC16 1 </para>
/// </summary>
public static byte[] ToIrdaMessage(this byte[] bytes)
{
var payloadLength = bytes.Length;
payloadLength += payloadLength % OxO2;
var index = OxOO;
var message = new byte[payloadLength + IRDA_MIN_LENGTH];
message[index++] = IRDA_START;
message[index++] = IRDA_PC2REG;
message[index++] = (byte)(payloadLength / OxO2);
bytes.CopyTo(message, index);
var messageLength = message.Length;
var crc16 = message.CalculateCRC8408(1, messageLength - IRDA_CRC_LENGTH);
message[messageLength - OxO2] = crc16[OxOO];
message[messageLength - OxO1] = crc16[OxO1];
return message;
}
/// <summary>
/// <para>Irda structure:</para>
/// <para> 0. .... - Start byte</para>
/// <para> 1. .... - Direction</para>
/// <para> 2. .... - Length / 2</para>
/// <para>3+n. .... - Payload</para>
/// <para>n-3. .... - aligned byte</para>
/// <para>n-2. .... - CRC16 0 </para>
/// <para>n-1. .... - CRC16 1 </para>
/// </summary>
public static byte[] FromIrdaMessage(this byte[] bytes)
{
var payload = new byte[OxOO];
if (bytes is null)
{
return payload;
}
var payloadLength = bytes.Length - IRDA_MIN_LENGTH;
if (payloadLength <= OxOO)
{
return payload;
}
payload = new byte[payloadLength];
Array.Copy(bytes, OxO3, payload, OxOO, payloadLength);
return payload;
}
public static byte[] CalculateCRC8408(this byte[] message, int start, int length)
{
var crc = 0xFFFF;
for (int x = start; x < length; x++)
{
crc ^= 0x00FF & message[x];
for (int i = 8; i > OxOO; i--)
{
if ((crc & 0x0001) != OxOO)
{
crc = (crc >> OxO1) ^ 0x8408;
}
else
{
crc >>= OxO1;
}
}
}
crc = ~crc;
return BitConverter.GetBytes(crc);
}
public static byte[] CalculateCheckSUM(this byte[] bytes, int length)
{
ushort checksum = OxOO;
for (int i = OxOO; i < length; i++)
{
checksum += bytes[i];
}
return BitConverter.GetBytes(checksum);
}
public static void Clear(this byte[] bytes)
{
var length = bytes.Length;
for (int i = OxOO; i < length; i++)
{
bytes[i] = OxOO;
}
}
public static string ToASCIIString(this byte[] bytes, int start, int length)
{
var asciiString = string.Empty;
while (start >= 0 && start < bytes.Length)
{
asciiString += (char)bytes[start++];
}
return asciiString;
}
public static void ContinueWhenAll(this Task[] tasks)
=> Task.Factory
.ContinueWhenAll(tasks, _ => { })
.Wait();
public static void OpenConnection(this SqlConnection sqlConnection)
{
sqlConnection.FireInfoMessageEventOnUserErrors = true;
sqlConnection.InfoMessage += SqlConnection_InfoMessage;
sqlConnection.Open();
}
private static void SqlConnection_InfoMessage(object _, SqlInfoMessageEventArgs args)
{
Console.WriteLine(args.Message);
}
public static T GetValue<T>(this SqlDataReader reader, int field)
{
if (!reader.IsDBNull(field) && reader.GetValue(field) is T value)
{
return value;
}
return default(T);
}
public static double MlPerRotation(byte intPart, ushort fraction, short correctionFactor)
=> (intPart + (double)fraction / ushort.MaxValue) * correctionFactor;
public static double GPM2M3H(double value)
=> value * 3785.411784 / 1000 / 1000 * 60;
public static double GetCorrectionFactor(this double[] points)
{
var min = points[0];
var mid = points[1];
var max = points[2];
if (Math.Abs(mid - max) <= 3 && Math.Max(mid, max) - min <= 6.5)
{
var avgMidMax = (mid + max) / 2;
if (100 - avgMidMax + min < 95)
{
return 95 - min;
}
else
{
return 100 - avgMidMax;
}
}
return double.MaxValue;
}
public static byte[] GetBits(this byte value)
{
var bits = new byte[BYTE_BITS];
for (byte i = 0; i < BYTE_BITS; i++)
{
bits[i] = (byte)(value >> i & 1);
}
return bits;
}
public static byte[] GetBits(this byte[] bytes)
{
var bytesL = bytes.Length;
var bitsL = bytesL * BYTE_BITS;
var bits = new byte[bitsL];
for (int i = 0; i < bytesL; i++)
{
for (int b = 0; b < BYTE_BITS; b++)
{
bits[i + b] = (byte)(bytes[i] >> b & 1);
}
}
return bytes;
}
public static byte ToUint8(this byte[] bits)
{
var sum = default(byte);
for (byte i = 0; i < bits.Length; i++)
{
sum ^= (byte)(bits[i] << i);
}
return sum;
}
public static byte GetUint8(this byte x, int start, int length)
{
var src = x.GetBits();
var dst = new byte[8];
Array.Copy(src, start, dst, 0, length);
return dst.ToUint8();
}
public static void SetUint8(this ref byte x, int start, int length, byte value)
{
var src = value.GetBits();
var dst = x.GetBits();
Array.Copy(src, 0, dst, start, length);
x = dst.ToUint8();
}
public static byte[] Subarray(this byte[] bytes, int start, int length)
{
var subarray = new byte[length];
Array.Copy(bytes, start, subarray, 0, length);
return subarray;
}
public static byte[] Reverse(this byte[] bytes)
{
var length = bytes.Length / 2;
for (int i = 0; i < length; i++)
{
var last = length - i - 1;
var first = bytes[i];
bytes[i] = bytes[last];
bytes[last] = first;
}
return bytes;
}
}
}
+87
View File
@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace OmniFeaturesTest
{
class Program
{
static readonly Connection connection = new Connection("COM26");
static void Main(string[] args)
{
connection.Open();
var factoryIDBytes = SendAndWaitResponse(0x01);
Console.WriteLine(Encoding.UTF8.GetString(factoryIDBytes));
var x = new byte[14];
x[0] = 0x02;
Encoding
.ASCII
.GetBytes("816232411982")
.CopyTo(x, 1);
var response = SendAndWaitResponse(x);
factoryIDBytes = SendAndWaitResponse(0x01);
Console.WriteLine(Encoding.UTF8.GetString(factoryIDBytes));
if (Console.ReadKey().Key == ConsoleKey.Enter)
{
connection.Close();
}
}
private static byte[] SendAndWaitResponse(params byte[] request)
{
var response = new byte[1];
var received = false;
if (request?.Length <= 0)
{
return response;
}
void receiveResponse(byte[] data)
{
response = data
.FromIrdaMessage()
.FromUI1236Message();
if (response?.Length > 0 && response[0] > 0)
{
Console.WriteLine("RX: " + BitConverter.ToString(response));
connection.ResponseReceived -= receiveResponse;
received = true;
}
}
connection.ResponseReceived += receiveResponse;
Console.WriteLine("TX: " + BitConverter.ToString(request));
request = request
.ToUI1236Message()
.ToIrdaMessage();
connection.Send(1, 1, 1, 1);
Thread.Sleep(1);
connection.Send(request);
while (!received)
{
Thread.Sleep(1000);
}
connection.ResponseReceived -= receiveResponse;
return response;
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OmniFeaturesTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OmniFeaturesTest")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("46657e9a-8885-4ebb-9300-6f9658aa0273")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+9 -9
View File
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="COMS" value="COM4, COM, COM, COM, COM, COM, COM, COM"/>
<add key="OMNIDB" value="Server=SLASQL01.emea.sensus.net; Database=AuftragKopie; User ID=sa; Password=sqlserver;"/>
<add key="SIGNALR" value="http://localhost:52822/"/>
<add key="COMS" value="COM26" />
<add key="OMNIDB" value="Server=SLASQL01.emea.sensus.net; Database=AuftragKopie; User ID=sa; Password=sqlserver;" />
<add key="SIGNALR" value="http://localhost:52822/" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0"/>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
+6 -1
View File
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>OmniPlus.UI</RootNamespace>
<AssemblyName>OmniPlus.UI</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
@@ -36,6 +36,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
@@ -70,6 +73,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -89,5 +93,6 @@
<Name>OmniPlus</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+13 -1
View File
@@ -26,11 +26,13 @@ namespace OmniPlus.UI
{
this.connectionsPool.Dispose();
this.connectionsPool.Done -= this.ConnectionsPool_Done;
this.connectionsPool.StateChanged -= this.ConnectionsPool_StateChanged;
}
private void OmniPlusUI_HandleCreated(object _, EventArgs _1)
{
this.connectionsPool.Done += this.ConnectionsPool_Done;
this.connectionsPool.StateChanged += this.ConnectionsPool_StateChanged;
this.InitializeBody();
@@ -43,6 +45,15 @@ namespace OmniPlus.UI
this.connectionsPool.InitializeInspection(portNames);
}
private void ConnectionsPool_Done()
{
this.Invoke(new Action(() =>
{
this.Cursor = Cursors.Default;
this.pruefungStartBTN.Enabled = true;
}));
}
private void CancelBTN_Click(Object sender, EventArgs e)
{
this.Invoke(new Action(() =>
@@ -69,6 +80,7 @@ namespace OmniPlus.UI
this.pruefungStartBTN.Enabled = false;
}));
this.ClearBody();
this.connectionsPool.StartInspection();
this.Invoke(new Action(() =>
@@ -241,7 +253,7 @@ namespace OmniPlus.UI
var cols = this.body.ColumnCount;
var controls = this.body.Controls;
for (int row = 1; row < rows; row++)
for (int row = 2; row < rows; row++)
{
var offset = Math.Max(row - 1, 1) * cols;
+24 -1
View File
@@ -1,4 +1,6 @@
using System;
using OmniPlus.Features;
using System;
using System.Windows.Forms;
namespace OmniPlus.UI
@@ -8,6 +10,27 @@ namespace OmniPlus.UI
[STAThread]
public static void Main()
{
//var connection = new OmniPlusConnection("COM26");
//if (connection.ConnectIrda())
//{
// var factorySeal = connection.ViewFactorySeal();
// var response = default(FeatureResponse);
// if (!factorySeal.Sealed)
// {
// var _programmableID = connection.ViewProgrammableID();
// var programmableID = new ProgrammableID("816232411982");
// response = connection.Set(programmableID);
// var _factoryID = connection.ViewFactoryID();
// var factoryID = new FactoryID("816232411982");
// response = connection.Set(factoryID);
// }
//}
//connection.Disconnect();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new OmniPlusUI());
+8 -5
View File
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@@ -109,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net481" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" />
</packages>
+14 -5
View File
@@ -26,7 +26,7 @@ namespace OmniPlus
var response = new byte[0];
var received = false;
if (command is null)
if (command?.Length <= 0)
{
return response;
}
@@ -36,22 +36,31 @@ namespace OmniPlus
response = bytes
.FromIrdaMessage()
.FromUI1236Message();
received = true;
this.InvokeLogMessage($"RX: {BitConverter.ToString(response)}");
received = response.Length > 0 && response[0] > 0;
if (received)
{
this.MessageReceived -= MessageReceivedHandler;
}
}
this.MessageReceived += MessageReceivedHandler;
this.Write(1, 1, 1, 1);
var request = command
.ToUI1236Message()
.ToIrdaMessage();
var sleep = 5000;
var delay = 500;
this.Write(1, 1, 1, 1);
Thread.Sleep(1);
this.Write(request);
this.InvokeLogMessage($"TX: {BitConverter.ToString(command)}");
while (!received && sleep >= 0)
while (!received /*&& sleep >= 0*/)
{
sleep -= delay;
@@ -5,6 +5,7 @@ using OmniPlus.Options;
using System;
using System.IO;
using System.IO.Ports;
using System.Threading;
namespace OmniPlus
{
@@ -16,6 +17,7 @@ namespace OmniPlus
private SerialPort serialPort;
private SerialPortState state;
private Thread readingThread;
protected SerialPortConnection()
=> this.Options = new SerialPortOptions();
@@ -26,11 +28,20 @@ namespace OmniPlus
public virtual void Close()
{
try
{
this.readingThread?.Abort();
}
catch (Exception e)
{
this.LogMessage?.Invoke(e.ToString());
}
try
{
if (this.serialPort != null)
{
this.serialPort.DataReceived -= this.SerialPort_DataReceived;
// this.serialPort.DataReceived -= this.SerialPort_DataReceived;
this.serialPort.Disposed -= this.SerialPort_Disposed;
this.serialPort.ErrorReceived -= this.SerialPort_ErrorReceived;
this.serialPort.PinChanged -= this.SerialPort_PinChanged;
@@ -42,6 +53,7 @@ namespace OmniPlus
catch (Exception e)
{
this.StateChanged?.Invoke(SerialPortState.ErrorReceived, e.ToString());
this.LogMessage?.Invoke(e.ToString());
}
this.serialPort = null;
@@ -64,9 +76,9 @@ namespace OmniPlus
{
foreach (var @delegate in this.StateChanged.GetInvocationList())
{
if (@delegate is LogMessageEventHandler eventHandler)
if (@delegate is StateChangedEventHandler eventHandler)
{
this.LogMessage -= eventHandler;
this.StateChanged -= eventHandler;
}
}
}
@@ -75,9 +87,9 @@ namespace OmniPlus
{
foreach (var @delegate in this.DataReceived.GetInvocationList())
{
if (@delegate is LogMessageEventHandler eventHandler)
if (@delegate is DataReceivedHandler eventHandler)
{
this.LogMessage -= eventHandler;
this.DataReceived -= eventHandler;
}
}
}
@@ -101,6 +113,7 @@ namespace OmniPlus
this.state = SerialPortState.ErrorReceived;
this.StateChanged?.Invoke(this.state, $"{this.Options.PortName}: {e}");
this.LogMessage?.Invoke(e.ToString());
}
try
@@ -116,7 +129,7 @@ namespace OmniPlus
DtrEnable = this.Options.DtrEnabled
};
this.serialPort.DataReceived += this.SerialPort_DataReceived;
// this.serialPort.DataReceived += this.SerialPort_DataReceived;
this.serialPort.Disposed += this.SerialPort_Disposed;
this.serialPort.ErrorReceived += this.SerialPort_ErrorReceived;
this.serialPort.PinChanged += this.SerialPort_PinChanged;
@@ -133,34 +146,106 @@ namespace OmniPlus
+ $", {this.Options.DataBits}"
+ $", {this.Options.Parity}"
+ $", {this.Options.StopBits}");
if (this.serialPort.IsOpen)
{
this.readingThread = new Thread(this.SerialPortConnectionBeginRead);
this.readingThread.Start(this.serialPort.BaseStream);
}
}
catch (Exception e)
{
this.state = SerialPortState.ErrorReceived;
this.StateChanged?.Invoke(this.state, $"{this.Options.PortName}: {e}");
this.LogMessage?.Invoke(e.ToString());
this.Close();
}
}
protected void InvokeLogMessage(string message)
=> this.LogMessage?.Invoke(message);
protected void Write(params byte[] message)
{
if (this.Connected && message.Length > 0)
{
lock (this.serialPort)
{
this.serialPort.Write(message, 0, message.Length);
}
this.LogMessage?.Invoke($"TX: {BitConverter.ToString(message)}");
}
}
protected abstract void SerialPortConnection_DataReceived(byte[] bytes);
private void SerialPortConnectionBeginRead(object parameter)
{
if (parameter is Stream stream && stream.CanRead)
{
byte[] data;
byte[] buffer = new byte[128];
AsyncCallback endReadHandler = _asyncResult =>
{
try
{
if (_asyncResult.AsyncState is Stream _stream)
{
var bytesReaded = _stream.EndRead(_asyncResult);
if (bytesReaded > 0)
{
data = new byte[bytesReaded];
Array.Copy(buffer, 0, data, 0, bytesReaded);
this.DataReceived?.Invoke(buffer);
}
}
}
catch (Exception e)
{
this.LogMessage?.Invoke(e.ToString());
}
};
while (stream.CanRead)
{
stream
.BeginRead(buffer, 0, buffer.Length, endReadHandler, stream)
.AsyncWaitHandle
.WaitOne();
}
}
this.Close();
}
protected void SerialPortConnection_LogMessage(string message)
=> File.AppendAllText(this.Options.LogFile, $"{message}{Environment.NewLine}");
{
try
{
File.AppendAllText(this.Options.LogFile, $"{message}{Environment.NewLine}");
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
protected void SerialPortConnection_StateChanged(SerialPortState state, string message)
=> File.AppendAllText(this.Options.LogFile, $"[{state}] {message}{Environment.NewLine}");
{
try
{
File.AppendAllText(this.Options.LogFile, $"[{state}] {message}{Environment.NewLine}");
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
private void SerialPort_PinChanged(object sender, SerialPinChangedEventArgs args)
{
@@ -189,21 +274,21 @@ namespace OmniPlus
this.Close();
}
private void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs args)
{
if (this.Connected && sender is SerialPort port && port.BytesToRead > 0)
{
var bytes = new byte[port.BytesToRead];
var lock_object = new object();
/// <summary>
/// TODO: investigate the usage of port.Read... (may be its wrong)
/// New approach implemented whit the base stream. See above!
/// </summary>
//private void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs args)
//{
// if (this.Connected && sender is SerialPort port)
// {
// var bytes = new byte[port.BytesToRead];
lock (lock_object)
{
port.Read(bytes, 0, port.BytesToRead);
}
// port.Read(bytes, 0, port.BytesToRead);
this.DataReceived?.Invoke(bytes);
this.LogMessage?.Invoke($"RX: {BitConverter.ToString(bytes)}");
}
}
// this.DataReceived?.Invoke(bytes);
// this.LogMessage?.Invoke($"RX: {BitConverter.ToString(bytes)}");
// }
//}
}
}
@@ -40,8 +40,8 @@ namespace OmniPlus
this.MessageReceived += MessageReceivedHandler;
var request = command.ToUniProMessage();
var sleep = 5000;
var delay = 500;
var sleep = 33000;
var delay = 1000;
this.Write(request);
+56 -8
View File
@@ -1,14 +1,32 @@
namespace OmniPlus.Features
{
using System.Text;
using System;
using static System.Text.Encoding;
namespace OmniPlus.Features
{
public class ASCIIString : FeatureRequest
{
protected const char NULL = '\0';
public ASCIIString(int length) : base(length)
{
}
public ASCIIString(string value, int length) : base(length)
{
if (!string.IsNullOrWhiteSpace(value))
{
value = value.Trim(NULL);
if (value.Length > length - 2)
{
value = value.Substring(0, length - 2);
}
this.Value = $"{NULL}{value}{NULL}";
}
}
public ASCIIString(byte[] response, int length) : base(response, length)
{
@@ -20,18 +38,48 @@
set => this.SetValue(value);
}
public void ToASCIIString(byte[] buffer, int start, int end)
{
var value = string.Empty;
while (start <= end)
{
value += (char)buffer[start];
start++;
}
this.SetValue(value);
}
private string GetValue()
=> Encoding.ASCII
{
if (this.bytes?.Length > 0)
{
return ASCII
.GetString(this.bytes)
.Trim();
.Trim('\0');
}
return default(string);
}
private void SetValue(string value)
{
this.bytes.Clear();
Encoding.ASCII
.GetBytes(value?.Trim('\0', ' ') ?? string.Empty)
.CopyTo(this.bytes, 0);
if (!string.IsNullOrWhiteSpace(value))
{
var buffer = ASCII.GetBytes(value);
var bufferLength = buffer.Length;
var i = 0;
while (i < this.length && i < bufferLength)
{
this.bytes[i] = buffer[i];
i++;
}
}
}
}
}
+6 -4
View File
@@ -16,10 +16,12 @@
{
}
public static implicit operator BuildInfo(string value)
=> new BuildInfo
public BuildInfo(string value) : base(value, LENGTH)
{
Value = value,
};
}
public static implicit operator BuildInfo(string value)
=> new BuildInfo { Value = value };
}
}
@@ -1,68 +0,0 @@
using System;
namespace OmniPlus.Features
{
public class ChamberCalibration : FeatureRequest
{
public const byte ACTIVATE_TEST = 0x00;
public const byte REQUEST_RESULTS = 0x01;
public const byte TEST_ACTIVATED = 0x00;
public const byte TEST_FAILED = 0x01;
public const byte TEST_COMPLETED = 0x02;
const int LENGTH = 5;
public ChamberCalibration() : base(LENGTH)
{
}
public ChamberCalibration(byte[] response) : base(response, LENGTH)
{
}
/// <summary>
/// Request Response
/// 0 – Activate Factory Calibration Test Test Activation Successful
/// 1 – Request Factory Calibration Test Results Test Failed (Timeout)
/// 2 - ........................................ Test Successfully Completed
/// </summary>
public byte Control
{
get => this.bytes[0];
set => this.bytes[0] = value;
}
/// <summary>
/// <para>
/// Request: Number of Rotations to collect. (not required if Requesting Calibration results) (Limited to 1 to 5000 rotations)
/// </para>
/// <para>
/// Response: Number of rotations collected
/// On Test Activation, this field echoes the number of rotations requested.
/// On Test Failed and Test Successfully Completed, returns the number of rotations collected.
/// </para>
/// </summary>
public ushort Rotations
{
get => BitConverter.ToUInt16(this.bytes, 1);
set => BitConverter.GetBytes(value).CopyTo(this.bytes, 1);
}
/// <summary>
/// <para>
/// Request: Maximum Time command is supposed to take to execute - 1 to 3600 Seconds.
/// </para>
/// <para>
/// Response: Total Time it took to collect the indicated rotations. Each count is equal to 30.5176us.
/// On Test Activation Successful, returns number of seconds test is allowed to take.
/// On Test Failed, this field will show 0 indicating that the tested failed.
/// </para>
/// </summary>
public ushort Duration
{
get => BitConverter.ToUInt16(this.bytes, 3);
set => BitConverter.GetBytes(value).CopyTo(this.bytes, 3);
}
}
}
@@ -1,6 +1,7 @@
namespace OmniPlus.Features
{
using System;
using System.Text;
public class ConfigurationParameters : FeatureRequest
{
@@ -20,11 +21,11 @@
{
this.ProgrammableID = new ProgrammableID();
this.ProgrammableID.Status = this.Status;
this.ProgrammableID.Value = this.bytes.ToASCIIString(0, 20);
this.ProgrammableID.ToASCIIString(this.bytes, 0, 20);
this.FactoryID = new FactoryID();
this.FactoryID.Status = this.Status;
this.FactoryID.Value = this.bytes.ToASCIIString(21, 33);
this.FactoryID.ToASCIIString(this.bytes, 21, 33);
this.ReadingDigits = new ReadingDigits();
this.ReadingDigits.Status = this.Status;
@@ -33,18 +34,18 @@
this.Readings = new Readings();
this.Readings.Status = this.Status;
this.Readings.Value = this.bytes.ToASCIIString(36, 45);
this.Readings.ToASCIIString(this.bytes, 36, 45);
this.OptionalUniDirFields = new OptionalUniDirFields();
this.OptionalUniDirFields.Status = this.Status;
this.OptionalUniDirFields.Value = this.bytes.ToASCIIString(46, 49);
this.OptionalUniDirFields.ToASCIIString(this.bytes, 46, 49);
this.AlartPersistenceDays = this.bytes[50];
this.AlarmPersistenceDays = this.bytes[50];
this.DataLogIntervalMins = BitConverter.ToUInt16(this.bytes, 51);
this.DeviceID = new DeviceID();
this.DeviceID.Status = this.Status;
this.DeviceID.Value = this.bytes.ToASCIIString(53, 61);
this.DeviceID.ToASCIIString(this.bytes, 53, 61);
}
public ProgrammableID ProgrammableID { get; set; }
@@ -57,18 +58,221 @@
public OptionalUniDirFields OptionalUniDirFields { get; set; }
public byte AlartPersistenceDays { get; set; }
public byte AlarmPersistenceDays { get; set; }
public ushort DataLogIntervalMins { get; set; }
public DeviceID DeviceID { get; set; }
}
public ManifacturingTime ManifacturingTime { private get; set; }
public class ConfigurationParametersSet : FeatureRequest
{
const int LENGTH = 85;
public SystemTime SystemTime { private get; set; }
public ConfigurationParametersSet() : base(LENGTH)
{
}
public byte RebootCount { private get; set; }
private ConfigurationParametersSet(byte[] response) : base(response, LENGTH)
{
}
public BuildInfo BuildInfo { private get; set; }
/// <summary>
/// <para>0 - 20</para>
/// Set Programmable ID request, string is padded and terminated with '\0'
/// +1
/// </summary>
private string programmableID;
public string ProgrammableID
{
get => this.programmableID;
set
{
this.SetASCIIBytes(value, 0, 20);
this.programmableID = this.bytes.ToASCIIString(0, 20);
}
}
/// <summary>
/// <para>21 - 33</para>
/// Set Factory ID request, string padded and terminated with '\0'
/// +1
/// </summary>
private string factoryID;
public string FactoryID
{
get => this.factoryID;
set
{
this.SetASCIIBytes(value, 21, 13);
this.factoryID = this.bytes.ToASCIIString(21, 13);
}
}
/// <summary>
/// <para>34 - 35</para>
/// Set Number of Reading Digits request
/// </summary>
private sbyte nrOfReadingDigits;
public sbyte NumberOfReadingDigits
{
get => this.nrOfReadingDigits;
set
{
BitConverter.GetBytes(value).CopyTo(this.bytes, 34);
this.nrOfReadingDigits = (sbyte)BitConverter.ToInt16(this.bytes, 34);
}
}
/// <summary>
/// <para>36 - 47</para>
/// Set Preset Reading (v1.24), string padded and terminated with '\0'.
/// First Two Characters are set to 0x00 0x00 to indicate that we are programming Totalizer
/// +1
/// </summary>
private string readingPreset;
public string ReadingPreset
{
get => this.readingPreset;
set
{
this.SetASCIIBytes(value, 38, 10);
this.readingPreset = this.bytes.ToASCIIString(38, 10);
}
}
/// <summary>
/// <para>48 - 49</para>
/// Set Optional Uni-directional Fields request
/// </summary>
private ushort optionalFields;
public ushort OptionalUniDirFields
{
get => this.optionalFields;
set
{
BitConverter.GetBytes(value).CopyTo(bytes, 48);
this.optionalFields = BitConverter.ToUInt16(this.bytes, 48);
}
}
/// <summary>
/// <para>50 - 51</para>
/// Set Alarm Persistence Period request. First Byte is always set to 0x00 to indicate Volume Sensor
/// </summary>
public byte AlarmPercistancePeriodDays
{
get => this.bytes[51];
set => this.bytes[51] = value;
}
/// <summary>
/// <para>52 - 54</para>
/// Set Data Log Interval request. First Byte is always set to 0x00 to indicate Volume Sensor
/// </summary>
private ushort dataLogInterval;
public ushort DataLogIntervalMinutes
{
get => this.dataLogInterval;
set
{
BitConverter.GetBytes(value).CopyTo(this.bytes, 53);
this.dataLogInterval = BitConverter.ToUInt16(this.bytes, 53);
}
}
/// <summary>
/// <para>55 - 58</para>
/// Manufacturing Time request
/// </summary>
private uint manifactured;
public uint ManifacturingTime
{
get => this.manifactured;
set
{
BitConverter.GetBytes(value).CopyTo(this.bytes, 55);
this.manifactured = BitConverter.ToUInt16(this.bytes, 55);
}
}
/// <summary>
/// <para>59 - 62</para>
/// System Time request
/// </summary>
private uint timeDrift;
public uint SystemTime
{
get => this.timeDrift;
set
{
BitConverter.GetBytes(value).CopyTo(this.bytes, 59);
this.timeDrift = BitConverter.ToUInt16(this.bytes, 59);
}
}
/// <summary>
/// <para>63</para>
/// Set Reboot Count request
/// </summary>
public byte RebootCount
{
get => this.bytes[63];
set => this.bytes[63] = value;
}
/// <summary>
/// <para>64-79</para>
/// Build Information request, string padded and terminated with '\0'
/// +1
/// </summary>
private string buildInfo;
public string BuildInfo
{
get => this.buildInfo;
set
{
this.SetASCIIBytes(value, 64, 16);
this.buildInfo = this.bytes.ToASCIIString(64, 16);
}
}
/// <summary>
/// <para>80-89</para>
/// Set Device ID String, string is padded and terminated with '\0'
/// +1
/// </summary>
//public string DeviceID
//{
// set => this.SetASCIIBytes(value, 80, 10);
//}
private void SetASCIIBytes(string value, int start, int length)
{
if (string.IsNullOrWhiteSpace(value))
{
return;
}
var asciiBytes = Encoding.ASCII.GetBytes(value);
var asciiLength = asciiBytes.Length;
var asciiIndex = 0;
length += start;
while (start >= 0 && start < length && asciiIndex < asciiLength)
{
this.bytes[start++] = asciiBytes[asciiIndex++];
}
}
}
}
+5
View File
@@ -15,5 +15,10 @@
public CustomerText(byte[] response) : base(response, LENGTH)
{
}
public CustomerText(string value) : base(value, LENGTH)
{
}
}
}
+5
View File
@@ -11,5 +11,10 @@
public DeviceID(byte[] response) : base(response, LENGTH)
{
}
public DeviceID(string value) : base(value, LENGTH)
{
}
}
}
@@ -27,5 +27,7 @@
get => epoch.AddSeconds(this.SecondsSince);
set => this.SecondsSince = (uint)(value - epoch).TotalSeconds;
}
public static uint UTCNow => (uint)(DateTime.UtcNow - epoch).TotalSeconds;
}
}
+8
View File
@@ -12,5 +12,13 @@
public FactoryID(byte[] response) : base(response, LENGTH)
{
}
public FactoryID(string value) : base(value, LENGTH)
{
}
public static implicit operator FactoryID(string value)
=> new FactoryID { Value = value };
}
}
+6 -1
View File
@@ -1,4 +1,6 @@
namespace OmniPlus.Features
using System;
namespace OmniPlus.Features
{
public class FeatureRequest : FeatureResponse
{
@@ -25,5 +27,8 @@
return request;
}
}
internal void CopyTo(byte[] bytes, int start)
=> Array.Copy(this.bytes, 0, bytes, start, this.length);
}
}
+14 -5
View File
@@ -13,22 +13,31 @@ namespace OmniPlus.Features
public FeatureResponse(byte[] response, int length = 0) : this(length)
{
if (response != null )
if (response?.Length > 0)
{
this.Status = (Status)response[0];
}
if (response.Length > 1 && response.Length >= length)
if (response?.Length > length)
{
Array.Copy(response, 1, this.bytes, 0, length);
}
}
}
public Status Status { get; set; }
public bool Succeeded => this.Status == Status.Completed;
public static implicit operator byte[](FeatureResponse response)
=> response?.bytes ?? new byte[0];
public override bool Equals(object obj)
=> obj is FeatureResponse outer && outer.bytes == this.bytes;
public override int GetHashCode()
=> this.bytes.GetHashCode();
public override string ToString()
=> BitConverter.ToString(this.bytes);
//public static implicit operator byte[](FeatureResponse response)
// => response?.bytes ?? new byte[0];
}
}
@@ -16,5 +16,13 @@
public OptionalUniDirFields(byte[] response) : base(response, LENGTH)
{
}
public OptionalUniDirFields(string value) : base(value, LENGTH)
{
}
public static implicit operator ushort(OptionalUniDirFields obj)
=> BitConverter.ToUInt16(obj.bytes, 0);
}
}
+11 -1
View File
@@ -1,4 +1,6 @@
namespace OmniPlus.Features
using System;
namespace OmniPlus.Features
{
public class ProgrammableID : ASCIIString
{
@@ -12,5 +14,13 @@
public ProgrammableID(byte[] response) : base(response, LENGTH)
{
}
public ProgrammableID(string value) : base(value, LENGTH)
{
}
public static implicit operator ProgrammableID(string value)
=> new ProgrammableID { Value = value };
}
}
+17 -1
View File
@@ -1,4 +1,6 @@
namespace OmniPlus.Features
using System;
namespace OmniPlus.Features
{
public class ReadingDigits : FeatureRequest
{
@@ -23,5 +25,19 @@
get => this.bytes[1];
set => this.bytes[1] = value;
}
public static implicit operator ReadingDigits(sbyte value)
{
var bytes = BitConverter.GetBytes(value);
return new ReadingDigits
{
Count = bytes[0],
Offset = bytes[1]
};
}
public static implicit operator sbyte(ReadingDigits readingDigits)
=> (sbyte)BitConverter.ToInt16(new[] { readingDigits?.Count ?? 0, readingDigits?.Offset ?? 0 }, 0);
}
}
+9 -1
View File
@@ -33,7 +33,7 @@ namespace OmniPlus.Features
/// </summary>
public class Readings : ASCIIString
{
const int LENGTH = 8;
const int LENGTH = 12;
public Readings() : base(LENGTH)
{
@@ -43,10 +43,18 @@ namespace OmniPlus.Features
{
}
public Readings(string value) : base(value, LENGTH)
{
}
public byte SensorID => this.bytes[0];
public ReadingSettings Setting => (ReadingSettings)this.bytes[1];
public bool Include => this.bytes[2] == 1;
public static implicit operator Readings(string value)
=> new Readings { Value = value };
}
}
@@ -91,21 +91,5 @@ namespace OmniPlus.Features
get => this.bytes[12].GetUint8(3, 3);
set => OmniPlusExtensions.SetUint8(ref this.bytes[12], 3, 3, value);
}
public override bool Equals(object other)
=> other is RegisterSettings registerSettings
&& registerSettings.IntPart == this.IntPart
&& registerSettings.Fraction == this.Fraction
&& registerSettings.Size == this.Size
&& registerSettings.Range == this.Range
&& registerSettings.VolumePerPulseUnit == this.VolumePerPulseUnit
&& registerSettings.MeterUnits == this.MeterUnits
&& registerSettings.FlowUnits == this.FlowUnits
&& registerSettings.FlowRate == this.FlowRate
&& registerSettings.FactoryCorrection == this.FactoryCorrection
&& registerSettings.FieldCorrection == this.FieldCorrection
&& registerSettings.PulseWeight == this.PulseWeight
&& registerSettings.PulseWidth == this.PulseWidth
&& registerSettings.PulseUpdate == this.PulseUpdate;
}
}
+2 -2
View File
@@ -19,7 +19,7 @@
{
this.BuildInfo = new BuildInfo();
this.BuildInfo.Status = this.Status;
this.BuildInfo.Value = this.bytes.ToASCIIString(0, 15);
this.BuildInfo.ToASCIIString(this.bytes, 0, 15);
this.ManifacturingTime = new ManifacturingTime();
this.ManifacturingTime.Status = this.Status;
@@ -33,7 +33,7 @@
this.VersionAndType = new VersionAndType();
this.VersionAndType.Status = this.Status;
this.VersionAndType.Value = this.bytes.ToASCIIString(25, 51);
this.VersionAndType.ToASCIIString(this.bytes, 25, 51);
this.BatteryVoltage = new BatteryVoltage();
this.BatteryVoltage.Status = this.Status;
@@ -21,5 +21,10 @@
public VersionAndType(byte[] response) : base(response, LENGTH)
{
}
public VersionAndType(string value) : base(value, LENGTH)
{
}
}
}
+4 -3
View File
@@ -112,10 +112,11 @@
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SignalRClient\SignalRClient.csproj">
<Project>{5C16DAC4-71E5-49B4-A087-36C704AADCF1}</Project>
<Name>SignalRClient</Name>
<ProjectReference Include="..\ExchangeHub\ExchangeHub.csproj">
<Project>{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}</Project>
<Name>ExchangeHub</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+20 -4
View File
@@ -1,12 +1,15 @@
using OmniPlus.Features;
using System;
using OmniPlus.Features;
using OmniPlus.Hanlers;
using static OmniPlus.Features.Features;
namespace OmniPlus
{
public class OmniPlusConnection
public sealed class OmniPlusConnection
{
private uint secondsToWait;
private Func<bool> connected;
private readonly IrdaConnection irdaConnection;
private readonly UniProConnection uniProConnection;
@@ -18,11 +21,15 @@ namespace OmniPlus
internal MessageHandler MessageHandler;
public bool Connected
=> this.connected?.Invoke() == true;
public bool ConnectIrda()
{
this.uniProConnection.Close();
this.irdaConnection.Open();
this.connected = () => this.irdaConnection.Connected;
this.MessageHandler = this.irdaConnection.SendMessage;
return this.irdaConnection.Connected;
@@ -33,6 +40,7 @@ namespace OmniPlus
this.irdaConnection.Close();
this.uniProConnection.Open();
this.connected = () => this.uniProConnection.Connected;
this.MessageHandler = this.uniProConnection.SendMessage;
return this.irdaConnection.Connected;
@@ -137,7 +145,7 @@ namespace OmniPlus
public ConfigurationParameters ViewConfigurationParameters()
{
var response = this.MessageHandler.Invoke(DEVICE_SPECIFIC, VIEW_CONFIGURATION_PARAMETERS, 0x01);
var response = this.MessageHandler.Invoke(DEVICE_SPECIFIC, VIEW_CONFIGURATION_PARAMETERS/*, 0x01*/);
return new ConfigurationParameters(response);
}
@@ -245,7 +253,7 @@ namespace OmniPlus
return new FeatureResponse(response);
}
public FeatureResponse Set(ConfigurationParameters configurationParameters)
public FeatureResponse Set(ConfigurationParametersSet configurationParameters)
{
var response = this.MessageHandler.Invoke(configurationParameters[DEVICE_SPECIFIC, SET_CONFIGURATION_PARAMETERS]);
@@ -383,5 +391,13 @@ namespace OmniPlus
return new FeatureResponse();
}
private void WaitBeforeNextExecution()
{
while (this.secondsToWait > 0)
{
this.secondsToWait--;
}
}
}
}
+100 -69
View File
@@ -1,5 +1,4 @@
using OmniPlus;
using OmniPlus.Enums;
using OmniPlus.Enums;
using OmniPlus.Features;
using System;
@@ -12,8 +11,9 @@ using static OmniPlus.OmniPlusConstants;
namespace OmniPlus
{
public class OmniPlusConnectionsPool
public class OmniPlusConnectionsPool : IDisposable
{
public event Action Done;
public event OmniPlusStateChanged StateChanged;
private readonly ConcurrentDictionary<int, OmniPlusConnection> connections;
@@ -45,6 +45,8 @@ namespace OmniPlus
public void Dispose()
{
this.signalRConnection.Dispose();
// Disposes all OmniPlus connections.
foreach (var connectionKVP in this.connections)
{
@@ -117,12 +119,29 @@ namespace OmniPlus
public void StartInspection()
{
this.background = new BackgroundWorker();
foreach (var position in this.connections.Keys)
{
//this.StartOmniInitialization(position);
this.background.DoWork += this.StartInspection;
//foreach (var point in this.omniType.TestPoints)
//{
// this.StartOmniInspection(position, point);
//}
this.background.RunWorkerAsync();
//this.CalculateCorrectionFactor(position);
this.FinishOmniInspection(position);
}
}
//public void StartInspection()
//{
// this.background = new BackgroundWorker();
// this.background.DoWork += this.StartInspection;
// this.background.RunWorkerAsync();
//}
private void StartInspection(object sender, EventArgs args)
{
@@ -131,7 +150,7 @@ namespace OmniPlus
foreach (var position in this.connections.Keys)
{
tasks[position - 1] = Task.Factory.StartNew(() => this.StartOmniInitialization(position));
tasks[position - 1] = Task.Factory.StartNew(() => this.StartOmniInitialization(position), this.cancellationToken);
}
tasks.ContinueWhenAll();
@@ -139,38 +158,46 @@ namespace OmniPlus
foreach (var point in this.omniType.TestPoints)
{
// TODO: 600 = 10min * 60sec - change for production.
this.signalRConnection.SetQAndWaitUntilReached(point.VolumeM3H, 600);
tasks = new Task[connectionsCount];
foreach (var position in this.connections.Keys)
if (!this.signalRConnection.SetQAndWaitUntilReached(point.VolumeM3H))
{
tasks[position - 1] = Task.Factory.StartNew(() => this.StartOmniInspection(position, point));
}
this.CancelExecution();
tasks.ContinueWhenAll();
var volumeMessured = 0.1D; // TODO: this.GetM3();
foreach (var position in this.connections.Keys)
{
this.SetPointDifference(position, point, volumeMessured);
}
}
foreach (var position in this.connections.Keys)
{
this.GetCorrectionFactor(position);
break;
}
tasks = new Task[connectionsCount];
foreach (var position in this.connections.Keys)
{
tasks[position - 1] = Task.Factory.StartNew(() => this.FinishOmniInspection(position));
tasks[position - 1] = Task.Factory.StartNew(() => this.StartOmniInspection(position, point), this.cancellationToken);
}
tasks.ContinueWhenAll();
var volume = this.signalRConnection.RequestRefV();
foreach (var position in this.connections.Keys)
{
this.SetPointDifference(position, point, volume);
}
}
foreach (var position in this.connections.Keys)
{
this.CalculateCorrectionFactor(position);
}
tasks = new Task[connectionsCount];
foreach (var position in this.connections.Keys)
{
tasks[position - 1] = Task.Factory.StartNew(() => this.FinishOmniInspection(position), this.cancellationToken);
}
tasks.ContinueWhenAll();
this.Done?.Invoke();
}
private void StartOmniInitialization(int position)
@@ -204,7 +231,7 @@ namespace OmniPlus
{
var header = $"{point.VolumeM3H:0.0000}m³/h";
if (this.TryGetOmni(position, out var connection, out var meter) && meter.Initialized && meter.CanCalibrate)
if (this.TryGetOmni(position, out var connection, out var meter) /*&& meter.Initialized && meter.CanCalibrate*/)
{
this.StateChanged?.Invoke(position, 0, header, TBD);
@@ -231,11 +258,14 @@ namespace OmniPlus
if (!calibrationResult.Succeeded)
{
this.StateChanged?.Invoke(position, -1, header, $"CC: {calibrationResult.Status}");
this.StateChanged?.Invoke(position, -1, header, $"CC: {calibrationResult.Status.ToString()}");
}
else if (calibrationResult.Control != ChamberCalibrationResponse.TEST_COMPLETED)
{
this.StateChanged?.Invoke(position, -1, header, $"CC: {calibrationResult.Control}");
var control = calibrationResult.Control == ChamberCalibrationResponse.TEST_ACTIVATED
? nameof(ChamberCalibrationResponse.TEST_ACTIVATED)
: nameof(ChamberCalibrationResponse.TEST_FAILED);
this.StateChanged?.Invoke(position, -1, header, $"CC: {control}");
}
else // process calibration
{
@@ -271,7 +301,7 @@ namespace OmniPlus
}
}
private void GetCorrectionFactor(int position)
private void CalculateCorrectionFactor(int position)
{
if (this.TryGetOmni(position, out var _, out var meter) && meter.Initialized && meter.CanCalibrate)
{
@@ -287,7 +317,7 @@ namespace OmniPlus
private void FinishOmniInspection(int position)
{
if (this.TryGetOmni(position, out var connection, out var meter) && meter.Calibrated)
if (this.TryGetOmni(position, out var connection, out var meter)/* && meter.Calibrated*/)
{
var configurationParameters = connection.ViewConfigurationParameters();
var canContinue = configurationParameters.Succeeded;
@@ -305,49 +335,50 @@ namespace OmniPlus
//canContinue = systemTimeReset.Succeeded;
}
if (canContinue)
{
var registerSettings = connection.ViewRegisterSettings();
//if (canContinue)
//{
// var registerSettings = new RegisterSettings();
registerSettings.IntPart = this.omniType.IntPart;
registerSettings.Fraction = this.omniType.Fraction;
registerSettings.Size = this.omniType.Size;
registerSettings.Range = this.omniType.Range;
registerSettings.VolumePerPulseUnit = 0x00;
registerSettings.MeterUnits = (byte)MessurementUnits.USGallons;
registerSettings.FlowUnits = (byte)MessurementUnits.USGallons;
registerSettings.FlowRate = (byte)TimeUnits.Minutes;
registerSettings.FactoryCorrection = meter.FactoryCorrection;
registerSettings.FieldCorrection = 0x00;
registerSettings.PulseWeight = 0x01;
registerSettings.PulseWidth = 0x02;
registerSettings.PulseUpdate = 0x00;
// registerSettings.IntPart = this.omniType.IntPart;
// registerSettings.Fraction = this.omniType.Fraction;
// registerSettings.Size = this.omniType.Size;
// registerSettings.Range = this.omniType.Range;
// registerSettings.VolumePerPulseUnit = 0x00;
// registerSettings.MeterUnits = (byte)MessurementUnits.USGallons;
// registerSettings.FlowUnits = (byte)MessurementUnits.USGallons;
// registerSettings.FlowRate = (byte)TimeUnits.Minutes;
// registerSettings.FactoryCorrection = meter.FactoryCorrection;
// registerSettings.FieldCorrection = 0x00;
// registerSettings.PulseWeight = 0x01;
// registerSettings.PulseWidth = 0x02;
// registerSettings.PulseUpdate = 0x00;
var response = connection.Set(registerSettings);
canContinue = response.Succeeded;
// var response = connection.Set(registerSettings);
// canContinue = response.Succeeded;
// if (canContinue)
// {
// meter.AddRegisterSettings(registerSettings);
// }
//}
if (canContinue)
{
meter.AddRegisterSettings(registerSettings);
}
}
var configurationParametersSet = new ConfigurationParametersSet();
configurationParametersSet.ProgrammableID = "816232411982";
configurationParametersSet.FactoryID = "816232411982";
configurationParametersSet.NumberOfReadingDigits = 8; // meter.ReadingDigits;
configurationParametersSet.ReadingPreset = "0000000000";
configurationParametersSet.OptionalUniDirFields = 0; // meter.OptionalUniDirFields;
configurationParametersSet.AlarmPercistancePeriodDays = 31;
configurationParametersSet.DataLogIntervalMinutes = 60;
configurationParametersSet.ManifacturingTime = Epoch20000101.UTCNow - 30000; // meter.ManifacturingTime;
configurationParametersSet.SystemTime = Epoch20000101.UTCNow;
configurationParametersSet.RebootCount = 0;
configurationParametersSet.BuildInfo = "816232411982"; // meter.BuildInfo;
// configurationParametersSet.DeviceID = "OMNI-01";
if (canContinue)
{
configurationParameters.ProgrammableID = meter.ProgrammableID;
configurationParameters.FactoryID = meter.FactoryID;
configurationParameters.ReadingDigits = meter.ReadingDigits;
configurationParameters.Readings = meter.Readings;
configurationParameters.OptionalUniDirFields = meter.OptionalUniDirFields;
configurationParameters.AlartPersistenceDays = meter.AlartPersistenceDays;
configurationParameters.DataLogIntervalMins = meter.DataLogIntervalMins;
configurationParameters.ManifacturingTime = meter.ManifacturingTime;
configurationParameters.SystemTime = DateTime.UtcNow;
configurationParameters.RebootCount = 0;
configurationParameters.BuildInfo = meter.BuildInfo;
configurationParameters.DeviceID = meter.DeviceID;
var response = connection.Set(configurationParameters);
var response = connection.Set(configurationParametersSet);
canContinue = response.Succeeded;
}
+13 -7
View File
@@ -1,5 +1,5 @@
using OmniPlus.Features;
using System;
using System.Data.SqlClient;
namespace OmniPlus
@@ -75,9 +75,8 @@ namespace OmniPlus
, [ReadingDigitsOffsest] = @{nameof(parameters.ReadingDigits.Offset)}
, [Readings] = @{nameof(parameters.Readings)}
, [OptionalUniDirFields] = @{nameof(parameters.OptionalUniDirFields)}
, [AlarmPersitenceDays] = @{nameof(parameters.AlartPersistenceDays)}
, [AlarmPersitenceDays] = @{nameof(parameters.AlarmPersistenceDays)}
, [DataLogIntervalMins] = @{nameof(parameters.DataLogIntervalMins)}
, [DeviceID] = @{nameof(parameters.DeviceID)}
WHERE [Position] = @{nameof(position)}";
sqlCommand.Parameters.Add(new SqlParameter(nameof(position), position));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.ProgrammableID), parameters.ProgrammableID.Value));
@@ -85,13 +84,20 @@ namespace OmniPlus
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.ReadingDigits.Count), parameters.ReadingDigits.Count));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.ReadingDigits.Offset), parameters.ReadingDigits.Offset));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.Readings), parameters.Readings.Value));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.OptionalUniDirFields), parameters.OptionalUniDirFields));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.AlartPersistenceDays), parameters.AlartPersistenceDays));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.DataLogIntervalMins), parameters.DataLogIntervalMins));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.DeviceID), parameters.DeviceID.Value));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.OptionalUniDirFields), parameters.OptionalUniDirFields.Value));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.AlarmPersistenceDays), parameters.AlarmPersistenceDays));
sqlCommand.Parameters.Add(new SqlParameter(nameof(parameters.DataLogIntervalMins), BitConverter.GetBytes(parameters.DataLogIntervalMins).Reverse()));
try
{
sqlCommand.ExecuteNonQuery();
sqlCommand.Parameters.Clear();
}
catch (System.Exception e)
{
}
}
}
}
+5 -6
View File
@@ -56,7 +56,7 @@ namespace OmniPlus
control.ReturnResponse = true;
message[index++] = control;
bytes.CopyTo(message, index--);
bytes.CopyTo(message, index);
var checksum = message.CalculateCheckSUM(message.Length - OxO2);
var checksumIndex = bytesLength + UI1236_HED_LENGTH;
@@ -264,17 +264,16 @@ namespace OmniPlus
}
}
public static string ToASCIIString(this byte[] bytes, int start, int end)
public static string ToASCIIString(this byte[] bytes, int start, int length)
{
var asciiString = string.Empty;
while (start <= end)
while (start >= 0 && start < bytes.Length)
{
asciiString += (char)bytes[start];
start++;
asciiString += (char)bytes[start++];
}
return asciiString.Trim();
return asciiString;
}
public static void ContinueWhenAll(this Task[] tasks)
+29 -18
View File
@@ -18,6 +18,7 @@ namespace OmniPlus
{
this.Connected = connected;
this.systemParameters = new SystemParameters();
this.configurationParameters = new ConfigurationParameters();
this.testPoints = new Dictionary<OmniPlusTestPoint, OmniPlusTest>();
}
@@ -37,22 +38,22 @@ namespace OmniPlus
public string BuildInfo
{
get => this.systemParameters.BuildInfo.Value.Trim('\0');
get => this.systemParameters.BuildInfo.Value;
set => this.systemParameters.BuildInfo.Value = value;
}
public DateTime ManifacturingTime
public uint ManifacturingTime
{
get => this.systemParameters.ManifacturingTime.DateTime;
set => this.systemParameters.ManifacturingTime.DateTime = value;
get => this.systemParameters.ManifacturingTime.SecondsSince;
set => this.systemParameters.ManifacturingTime.SecondsSince = value;
}
public bool ManifacturingTimeInRange { get; private set; }
public DateTime SystemTime
public uint SystemTime
{
get => this.systemParameters.SystemTime.DateTime;
set => this.systemParameters.SystemTime.DateTime = value;
get => this.systemParameters.SystemTime.SecondsSince;
set => this.systemParameters.SystemTime.SecondsSince = value;
}
public int SystemTimeDrift { get; private set; }
@@ -67,7 +68,7 @@ namespace OmniPlus
public string Firmware
{
get => this.systemParameters.VersionAndType.Value.Trim('\0');
get => this.systemParameters.VersionAndType.Value;
set => this.systemParameters.VersionAndType.Value = value;
}
@@ -100,8 +101,8 @@ namespace OmniPlus
public FactoryID FactoryID
=> this.configurationParameters.FactoryID;
public ReadingDigits ReadingDigits
=> this.configurationParameters.ReadingDigits;
public sbyte ReadingDigits
=> this.configurationParameters?.ReadingDigits ?? 0;
public Readings Readings
=> this.configurationParameters.Readings;
@@ -110,14 +111,11 @@ namespace OmniPlus
=> this.configurationParameters.OptionalUniDirFields;
public byte AlartPersistenceDays
=> this.configurationParameters.AlartPersistenceDays;
=> this.configurationParameters.AlarmPersistenceDays;
public ushort DataLogIntervalMins
=> this.configurationParameters.DataLogIntervalMins;
public DeviceID DeviceID
=> this.configurationParameters.DeviceID;
internal double AddCalibrationResult(OmniPlusTestPoint point, ChamberCalibrationResponse result)
{
this.testPoints[point] = new OmniPlusTest
@@ -149,16 +147,29 @@ namespace OmniPlus
{
this.systemParameters = systemParameters;
this.SystemTimeDrift = (DateTime.UtcNow - this.SystemTime).Seconds;
this.SystemTimeDrift = (DateTime.UtcNow - this.systemParameters.SystemTime.DateTime).Seconds;
this.SystemTimeInRange = Math.Abs(this.SystemTimeDrift) <= 700;
this.ManifacturingTimeInRange = Math.Abs((DateTime.UtcNow - this.ManifacturingTime).Days) <= 365;
this.ManifacturingTimeInRange = Math.Abs((DateTime.UtcNow - this.systemParameters.ManifacturingTime.DateTime).Days) <= 365;
var firmwareTokens = this.Firmware
?.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
?? new string[2];
var versionString = firmwareTokens[0]?.Substring(1) ?? string.Empty;
var versionString = string.Empty;
if (firmwareTokens?.Length > 0 && firmwareTokens[0]?.Length > 0)
{
versionString = firmwareTokens[0].Substring(1);
}
var versionParsed = double.TryParse(versionString, out var version);
var typeString = firmwareTokens[1]?.ToUpper() ?? string.Empty;
var typeString = string.Empty;
if (firmwareTokens?.Length > 1 && firmwareTokens[1]?.Length > 0)
{
typeString = firmwareTokens[1].ToUpper();
}
var isOmni = typeString == "OMNI-01" || typeString == "OMNI-02";
this.FirmwareInRange = versionParsed && version >= 1.23 && isOmni;
+66 -14
View File
@@ -1,39 +1,91 @@
namespace OmniPlus
{
using SignalRClient;
using System.Threading;
using ExchangeHub;
public class SignalRConnection
using System;
using System.Threading;
namespace OmniPlus
{
public class SignalRConnection : IDisposable
{
private readonly ExchangeHub exchangeHub;
private readonly ExchangeConnection slave;
private readonly string url;
public SignalRConnection(string url)
{
this.url = url;
this.exchangeHub = new ExchangeHub();
this.slave = new ExchangeConnection();
}
internal void Connect()
=> this.exchangeHub.Connect(this.url);
=> this.slave.Connect(this.url);
public bool SetQAndWaitUntilReached(double value, int seconds)
internal bool SetQAndWaitUntilReached(double value, int seconds = 300)
{
var reachSeconds = seconds;
var reached = false;
var started = false;
void WaitUntilReached(double _) => reached = true;
this.exchangeHub.ExchangeQ += WaitUntilReached;
void waitQReached(double _) => reached = true;
this.slave.StartQ += waitQReached;
this.exchangeHub.SendExchangeQ(value);
this.slave.NotifyStartQ(value);
while (!reached && seconds >= 0)
while (!reached && reachSeconds >= 0)
{
Thread.Sleep(1000);
reachSeconds--;
}
if (reached)
{
var startSeconds = seconds;
void waitRefStarted() => started = true;
this.slave.StartRef += waitRefStarted;
this.slave.NotifyStartRef();
while (!started && startSeconds >= 0)
{
Thread.Sleep(1000);
startSeconds--;
}
}
return reached && started;
}
internal void StopRunning()
=> this.slave.NotifyStopQ();
internal double RequestRefV(int seconds = 300)
{
var received = false;
var referenceV = 0D;
void waitRefV(double value)
{
referenceV = value;
received = true;
}
this.slave.StopRef += waitRefV;
this.slave.NotifyStopRef();
while (!received && seconds >= 0)
{
Thread.Sleep(1000);
seconds--;
}
return reached;
return referenceV;
}
public void Dispose()
=> this.slave.Dispose();
}
}
@@ -1,38 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace SignalRClient.Contracts
{
public interface IExchangeHub : IDisposable
{
void SendExchangeQ(double value);
void SendExchangeV(double value);
}
[Guid("4F018C57-9E7B-4391-8837-BCA6373E0AFE")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IExchangeClient : IExchangeHub
{
bool Connected { get; }
bool Connect(string url);
new void Dispose();
new void SendExchangeQ(double value);
new void SendExchangeV(double value);
}
[Guid("D140D0EA-220E-478E-91B6-5FE8D45B52D0")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IExchangeEvents
{
void ExchangeQ(double value);
void ExchangeV(double value);
}
public delegate void DoubleEventHandler(double value);
}
-138
View File
@@ -1,138 +0,0 @@
using SignalRClient.Contracts;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.AspNet.SignalR.Client;
namespace SignalRClient
{
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IExchangeEvents))]
[Guid("3FBA514A-326B-4F34-BFF4-425AF4115B43")]
[ProgId("SignalRClient.ExchangeHub")]
public class ExchangeHub : IExchangeClient
{
public const string HUB_DIR = ".\\SignalRClient";
public const string HUB_NAME = nameof(IExchangeHub);
public event DoubleEventHandler ExchangeQ;
public event DoubleEventHandler ExchangeV;
private readonly ICollection<IDisposable> disposables;
private HubConnection connection;
private IHubProxy proxy;
public ExchangeHub()
{
Directory.CreateDirectory(HUB_DIR);
this.disposables = new List<IDisposable>();
}
public bool Connected { get; private set; }
public bool Connect(string url)
{
this.connection = new HubConnection(url);
this.connection.Closed += this.Connection_Closed;
this.connection.ConnectionSlow += Connection_ConnectionSlow;
this.connection.Error += this.Connection_Error;
this.connection.Received += this.Connection_Received;
this.connection.Reconnected += this.Connection_Reconnected;
this.connection.Reconnecting += this.Connection_Reconnecting;
this.connection.StateChanged += this.Connection_StateChanged;
this.proxy = this.connection.CreateHubProxy(HUB_NAME);
var disposableQ = this.proxy.On<double>(nameof(this.SendExchangeQ), x => this.ExchangeQ?.Invoke(x));
var disposableV = this.proxy.On<double>(nameof(this.SendExchangeV), x => this.ExchangeV?.Invoke(x));
this.disposables.Add(disposableQ);
this.disposables.Add(disposableV);
try
{
this.connection
.Start()
.Wait();
}
catch (Exception e)
{
this.FileAppendLine(e.ToString());
}
return this.connection.State == ConnectionState.Connected;
}
public void Dispose()
{
foreach (var disposable in this.disposables)
{
disposable?.Dispose();
}
this.connection.Stop();
}
public void SendExchangeQ(double value)
=> this.proxy.Invoke(nameof(this.SendExchangeQ), new object[] { value });
public void SendExchangeV(Double value)
=> this.proxy.Invoke(nameof(this.SendExchangeV), new object[] { value });
private void Connection_Closed()
{
this.Connected = this.connection.State == ConnectionState.Connected;
this.FileAppendLine("HubConnection closed!");
}
private void Connection_ConnectionSlow()
{
this.Connected = this.connection.State == ConnectionState.Connected;
this.FileAppendLine("HubConnection is about to timeout!");
}
private void Connection_Error(Exception e)
{
this.Connected = this.connection.State == ConnectionState.Connected;
this.FileAppendLine(e.ToString());
}
private void Connection_Received(string data)
{
this.Connected = this.connection.State == ConnectionState.Connected;
this.FileAppendLine(data);
}
private void Connection_Reconnected()
{
this.Connected = this.connection.State == ConnectionState.Connected;
this.FileAppendLine("HubConnection reconnected!");
}
private void Connection_Reconnecting()
{
this.Connected = this.connection.State == ConnectionState.Connected;
this.FileAppendLine("HubConnection reconnecting!");
}
private void Connection_StateChanged(StateChange state)
{
this.Connected = this.connection.State == ConnectionState.Connected;
this.FileAppendLine($"{state.OldState} -> {state.NewState}");
}
private void FileAppendLine(string text)
=> File.AppendAllText($"{HUB_DIR}\\{DateTime.Now:yyyy_MM_dd}.txt", $"[{DateTime.Now:HH:mm:ss}] {text}{Environment.NewLine}");
}
}
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,2 @@
[SQL ERROR] Violation of PRIMARY KEY constraint 'PK_MitarbeiterTokens'. Cannot insert duplicate key in object 'dbo.MitarbeiterTokens'. The duplicate key value is (13, 19207).
[SQL ERROR] The statement has been terminated.
@@ -1,18 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using Newtonsoft.Json;
using System.IO;
using System.Web;
using System.Web.Http;
namespace LaaProductionWeb.Controllers
{
[AllowAnonymous]
[RoutePrefix("/api/values")]
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
public object Get()
{
return new string[] { "value1", "value2" };
var filePath = HttpContext.Current.Server.MapPath("~/App_Content/json/chart.json");
var fileContent = File.ReadAllText(filePath);
return JsonConvert.DeserializeObject(fileContent);
}
// GET api/values/5
File diff suppressed because it is too large Load Diff
@@ -77,5 +77,10 @@
return this.Redirect("~/");
}
public ActionResult Chart()
{
return this.View();
}
}
}
@@ -1,21 +1,37 @@
using SignalRClient.Contracts;
using ExchangeHub;
using ExchangeHub.Contracts;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
namespace LaaProductionWeb.Hubs
{
[HubName(nameof(IExchangeHub))]
[HubName(ExchangeConnection.HUB_NAME)]
public class ExchangeHub : Hub, IExchangeHub
{
public void SendExchangeQ(double value)
public void Disposed()
=> this.Clients
.AllExcept(this.Context.ConnectionId)
.SendExchangeQ(value);
.Disposed();
public void SendExchangeV(double value)
public void StartQ(double volumeM3)
=> this.Clients
.AllExcept(this.Context.ConnectionId)
.SendExchangeV(value);
.StartQ(volumeM3);
public void StartRef()
=> this.Clients
.AllExcept(this.Context.ConnectionId)
.StartRef();
public void StopQ()
=> this.Clients
.AllExcept(this.Context.ConnectionId)
.StopQ();
public void StopRef(double volumeM3)
=> this.Clients
.AllExcept(this.Context.ConnectionId)
.StopRef(volumeM3);
}
}
@@ -45,6 +45,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ExchangeHub">
<HintPath>..\..\Common\ExchangeHub\bin\Debug\ExchangeHub.dll</HintPath>
</Reference>
<Reference Include="LaaProductionDI, Version=1.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LaaProductionDI.1.0.4\lib\netstandard2.0\LaaProductionDI.dll</HintPath>
</Reference>
@@ -94,12 +97,6 @@
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="SignalRClient">
<HintPath>..\..\Common\SignalRClient\bin\Debug\SignalRClient.dll</HintPath>
</Reference>
<Reference Include="SIRTBroadcaster.Abstraction">
<HintPath>..\..\Common\SIRTBroadcaster.Abstraction\bin\Debug\SIRTBroadcaster.Abstraction.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd1bb07a5ac7c7bc, processorArchitecture=MSIL">
<HintPath>..\packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll</HintPath>
</Reference>
@@ -223,7 +220,7 @@
<Compile Include="Controllers\ReportController.cs" />
<Compile Include="Controllers\SearchController.cs" />
<Compile Include="Controllers\ShipmentsController.cs" />
<Compile Include="Controllers\ValuesController.cs" />
<Compile Include="API\ValuesController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@@ -266,6 +263,7 @@
<Content Include="Areas\Personalization\Views\Software\Details.cshtml" />
<Content Include="Areas\Personalization\Views\Software\Index.cshtml" />
<Content Include="Areas\Personalization\Views\Web.config" />
<Content Include="App_Content\json\chart.json" />
<None Include="packages.config" />
<Content Include="Views\Approvals\Add.cshtml" />
<Content Include="Views\Protocol\Clients.cshtml" />
@@ -298,6 +296,7 @@
<Content Include="Views\Protocol\Files.cshtml" />
<Content Include="Views\Protocol\Results.cshtml" />
<Content Include="Views\Search\Passwords.cshtml" />
<Content Include="Views\Home\Chart.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LaaProduction.Personalization\LaaProduction.Personalization.csproj">
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" id="chart">
<line x1="0" y1="80" x2="100" y2="20" stroke="black" />
</svg>
@section scripts {
<script>
let chart = document.getElementById('chart');
let data = JSON.parse('[]');
let json = fetch('/LaaProductionWeb/api/values')
.then((response) => response.json())
.then((json) => data = JSON.parse(json))
.finally(() => console.log(data));
</script>
}