FM2014: - extended

This commit is contained in:
Thomas Wiedebusch 2026-01-10 11:52:39 +01:00
parent 8aa977e28d
commit c9973301f2
10 changed files with 130 additions and 155 deletions

View File

@ -212,11 +212,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// <summary>
///
/// </summary>
CMD_ADDR_PC,
/// <summary>
///
/// </summary>
CMD_EOT
CMD_ADDR_PC
}
/// <summary>
@ -228,15 +224,18 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// Individual addressed command with answer
/// </summary>
INDIVIDUAL_WA,
/// <summary>
/// Individual addressed command without answer
/// </summary>
INDIVIDUAL_NA,
/// <summary>
/// Broadcast command without answer to address 0 or individual without answer
/// </summary>
BROADCAST
}
/// <summary>
/// Assembly of command information and functional code
/// </summary>
@ -281,12 +280,13 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// <summary>
/// Combine constant string returns from FM2014 firmware to multilingual information
/// </summary>
public struct CmdErrorCode
public struct CmdErrorMsg
{
/// <summary>
/// Hard coded return string from FM2014
/// </summary>
public String FM2014ErrorReturnStr;
/// <summary>
/// Multilingual forwarded string to GUI
/// </summary>
@ -297,7 +297,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// </summary>
/// <param name="fixedFwErrorStr"></param>
/// <param name="multilingualFeedback"></param>
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
/// <summary>
/// Table of error codes received from FM2014
/// </summary>
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)
};
/// <summary>
/// Command response from FM2014
/// </summary>
public struct CmdResponse
{
/// <summary>
/// FM2014 command identifier
/// </summary>
public CmdDef CmdId { get; private set; }
/// <summary>
/// Optional raw answer from FM2014
/// </summary>
public String AnswerStr { get; private set; }
/// <summary>
/// Optional integer value
/// </summary>
public Int32? IntValue { get; private set; }
/// <summary>
/// Optional double value
/// </summary>
public Double? DoubleValue { get; private set; }
/// <summary>
/// Ctor
/// </summary>
public CmdResponse(CmdDef cmdId, String answerStr, Int32? intValue = null, Double? doubleValue = null)
{
CmdId = cmdId;
AnswerStr = answerStr;
IntValue = intValue;
DoubleValue = doubleValue;
}
}
/// <summary>
/// Resolution of FM2014 timer for measurement of pulse width
/// </summary>
public const Double FM2014TimerResolution_s = 334e-6;
public const Double FM2014_TMR_RESOLUTION_s = 334e-6;
/// <summary>
/// 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();
}
/// <summary>
/// Get the information string
/// </summary>
/// <param name="cmdName"></param>
/// <returns>Multilingual information string</returns>
/// <remarks date="2026-Jan-10" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
public static String GetCmdInfo(CmdDef cmdName)
{
return (from ct in CmdTbl
where ct.CmdName == cmdName
select ct.CmdInfoStr).FirstOrDefault();
}
/// <summary>
/// Get the command type like addressing to individual with and without answer or broadcast
/// </summary>
/// <param name="cmdName"></param>
/// <returns>command type</returns>
/// <remarks date="2026-Jan-10" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
public static CmdType GetCmdCmdType(CmdDef cmdName)
{
return (from ct in CmdTbl
where ct.CmdName == cmdName
select ct.CmdType).FirstOrDefault();
}
}
}

View File

@ -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
{
/// <summary>
/// Process progress to feed the progress bar.
/// </summary>
public class FM2014AnswerEventArgs : System.EventArgs
{
/// <summary>
/// The process progress shall feed the GUI progress bars with values
/// </summary>
public enum ProcessInfo
{
/// <summary>
/// Overall progress max limit for a bunch of processes
/// </summary>
MaxOverallProcessSteps,
/// <summary>
/// Progress of a bunch of processes meaning single process finished
/// </summary>
OverallProcessesSteps,
/// <summary>
/// Actual progress max limit for subordinated process
/// </summary>
MaxActualProcessSteps,
/// <summary>
/// Actual progress step of subordinated process
/// </summary>
ActualProcessSteps,
/// <summary>
/// Feedback a received message from FM2014
/// </summary>
ReceivedMessage
}
/// <summary>
/// FM2014 command identifier
/// </summary>
public FM2014CmdDef.CmdDef CmdId { get; private set; }
/// <summary>
/// Optional raw answer from FM2014
/// </summary>
public String AnswerStr { get; private set; }
/// <summary>
/// Optional integer value
/// </summary>
public Int32? IntValue { get; private set; }
/// <summary>
/// Setup of progress type for progress bar or informational display
/// </summary>
public ProcessInfo ProgressInfo { get; private set; }
/// <summary>
/// Answer status
/// </summary>
public StatusReturn StatusReturn { get; private set; }
/// <summary>
/// Event arguments delivering answer code and message and optional a value and progress type
/// </summary>
/// <param name="cmdId">FM2014 command id</param>
/// <param name="answerStr">Optional raw answer from FM2014</param>
/// <param name="intValue">Optional integer value</param>
/// <param name="info">Setup of progress type for progress bar</param>
/// <param name="status">Status of the answer</param>
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;
}
}
}

View File

@ -283,7 +283,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="Consts\FM2014CmdDef.cs" />
<Compile Include="EventArgs\FM2014AnswerEventArgs.cs" />
<Compile Include="IFM2014.cs" />
<Compile Include="FM2014.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -336,6 +335,7 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>

