Associate Galaxy Heidenhain and Modbus driver fields

This commit is contained in:
Joseph Doherty
2026-11-13 20:23:31 -05:00
parent 9be717c0d7
commit c70bc44cd9
9 changed files with 707 additions and 173 deletions
@@ -13,42 +13,45 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">Gateway endpoint</label>
<InputText @bind-Value="_form.Galaxy.GatewayEndpoint" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
<label for="@FieldId("field-01")" class="form-label">Gateway endpoint</label>
<InputText aria-describedby="@FieldIds("field-01-hint")" id="@FieldId("field-01")" @bind-Value="_form.Galaxy.GatewayEndpoint" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
placeholder="https://localhost:5001" />
<div class="form-text">gRPC endpoint of the mxaccessgw process.</div>
<div id="@FieldId("field-01-hint")" class="form-text">gRPC endpoint of the mxaccessgw process.</div>
</div>
<div class="col-md-6">
<label class="form-label">API key secret ref</label>
<InputText @bind-Value="_form.Galaxy.GatewayApiKeySecretRef" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
<label for="@FieldId("field-02")" class="form-label">API key secret ref</label>
<InputText aria-describedby="@FieldIds("field-02-hint")" id="@FieldId("field-02")" @bind-Value="_form.Galaxy.GatewayApiKeySecretRef" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
placeholder="env:OTOPCUA_GALAXY_API_KEY" />
<div class="form-text">Forms: <code>secret:galaxy/NAME</code>, <code>env:OTOPCUA_GALAXY_NAME</code> (or legacy <code>env:GALAXY_MXGW_NAME</code>), <code>dev:KEY</code>. Cleartext is accepted but triggers a startup warning. References outside the Galaxy namespace and <code>file:</code> are refused (#815).</div>
<div id="@FieldId("field-02-hint")" class="form-text">Forms: <code>secret:galaxy/NAME</code>, <code>env:OTOPCUA_GALAXY_NAME</code> (or legacy <code>env:GALAXY_MXGW_NAME</code>), <code>dev:KEY</code>. Cleartext is accepted but triggers a startup warning. References outside the Galaxy namespace and <code>file:</code> are refused (#815).</div>
</div>
<div class="col-md-3">
<div class="form-check form-switch mt-4">
<InputCheckbox @bind-Value="_form.Galaxy.GatewayUseTls" @bind-Value:after="EmitAsync" class="form-check-input" id="gwTls" />
<label class="form-check-label" for="gwTls">Use TLS</label>
<InputCheckbox @bind-Value="_form.Galaxy.GatewayUseTls" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("gwTls")" />
<label class="form-check-label" for="@FieldId("gwTls")">Use TLS</label>
</div>
</div>
<div class="col-md-5">
<label class="form-label">CA certificate path (optional)</label>
<InputText @bind-Value="_form.Galaxy.GatewayCaCertificatePath" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
<label for="@FieldId("field-04")" class="form-label">CA certificate path (optional)</label>
<InputText id="@FieldId("field-04")" @bind-Value="_form.Galaxy.GatewayCaCertificatePath" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
placeholder="C:\certs\ca.pem" />
</div>
<div class="col-md-2">
<label class="form-label">Connect timeout (s)</label>
<InputNumber @bind-Value="_form.Galaxy.GatewayConnectTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 10 s.</div>
<label for="@FieldId("field-05")" class="form-label">Connect timeout (s)</label>
<InputNumber aria-describedby="@FieldIds("field-05-error", "field-05-hint")" id="@FieldId("field-05")" @bind-Value="_form.Galaxy.GatewayConnectTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-05-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.GatewayConnectTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-05-hint")" class="form-text">Default 10 s.</div>
</div>
<div class="col-md-2">
<label class="form-label">Call timeout (s)</label>
<InputNumber @bind-Value="_form.Galaxy.GatewayDefaultCallTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 30 s.</div>
<label for="@FieldId("field-06")" class="form-label">Call timeout (s)</label>
<InputNumber aria-describedby="@FieldIds("field-06-error", "field-06-hint")" id="@FieldId("field-06")" @bind-Value="_form.Galaxy.GatewayDefaultCallTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-06-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.GatewayDefaultCallTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-06-hint")" class="form-text">Default 30 s.</div>
</div>
<div class="col-md-2">
<label class="form-label">Stream timeout (s, 0 = unlimited)</label>
<InputNumber @bind-Value="_form.Galaxy.GatewayStreamTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 0 (lifetime of driver).</div>
<label for="@FieldId("field-07")" class="form-label">Stream timeout (s, 0 = unlimited)</label>
<InputNumber aria-describedby="@FieldIds("field-07-error", "field-07-hint")" id="@FieldId("field-07")" @bind-Value="_form.Galaxy.GatewayStreamTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-07-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.GatewayStreamTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-07-hint")" class="form-text">Default 0 (lifetime of driver).</div>
</div>
</div>
</div>
@@ -60,25 +63,28 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-4">
<label class="form-label">Client name</label>
<InputText @bind-Value="_form.Galaxy.MxClientName" @bind-Value:after="EmitAsync" class="form-control form-control-sm"
<label for="@FieldId("field-08")" class="form-label">Client name</label>
<InputText aria-describedby="@FieldIds("field-08-hint")" id="@FieldId("field-08")" @bind-Value="_form.Galaxy.MxClientName" @bind-Value:after="EmitAsync" class="form-control form-control-sm"
placeholder="OtOpcUa-Primary" />
<div class="form-text">Must be unique per OtOpcUa instance — redundancy pairs each get a distinct name.</div>
<div id="@FieldId("field-08-hint")" class="form-text">Must be unique per OtOpcUa instance — redundancy pairs each get a distinct name.</div>
</div>
<div class="col-md-3">
<label class="form-label">Publishing interval (ms)</label>
<InputNumber @bind-Value="_form.Galaxy.MxPublishingIntervalMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 1000 ms.</div>
<label for="@FieldId("field-09")" class="form-label">Publishing interval (ms)</label>
<InputNumber aria-describedby="@FieldIds("field-09-error", "field-09-hint")" id="@FieldId("field-09")" @bind-Value="_form.Galaxy.MxPublishingIntervalMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-09-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.MxPublishingIntervalMs)" /> }</div>
<div id="@FieldId("field-09-hint")" class="form-text">Default 1000 ms.</div>
</div>
<div class="col-md-2">
<label class="form-label">Write user ID</label>
<InputNumber @bind-Value="_form.Galaxy.MxWriteUserId" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">0 = anonymous.</div>
<label for="@FieldId("field-10")" class="form-label">Write user ID</label>
<InputNumber aria-describedby="@FieldIds("field-10-error", "field-10-hint")" id="@FieldId("field-10")" @bind-Value="_form.Galaxy.MxWriteUserId" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-10-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.MxWriteUserId)" /> }</div>
<div id="@FieldId("field-10-hint")" class="form-text">0 = anonymous.</div>
</div>
<div class="col-md-3">
<label class="form-label">Event pump channel capacity</label>
<InputNumber @bind-Value="_form.Galaxy.MxEventPumpChannelCapacity" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 50000. Raise if events.dropped appears.</div>
<label for="@FieldId("field-11")" class="form-label">Event pump channel capacity</label>
<InputNumber aria-describedby="@FieldIds("field-11-error", "field-11-hint")" id="@FieldId("field-11")" @bind-Value="_form.Galaxy.MxEventPumpChannelCapacity" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-11-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.MxEventPumpChannelCapacity)" /> }</div>
<div id="@FieldId("field-11-hint")" class="form-text">Default 50000. Raise if events.dropped appears.</div>
</div>
</div>
</div>
@@ -95,24 +101,25 @@
</div>
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Fallback user</label>
<InputText @bind-Value="_form.Galaxy.AckFallbackUser" @bind-Value:after="EmitAsync" class="form-control form-control-sm"
<label for="@FieldId("field-12")" class="form-label">Fallback user</label>
<InputText id="@FieldId("field-12")" @bind-Value="_form.Galaxy.AckFallbackUser" @bind-Value:after="EmitAsync" class="form-control form-control-sm"
placeholder="(none — refuse)" />
</div>
<div class="col-md-3">
<label class="form-label">Fallback domain (optional)</label>
<InputText @bind-Value="_form.Galaxy.AckFallbackDomain" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label for="@FieldId("field-13")" class="form-label">Fallback domain (optional)</label>
<InputText id="@FieldId("field-13")" @bind-Value="_form.Galaxy.AckFallbackDomain" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
</div>
<div class="col-md-6">
<label class="form-label">Fallback password secret ref</label>
<InputText @bind-Value="_form.Galaxy.AckFallbackPasswordSecretRef" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
<label for="@FieldId("field-14")" class="form-label">Fallback password secret ref</label>
<InputText aria-describedby="@FieldIds("field-14-hint")" id="@FieldId("field-14")" @bind-Value="_form.Galaxy.AckFallbackPasswordSecretRef" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono"
placeholder="secret:otopcua/galaxy/ack-fallback-password" />
<div class="form-text">Forms: <code>secret:galaxy/NAME</code> or <code>secret:otopcua/galaxy/NAME</code> (production), <code>env:OTOPCUA_GALAXY_NAME</code>, <code>dev:VALUE</code>. A bare literal, <code>file:</code>, or a reference outside the Galaxy namespace is refused (#815).</div>
<div id="@FieldId("field-14-hint")" class="form-text">Forms: <code>secret:galaxy/NAME</code> or <code>secret:otopcua/galaxy/NAME</code> (production), <code>env:OTOPCUA_GALAXY_NAME</code>, <code>dev:VALUE</code>. A bare literal, <code>file:</code>, or a reference outside the Galaxy namespace is refused (#815).</div>
</div>
<div class="col-md-3">
<label class="form-label">Ack confirm timeout (ms)</label>
<InputNumber @bind-Value="_form.Galaxy.AckConfirmTimeoutMs" @bind-Value:after="EmitAsync" min="0" max="120000" class="form-control form-control-sm" />
<div class="form-text">When the gateway sends an ack but cannot confirm it, wait this long for Galaxy's acknowledged transition before reverting the condition to unacknowledged (#869). Default 10000; 0 = do not wait.</div>
<label for="@FieldId("field-15")" class="form-label">Ack confirm timeout (ms)</label>
<InputNumber aria-describedby="@FieldIds("field-15-error", "field-15-hint")" id="@FieldId("field-15")" @bind-Value="_form.Galaxy.AckConfirmTimeoutMs" @bind-Value:after="EmitAsync" min="0" max="120000" class="form-control form-control-sm" />
<div id="@FieldId("field-15-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.AckConfirmTimeoutMs)" /> }</div>
<div id="@FieldId("field-15-hint")" class="form-text">When the gateway sends an ack but cannot confirm it, wait this long for Galaxy's acknowledged transition before reverting the condition to unacknowledged (#869). Default 10000; 0 = do not wait.</div>
</div>
</div>
</div>
@@ -124,16 +131,17 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Discover page size</label>
<InputNumber @bind-Value="_form.Galaxy.RepositoryDiscoverPageSize" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Objects per DiscoverHierarchy page the driver asks the gateway for. Default 5000.</div>
<label for="@FieldId("field-16")" class="form-label">Discover page size</label>
<InputNumber aria-describedby="@FieldIds("field-16-error", "field-16-hint")" id="@FieldId("field-16")" @bind-Value="_form.Galaxy.RepositoryDiscoverPageSize" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-16-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.RepositoryDiscoverPageSize)" /> }</div>
<div id="@FieldId("field-16-hint")" class="form-text">Objects per DiscoverHierarchy page the driver asks the gateway for. Default 5000.</div>
</div>
<div class="col-md-3">
<div class="form-check form-switch mt-4">
<InputCheckbox @bind-Value="_form.Galaxy.RepositoryWatchDeployEvents" @bind-Value:after="EmitAsync" class="form-check-input" id="watchDeploy" />
<label class="form-check-label" for="watchDeploy">Watch deploy events</label>
<InputCheckbox aria-describedby="@FieldIds("watchDeploy-hint")" @bind-Value="_form.Galaxy.RepositoryWatchDeployEvents" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("watchDeploy")" />
<label class="form-check-label" for="@FieldId("watchDeploy")">Watch deploy events</label>
</div>
<div class="form-text mt-0">Triggers address-space rebuild on Galaxy re-deploy.</div>
<div id="@FieldId("watchDeploy-hint")" class="form-text mt-0">Triggers address-space rebuild on Galaxy re-deploy.</div>
</div>
</div>
</div>
@@ -145,19 +153,21 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Initial backoff (ms)</label>
<InputNumber @bind-Value="_form.Galaxy.ReconnectInitialBackoffMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 500 ms.</div>
<label for="@FieldId("field-18")" class="form-label">Initial backoff (ms)</label>
<InputNumber aria-describedby="@FieldIds("field-18-error", "field-18-hint")" id="@FieldId("field-18")" @bind-Value="_form.Galaxy.ReconnectInitialBackoffMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-18-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.ReconnectInitialBackoffMs)" /> }</div>
<div id="@FieldId("field-18-hint")" class="form-text">Default 500 ms.</div>
</div>
<div class="col-md-3">
<label class="form-label">Max backoff (ms)</label>
<InputNumber @bind-Value="_form.Galaxy.ReconnectMaxBackoffMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 30000 ms.</div>
<label for="@FieldId("field-19")" class="form-label">Max backoff (ms)</label>
<InputNumber aria-describedby="@FieldIds("field-19-error", "field-19-hint")" id="@FieldId("field-19")" @bind-Value="_form.Galaxy.ReconnectMaxBackoffMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-19-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.ReconnectMaxBackoffMs)" /> }</div>
<div id="@FieldId("field-19-hint")" class="form-text">Default 30000 ms.</div>
</div>
<div class="col-md-3">
<div class="form-check form-switch mt-4">
<InputCheckbox @bind-Value="_form.Galaxy.ReconnectReplayOnSessionLost" @bind-Value:after="EmitAsync" class="form-check-input" id="replayOnLost" />
<label class="form-check-label" for="replayOnLost">Replay subscriptions on session lost</label>
<InputCheckbox @bind-Value="_form.Galaxy.ReconnectReplayOnSessionLost" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("replayOnLost")" />
<label class="form-check-label" for="@FieldId("replayOnLost")">Replay subscriptions on session lost</label>
</div>
</div>
</div>
@@ -170,9 +180,10 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Admin UI probe timeout (seconds)</label>
<InputNumber @bind-Value="_form.Galaxy.ProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">The Test Connect probe budget (1–60 s). Default 30.</div>
<label for="@FieldId("field-21")" class="form-label">Admin UI probe timeout (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-21-error", "field-21-hint")" id="@FieldId("field-21")" @bind-Value="_form.Galaxy.ProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-21-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.Galaxy.ProbeTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-21-hint")" class="form-text">The Test Connect probe budget (1–60 s). Default 30.</div>
</div>
</div>
</div>
@@ -181,6 +192,11 @@
<DriverResilienceSection ResilienceConfig="@ResilienceConfig" ResilienceConfigChanged="OnResilienceChanged" />
@code {
private readonly string _fieldScope = "galaxy-driver-form-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[CascadingParameter] private Microsoft.AspNetCore.Components.Forms.EditContext? _fieldEditContext { get; set; }
[Parameter] public string DriverConfigJson { get; set; } = "{}";
[Parameter] public EventCallback<string> DriverConfigJsonChanged { get; set; }
[Parameter] public string? ResilienceConfig { get; set; }
@@ -9,22 +9,26 @@
<div style="padding:1rem">
<div class="row">
<div class="col-md-3 mb-3">
<label class="form-label" for="hhTimeout">Transaction timeout (ms)</label>
<InputNumber id="hhTimeout" @bind-Value="_m.TimeoutMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">100–60000. Bounds connect and each complete response. Default 5000.</div>
<label class="form-label" for="@FieldId("hhTimeout")">Transaction timeout (ms)</label>
<InputNumber aria-describedby="@FieldIds("hhTimeout-error", "hhTimeout-hint")" id="@FieldId("hhTimeout")" @bind-Value="_m.TimeoutMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhTimeout-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.TimeoutMs)" /> }</div>
<div id="@FieldId("hhTimeout-hint")" class="form-text">100–60000. Bounds connect and each complete response. Default 5000.</div>
</div>
<div class="col-md-3 mb-3">
<label class="form-label" for="hhReconnect">Reconnect initial delay (ms)</label>
<InputNumber id="hhReconnect" @bind-Value="_m.ReconnectInitialMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label class="form-label" for="@FieldId("hhReconnect")">Reconnect initial delay (ms)</label>
<InputNumber aria-describedby="@FieldId("hhReconnect-error")" id="@FieldId("hhReconnect")" @bind-Value="_m.ReconnectInitialMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhReconnect-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.ReconnectInitialMs)" /> }</div>
</div>
<div class="col-md-3 mb-3">
<label class="form-label" for="hhReconnectMax">Reconnect max delay (ms)</label>
<InputNumber id="hhReconnectMax" @bind-Value="_m.ReconnectMaxMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Backoff doubles from the initial delay up to this ceiling.</div>
<label class="form-label" for="@FieldId("hhReconnectMax")">Reconnect max delay (ms)</label>
<InputNumber aria-describedby="@FieldIds("hhReconnectMax-error", "hhReconnectMax-hint")" id="@FieldId("hhReconnectMax")" @bind-Value="_m.ReconnectMaxMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhReconnectMax-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.ReconnectMaxMs)" /> }</div>
<div id="@FieldId("hhReconnectMax-hint")" class="form-text">Backoff doubles from the initial delay up to this ceiling.</div>
</div>
<div class="col-md-3 mb-3">
<label class="form-label" for="hhProbe">Test Connect timeout (s)</label>
<InputNumber id="hhProbe" @bind-Value="_m.ProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label class="form-label" for="@FieldId("hhProbe")">Test Connect timeout (s)</label>
<InputNumber aria-describedby="@FieldId("hhProbe-error")" id="@FieldId("hhProbe")" @bind-Value="_m.ProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhProbe-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.ProbeTimeoutSeconds)" /> }</div>
</div>
</div>
</div>
@@ -36,38 +40,38 @@
<div class="row">
<div class="col-md-4 mb-3">
<div class="form-check form-switch mt-2">
<InputCheckbox id="hhTelemetry" @bind-Value="_m.TelemetryEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="hhTelemetry">Telemetry reads</label>
<InputCheckbox aria-describedby="@FieldIds("hhTelemetry-hint")" id="@FieldId("hhTelemetry")" @bind-Value="_m.TelemetryEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="@FieldId("hhTelemetry")">Telemetry reads</label>
</div>
<div class="form-text">Execution/program state, program, overrides, axes, tool, alarms. Off = no runtime-info requests.</div>
<div id="@FieldId("hhTelemetry-hint")" class="form-text">Execution/program state, program, overrides, axes, tool, alarms. Off = no runtime-info requests.</div>
</div>
<div class="col-md-4 mb-3">
<div class="form-check form-switch mt-2">
<InputCheckbox id="hhDnc" @bind-Value="_m.DncLoginEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="hhDnc">Optional DNC login</label>
<InputCheckbox aria-describedby="@FieldIds("hhDnc-hint")" id="@FieldId("hhDnc")" @bind-Value="_m.DncLoginEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="@FieldId("hhDnc")">Optional DNC login</label>
</div>
<div class="form-text">A refused DNC login never blocks reads the control permits under INSPECT.</div>
<div id="@FieldId("hhDnc-hint")" class="form-text">A refused DNC login never blocks reads the control permits under INSPECT.</div>
</div>
<div class="col-md-4 mb-3">
<div class="form-check form-switch mt-2">
<InputCheckbox id="hhData" @bind-Value="_m.DataEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="hhData">DATA path reads</label>
<InputCheckbox aria-describedby="@FieldIds("hhData-hint")" id="@FieldId("hhData")" @bind-Value="_m.DataEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="@FieldId("hhData")">DATA path reads</label>
</div>
<div class="form-text">Opt-in DATA login, only when a <span class="mono">DATA:</span> binding needs it (reference-derived; iTNC only).</div>
<div id="@FieldId("hhData-hint")" class="form-text">Opt-in DATA login, only when a <span class="mono">DATA:</span> binding needs it (reference-derived; iTNC only).</div>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label" for="hhInspectPw">INSPECT password ref</label>
<InputText id="hhInspectPw" @bind-Value="_m.InspectPassword" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono" placeholder="secret:heidenhain/inspect" />
<label class="form-label" for="@FieldId("hhInspectPw")">INSPECT password ref</label>
<InputText id="@FieldId("hhInspectPw")" @bind-Value="_m.InspectPassword" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono" placeholder="secret:heidenhain/inspect" />
</div>
<div class="col-md-4 mb-3">
<label class="form-label" for="hhDncPw">DNC password ref</label>
<InputText id="hhDncPw" @bind-Value="_m.DncPassword" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono" placeholder="secret:heidenhain/dnc" />
<label class="form-label" for="@FieldId("hhDncPw")">DNC password ref</label>
<InputText id="@FieldId("hhDncPw")" @bind-Value="_m.DncPassword" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono" placeholder="secret:heidenhain/dnc" />
</div>
<div class="col-md-4 mb-3">
<label class="form-label" for="hhDataPw">DATA password ref</label>
<InputText id="hhDataPw" @bind-Value="_m.DataPassword" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono" placeholder="env:OTOPCUA_HEIDENHAIN_DATA_PASSWORD" />
<label class="form-label" for="@FieldId("hhDataPw")">DATA password ref</label>
<InputText id="@FieldId("hhDataPw")" @bind-Value="_m.DataPassword" @bind-Value:after="EmitAsync" class="form-control form-control-sm mono" placeholder="env:OTOPCUA_HEIDENHAIN_DATA_PASSWORD" />
</div>
</div>
<div class="form-text">References only: blank, <span class="mono">secret:heidenhain/&lt;name&gt;</span> (node secret store) or <span class="mono">env:OTOPCUA_HEIDENHAIN_&lt;NAME&gt;</span>. Resolved at each login; a literal password is refused.</div>
@@ -79,31 +83,36 @@
<div style="padding:1rem">
<div class="row">
<div class="col-md-2 mb-3">
<label class="form-label" for="hhStatus">Status (ms)</label>
<InputNumber id="hhStatus" @bind-Value="_m.StatusMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label class="form-label" for="@FieldId("hhStatus")">Status (ms)</label>
<InputNumber aria-describedby="@FieldId("hhStatus-error")" id="@FieldId("hhStatus")" @bind-Value="_m.StatusMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhStatus-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.StatusMs)" /> }</div>
</div>
<div class="col-md-2 mb-3">
<label class="form-label" for="hhCustom">Custom (ms)</label>
<InputNumber id="hhCustom" @bind-Value="_m.CustomMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label class="form-label" for="@FieldId("hhCustom")">Custom (ms)</label>
<InputNumber aria-describedby="@FieldId("hhCustom-error")" id="@FieldId("hhCustom")" @bind-Value="_m.CustomMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhCustom-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.CustomMs)" /> }</div>
</div>
<div class="col-md-2 mb-3">
<label class="form-label" for="hhSlow">Slow (ms)</label>
<InputNumber id="hhSlow" @bind-Value="_m.SlowMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label class="form-label" for="@FieldId("hhSlow")">Slow (ms)</label>
<InputNumber aria-describedby="@FieldId("hhSlow-error")" id="@FieldId("hhSlow")" @bind-Value="_m.SlowMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhSlow-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.SlowMs)" /> }</div>
</div>
<div class="col-md-2 mb-3">
<label class="form-label" for="hhAlarmMs" title="Cadence of the alarm-list walk behind ALARM: Part 9 conditions; only polled when the control carries an ALARM: tag">Alarm conditions (ms)</label>
<InputNumber id="hhAlarmMs" @bind-Value="_m.AlarmMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label class="form-label" for="@FieldId("hhAlarmMs")" title="Cadence of the alarm-list walk behind ALARM: Part 9 conditions; only polled when the control carries an ALARM: tag">Alarm conditions (ms)</label>
<InputNumber aria-describedby="@FieldId("hhAlarmMs-error")" id="@FieldId("hhAlarmMs")" @bind-Value="_m.AlarmMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhAlarmMs-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.AlarmMs)" /> }</div>
</div>
<div class="col-md-2 mb-3">
<label class="form-label" for="hhAlarms">Max alarms</label>
<InputNumber id="hhAlarms" @bind-Value="_m.MaxAlarms" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<label class="form-label" for="@FieldId("hhAlarms")">Max alarms</label>
<InputNumber aria-describedby="@FieldId("hhAlarms-error")" id="@FieldId("hhAlarms")" @bind-Value="_m.MaxAlarms" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("hhAlarms-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _m.MaxAlarms)" /> }</div>
</div>
<div class="col-md-4 mb-3">
<div class="form-check form-switch mt-4">
<InputCheckbox id="hhTimers" @bind-Value="_m.TimersEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="hhTimers">Experimental timer reads</label>
<InputCheckbox aria-describedby="@FieldIds("hhTimers-hint")" id="@FieldId("hhTimers")" @bind-Value="_m.TimersEnabled" @bind-Value:after="EmitAsync" class="form-check-input" />
<label class="form-check-label" for="@FieldId("hhTimers")">Experimental timer reads</label>
</div>
<div class="form-text">Selectors 30–34. Units/semantics unverified on real controls — confirm before using as durations.</div>
<div id="@FieldId("hhTimers-hint")" class="form-text">Selectors 30–34. Units/semantics unverified on real controls — confirm before using as durations.</div>
</div>
</div>
<div class="form-text">Intervals 100–3600000 ms. OPC reads and subscriptions are served from the cache; sampling cannot exceed these cadences.</div>
@@ -117,6 +126,11 @@
<DriverResilienceSection ResilienceConfig="@ResilienceConfig" ResilienceConfigChanged="OnResilienceChanged" />
@code {
private readonly string _fieldScope = "heidenhain-driver-form-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[CascadingParameter] private Microsoft.AspNetCore.Components.Forms.EditContext? _fieldEditContext { get; set; }
/// <summary>The driver-level DriverConfig JSON.</summary>
[Parameter] public string DriverConfigJson { get; set; } = "{}";
/// <summary>Fired whenever a field changes — enables @bind-DriverConfigJson.</summary>
@@ -14,13 +14,14 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Timeout (seconds)</label>
<InputNumber @bind-Value="_form.TimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 2 s.</div>
<label for="@FieldId("field-01")" class="form-label">Timeout (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-01-error", "field-01-hint")" id="@FieldId("field-01")" @bind-Value="_form.TimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-01-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.TimeoutSeconds)" /> }</div>
<div id="@FieldId("field-01-hint")" class="form-text">Default 2 s.</div>
</div>
<div class="col-md-3">
<label class="form-label">PLC family</label>
<InputSelect @bind-Value="_form.Family" @bind-Value:after="EmitAsync" class="form-select form-select-sm">
<label for="@FieldId("field-02")" class="form-label">PLC family</label>
<InputSelect id="@FieldId("field-02")" @bind-Value="_form.Family" @bind-Value:after="EmitAsync" class="form-select form-select-sm">
@foreach (var e in Enum.GetValues<ModbusFamily>())
{
<option value="@e">@e</option>
@@ -28,29 +29,29 @@
</InputSelect>
</div>
<div class="col-md-3">
<label class="form-label">Transport</label>
<InputSelect @bind-Value="_form.Transport" @bind-Value:after="EmitAsync" class="form-select form-select-sm">
<label for="@FieldId("field-03")" class="form-label">Transport</label>
<InputSelect aria-describedby="@FieldIds("field-03-hint")" id="@FieldId("field-03")" @bind-Value="_form.Transport" @bind-Value:after="EmitAsync" class="form-select form-select-sm">
@foreach (var e in Enum.GetValues<ModbusTransportMode>())
{
<option value="@e">@e</option>
}
</InputSelect>
<div class="form-text">RtuOverTcp = talk raw RTU frames to a serial→Ethernet gateway; must match the gateway's mode.</div>
<div id="@FieldId("field-03-hint")" class="form-text">RtuOverTcp = talk raw RTU frames to a serial→Ethernet gateway; must match the gateway's mode.</div>
</div>
<div class="col-md-3">
<label class="form-label">MELSEC sub-family</label>
<InputSelect @bind-Value="_form.MelsecSubFamily" @bind-Value:after="EmitAsync" class="form-select form-select-sm">
<label for="@FieldId("field-04")" class="form-label">MELSEC sub-family</label>
<InputSelect aria-describedby="@FieldIds("field-04-hint")" id="@FieldId("field-04")" @bind-Value="_form.MelsecSubFamily" @bind-Value:after="EmitAsync" class="form-select form-select-sm">
@foreach (var e in Enum.GetValues<MelsecFamily>())
{
<option value="@e">@e</option>
}
</InputSelect>
<div class="form-text">Only used when Family = MELSEC.</div>
<div id="@FieldId("field-04-hint")" class="form-text">Only used when Family = MELSEC.</div>
</div>
<div class="col-md-3">
<div class="form-check form-switch mt-4">
<InputCheckbox @bind-Value="_form.AutoReconnect" @bind-Value:after="EmitAsync" class="form-check-input" id="autoReconnect" />
<label class="form-check-label" for="autoReconnect">Auto-reconnect</label>
<InputCheckbox @bind-Value="_form.AutoReconnect" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("autoReconnect")" />
<label class="form-check-label" for="@FieldId("autoReconnect")">Auto-reconnect</label>
</div>
</div>
</div>
@@ -63,29 +64,33 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Max registers per read</label>
<InputNumber @bind-Value="_form.MaxRegistersPerRead" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Spec max 125. Reduce for limited devices.</div>
<label for="@FieldId("field-06")" class="form-label">Max registers per read</label>
<InputNumber aria-describedby="@FieldIds("field-06-error", "field-06-hint")" id="@FieldId("field-06")" @bind-Value="_form.MaxRegistersPerRead" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-06-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.MaxRegistersPerRead)" /> }</div>
<div id="@FieldId("field-06-hint")" class="form-text">Spec max 125. Reduce for limited devices.</div>
</div>
<div class="col-md-3">
<label class="form-label">Max registers per write</label>
<InputNumber @bind-Value="_form.MaxRegistersPerWrite" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Spec max 123.</div>
<label for="@FieldId("field-07")" class="form-label">Max registers per write</label>
<InputNumber aria-describedby="@FieldIds("field-07-error", "field-07-hint")" id="@FieldId("field-07")" @bind-Value="_form.MaxRegistersPerWrite" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-07-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.MaxRegistersPerWrite)" /> }</div>
<div id="@FieldId("field-07-hint")" class="form-text">Spec max 123.</div>
</div>
<div class="col-md-3">
<label class="form-label">Max coils per read</label>
<InputNumber @bind-Value="_form.MaxCoilsPerRead" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Spec max 2000.</div>
<label for="@FieldId("field-08")" class="form-label">Max coils per read</label>
<InputNumber aria-describedby="@FieldIds("field-08-error", "field-08-hint")" id="@FieldId("field-08")" @bind-Value="_form.MaxCoilsPerRead" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-08-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.MaxCoilsPerRead)" /> }</div>
<div id="@FieldId("field-08-hint")" class="form-text">Spec max 2000.</div>
</div>
<div class="col-md-3">
<label class="form-label">Max read gap (coalescing)</label>
<InputNumber @bind-Value="_form.MaxReadGap" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">0 = no coalescing. Default 8. Refused ranges fall back per tag.</div>
<label for="@FieldId("field-09")" class="form-label">Max read gap (coalescing)</label>
<InputNumber aria-describedby="@FieldIds("field-09-error", "field-09-hint")" id="@FieldId("field-09")" @bind-Value="_form.MaxReadGap" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-09-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.MaxReadGap)" /> }</div>
<div id="@FieldId("field-09-hint")" class="form-text">0 = no coalescing. Default 8. Refused ranges fall back per tag.</div>
</div>
<div class="col-md-3">
<div class="form-check form-switch mt-4">
<InputCheckbox @bind-Value="_form.DisableReadCoalescing" @bind-Value:after="EmitAsync" class="form-check-input" id="disableCoalescing" />
<label class="form-check-label" for="disableCoalescing">Disable read coalescing</label>
<InputCheckbox @bind-Value="_form.DisableReadCoalescing" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("disableCoalescing")" />
<label class="form-check-label" for="@FieldId("disableCoalescing")">Disable read coalescing</label>
</div>
</div>
</div>
@@ -99,32 +104,32 @@
<div class="row g-3">
<div class="col-md-4">
<div class="form-check form-switch">
<InputCheckbox @bind-Value="_form.UseFC15ForSingleCoilWrites" @bind-Value:after="EmitAsync" class="form-check-input" id="useFC15" />
<label class="form-check-label" for="useFC15">Use FC15 for single coil writes</label>
<InputCheckbox @bind-Value="_form.UseFC15ForSingleCoilWrites" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("useFC15")" />
<label class="form-check-label" for="@FieldId("useFC15")">Use FC15 for single coil writes</label>
</div>
</div>
<div class="col-md-4">
<div class="form-check form-switch">
<InputCheckbox @bind-Value="_form.UseFC16ForSingleRegisterWrites" @bind-Value:after="EmitAsync" class="form-check-input" id="useFC16" />
<label class="form-check-label" for="useFC16">Use FC16 for single register writes</label>
<InputCheckbox @bind-Value="_form.UseFC16ForSingleRegisterWrites" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("useFC16")" />
<label class="form-check-label" for="@FieldId("useFC16")">Use FC16 for single register writes</label>
</div>
</div>
<div class="col-md-4">
<div class="form-check form-switch">
<InputCheckbox @bind-Value="_form.DisableFC23" @bind-Value:after="EmitAsync" class="form-check-input" id="disableFC23" />
<label class="form-check-label" for="disableFC23">Disable FC23 (never send FC23, even when opted in below)</label>
<InputCheckbox @bind-Value="_form.DisableFC23" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("disableFC23")" />
<label class="form-check-label" for="@FieldId("disableFC23")">Disable FC23 (never send FC23, even when opted in below)</label>
</div>
</div>
<div class="col-md-4">
<div class="form-check form-switch">
<InputCheckbox @bind-Value="_form.UseFC23ForMultiRegisterWrites" @bind-Value:after="EmitAsync" class="form-check-input" id="useFC23" />
<label class="form-check-label" for="useFC23">Use FC23 write + read-back for multi-register writes (opt-in; default FC16)</label>
<InputCheckbox @bind-Value="_form.UseFC23ForMultiRegisterWrites" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("useFC23")" />
<label class="form-check-label" for="@FieldId("useFC23")">Use FC23 write + read-back for multi-register writes (opt-in; default FC16)</label>
</div>
</div>
<div class="col-md-4">
<div class="form-check form-switch">
<InputCheckbox @bind-Value="_form.WriteOnChangeOnly" @bind-Value:after="EmitAsync" class="form-check-input" id="writeOnChangeOnly" />
<label class="form-check-label" for="writeOnChangeOnly">Write on change only</label>
<InputCheckbox @bind-Value="_form.WriteOnChangeOnly" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("writeOnChangeOnly")" />
<label class="form-check-label" for="@FieldId("writeOnChangeOnly")">Write on change only</label>
</div>
</div>
</div>
@@ -138,24 +143,27 @@
<div class="row g-3">
<div class="col-md-3">
<div class="form-check form-switch mt-4">
<InputCheckbox @bind-Value="_form.KeepAliveEnabled" @bind-Value:after="EmitAsync" class="form-check-input" id="kaEnabled" />
<label class="form-check-label" for="kaEnabled">Enabled</label>
<InputCheckbox @bind-Value="_form.KeepAliveEnabled" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("kaEnabled")" />
<label class="form-check-label" for="@FieldId("kaEnabled")">Enabled</label>
</div>
</div>
<div class="col-md-3">
<label class="form-label">Time (seconds)</label>
<InputNumber @bind-Value="_form.KeepAliveTimeSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Idle time before first probe. Default 30 s.</div>
<label for="@FieldId("field-17")" class="form-label">Time (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-17-error", "field-17-hint")" id="@FieldId("field-17")" @bind-Value="_form.KeepAliveTimeSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-17-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.KeepAliveTimeSeconds)" /> }</div>
<div id="@FieldId("field-17-hint")" class="form-text">Idle time before first probe. Default 30 s.</div>
</div>
<div class="col-md-3">
<label class="form-label">Interval (seconds)</label>
<InputNumber @bind-Value="_form.KeepAliveIntervalSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Between probes once started. Default 10 s.</div>
<label for="@FieldId("field-18")" class="form-label">Interval (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-18-error", "field-18-hint")" id="@FieldId("field-18")" @bind-Value="_form.KeepAliveIntervalSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-18-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.KeepAliveIntervalSeconds)" /> }</div>
<div id="@FieldId("field-18-hint")" class="form-text">Between probes once started. Default 10 s.</div>
</div>
<div class="col-md-3">
<label class="form-label">Retry count</label>
<InputNumber @bind-Value="_form.KeepAliveRetryCount" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Probes before declaring socket dead. Default 3.</div>
<label for="@FieldId("field-19")" class="form-label">Retry count</label>
<InputNumber aria-describedby="@FieldIds("field-19-error", "field-19-hint")" id="@FieldId("field-19")" @bind-Value="_form.KeepAliveRetryCount" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-19-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.KeepAliveRetryCount)" /> }</div>
<div id="@FieldId("field-19-hint")" class="form-text">Probes before declaring socket dead. Default 3.</div>
</div>
</div>
</div>
@@ -167,24 +175,28 @@
<div style="padding:1rem">
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Initial delay (seconds)</label>
<InputNumber @bind-Value="_form.ReconnectInitialDelaySeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">0 = immediate retry.</div>
<label for="@FieldId("field-20")" class="form-label">Initial delay (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-20-error", "field-20-hint")" id="@FieldId("field-20")" @bind-Value="_form.ReconnectInitialDelaySeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-20-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.ReconnectInitialDelaySeconds)" /> }</div>
<div id="@FieldId("field-20-hint")" class="form-text">0 = immediate retry.</div>
</div>
<div class="col-md-3">
<label class="form-label">Max delay (seconds)</label>
<InputNumber @bind-Value="_form.ReconnectMaxDelaySeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 30 s.</div>
<label for="@FieldId("field-21")" class="form-label">Max delay (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-21-error", "field-21-hint")" id="@FieldId("field-21")" @bind-Value="_form.ReconnectMaxDelaySeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-21-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.ReconnectMaxDelaySeconds)" /> }</div>
<div id="@FieldId("field-21-hint")" class="form-text">Default 30 s.</div>
</div>
<div class="col-md-3">
<label class="form-label">Backoff multiplier</label>
<InputNumber @bind-Value="_form.ReconnectBackoffMultiplier" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 2.0 (doubles each step).</div>
<label for="@FieldId("field-22")" class="form-label">Backoff multiplier</label>
<InputNumber aria-describedby="@FieldIds("field-22-error", "field-22-hint")" id="@FieldId("field-22")" @bind-Value="_form.ReconnectBackoffMultiplier" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-22-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.ReconnectBackoffMultiplier)" /> }</div>
<div id="@FieldId("field-22-hint")" class="form-text">Default 2.0 (doubles each step).</div>
</div>
<div class="col-md-3">
<label class="form-label">Idle disconnect (seconds, 0 = off)</label>
<InputNumber @bind-Value="_form.IdleDisconnectTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Proactive close after idle period. 0 = disabled.</div>
<label for="@FieldId("field-23")" class="form-label">Idle disconnect (seconds, 0 = off)</label>
<InputNumber aria-describedby="@FieldIds("field-23-error", "field-23-hint")" id="@FieldId("field-23")" @bind-Value="_form.IdleDisconnectTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-23-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.IdleDisconnectTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-23-hint")" class="form-text">Proactive close after idle period. 0 = disabled.</div>
</div>
</div>
</div>
@@ -197,34 +209,39 @@
<div class="row g-3">
<div class="col-md-3">
<div class="form-check form-switch mt-4">
<InputCheckbox @bind-Value="_form.ProbeEnabled" @bind-Value:after="EmitAsync" class="form-check-input" id="probeEnabled" />
<label class="form-check-label" for="probeEnabled">Enabled</label>
<InputCheckbox @bind-Value="_form.ProbeEnabled" @bind-Value:after="EmitAsync" class="form-check-input" id="@FieldId("probeEnabled")" />
<label class="form-check-label" for="@FieldId("probeEnabled")">Enabled</label>
</div>
</div>
<div class="col-md-3">
<label class="form-label">Probe interval (seconds)</label>
<InputNumber @bind-Value="_form.ProbeIntervalSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 5 s.</div>
<label for="@FieldId("field-25")" class="form-label">Probe interval (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-25-error", "field-25-hint")" id="@FieldId("field-25")" @bind-Value="_form.ProbeIntervalSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-25-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.ProbeIntervalSeconds)" /> }</div>
<div id="@FieldId("field-25-hint")" class="form-text">Default 5 s.</div>
</div>
<div class="col-md-3">
<label class="form-label">Probe timeout (seconds)</label>
<InputNumber @bind-Value="_form.ProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Default 2 s.</div>
<label for="@FieldId("field-26")" class="form-label">Probe timeout (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-26-error", "field-26-hint")" id="@FieldId("field-26")" @bind-Value="_form.ProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-26-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.ProbeTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-26-hint")" class="form-text">Default 2 s.</div>
</div>
<div class="col-md-3">
<label class="form-label">Probe register address</label>
<InputNumber @bind-Value="_form.ProbeAddress" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Zero-based. Default 0 (FC03 at register 0).</div>
<label for="@FieldId("field-27")" class="form-label">Probe register address</label>
<InputNumber aria-describedby="@FieldIds("field-27-error", "field-27-hint")" id="@FieldId("field-27")" @bind-Value="_form.ProbeAddress" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-27-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.ProbeAddress)" /> }</div>
<div id="@FieldId("field-27-hint")" class="form-text">Zero-based. Default 0 (FC03 at register 0).</div>
</div>
<div class="col-md-3">
<label class="form-label">Admin UI probe timeout (seconds)</label>
<InputNumber @bind-Value="_form.AdminProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Max 60. Used by Test Connect. Default 5.</div>
<label for="@FieldId("field-28")" class="form-label">Admin UI probe timeout (seconds)</label>
<InputNumber aria-describedby="@FieldIds("field-28-error", "field-28-hint")" id="@FieldId("field-28")" @bind-Value="_form.AdminProbeTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-28-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.AdminProbeTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-28-hint")" class="form-text">Max 60. Used by Test Connect. Default 5.</div>
</div>
<div class="col-md-3">
<label class="form-label">Auto-prohibit re-probe interval (seconds, 0 = off)</label>
<InputNumber @bind-Value="_form.AutoProhibitReprobeIntervalSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div class="form-text">Interval to retry auto-prohibited coalesced ranges.</div>
<label for="@FieldId("field-29")" class="form-label">Auto-prohibit re-probe interval (seconds, 0 = off)</label>
<InputNumber aria-describedby="@FieldIds("field-29-error", "field-29-hint")" id="@FieldId("field-29")" @bind-Value="_form.AutoProhibitReprobeIntervalSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-29-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.AutoProhibitReprobeIntervalSeconds)" /> }</div>
<div id="@FieldId("field-29-hint")" class="form-text">Interval to retry auto-prohibited coalesced ranges.</div>
</div>
</div>
</div>
@@ -233,6 +250,11 @@
<DriverResilienceSection ResilienceConfig="@ResilienceConfig" ResilienceConfigChanged="OnResilienceChanged" />
@code {
private readonly string _fieldScope = "modbus-driver-form-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[CascadingParameter] private Microsoft.AspNetCore.Components.Forms.EditContext? _fieldEditContext { get; set; }
/// <summary>The driver-level DriverConfig JSON (protocol/channel; endpoint lives in the device).</summary>
[Parameter] public string DriverConfigJson { get; set; } = "{}";
/// <summary>Fired (camelCase-serialized) whenever a channel field changes — enables @bind-DriverConfigJson.</summary>