diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs index 17eedcdf..f7342a91 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs @@ -212,11 +212,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co /// /// /// - CMD_ADDR_PC, - /// - /// - /// - CMD_EOT + CMD_ADDR_PC } /// @@ -228,15 +224,18 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co /// Individual addressed command with answer /// INDIVIDUAL_WA, + /// /// Individual addressed command without answer /// INDIVIDUAL_NA, + /// /// Broadcast command without answer to address 0 or individual without answer /// BROADCAST } + /// /// Assembly of command information and functional code /// @@ -281,12 +280,13 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co /// /// Combine constant string returns from FM2014 firmware to multilingual information /// - public struct CmdErrorCode + public struct CmdErrorMsg { /// /// Hard coded return string from FM2014 /// public String FM2014ErrorReturnStr; + /// /// Multilingual forwarded string to GUI /// @@ -297,7 +297,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co /// /// /// - public CmdErrorCode(String fixedFwErrorStr, String multilingualFeedback) + public CmdErrorMsg(String fixedFwErrorStr, String multilingualFeedback) { FM2014ErrorReturnStr = fixedFwErrorStr; MultilingualForwardStr = multilingualFeedback; @@ -307,21 +307,57 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co /// /// Table of error codes received from FM2014 /// - public static readonly CmdErrorCode[] CmdErrorCodes = + public static readonly CmdErrorMsg[] CmdErrorCodes = { - new CmdErrorCode ("Parameter is out of range!", Resources.StrCmdRespErrorParamOutOfRange), - new CmdErrorCode ("Command not supported!", Resources.StrCmdRespErrorCmdNotSupported), - new CmdErrorCode ("DUT signal timeout!", Resources.StrCmdRespErrorDutTimeout), - new CmdErrorCode ("REF signal timeout!", Resources.StrCmdRespErrorRefTimeout), - new CmdErrorCode ("Measurement not started!", Resources.StrCmdRespErrorMeasNotStarted), - new CmdErrorCode ("Measurement incomplete!", Resources.StrCmdRespErrorMeasIncomplete) + new CmdErrorMsg ("Parameter is out of range!", Resources.StrCmdRespErrorParamOutOfRange), + new CmdErrorMsg ("Command not supported!", Resources.StrCmdRespErrorCmdNotSupported), + new CmdErrorMsg ("DUT signal timeout!", Resources.StrCmdRespErrorDutTimeout), + new CmdErrorMsg ("REF signal timeout!", Resources.StrCmdRespErrorRefTimeout), + new CmdErrorMsg ("Measurement not started!", Resources.StrCmdRespErrorMeasNotStarted), + new CmdErrorMsg ("Measurement incomplete!", Resources.StrCmdRespErrorMeasIncomplete) }; + /// + /// Command response from FM2014 + /// + public struct CmdResponse + { + /// + /// FM2014 command identifier + /// + public CmdDef CmdId { get; private set; } + + /// + /// Optional raw answer from FM2014 + /// + public String AnswerStr { get; private set; } + + /// + /// Optional integer value + /// + public Int32? IntValue { get; private set; } + + /// + /// Optional double value + /// + public Double? DoubleValue { get; private set; } + + /// + /// Ctor + /// + public CmdResponse(CmdDef cmdId, String answerStr, Int32? intValue = null, Double? doubleValue = null) + { + CmdId = cmdId; + AnswerStr = answerStr; + IntValue = intValue; + DoubleValue = doubleValue; + } + } /// /// Resolution of FM2014 timer for measurement of pulse width /// - public const Double FM2014TimerResolution_s = 334e-6; + public const Double FM2014_TMR_RESOLUTION_s = 334e-6; /// /// FM2014 Ascii string delimiter @@ -423,8 +459,38 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co public static Char GetCmdChar(CmdDef cmdName) { return (from ct in CmdTbl - where ct.CmdName == cmdName - select ct.CmdCodeChar).FirstOrDefault(); + where ct.CmdName == cmdName + select ct.CmdCodeChar).FirstOrDefault(); + } + + /// + /// Get the information string + /// + /// + /// Multilingual information string + /// + /// - Initial. + /// + public static String GetCmdInfo(CmdDef cmdName) + { + return (from ct in CmdTbl + where ct.CmdName == cmdName + select ct.CmdInfoStr).FirstOrDefault(); + } + + /// + /// Get the command type like addressing to individual with and without answer or broadcast + /// + /// + /// command type + /// + /// - Initial. + /// + public static CmdType GetCmdCmdType(CmdDef cmdName) + { + return (from ct in CmdTbl + where ct.CmdName == cmdName + select ct.CmdType).FirstOrDefault(); } } } diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/EventArgs/FM2014AnswerEventArgs.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/EventArgs/FM2014AnswerEventArgs.cs deleted file mode 100644 index f6868618..00000000 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/EventArgs/FM2014AnswerEventArgs.cs +++ /dev/null @@ -1,110 +0,0 @@ -/****************************************************************************************/ -/*!@file FM2014AnswerEventArgs.cs - * @brief The answer from the FM2014. - * - *=======================================================================================\n - * @copyright - * - *_______________________________________________________________________________________\n - * Copyright (c) 2026 SENSUS GmbH.\n - * All Rights Reserved.\n - * \n - * Confidential property of\n - * SENSUS GmbH,\n - * Meineckestr. 10, 30880 LAATZEN, GERMANY\n - * \n - *=======================================================================================\n - * @authors - * - *_______________________________________________________________________________________\n - * Thomas Wiedebusch\n - * - * - *=======================================================================================\n - * @version - * - *_______________________________________________________________________________________\n - * V1.00 08-Jan-2026 by Thomas Wiedebusch\n - * - Initial. - * - * - *=======================================================================================\n - */ -using System; -using Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Consts; -using Xylem.Common.CommonCore.Consts; - -namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.EventArgs -{ - /// - /// Process progress to feed the progress bar. - /// - public class FM2014AnswerEventArgs : System.EventArgs - { - /// - /// The process progress shall feed the GUI progress bars with values - /// - public enum ProcessInfo - { - /// - /// Overall progress max limit for a bunch of processes - /// - MaxOverallProcessSteps, - /// - /// Progress of a bunch of processes meaning single process finished - /// - OverallProcessesSteps, - /// - /// Actual progress max limit for subordinated process - /// - MaxActualProcessSteps, - /// - /// Actual progress step of subordinated process - /// - ActualProcessSteps, - /// - /// Feedback a received message from FM2014 - /// - ReceivedMessage - } - - /// - /// FM2014 command identifier - /// - public FM2014CmdDef.CmdDef CmdId { get; private set; } - /// - /// Optional raw answer from FM2014 - /// - public String AnswerStr { get; private set; } - /// - /// Optional integer value - /// - public Int32? IntValue { get; private set; } - /// - /// Setup of progress type for progress bar or informational display - /// - public ProcessInfo ProgressInfo { get; private set; } - /// - /// Answer status - /// - public StatusReturn StatusReturn { get; private set; } - - /// - /// Event arguments delivering answer code and message and optional a value and progress type - /// - /// FM2014 command id - /// Optional raw answer from FM2014 - /// Optional integer value - /// Setup of progress type for progress bar - /// Status of the answer - public FM2014AnswerEventArgs(FM2014CmdDef.CmdDef cmdId, String answerStr = null, Int32? intValue = null, - ProcessInfo info = ProcessInfo.ReceivedMessage, StatusReturn status = StatusReturn.Unknown) - { - CmdId = cmdId; - AnswerStr = answerStr; - IntValue = intValue; - ProgressInfo = info; - StatusReturn = status; - } - } -} diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj index 0800fff0..55565179 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014Core.csproj @@ -283,7 +283,6 @@ - @@ -336,6 +335,7 @@ Designer + diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs index 9d70c454..abb6264d 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs @@ -431,7 +431,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Command not supported!. + /// Looks up a localized string similar to Command not supported. /// internal static string StrCmdRespErrorCmdNotSupported { get { @@ -440,7 +440,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to DUT signal timeout!. + /// Looks up a localized string similar to DUT signal timeout. /// internal static string StrCmdRespErrorDutTimeout { get { @@ -449,7 +449,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measurement incomplete!. + /// Looks up a localized string similar to Measurement incomplete. /// internal static string StrCmdRespErrorMeasIncomplete { get { @@ -458,7 +458,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measurement not started!. + /// Looks up a localized string similar to Measurement not started. /// internal static string StrCmdRespErrorMeasNotStarted { get { @@ -467,7 +467,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Parameter is out of range!. + /// Looks up a localized string similar to Parameter is out of range. /// internal static string StrCmdRespErrorParamOutOfRange { get { @@ -476,7 +476,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to REF signal timeout!. + /// Looks up a localized string similar to REF signal timeout. /// internal static string StrCmdRespErrorRefTimeout { get { diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx index d40d8a30..0fe35e8a 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx @@ -178,22 +178,22 @@ Einstellung REF Impulse pro Volumeneinheit - Parameterbereichsüberschreitung! + Parameterbereichsüberschreitung - Messung noch nicht beendet! + Messung noch nicht beendet - DUT Signaltimeout! + DUT Signaltimeout - REF Signaltimeout! + REF Signaltimeout - Messung nicht gestartet! + Messung nicht gestartet - Kommando nicht unterstützt! + Kommando nicht unterstützt diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx index 4729387b..3c2b6c6a 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx @@ -178,22 +178,22 @@ Set REF pulses per volume - Parameter is out of range! + Parameter is out of range - Measurement incomplete! + Measurement incomplete - DUT signal timeout! + DUT signal timeout - REF signal timeout! + REF signal timeout - Measurement not started! + Measurement not started - Command not supported! + Command not supported diff --git a/Common/Utils/ProcessExec/packages.config b/Common/Utils/ProcessExec/Const/packages.config similarity index 100% rename from Common/Utils/ProcessExec/packages.config rename to Common/Utils/ProcessExec/Const/packages.config diff --git a/Common/Utils/ProcessExec/EventArguments/ProcessExecEventArgs.cs b/Common/Utils/ProcessExec/EventArguments/ProcessExecEventArgs.cs index 8899e926..93a53d25 100644 --- a/Common/Utils/ProcessExec/EventArguments/ProcessExecEventArgs.cs +++ b/Common/Utils/ProcessExec/EventArguments/ProcessExecEventArgs.cs @@ -30,21 +30,31 @@ namespace Xylem.Common.Utils.ProcessExec.EventArguments public Double? ActualProcessPercent { get; } /// - /// Single process percentage 0..100 + /// Status of message /// public StatusReturn StatusReturn { get; } + /// + /// Object containing specific information + /// + public Object SpecificInfoObj { get; } + /// /// Ctor /// - /// - /// - /// - /// - /// + /// Message for overall process + /// Internal limited to 0..100 % + /// Message for actual subprocess + /// Internal limited to 0..100 % + /// Status information + /// Specific information as object + /// + /// - Object as specific information. + /// public ProcessExecEventArgs(String overallProcessMessage, Double? overallProcessPercent = null, String actualProcessMessage = null, - Double? actualProcessPercent = null, StatusReturn statusReturn = StatusReturn.Unknown) + Double? actualProcessPercent = null, StatusReturn statusReturn = StatusReturn.Unknown, + Object specificInfoObj = null) { OverallProcessMessage = overallProcessMessage; ActualProcessMessage = actualProcessMessage; @@ -53,6 +63,7 @@ namespace Xylem.Common.Utils.ProcessExec.EventArguments ActualProcessPercent = actualProcessPercent > 100.0 ? 100.0 : actualProcessPercent; ActualProcessPercent = ActualProcessPercent < 0 ? 0 : ActualProcessPercent; StatusReturn = statusReturn; + SpecificInfoObj = specificInfoObj; } } } diff --git a/Common/Utils/ProcessExec/ProcessExec.csproj b/Common/Utils/ProcessExec/ProcessExec.csproj index 42e92d48..ae3a7313 100644 --- a/Common/Utils/ProcessExec/ProcessExec.csproj +++ b/Common/Utils/ProcessExec/ProcessExec.csproj @@ -104,11 +104,10 @@ - - + diff --git a/MiniPrf/MiniPrf.sln b/MiniPrf/MiniPrf.sln index 12955427..5eabe8b7 100644 --- a/MiniPrf/MiniPrf.sln +++ b/MiniPrf/MiniPrf.sln @@ -44,6 +44,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Protocols", "Protocols", "{ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortCore", "..\Common\Hardware\Interfaces\Ports\PortCore\PortCore.csproj", "{2E139F63-B6FE-4EA9-A098-85364FE9B26C}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{DBC8FF8D-D0A2-4C55-B7D5-F7D17CCEE01F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessExec", "..\Common\Utils\ProcessExec\ProcessExec.csproj", "{2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -74,6 +78,10 @@ Global {2E139F63-B6FE-4EA9-A098-85364FE9B26C}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E139F63-B6FE-4EA9-A098-85364FE9B26C}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E139F63-B6FE-4EA9-A098-85364FE9B26C}.Release|Any CPU.Build.0 = Release|Any CPU + {2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -94,6 +102,7 @@ Global {83A52B6E-DB81-4B43-B5C1-F9B637D135BE} = {14FE7B6A-2029-4DCD-AD07-2BDF77D42D94} {4E27EA04-8B52-4681-BB5E-4658BC3FF9A6} = {14FE7B6A-2029-4DCD-AD07-2BDF77D42D94} {2E139F63-B6FE-4EA9-A098-85364FE9B26C} = {83A52B6E-DB81-4B43-B5C1-F9B637D135BE} + {2FD60CF1-45CD-4060-B8E5-4F39FBA7F1CB} = {DBC8FF8D-D0A2-4C55-B7D5-F7D17CCEE01F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B72A8444-29F9-4FA4-82BE-B6E230750911}