From 755ce90691bd003bd296a44e317040fede97ffe2 Mon Sep 17 00:00:00 2001 From: Luc Vandenbroucke Date: Mon, 14 Oct 2024 07:51:22 +0200 Subject: [PATCH] 2.34 close com at end , also MK2 --- EpdBase/EpdBase.cpp | 32 ++++++++++++++++---------- EpdBase/EpdBase.h | 8 +++---- EpdBase3/Epd3Base.cpp | 17 +++++++------- eDosStation/App.config | 7 ++---- eDosStation/Properties/AssemblyInfo.cs | 5 ++-- eDosStation/Resources/BuildDate.txt | 2 +- eDosStation/ShowEPDDose.xaml.cs | 1 - eDosStation/eDosStation.csproj | 17 +++++++++----- eDosStation/packages.config | 10 ++++---- 9 files changed, 56 insertions(+), 43 deletions(-) diff --git a/EpdBase/EpdBase.cpp b/EpdBase/EpdBase.cpp index db1478e..4ccb087 100644 --- a/EpdBase/EpdBase.cpp +++ b/EpdBase/EpdBase.cpp @@ -123,20 +123,21 @@ int EpdBase::Epd2U::Open(DWORD DeviceID) else { OpenRV = ConRV = 1; rv = 0; } return rv; } -void EpdBase::Epd2U::Close() +void EpdBase::Epd2U::Close(WORD doEndCom) { if (port > 0 && CurrentDeviceID>0) CloseDevice(); CurrentDeviceID = 0; FlushBuffers(port); + if (doEndCom) EndCom(); } -int EpdBase::Epd2U::CloseAndSignal(WORD EndSessionControl, WORD duration) +int EpdBase::Epd2U::CloseAndSignal(WORD EndSessionControl, WORD duration, WORD doEndCom) { int rv = 0; WORD r; Sleep(250); r = EndSession(EndSessionControl, duration); if (r == 1) rv = 0; else rv = 1; - Close(); + Close( doEndCom); return rv; } void EpdBase::Epd2U::DecodeFunctionFlags() @@ -496,7 +497,7 @@ WORD EpdBase::Epd2U::PrepareForIssue() /// DeIssue and close /// /// -WORD EpdBase::Epd2U::DeIssue() +WORD EpdBase::Epd2U::DeIssue(WORD doEndCom) { int rv = 0; ClearDoseRV = ClearTotalDoseRV = ClearPeakRatesRV = DeIssueEpdRV = 0; @@ -520,14 +521,14 @@ WORD EpdBase::Epd2U::DeIssue() } if (CommitRV ) { - CloseAndSignal(EndSessionControl, 12); + CloseAndSignal(EndSessionControl, 12, doEndCom); rv = 0; } else { FlushBuffers(port); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); - CloseAndSignal(EndSessionControl, 40); + CloseAndSignal(EndSessionControl, 40,doEndCom); rv = ErrorReason; } return rv; @@ -536,7 +537,7 @@ WORD EpdBase::Epd2U::DeIssue() /// /// /// O = OK -WORD EpdBase::Epd2U::Issue() +WORD EpdBase::Epd2U::Issue(WORD doEndCom) { int rv=0; IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0; @@ -569,35 +570,40 @@ WORD EpdBase::Epd2U::Issue() OKRV = Commit(); if (!VersionOK) Sleep(1500); } - CloseAndSignal(EndSessionControl, 12); + CloseAndSignal(EndSessionControl, 12, doEndCom); rv = 0; } else { FlushBuffers(port); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); - CloseAndSignal(EndSessionControl, 40); + CloseAndSignal(EndSessionControl, 40, doEndCom); rv = 1; } return rv; } +//main exit function +//does endcom at end int EpdBase::Epd2U::GetAllDeissue() { int rv = 0; rv = ReadDoses(); //0 = success //rv = ReadTresHolds(); //tresholds not needed, only doses rv = EPDReadExtraStatus(); - rv = DeIssue(); //does close + rv = DeIssue(true); //does close return rv; } + +//main get dos function +//does endcom at end int EpdBase::Epd2U::GetAll(bool Closeconnection) { int rv = 0; rv = ReadDoses(); //0 = success rv = ReadTresHolds(); //0 = success Tresholds needed - if (Closeconnection) Close(); + if (Closeconnection) Close(1); return rv; } @@ -622,6 +628,8 @@ int EpdBase::Epd2U::ConnectAndStatus(int tokenSourceTimeoutms) return rv; } +// main EPD-issue function +// does endcom at the end int EpdBase::Epd2U::IssueAndCheck(float gain) { //chirp not supported @@ -638,7 +646,7 @@ int EpdBase::Epd2U::IssueAndCheck(float gain) } } rv = PrepareForIssue(); - rv = Issue(); // data already loaded + rv = Issue(true); // data already loaded return rv; error: return rv; diff --git a/EpdBase/EpdBase.h b/EpdBase/EpdBase.h index 29df418..7dfe9c3 100644 --- a/EpdBase/EpdBase.h +++ b/EpdBase/EpdBase.h @@ -220,8 +220,8 @@ namespace EpdBase BYTE ConnectTimerFired; int StartDiscover(int EpdTimeout); int Open(DWORD DeviceID); - void Close(); - int CloseAndSignal(WORD EndSessionControl, WORD duration); + void Close(WORD doEndCom); + int CloseAndSignal(WORD EndSessionControl, WORD duration, WORD doEndCom); void DecodeFunctionFlags(); void DecodeStatus(); @@ -244,8 +244,8 @@ namespace EpdBase WORD ClearAlarms(); WORD PrepareForIssue(); - WORD DeIssue(); - WORD Issue(); + WORD DeIssue(WORD doEndCom); + WORD Issue(WORD doEndCom); int GetAll(bool Close); int GetAllDeissue(); ~Epd2U(); diff --git a/EpdBase3/Epd3Base.cpp b/EpdBase3/Epd3Base.cpp index 4e76904..48bfea1 100644 --- a/EpdBase3/Epd3Base.cpp +++ b/EpdBase3/Epd3Base.cpp @@ -1532,6 +1532,8 @@ error: return r; } +//main get dose function +//close com at end int Epd3Base::Epd3U::GetAll(bool Closeconnection) { int rv = 0, step = 1; @@ -1543,6 +1545,7 @@ int Epd3Base::Epd3U::GetAll(bool Closeconnection) } // Main entry point deissue for MK3 +// close com at then int Epd3Base::Epd3U::GetAllDeissue(bool reconnect) { int rv = 0; @@ -1562,18 +1565,19 @@ int Epd3Base::Epd3U::GetAllDeissue(bool reconnect) step = 3; rv = DeIssue(); //does close - if (rv) goto error; EndCom(isConnected); + if (rv) goto error; + return rv; error: - EndCom(isConnected); Error = rv; ErrorStep = step; return rv; } // main issue routine +// cloise com at end int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate) { int rv = 0; @@ -1633,17 +1637,14 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate) step = 5; rv = Issue(true); // data already loaded + + EndCom(isConnected); if (rv) goto error; - //debug - /*rv = 1; EPDIssued = 0; goto error;*/ - - - EndCom(isConnected); return rv; error: - EndCom(isConnected); + Error = rv; ErrorStep = step; return rv; diff --git a/eDosStation/App.config b/eDosStation/App.config index f0c4d25..e0590ac 100644 --- a/eDosStation/App.config +++ b/eDosStation/App.config @@ -6,11 +6,8 @@ - - + + diff --git a/eDosStation/Properties/AssemblyInfo.cs b/eDosStation/Properties/AssemblyInfo.cs index 3bff275..7e25e3f 100644 --- a/eDosStation/Properties/AssemblyInfo.cs +++ b/eDosStation/Properties/AssemblyInfo.cs @@ -62,5 +62,6 @@ using System.Windows; //2.30 check reset voor OF na EPD verbinding //2.31 extra disconnect/connect //2.32 VS2022 -[assembly: AssemblyVersion("2.33.0.0")] -[assembly: AssemblyFileVersion("2.33.0.0")] +//2.34 close com at end , also MK2 +[assembly: AssemblyVersion("2.34.0.0")] +[assembly: AssemblyFileVersion("2.34.0.0")] diff --git a/eDosStation/Resources/BuildDate.txt b/eDosStation/Resources/BuildDate.txt index 3d10df5..c5900e7 100644 --- a/eDosStation/Resources/BuildDate.txt +++ b/eDosStation/Resources/BuildDate.txt @@ -1 +1 @@ -Fri 09/13/2024 15:19:32.68 +Mon 10/14/2024 7:50:24.36 diff --git a/eDosStation/ShowEPDDose.xaml.cs b/eDosStation/ShowEPDDose.xaml.cs index a84cb4d..d892c2a 100644 --- a/eDosStation/ShowEPDDose.xaml.cs +++ b/eDosStation/ShowEPDDose.xaml.cs @@ -44,7 +44,6 @@ namespace eDosStation } else { - SetTimedOutAndEnd(); } } diff --git a/eDosStation/eDosStation.csproj b/eDosStation/eDosStation.csproj index ab8d798..50d5302 100644 --- a/eDosStation/eDosStation.csproj +++ b/eDosStation/eDosStation.csproj @@ -91,8 +91,8 @@ app.manifest - - ..\packages\LSWLib2.4.0.25\lib\net48\LSWLib.dll + + ..\packages\LSWLib2.4.0.26\lib\net48\LSWLib.dll ..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll @@ -138,7 +138,10 @@ - ..\packages\System.Drawing.Common.8.0.4\lib\net462\System.Drawing.Common.dll + ..\packages\System.Drawing.Common.8.0.8\lib\net462\System.Drawing.Common.dll + + + ..\packages\System.Formats.Asn1.8.0.1\lib\net462\System.Formats.Asn1.dll @@ -171,7 +174,6 @@ ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll True - True @@ -206,8 +208,8 @@ ..\packages\System.Security.Cryptography.ProtectedData.8.0.0\lib\net462\System.Security.Cryptography.ProtectedData.dll - - ..\packages\System.Security.Cryptography.Xml.8.0.0\lib\net462\System.Security.Cryptography.Xml.dll + + ..\packages\System.Security.Cryptography.Xml.8.0.1\lib\net462\System.Security.Cryptography.Xml.dll ..\packages\System.Security.Permissions.8.0.0\lib\net462\System.Security.Permissions.dll @@ -246,6 +248,9 @@ ..\packages\System.Threading.AccessControl.8.0.0\lib\net462\System.Threading.AccessControl.dll + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + diff --git a/eDosStation/packages.config b/eDosStation/packages.config index 87ad711..08a068d 100644 --- a/eDosStation/packages.config +++ b/eDosStation/packages.config @@ -1,12 +1,12 @@  - + - + @@ -26,7 +26,8 @@ - + + @@ -49,7 +50,7 @@ - + @@ -62,6 +63,7 @@ +