Record
public record TableData : System.ValueType, System.IEquatable<SharpMeter.Core.Models.TableData>

Namespace: SharpMeter.Core.Models

Represents raw data read from a PSEM table.

Inheritance

Inherits from: System.ValueType

Implements: System.IEquatable<SharpMeter.Core.Models.TableData>

Constructors

NameDescription
TableData(ushort TableId, ReadOnlyMemory<byte> Data) Represents raw data read from a PSEM table.

TableData(ushort TableId, ReadOnlyMemory Data)

TableData.TableData(ushort TableId, ReadOnlyMemory<byte> Data)

Represents raw data read from a PSEM table.

Parameters

NameTypeDescription
TableIdushortThe table identifier.
DataReadOnlyMemory<byte>The raw table data bytes.

Properties

NameDescription
Data The raw table data bytes.
DisplayName Gets the display name (e.g., "ST0" or "MT64").
IsManufacturing Gets whether this is a manufacturing table (ID 2048-4095).
IsStandard Gets whether this is a standard table (ID 0-2047).
Length Gets the data length in bytes.
TableId The table identifier.

Data

ReadOnlyMemory<byte> TableData.Data { get; init; }

The raw table data bytes.

DisplayName

string TableData.DisplayName { get; }

Gets the display name (e.g., "ST0" or "MT64").

IsManufacturing

bool TableData.IsManufacturing { get; }

Gets whether this is a manufacturing table (ID 2048-4095).

IsStandard

bool TableData.IsStandard { get; }

Gets whether this is a standard table (ID 0-2047).

Length

int TableData.Length { get; }

Gets the data length in bytes.

TableId

ushort TableData.TableId { get; init; }

The table identifier.

Type Relationships
classDiagram
                    style TableData fill:#f9f,stroke:#333,stroke-width:2px
                    TableData --|> ValueType : inherits
                    TableData ..|> TableData~ : implements
                
View Source
/// <summary>
///     Represents raw data read from a PSEM table.
/// </summary>
/// <param name = "TableId">The table identifier.</param>
/// <param name = "Data">The raw table data bytes.</param>
public readonly record struct TableData(ushort TableId, ReadOnlyMemory<byte> Data)
{
#region Properties
    /// <summary>Gets whether this is a standard table (ID 0-2047).</summary>
    public bool IsStandard => TableId <= PsemConstants.StandardTableMax;
    /// <summary>Gets whether this is a manufacturing table (ID 2048-4095).</summary>
    public bool IsManufacturing => TableId > PsemConstants.StandardTableMax;
    /// <summary>Gets the display name (e.g., "ST0" or "MT64").</summary>
    public string DisplayName => IsStandard ? $"ST{TableId}" : $"MT{TableId - PsemConstants.ManufacturingTableOffset}";
    /// <summary>Gets the data length in bytes.</summary>
    public int Length => Data.Length;
#endregion
}
Was this page helpful?