Client State Machine handling

Unified Architecture topics related to OPC UA Specification, compliant behavior and any technical issues of OPC UA, like Security, Information Model, Companion Specs DI, PLCopen, ADI, ...

Moderator: Support Team

Post Reply
sxdev
Jr. Member
Jr. Member
Posts: 1
Joined: 25 Mar 2020, 09:07

Client State Machine handling

Post 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!

Post Reply