Files
HC_APTBS/Models/PumpStatusDefinition.cs
2026-04-11 12:45:18 +02:00

54 lines
1.9 KiB
C#

using System.Collections.Generic;
namespace HC_APTBS.Models
{
/// <summary>
/// Describes how a multi-bit status word returned by the pump ECU should be
/// displayed in the UI. Each <see cref="PumpStatusDefinition"/> maps to one
/// CAN status parameter and contains a set of bit-field <see cref="StatusBit"/>
/// definitions.
/// </summary>
public class PumpStatusDefinition
{
/// <summary>Numeric identifier of this status word.</summary>
public int Id { get; set; }
/// <summary>Display label for the status word group.</summary>
public string Name { get; set; } = "-";
/// <summary>Bit-field definitions within this status word.</summary>
public List<StatusBit> Bits { get; set; } = new();
}
/// <summary>
/// Defines the meaning of a single bit (or bit-group) within a pump status word.
/// </summary>
public class StatusBit
{
/// <summary>Bit position (0-based) within the status word.</summary>
public int Bit { get; set; }
/// <summary>When false, this bit position is ignored in the display.</summary>
public bool Enabled { get; set; } = true;
/// <summary>Possible states and their display colours.</summary>
public List<StatusBitValue> Values { get; set; } = new();
}
/// <summary>
/// A single state value for a <see cref="StatusBit"/>: a numeric state code
/// mapped to a display colour and human-readable description.
/// </summary>
public class StatusBitValue
{
/// <summary>Numeric state (0 or 1 for single-bit fields).</summary>
public int State { get; set; }
/// <summary>HTML hex colour used to paint the indicator (e.g. "26C200" for green).</summary>
public string Color { get; set; } = "26C200";
/// <summary>Human-readable description of this state.</summary>
public string Description { get; set; } = string.Empty;
}
}