OPC UA tutorials
Each tutorial gives you a goal, what you need, numbered steps with commands and their expected results, common errors and cleanup. The commands were run on macOS on Apple silicon. It helps to go through the quickstart once before you start.
Tutorials
Section titled “Tutorials”| Tutorial | What you learn | Packages |
|---|---|---|
| PKI and trust setup | Create and inspect application certificates and test trust. | native |
| C client | Connect, Read and Write, Browse and Call with the C ABI. | native, apps |
| C++ client and server | Build a server with the RAII wrapper and connect a client to it. | native |
| Qt client worker | Send requests with qt_client_worker without blocking the UI thread. |
qt |
| .NET | Build a server and a client with PDComm.OpcUa. |
dotnet |
| MFC worker | Use MfcClientWorker in a Windows MFC application. |
Windows native |
| Subscriptions | Receive data change notifications. | apps |
| Events and alarms | Receive alarms and call Acknowledge, Confirm and ConditionRefresh. | apps |
| History | Read raw history and use continuation points. | apps |
| PubSub over UDP | Publish and subscribe to UADP messages over UDP. | apps |
| PubSub over MQTT | Publish and subscribe to UADP messages through an MQTT broker. | apps |
You practice the features the SDK server doesn’t have (events, history and PubSub) with the headless program of the simulator package, apps.
Set up the lab
Section titled “Set up the lab”Several tutorials share one lab folder. Set it up once.
-
Create the lab folder and copy the package files (
pdcomm-opcua-native-darwin-arm64.tar.gzandpdcomm-opcua-apps-darwin-arm64.tar.gz) into it.터미널 창 mkdir opcua-labcd opcua-lab -
Unpack both packages:
터미널 창 tar -xzf pdcomm-opcua-native-darwin-arm64.tar.gztar -xzf pdcomm-opcua-apps-darwin-arm64.tar.gz -
Set the environment variables the tutorials use. Every time you open a new terminal, run these four lines again from the lab folder. The last line names your license file: the SDK examples need a license for the
opcua-clientandopcua-servermodules (an evaluation license has both), while the simulators don’t. See Install and check a license.터미널 창 export OPCUA_SDK="$PWD/pdcomm-opcua-native-darwin-arm64"export OPCUA_APPS="$PWD/pdcomm-opcua-apps-darwin-arm64"export PKI="$OPCUA_SDK/examples/opcua/pki"export PDCOMM_LICENSE_FILE="$HOME/pdcomm/pdcomm.license" -
Follow PKI and trust setup to create the certificates in
$PKI. -
Build the SDK examples:
터미널 창 cd "$OPCUA_SDK"cmake -S examples/opcua -B build -DCMAKE_BUILD_TYPE=Releasecmake --build build --config Release
The apps package contains:
| Path | Contents |
|---|---|
PDComm OPC UA Simulator.app |
The Qt GUI simulator |
bin/pdcomm-opcua-headless |
The headless simulator, driven by JSON lines |
bin/pdcomm-opcua-mcp |
The MCP server for AI tools |
lib/ |
The simulator library and the Qt and OpenSSL runtimes |
examples/opcua/scenarios/simulator-tour.json |
A scenario that visits every workspace |
On Windows, set the variables in PowerShell, as in $env:OPCUA_SDK = "$PWD\pdcomm-opcua-native-windows-AMD64" and $env:PDCOMM_LICENSE_FILE = "$HOME\pdcomm\pdcomm.license", and unpack the ZIP packages.