chore: organize solution into module folders (Core/Server/Drivers/Client/Tooling)
Group all 69 projects into category subfolders under src/ and tests/ so the Rider Solution Explorer mirrors the module structure. Folders: Core, Server, Drivers (with a nested Driver CLIs subfolder), Client, Tooling. - Move every project folder on disk with git mv (history preserved as renames). - Recompute relative paths in 57 .csproj files: cross-category ProjectReferences, the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external mxaccessgw refs in Driver.Galaxy and its test project. - Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders. - Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL, integration, install). Build green (0 errors); unit tests pass. Docs left for a separate pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Aggregate functions for processed history reads.
|
||||
/// </summary>
|
||||
public enum AggregateType
|
||||
{
|
||||
/// <summary>Average of values in the interval.</summary>
|
||||
Average,
|
||||
|
||||
/// <summary>Minimum value in the interval.</summary>
|
||||
Minimum,
|
||||
|
||||
/// <summary>Maximum value in the interval.</summary>
|
||||
Maximum,
|
||||
|
||||
/// <summary>Count of values in the interval.</summary>
|
||||
Count,
|
||||
|
||||
/// <summary>First value in the interval.</summary>
|
||||
Start,
|
||||
|
||||
/// <summary>Last value in the interval.</summary>
|
||||
End,
|
||||
|
||||
/// <summary>Population standard deviation of values in the interval.</summary>
|
||||
StandardDeviation
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Event data for an alarm or condition notification from the OPC UA server.
|
||||
/// </summary>
|
||||
public sealed class AlarmEventArgs : EventArgs
|
||||
{
|
||||
public AlarmEventArgs(
|
||||
string sourceName,
|
||||
string conditionName,
|
||||
ushort severity,
|
||||
string message,
|
||||
bool retain,
|
||||
bool activeState,
|
||||
bool ackedState,
|
||||
DateTime time,
|
||||
byte[]? eventId = null,
|
||||
string? conditionNodeId = null,
|
||||
string? operatorComment = null,
|
||||
DateTime? originalRaiseTimestampUtc = null,
|
||||
string? alarmCategory = null)
|
||||
{
|
||||
SourceName = sourceName;
|
||||
ConditionName = conditionName;
|
||||
Severity = severity;
|
||||
Message = message;
|
||||
Retain = retain;
|
||||
ActiveState = activeState;
|
||||
AckedState = ackedState;
|
||||
Time = time;
|
||||
EventId = eventId;
|
||||
ConditionNodeId = conditionNodeId;
|
||||
OperatorComment = operatorComment;
|
||||
OriginalRaiseTimestampUtc = originalRaiseTimestampUtc;
|
||||
AlarmCategory = alarmCategory;
|
||||
}
|
||||
|
||||
/// <summary>The name of the source object that raised the alarm.</summary>
|
||||
public string SourceName { get; }
|
||||
|
||||
/// <summary>The condition type name.</summary>
|
||||
public string ConditionName { get; }
|
||||
|
||||
/// <summary>The alarm severity (0-1000).</summary>
|
||||
public ushort Severity { get; }
|
||||
|
||||
/// <summary>Human-readable alarm message.</summary>
|
||||
public string Message { get; }
|
||||
|
||||
/// <summary>Whether the alarm should be retained in the display.</summary>
|
||||
public bool Retain { get; }
|
||||
|
||||
/// <summary>Whether the alarm condition is currently active.</summary>
|
||||
public bool ActiveState { get; }
|
||||
|
||||
/// <summary>Whether the alarm has been acknowledged.</summary>
|
||||
public bool AckedState { get; }
|
||||
|
||||
/// <summary>The time the event occurred.</summary>
|
||||
public DateTime Time { get; }
|
||||
|
||||
/// <summary>The EventId used for alarm acknowledgment.</summary>
|
||||
public byte[]? EventId { get; }
|
||||
|
||||
/// <summary>The NodeId of the condition instance (SourceNode), used for acknowledgment.</summary>
|
||||
public string? ConditionNodeId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// PR E.7 — Operator-supplied comment recorded by the upstream alarm system on
|
||||
/// Acknowledge transitions. Null on raise / clear, or when the upstream path
|
||||
/// can't surface the comment (sub-attribute fallback path collapses comments
|
||||
/// into a single string write).
|
||||
/// </summary>
|
||||
public string? OperatorComment { get; }
|
||||
|
||||
/// <summary>
|
||||
/// PR E.7 — When the alarm originally entered the active state. Preserved
|
||||
/// across Acknowledge transitions so OPC UA Part 9 conditions keep the
|
||||
/// original raise time. Null when the upstream path doesn't surface it.
|
||||
/// </summary>
|
||||
public DateTime? OriginalRaiseTimestampUtc { get; }
|
||||
|
||||
/// <summary>
|
||||
/// PR E.7 — Upstream alarm taxonomy bucket (e.g. <c>Process</c> /
|
||||
/// <c>Safety</c> / <c>Diagnostics</c>). Null when not surfaced.
|
||||
/// </summary>
|
||||
public string? AlarmCategory { get; }
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a single node in the browse result set.
|
||||
/// </summary>
|
||||
public sealed class BrowseResult
|
||||
{
|
||||
public BrowseResult(string nodeId, string displayName, string nodeClass, bool hasChildren)
|
||||
{
|
||||
NodeId = nodeId;
|
||||
DisplayName = displayName;
|
||||
NodeClass = nodeClass;
|
||||
HasChildren = hasChildren;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of the node's NodeId.
|
||||
/// </summary>
|
||||
public string NodeId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The display name of the node.
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The node class (e.g., "Object", "Variable", "Method").
|
||||
/// </summary>
|
||||
public string NodeClass { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the node has child references.
|
||||
/// </summary>
|
||||
public bool HasChildren { get; }
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Information about the current OPC UA session.
|
||||
/// </summary>
|
||||
public sealed class ConnectionInfo
|
||||
{
|
||||
public ConnectionInfo(
|
||||
string endpointUrl,
|
||||
string serverName,
|
||||
string securityMode,
|
||||
string securityPolicyUri,
|
||||
string sessionId,
|
||||
string sessionName)
|
||||
{
|
||||
EndpointUrl = endpointUrl;
|
||||
ServerName = serverName;
|
||||
SecurityMode = securityMode;
|
||||
SecurityPolicyUri = securityPolicyUri;
|
||||
SessionId = sessionId;
|
||||
SessionName = sessionName;
|
||||
}
|
||||
|
||||
/// <summary>The endpoint URL of the connected server.</summary>
|
||||
public string EndpointUrl { get; }
|
||||
|
||||
/// <summary>The server application name.</summary>
|
||||
public string ServerName { get; }
|
||||
|
||||
/// <summary>The security mode in use (e.g., "None", "Sign", "SignAndEncrypt").</summary>
|
||||
public string SecurityMode { get; }
|
||||
|
||||
/// <summary>The security policy URI (e.g., "http://opcfoundation.org/UA/SecurityPolicy#None").</summary>
|
||||
public string SecurityPolicyUri { get; }
|
||||
|
||||
/// <summary>The session identifier.</summary>
|
||||
public string SessionId { get; }
|
||||
|
||||
/// <summary>The session name.</summary>
|
||||
public string SessionName { get; }
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Settings for establishing an OPC UA client connection.
|
||||
/// </summary>
|
||||
public sealed class ConnectionSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// The primary OPC UA endpoint URL.
|
||||
/// </summary>
|
||||
public string EndpointUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Optional failover endpoint URLs for redundancy.
|
||||
/// </summary>
|
||||
public string[]? FailoverUrls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional username for authentication.
|
||||
/// </summary>
|
||||
public string? Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional password for authentication.
|
||||
/// </summary>
|
||||
public string? Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Transport security mode. Defaults to <see cref="Models.SecurityMode.None" />.
|
||||
/// </summary>
|
||||
public SecurityMode SecurityMode { get; set; } = SecurityMode.None;
|
||||
|
||||
/// <summary>
|
||||
/// Session timeout in seconds. Defaults to 60.
|
||||
/// </summary>
|
||||
public int SessionTimeoutSeconds { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to automatically accept untrusted server certificates. Defaults to true.
|
||||
/// </summary>
|
||||
public bool AutoAcceptCertificates { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the certificate store. Defaults to a subdirectory under LocalApplicationData
|
||||
/// resolved via <see cref="ClientStoragePaths"/> so the one-shot legacy-folder migration
|
||||
/// runs before the path is returned.
|
||||
/// </summary>
|
||||
public string CertificateStorePath { get; set; } = ClientStoragePaths.GetPkiPath();
|
||||
|
||||
/// <summary>
|
||||
/// Validates the settings and throws if any required values are missing or invalid.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">Thrown when settings are invalid.</exception>
|
||||
public void Validate()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(EndpointUrl))
|
||||
throw new ArgumentException("EndpointUrl must not be null or empty.", nameof(EndpointUrl));
|
||||
|
||||
if (SessionTimeoutSeconds <= 0)
|
||||
throw new ArgumentException("SessionTimeoutSeconds must be greater than zero.",
|
||||
nameof(SessionTimeoutSeconds));
|
||||
|
||||
if (SessionTimeoutSeconds > 3600)
|
||||
throw new ArgumentException("SessionTimeoutSeconds must not exceed 3600.", nameof(SessionTimeoutSeconds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the current state of the OPC UA client connection.
|
||||
/// </summary>
|
||||
public enum ConnectionState
|
||||
{
|
||||
/// <summary>Not connected to any server.</summary>
|
||||
Disconnected,
|
||||
|
||||
/// <summary>Connection attempt is in progress.</summary>
|
||||
Connecting,
|
||||
|
||||
/// <summary>Successfully connected to a server.</summary>
|
||||
Connected,
|
||||
|
||||
/// <summary>Connection was lost and reconnection is in progress.</summary>
|
||||
Reconnecting
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Event data raised when the client connection state changes.
|
||||
/// </summary>
|
||||
public sealed class ConnectionStateChangedEventArgs : EventArgs
|
||||
{
|
||||
public ConnectionStateChangedEventArgs(ConnectionState oldState, ConnectionState newState, string endpointUrl)
|
||||
{
|
||||
OldState = oldState;
|
||||
NewState = newState;
|
||||
EndpointUrl = endpointUrl;
|
||||
}
|
||||
|
||||
/// <summary>The previous connection state.</summary>
|
||||
public ConnectionState OldState { get; }
|
||||
|
||||
/// <summary>The new connection state.</summary>
|
||||
public ConnectionState NewState { get; }
|
||||
|
||||
/// <summary>The endpoint URL associated with the state change.</summary>
|
||||
public string EndpointUrl { get; }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Opc.Ua;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Event data for a monitored data value change.
|
||||
/// </summary>
|
||||
public sealed class DataChangedEventArgs : EventArgs
|
||||
{
|
||||
public DataChangedEventArgs(string nodeId, DataValue value)
|
||||
{
|
||||
NodeId = nodeId;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>The string representation of the node that changed.</summary>
|
||||
public string NodeId { get; }
|
||||
|
||||
/// <summary>The new data value from the server.</summary>
|
||||
public DataValue Value { get; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Redundancy information read from the server.
|
||||
/// </summary>
|
||||
public sealed class RedundancyInfo
|
||||
{
|
||||
public RedundancyInfo(string mode, byte serviceLevel, string[] serverUris, string applicationUri)
|
||||
{
|
||||
Mode = mode;
|
||||
ServiceLevel = serviceLevel;
|
||||
ServerUris = serverUris;
|
||||
ApplicationUri = applicationUri;
|
||||
}
|
||||
|
||||
/// <summary>The redundancy mode (e.g., "None", "Cold", "Warm", "Hot").</summary>
|
||||
public string Mode { get; }
|
||||
|
||||
/// <summary>The server's current service level (0-255).</summary>
|
||||
public byte ServiceLevel { get; }
|
||||
|
||||
/// <summary>URIs of all servers in the redundant set.</summary>
|
||||
public string[] ServerUris { get; }
|
||||
|
||||
/// <summary>The application URI of the connected server.</summary>
|
||||
public string ApplicationUri { get; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Transport security mode for the OPC UA connection.
|
||||
/// </summary>
|
||||
public enum SecurityMode
|
||||
{
|
||||
/// <summary>No transport security.</summary>
|
||||
None,
|
||||
|
||||
/// <summary>Messages are signed but not encrypted.</summary>
|
||||
Sign,
|
||||
|
||||
/// <summary>Messages are signed and encrypted.</summary>
|
||||
SignAndEncrypt
|
||||
}
|
||||
Reference in New Issue
Block a user