class documentation
class UaFiniteStateMachine(Generic[
Constructor: UaFiniteStateMachine(name, states, initial, write_func)
Finite state machine with OPC-UA representation based on transitions library.
| Method | __init__ |
Create a new instance. |
| Method | add |
Add the given transition to the internal state machine. |
| Async Method | init |
Asynchronous initialization of the instance. |
| Async Method | try |
Try to trigger an event in the internal state machine. |
| Instance Variable | logger |
Undocumented |
| Instance Variable | name |
Undocumented |
| Instance Variable | ua |
OPC UA node 'StateMachine' representing this instance. |
| Instance Variable | ua |
OPC UA node 'CurrentState' of the state machine. |
| Property | current |
Return the current state of the state machine. |
| Async Method | _after |
Handle callback from state machine after a state changes. Used to update the OPC-UA representation. |
| Instance Variable | _internal |
Undocumented |
| Instance Variable | _write |
Undocumented |
def __init__(self, *, name:
str, states: Iterable[ _StateType], initial: _StateType, write_func: Callable[ [ _StateType], Awaitable[ None]]):
¶
Create a new instance.
| Parameters | |
name:str | Name of the state machine. |
states:Iterable[ | States of the state machine. |
initial:_StateType | Initial state of the state machine. |
writeCallable[ | Async callback to write the current state. |
Add the given transition to the internal state machine.
For documentation of available keyword arguments, please look into transitions.Machine.add_transition().
Asynchronous initialization of the instance.
Adds a new OPC-UA object to the given parent node of some OPC-UA StateMachineType. Adds sub OPC-UA nodes representing all states of the internal state machine.
| Parameters | |
stateNode | OPC-UA node of the state machine (instantiated from respective types). |
Try to trigger an event in the internal state machine.
Handles expected exceptions due to wrong state and UaStatusCodeError exceptions due to unsatisfied conditions.
| Parameters | |
user:UserProtocol | None | User which triggers the event. |
triggerstr | Name of the trigger function. |
| Returns | |
ua.StatusCode | Returns either an OPC-UA status code or what the provided success_func returns. |