/* ======================================================================== * 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/ * ======================================================================*/ using System; namespace Opc.Ua.Client.StateMachines { /// /// A point-in-time snapshot of an OPC UA Part 16 state machine. /// Returned by StateMachineTypeClient.GetCurrentStateAsync /// and yielded by StateMachineTypeClient.ObserveStateChangesAsync. /// /// /// The non-finite variant only carries the /// StateVariableType value /// ( as ). /// Finite state machines yield the richer /// with the typed state and /// transition NodeIds. /// /// The NodeId of the state machine instance. /// The current state's localized name. /// The source timestamp of the observation. /// The status code reported with the observation. public sealed record StateMachineSnapshot( NodeId StateMachineId, LocalizedText CurrentState, DateTime Timestamp, StatusCode Status); /// /// A point-in-time snapshot of an OPC UA Part 16 /// FiniteStateMachineType instance. Adds the typed state /// and transition NodeIds on top of . /// /// The NodeId of the state machine instance. /// The current state's localized name. /// The current state's NodeId (the /// StateType instance the machine is currently in). /// The last transition's localized /// name. May be LocalizedText.Null if no transition has /// occurred since the state machine was created. /// The last transition's NodeId. /// May be NodeId.Null if no transition has occurred. /// The source timestamp of the observation. /// The status code reported with the observation. public sealed record FiniteStateSnapshot( NodeId StateMachineId, LocalizedText CurrentState, NodeId CurrentStateId, LocalizedText LastTransition, NodeId LastTransitionId, DateTime Timestamp, StatusCode Status) { /// /// When the FSM has a sub-state-machine attached to its /// current state via HasSubStateMachine, this holds /// the sub-SM's snapshot. null for state machines /// without sub-SMs or when the current state has no /// attached sub-SM. /// public FiniteStateSnapshot? SubMachine { get; init; } } /// /// Describes a state node defined on a finite state machine type. /// Returned by /// FiniteStateMachineTypeClient.GetAvailableStatesAsync. /// /// The NodeId of the StateType instance. /// The browse name (e.g. Unshelved). /// The state number declared by the /// type (Part 16 §B.4.3). Zero when the server does not expose /// the StateNumber property. public sealed record FiniteStateInfo( NodeId NodeId, QualifiedName BrowseName, uint StateNumber); /// /// Describes a transition node defined on a finite state machine /// type. Returned by /// FiniteStateMachineTypeClient.GetAvailableTransitionsAsync. /// /// The NodeId of the TransitionType instance. /// The browse name (e.g. /// UnshelvedToTimedShelved). /// The transition number declared /// by the type. Zero when the server does not expose the /// TransitionNumber property. public sealed record FiniteTransitionInfo( NodeId NodeId, QualifiedName BrowseName, uint TransitionNumber); }