mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-23 10:23:13 +08:00
535d017840
* Add OPC UA Part 17 (Alias Names) support Server-side: pluggable IAliasNameStore + thread-safe InMemoryAliasNameStore, AliasNameStoreRegistry (live dispatcher, surfaces through optional IAliasNameStoreRegistryProvider on ServerInternalData), AliasNameNodeManager (standalone CustomNodeManager2; defaults to SecurityAdmin-only mutations on SignAndEncrypt channels), AliasNameMethodDispatcher bridging generated typed FindAlias/FindAliasVerbose/Add/Delete *MethodState.OnCallAsync handlers, AliasNameWildcardMatcher (Part 4 §7.40 Like operator with proper escape handling), and a DiagnosticsNodeManager partial that late-binds the standard well-known Aliases (i=23470), TagVariables (i=23479) and Topics (i=23488) FindAlias methods plus Aliases.LastChange through the registry. Client-side: AliasNameClient (OpenStandardAliases/TagVariables/Topics + arbitrary category root) covering all four Part 17 methods, sub-category enumeration and ReadLastChangeAsync. Hardcoded method-id fast-path for standard categories; cached TranslateBrowsePaths resolution for custom ones. Service-level errors map to typed exceptions (UnauthorizedAccessException / NotSupportedException). AliasNameResolver (IAsyncDisposable) gives a name->NodeId cache with forward and reverse lookup; default refresh is Manual with opt-in AutoOnLastChange polling that compares VersionTime on inequality (wrap-safe). Reference server: registers an InMemoryAliasNameStore for the standard TagVariables + Topics categories with sample seeds (TIC101_Setpoint, TIC101_PV, FIC202_Flow, Pump1_Status, Heater_Power, MultiRefAlias, ServerEvents, AuditEvents) so the standard well-known FindAlias methods return data through the DiagnosticsNodeManager late binder. Tests: 45 server-side cases (wildcard matcher, in-memory store, registry, node manager) plus 11 mocked-session client cases and 4 end-to-end integration cases against a live ReferenceServer over a real OPC UA channel. All 60 tests pass; full solution builds clean across net472/net48/netstandard2.1/net8.0/net9.0/net10.0. Docs: Docs/Part17AliasNames.md plus a link from Docs/README.md.
70 lines
2.9 KiB
C#
70 lines
2.9 KiB
C#
/* ========================================================================
|
|
* Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved.
|
|
*
|
|
* OPC Foundation MIT License 1.00
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation
|
|
* files (the "Software"), to deal in the Software without
|
|
* restriction, including without limitation the rights to use,
|
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following
|
|
* conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* The complete license agreement can be found here:
|
|
* http://opcfoundation.org/License/MIT/1.00/
|
|
* ======================================================================*/
|
|
|
|
namespace Opc.Ua.Client.AliasNames.Refresh
|
|
{
|
|
/// <summary>
|
|
/// Tunables for
|
|
/// <see cref="MonitoredItemAliasNameRefreshStrategy"/>.
|
|
/// </summary>
|
|
public sealed class MonitoredItemAliasNameRefreshStrategyOptions
|
|
{
|
|
/// <summary>
|
|
/// When non-<c>null</c>, the strategy adds the
|
|
/// <c>LastChange</c> monitored item to this existing
|
|
/// <see cref="Subscription"/> instead of creating its own.
|
|
/// Disposal will <c>not</c> delete the subscription in this case
|
|
/// — only the monitored item is removed.
|
|
/// </summary>
|
|
public Subscription? SharedSubscription { get; set; }
|
|
|
|
/// <summary>
|
|
/// Display name to apply to the <see cref="Subscription"/> the
|
|
/// strategy creates (ignored when
|
|
/// <see cref="SharedSubscription"/> is set). Defaults to
|
|
/// <c>"AliasNameLastChange"</c>.
|
|
/// </summary>
|
|
public string SubscriptionDisplayName { get; set; }
|
|
= "AliasNameLastChange";
|
|
|
|
/// <summary>
|
|
/// Publishing interval (ms) of the owned
|
|
/// <see cref="Subscription"/> (ignored when
|
|
/// <see cref="SharedSubscription"/> is set). Defaults to 1000ms.
|
|
/// </summary>
|
|
public double PublishingIntervalMs { get; set; } = 1000.0;
|
|
|
|
/// <summary>
|
|
/// Sampling interval (ms) for the <c>LastChange</c> monitored
|
|
/// item. Defaults to 1000ms.
|
|
/// </summary>
|
|
public double SamplingIntervalMs { get; set; } = 1000.0;
|
|
}
|
|
}
|