Page 1 of 1

Client State Machine handling

Posted: 25 Mar 2020, 09:32
by sxdev
Hi,

I am developing an OPC UA client application that shoult programatically react to the current state of a finite state machine.
Is it the correct way to check the CurrentState->Id's value (which is a node id as you know) against the node ids of the states defined in the state machine's type definition?

Some pseudo code:

Code: Select all

if (CurrentState.Id == NodeId(ExampleStateMachineType.StateA))
{
  // react to state A
}
else if CurrentState.Id == NodeId(ExampleStateMachineType.StateB))
{
  // react to state B
}
// ... and so on
Or is there another way of checking the state? Maybe in a more "enum like" way?

Thank you!