86 lines
3.2 KiB
C#
86 lines
3.2 KiB
C#
namespace TBF.Rig.RegisterReaders.iPerlASICReader.communication.C4.diagnosticLed.parserer
|
||
{
|
||
/// <summary>
|
||
/// Base class for all Diagnostic LED data frames.
|
||
///
|
||
/// <para>
|
||
/// The iPERL meter emits diagnostic LED frames when the
|
||
/// Diagnostic LED is enabled using the
|
||
/// <c>Set Diagnostic LED State (0xFD 0x60)</c> command.
|
||
/// </para>
|
||
///
|
||
/// <para>
|
||
/// All diagnostic LED states (State #1 – State #7) share a common
|
||
/// set of leading fields, followed by state-specific extensions.
|
||
/// This class represents those common fields.
|
||
/// </para>
|
||
///
|
||
/// <list type="table">
|
||
/// <listheader>
|
||
/// <term>Pos</term>
|
||
/// <description>Common field description</description>
|
||
/// </listheader>
|
||
/// <item><term>0 – xxxxxx</term><description>Signed 24-bit ADC value (two’s 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>
|
||
/// </list>
|
||
///
|
||
/// <para>
|
||
/// Each derived state class parses additional fields starting at
|
||
/// position 5, according to the selected diagnostic LED state.
|
||
/// </para>
|
||
///
|
||
/// <para>
|
||
/// The raw ASCII line (including checksum and CRLF) is preserved
|
||
/// for logging, debugging, and offline analysis.
|
||
/// </para>
|
||
/// </summary>
|
||
public abstract class DiagnosticLedData
|
||
{
|
||
/// <summary>
|
||
/// Raw diagnostic LED line exactly as received from the meter,
|
||
/// including checksum and CRLF.
|
||
/// </summary>
|
||
public string RawLine { get; }
|
||
|
||
// ----- Common fields (present in all LED states) -----
|
||
|
||
/// <summary>
|
||
/// Signed 24-bit ADC value (two’s complement).
|
||
/// </summary>
|
||
public int Adc24 { get; protected set; }
|
||
|
||
/// <summary>
|
||
/// Unsigned 16-bit field strength in internal (non-legacy) units.
|
||
/// </summary>
|
||
public ushort FieldStrength { get; protected set; }
|
||
|
||
/// <summary>
|
||
/// Signed 16-bit raw flow rate in units of ¼ milliliter per bit.
|
||
/// </summary>
|
||
public short RawFlow { get; protected set; }
|
||
|
||
/// <summary>
|
||
/// Unsigned 24-bit raw volume accumulation in units of ¼ milliliter per bit.
|
||
/// </summary>
|
||
public uint RawVolume { get; protected set; }
|
||
|
||
/// <summary>
|
||
/// Unsigned 16-bit millivolt delta measured on the field drive capacitor.
|
||
/// </summary>
|
||
public ushort CapacitorMv { get; protected set; }
|
||
|
||
/// <summary>
|
||
/// Initializes the base diagnostic LED data with the raw input line.
|
||
/// </summary>
|
||
/// <param name="raw">
|
||
/// Raw ASCII line received from the diagnostic LED output.
|
||
/// </param>
|
||
protected DiagnosticLedData(string raw)
|
||
{
|
||
RawLine = raw;
|
||
}
|
||
}
|
||
} |