tbf/TBF/Rig/RegisterReaders/iPerlASICReader/communication/C4/diagnosticLed/parserer/DiagnosticLedState1Data.cs

40 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using TBF.Rig.RegisterReaders.iPerlASICReader.communication.C4.diagnosticLed.utils;
namespace TBF.Rig.RegisterReaders.iPerlASICReader.communication.C4.diagnosticLed.parserer
{
/// <summary>
/// Diagnostic LED State #1 data frame.
///
/// <para>
/// Frame format: TAB-separated ASCII hexadecimal fields, terminated by CRLF.
/// The checksum is an 8-bit sum of all previous ASCII bytes including
/// the TAB character before the checksum field.
/// </para>
///
/// <list type="table">
/// <listheader>
/// <term>Pos</term>
/// <description>Field description</description>
/// </listheader>
/// <item><term>0 xxxxxx</term><description>Signed 24-bit ADC value (twos complement)</description></item>
/// <item><term>1 aaaa</term><description>Unsigned 16-bit field strength (internal units)</description></item>
/// <item><term>2 yyyy</term><description>Signed 16-bit raw flow rate (¼ ml per bit)</description></item>
/// <item><term>3 vvvvvv</term><description>Unsigned 24-bit raw volume accumulation (¼ ml per bit)</description></item>
/// <item><term>4 cccc</term><description>Unsigned 16-bit millivolt delta on the field drive capacitor</description></item>
/// <item><term>5 ss</term><description>Unsigned 8-bit checksum (sum of all previous ASCII bytes
/// including the TAB before the checksum field)</description></item>
/// </list>
/// </summary>
public class DiagnosticLedState1Data : DiagnosticLedData
{
public DiagnosticLedState1Data(string raw, string[] f)
: base(raw)
{
Adc24 = DiagnosticHex.ParseInt24(f[0]);
FieldStrength = DiagnosticHex.ParseUInt16(f[1]);
RawFlow = DiagnosticHex.ParseInt16(f[2]);
RawVolume = DiagnosticHex.ParseUInt24(f[3]);
CapacitorMv = DiagnosticHex.ParseUInt16(f[4]);
}
}
}