This commit is contained in:
Stoyan Zlatev
2024-11-13 11:24:22 +01:00
6 changed files with 18 additions and 9 deletions
@@ -152,8 +152,8 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
{
case "@l":
//protocol @m starts with all contents of protocol @l and contains additional fields
//which needn't to be decoded as those are used for DEBUG
case "@m":
//which needn't be decoded as those are used for DEBUG
case "@n":
if (rawRecordIsValid || !_ignoreCorruptedData)
{
DecodeProtocolL(ref _dataMagFluxRec, rawMsgFields);
@@ -189,13 +189,17 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
/// <remarks date="2023-Jun-07" author="T.Wiedebusch">
/// - Reverse volume multiplied with -1.0 as the test bench expects a negative value for reverse volume.
/// </remarks>
/// <remarks date="2024-Oct-28" author="T.Wiedebusch">
/// - CRC is the last field of the data stream as new protocol "@n" is dynamic of size while the beginning
/// is identical to "@l".
/// </remarks>
private static void DecodeProtocolL(ref MagFluxRecord dataMagFluxRec, IList<String> fields)
{
// time stamp attachment
dataMagFluxRec.DecodedTime = DateTimeOffset.UtcNow;
// extract received CRC
dataMagFluxRec.Crc = UInt16.Parse(fields[(Int32)ProtLsubString.Crc], NumberStyles.HexNumber);
dataMagFluxRec.Crc = UInt16.Parse(fields[fields.Count - 1], NumberStyles.HexNumber);
// build result values
dataMagFluxRec.ForwardVolumeCm = UInt64.Parse(fields[(Int32)ProtLsubString.FwdVolume],
@@ -226,7 +230,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
/// field position in protocol 'l' (small 'L')
private enum ProtLsubString
{
//do not remove this needed for position in record and it is sorted
// Sorted to "@l" field positions.
ProtType,
FwdVolume,
RevVolume,
@@ -234,8 +238,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
FlowRate,
StatusBits,
UniqueId,
SensorId,
Crc
SensorId
}
}
}
@@ -1 +1 @@
89102b0142e574de38a9f47d370f3334e5e6c268
8fbe991b217e7692af4817ad205b768685aa5a72