View File

@ -431,7 +431,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
/// <summary>
/// Looks up a localized string similar to Command not supported!.
/// Looks up a localized string similar to Command not supported.
/// </summary>
internal static string StrCmdRespErrorCmdNotSupported {
get {
@ -440,7 +440,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
/// <summary>
/// Looks up a localized string similar to DUT signal timeout!.
/// Looks up a localized string similar to DUT signal timeout.
/// </summary>
internal static string StrCmdRespErrorDutTimeout {
get {
@ -449,7 +449,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
/// <summary>
/// Looks up a localized string similar to Measurement incomplete!.
/// Looks up a localized string similar to Measurement incomplete.
/// </summary>
internal static string StrCmdRespErrorMeasIncomplete {
get {
@ -458,7 +458,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
/// <summary>
/// Looks up a localized string similar to Measurement not started!.
/// Looks up a localized string similar to Measurement not started.
/// </summary>
internal static string StrCmdRespErrorMeasNotStarted {
get {
@ -467,7 +467,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
/// <summary>
/// Looks up a localized string similar to Parameter is out of range!.
/// Looks up a localized string similar to Parameter is out of range.
/// </summary>
internal static string StrCmdRespErrorParamOutOfRange {
get {
@ -476,7 +476,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
/// <summary>
/// Looks up a localized string similar to REF signal timeout!.
/// Looks up a localized string similar to REF signal timeout.
/// </summary>
internal static string StrCmdRespErrorRefTimeout {
get {

View File

@ -178,22 +178,22 @@
<value>Einstellung REF Impulse pro Volumeneinheit</value>
</data>
<data name="StrCmdRespErrorParamOutOfRange" xml:space="preserve">
<value>Parameterbereichsüberschreitung!</value>
<value>Parameterbereichsüberschreitung</value>
</data>
<data name="StrCmdRespErrorMeasIncomplete" xml:space="preserve">
<value>Messung noch nicht beendet!</value>
<value>Messung noch nicht beendet</value>
</data>
<data name="StrCmdRespErrorDutTimeout" xml:space="preserve">
<value>DUT Signaltimeout!</value>
<value>DUT Signaltimeout</value>
</data>
<data name="StrCmdRespErrorRefTimeout" xml:space="preserve">
<value>REF Signaltimeout!</value>
<value>REF Signaltimeout</value>
</data>
<data name="StrCmdRespErrorMeasNotStarted" xml:space="preserve">
<value>Messung nicht gestartet!</value>
<value>Messung nicht gestartet</value>
</data>
<data name="StrCmdRespErrorCmdNotSupported" xml:space="preserve">
<value>Kommando nicht unterstützt!</value>
<value>Kommando nicht unterstützt</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="StrCmdMsgDutGetTmr" type="System.Resources.ResXNullRef, System.Windows.Forms">

View File

@ -178,22 +178,22 @@
<value>Set REF pulses per volume</value>
</data>
<data name="StrCmdRespErrorParamOutOfRange" xml:space="preserve">
<value>Parameter is out of range!</value>
<value>Parameter is out of range</value>
</data>
<data name="StrCmdRespErrorMeasIncomplete" xml:space="preserve">
<value>Measurement incomplete!</value>
<value>Measurement incomplete</value>
</data>
<data name="StrCmdRespErrorDutTimeout" xml:space="preserve">
<value>DUT signal timeout!</value>
<value>DUT signal timeout</value>
</data>
<data name="StrCmdRespErrorRefTimeout" xml:space="preserve">
<value>REF signal timeout!</value>
<value>REF signal timeout</value>
</data>
<data name="StrCmdRespErrorMeasNotStarted" xml:space="preserve">
<value>Measurement not started!</value>
<value>Measurement not started</value>
</data>
<data name="StrCmdRespErrorCmdNotSupported" xml:space="preserve">
<value>Command not supported!</value>
<value>Command not supported</value>
</data>
<data name="StrCmdMsgDutGetTmr" xml:space="preserve">
<value />

View File

@ -30,21 +30,31 @@ namespace Xylem.Common.Utils.ProcessExec.EventArguments
public Double? ActualProcessPercent { get; }
/// <summary>
/// Single process percentage 0..100
/// Status of message
/// </summary>
public StatusReturn StatusReturn { get; }
/// <summary>
/// Object containing specific information
/// </summary>
public Object SpecificInfoObj { get; }
/// <summary>
/// Ctor
/// </summary>
/// <param name="overallProcessMessage"></param>
/// <param name="overallProcessPercent"></param>
/// <param name="actualProcessMessage"></param>
/// <param name="actualProcessPercent"></param>
/// <param name="statusReturn"></param>
/// <param name="overallProcessMessage">Message for overall process</param>
/// <param name="overallProcessPercent">Internal limited to 0..100 %</param>
/// <param name="actualProcessMessage">Message for actual subprocess</param>
/// <param name="actualProcessPercent">Internal limited to 0..100 %</param>
/// <param name="statusReturn">Status information</param>
/// <param name="specificInfoObj">Specific information as object</param>
/// <remarks date="2026-Jan-08" author="Thomas Wiedebusch">
/// - Object as specific information.
/// </remarks>
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;
}
}
}

View File

@ -104,11 +104,10 @@
<Compile Include="ProcessExec.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Const\" />
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Const\packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\CommonCore\CommonCore.csproj">

View File

@ -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}