review(Driver.AbCip): thread ElementCount/IsArray through factory tag DTOs
Cross-module fix from the review sweep. -018 (Medium): AbCipTagDto/AbCipMemberDto dropped elementCount/isArray, so driver-config-authored array tags read as a single scalar. Added the two optional JSON fields (additive; missing -> scalar as before) threaded into the tag def + TDD.
This commit is contained in:
@@ -104,9 +104,13 @@ public static class AbCipDriverFactoryExtensions
|
||||
DataType: ParseEnum<AbCipDataType>(m.DataType, t.Name, driverInstanceId,
|
||||
$"Members[{m.Name}].DataType"),
|
||||
Writable: m.Writable ?? true,
|
||||
WriteIdempotent: m.WriteIdempotent ?? false))]
|
||||
WriteIdempotent: m.WriteIdempotent ?? false,
|
||||
ElementCount: m.ElementCount is > 0 ? m.ElementCount.Value : 1,
|
||||
IsArray: m.IsArray))]
|
||||
: null,
|
||||
SafetyTag: t.SafetyTag ?? false);
|
||||
SafetyTag: t.SafetyTag ?? false,
|
||||
ElementCount: t.ElementCount is > 0 ? t.ElementCount.Value : 1,
|
||||
IsArray: t.IsArray);
|
||||
|
||||
private static T ParseEnum<T>(string? raw, string? tagName, string driverInstanceId, string field,
|
||||
T? fallback = null) where T : struct, Enum
|
||||
@@ -243,6 +247,20 @@ public static class AbCipDriverFactoryExtensions
|
||||
/// Gets or sets whether this is a safety tag.
|
||||
/// </summary>
|
||||
public bool? SafetyTag { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the explicit 1-D array signal — <c>true</c> ⟺ the tag is an array (even a
|
||||
/// 1-element one). Mirrors <c>AbCipTagDefinition.IsArray</c>; optional (absent ⇒ scalar).
|
||||
/// </summary>
|
||||
[JsonPropertyName("isArray")]
|
||||
public bool IsArray { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of elements for a 1-D array tag; <c>1</c> (or absent) for a scalar.
|
||||
/// Mirrors <c>AbCipTagDefinition.ElementCount</c>; only positive values are honoured.
|
||||
/// </summary>
|
||||
[JsonPropertyName("elementCount")]
|
||||
public int? ElementCount { get; init; }
|
||||
}
|
||||
|
||||
internal sealed class AbCipMemberDto
|
||||
@@ -266,6 +284,20 @@ public static class AbCipDriverFactoryExtensions
|
||||
/// Gets or sets whether write is idempotent.
|
||||
/// </summary>
|
||||
public bool? WriteIdempotent { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the explicit 1-D array signal for the member — <c>true</c> ⟺ the member is
|
||||
/// an array (even a 1-element one). Mirrors <c>AbCipStructureMember.IsArray</c>; optional.
|
||||
/// </summary>
|
||||
[JsonPropertyName("isArray")]
|
||||
public bool IsArray { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of elements for a 1-D array member; <c>1</c> (or absent) for a
|
||||
/// scalar. Mirrors <c>AbCipStructureMember.ElementCount</c>; only positive values are honoured.
|
||||
/// </summary>
|
||||
[JsonPropertyName("elementCount")]
|
||||
public int? ElementCount { get; init; }
|
||||
}
|
||||
|
||||
internal sealed class AbCipProbeDto
|
||||
|
||||
Reference in New Issue
Block a user