OPC represents a result of a service or operation in a status code, which consists of several bit-coded fields. OPC Data Client-UA encapsulates the status code in a UAStatusCode class. The bit fields in status code are inter-dependent, making it a bit complicated to encode or decode it. The UAStatusCode type takes care of this complexity. In addition, it offers symbolic constants that represent the individual coded options, and also has additional functionality such as for converting the status code to a string.
The following table attempts to depict the elements of UAStatusCode and their relations, together with related properties and methods:
UAStatusCode property InternalValue |
||||||
property CodeBits | property FlagBits | |||||
property Severity | property Condition | property StructureChanged | property SemanticsChanged | property InfoType property HasDataValueInfo |
if HasDataValueInfo == true: | |
property LimitInfo | property Overflow |
The CodeBits part represents the numeric value of an error or condition, whereas the FlagBits part provides more information on the meaning of the status code.
OPC Data Client-UA provides a UACodeBits class that contains constants for errors and conditions defined by the OPC-UA specifications. You can compare the resulting CodeBits to the constants if your code needs to look for a specific error or condition.
The semantics of some parts is dependent on InfoType, and therefore the LimitInfo and Overflow properties can only be accessed if the InfoType has a corresponding value, which is indicated by the value of HasDataValueInfo property.