# OPC UA Server – Exposing Tags and $ Functions

When an OPC UA Server Device is configured in your Cognex Designer project, you can interact with your deployed vision application through an OPC UA client application either by reading and writing the supported Tags, or by executing the published (and supported) OPC UA $ functions.

OPC UA supports exposing tags and $ functions with the following types:

- Boolean
- Byte
- Int16
- UInt16
- Int32
- UInt32
- Int64
- UInt64
- Float
- Double
- String
- DateTime
- Arrays of the above types
- Enums

Note: The OPC UA server also supports queries (such as System.Alarms.All or System.Recipes.<RecipeName>.Configurations). The results of these queries are represented as 2D arrays of strings on the server node.

At the same time, the following input argument types and/or output types are not supported:

- VisionPro types (like ICogRecord)
- Custom types defined in Cognex Designer
- WebHMI tags or $ functions are also not exposed by OPC UA.

## Reading and Writing Tags

The Cognex OPC UA implementation handles the reading and writing of tags as follows:

- By default, the OPC UA Server Device exposes all tags of the project in its address space if their types are supported by the OPC Foundation .NET implementation. See the supported types above.
- If a tag is not read-only, you can change its value in Test Mode or in deployed mode by connecting to the project with an OPC UA client.
- If the project is under development (that is, it is in Program Mode), you can only read the value of the tags through an OPC UA client, even if the tag is not read-only.
- Tag updates work both ways. Therefore, for example, if a tag is updated in Cognex Designer while the project is in runtime (that is, it is in Test Mode or being deployed), it will be updated in the OPC UA server node as well. At the same time, if a tag is modified through its OPC UA server node, it will also be updated in Cognex Designer.

- Tip:

  If you do not want to expose a tag with the OPC UA server, you can blacklist it. To do so, open the Tag Manager, select the tag you want to blacklist, and then check the Hide from server checkbox under the OPC UA node of the Properties window, as shown below.

## Reading and Writing $ Functions

The Cognex OPC UA implementation handles $ function exposure as follows:

- The OPC UA Server Device exposes a $ function if all of its input arguments (if it has any) and its return type as well (if it has one) are supported by the OPC Foundation .NET implementation. See the supported types at the beginning of this topic.
- $ Functions can only be executed through an OPC UA client if the project is in Test Mode or in deployed mode.
- If the project is under development (that is, it is in Program Mode), you can still read the node of the exposed $ functions through an OPC UA client.