44 lines
2.5 KiB
C#
44 lines
2.5 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Instance;
|
|
|
|
/// <summary>
|
|
/// Request to write a SET of data-sourced attributes on one instance to the device in a
|
|
/// single DCL batch round-trip, optionally followed by a trigger-flag attribute write.
|
|
/// The Instance Actor resolves each attribute's data binding (connection + device tag
|
|
/// path), decodes List values, enforces single-connection scope, and forwards one
|
|
/// <c>WriteTagBatchRequest</c> to the DCL. This is the write half of the script-facing
|
|
/// <c>Attributes.WriteBatchAndWaitAsync</c> helper; the wait half reuses the existing
|
|
/// event-driven <c>WaitForAttribute</c> waiter.
|
|
///
|
|
/// <para>
|
|
/// <b>Site-local only.</b> Values are carried codec-ENCODED (strings), so this message
|
|
/// would serialize — but the helper composing it issues the wait via the in-process
|
|
/// predicate-capable <c>WaitForAttribute</c> path, so the whole flow stays within one
|
|
/// site node's actor system (script execution → Instance Actor → DCL).
|
|
/// </para>
|
|
/// </summary>
|
|
/// <param name="CorrelationId">Per-write correlation id; echoed on the response.</param>
|
|
/// <param name="InstanceName">The instance whose attributes are written.</param>
|
|
/// <param name="AttributeEncodedValues">Canonical (scope-resolved) attribute name → codec-encoded value.</param>
|
|
/// <param name="TriggerAttribute">Optional canonical attribute name of a flag written AFTER the batch; null to skip.</param>
|
|
/// <param name="TriggerEncodedValue">Codec-encoded value for <paramref name="TriggerAttribute"/>.</param>
|
|
/// <param name="OccurredAtUtc">When the request was issued (UTC).</param>
|
|
public record WriteAttributeBatchRequest(
|
|
string CorrelationId,
|
|
string InstanceName,
|
|
IReadOnlyDictionary<string, string?> AttributeEncodedValues, // canonical attr name -> codec-encoded value
|
|
string? TriggerAttribute,
|
|
string? TriggerEncodedValue,
|
|
DateTimeOffset OccurredAtUtc);
|
|
|
|
/// <summary>
|
|
/// Reply to a <see cref="WriteAttributeBatchRequest"/>. <see cref="Success"/> is true only
|
|
/// when the DCL batch (and trigger, if any) all committed.
|
|
/// </summary>
|
|
/// <param name="CorrelationId">Echoes the request's correlation id.</param>
|
|
/// <param name="Success">True when the batch (and trigger, if any) all committed at the device.</param>
|
|
/// <param name="ErrorMessage">Non-null on failure — an unresolved/non-data-sourced attribute, a multi-connection batch, a list-decode failure, or the DCL error/timeout.</param>
|
|
public record WriteAttributeBatchResponse(
|
|
string CorrelationId,
|
|
bool Success,
|
|
string? ErrorMessage);
|