PicoOPC User's Guide and Reference
Operation Model

PicoOPC programming consists of creating instances of PicoOPC Types, getting and setting their properties, and making method calls on them.

Some operations may fail with an error. PicoOPC distinguishes between usage errors and other errors. Usage errors are programming errors that should never happen in a properly written program. They include invalid arguments, and invalid operations (such as if you make the method call when the object is not in the proper state). Your code should neither catch nor handle the usage errors. Other errors cannot be prevented from inside the program, and you need to provide code to detect and handle them, according to the error model for your language binding.

You perform the actual OPC UA operations by making method calls on the Client object. Each such method call may succeed, or fail as a whole. The rules for success and failure indication depend on the concrete language binding, and are documented there (under Error Model).

The Client object is not thread safe. You need to assure proper synchronization if you have more threads that need to access the same instance of the Client object.

Status Code

In addition to the overall method call success, OPC UA reads and writes indicate their success or failure using a status code, individually for each node being read or written to. For robustness, your code should test the status codes returned from OPC UA reads and writes, and handle the possible failures accordingly.

The status code is an unsigned 32-bit integer. For its precise layout, and possible value, see the OPC UA specifications. For very approximate test, your code can just look at the most significant bit (31). '0' in this bit means Success (Good quality) or Warning (Uncertain quality); '1' in this bit means Failure (Bad quality). In most cases, you can expect status code of 0 for fully successful outcome, and a non-zero value for anything else.

See Also