# OpcStateMachineNode Class

<dl class="api-definition">
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx">Opc.UaFx</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Members</dt>
<dd><a href="./members">OpcStateMachineNode Members</a></dd>
</dl>

Defines the base class for all state machine nodes. It uses a single variable which represents the current state of the machine.

## Syntax

<div class="api-signature" data-lang="csharp">

```csharp
public class OpcStateMachineNode : OpcObjectNode
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<OpcNodeType(2299)>
Public Class OpcStateMachineNode
    Inherits OpcObjectNode
```

</div>

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → [OpcNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/) → [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) → [OpcObjectNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcobjectnode/) → **OpcStateMachineNode**

## Implements

<ul class="api-implements">
<li><a href="../opc.uafx.iopcnode/">IOpcNode</a></li>
<li><a href="../opc.uafx.iopcnodeinfo/">IOpcNodeInfo</a></li>
</ul>

## Derived types

- [OpcFiniteStateMachineNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfinitestatemachinenode/)

## Remarks

An instance of this object should generate an event whenever a significant state change occurs. The server decides which state changes are significant. Servers should use the [GeneratesEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#generatesevent) reference type to indicate which event(s) could be produced by the state machine.

Subtypes may add methods which affect the state of the machine. The [Executable](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcattribute/#executable) attribute is used to indicate whether the method is valid given the current state of the machine. A state machine may not be active. In this case, the [CurrentState](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#currentstate) and [LastTransition](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#lasttransition) vvariables should have a status equal to [BadStateNotActive](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badstatenotactive).

Subtypes may add components which are instances of state machines. These components are considered to be sub-states of the state machine. Sub state machines are only active when the parent machine is in an appropriate state.

Events produced by sub state machines may be suppressed by the parent machine. In some cases, the parent machine will produce a single event that reflects changes in multiple sub state machines.

## Constructors

| Name | Description |
|---|---|
| [OpcStateMachineNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#opcstatemachinenode)<span class="api-meta">6 overloads</span> | Initializes a new instance of the OpcStateMachineNode class accessible by the `name` specified. |

## Properties

| Name | Description |
|---|---|
| [CurrentState](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#currentstate)<span class="api-meta">virtual</span> | Gets or sets the current state of the OpcStateMachineNode and provides a human readable name for the current state which may not be suitable for use in application control logic. |
| [CurrentStateNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#currentstatenode) | Gets the [OpcStateVariableNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatevariablenode/) of the [CurrentState](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#currentstate) property. |
| [DefaultTypeDefinitionId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#defaulttypedefinitionid)<span class="api-meta">protected · override</span> | Gets the default identifier which identifies the node that defines the underlying node type from that this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) has been created. |
| [LastTransition](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#lasttransition)<span class="api-meta">virtual</span> | Gets or sets the last transition which occurred in an instance and provides a human readable name for the last transition which may not be suitable for use in application control logic. |
| [LastTransitionNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#lasttransitionnode) | Gets the [OpcTransitionVariableNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opctransitionvariablenode/) of the [LastTransition](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatemachinenode/members#lasttransition) property. |

Inherits members from [OpcObjectNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcobjectnode/members), [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members), [OpcNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members).

## Applies to

| Package | Versions |
|---|---|
| Opc.UaFx.Advanced | v2.5–v2.59 |
