You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.6 KiB
69 lines
1.6 KiB
# OPC UA test clients
|
|
|
|
This project contains a few small C++ test clients for experimenting with an OPC UA server using the `open62541` library.
|
|
|
|
## Included clients
|
|
|
|
- `opcua_client.cpp`
|
|
- Simple example client.
|
|
- Connects to an OPC UA endpoint.
|
|
- Lists the nodes in the `Objects` folder.
|
|
- Reads a sample value from a string-based node.
|
|
|
|
- `opcua_browser.cpp`
|
|
- Interactive console browser for the OPC UA address space.
|
|
- Starts from the `Objects` folder.
|
|
- Lets you browse child nodes and navigate back through the history.
|
|
- Prints variable values while browsing.
|
|
|
|
- `OPCUAClient.h` / `OPCUAClient.cpp`
|
|
- Shared helper class that wraps the Open62541 client API.
|
|
- Provides connect, browse, read, and disconnect functions.
|
|
|
|
## Requirements
|
|
|
|
- C++17 compiler
|
|
- `open62541` development package
|
|
- `pkg-config`
|
|
|
|
On Linux, the library is usually available via the system package manager, for example:
|
|
|
|
```bash
|
|
sudo apt install libopen62541-dev
|
|
```
|
|
|
|
## Build
|
|
|
|
From the project directory, run:
|
|
|
|
```bash
|
|
make
|
|
```
|
|
|
|
This creates the following binaries:
|
|
|
|
- `opcua_client`
|
|
- `opcua_browser`
|
|
|
|
## Run
|
|
|
|
### Simple client
|
|
|
|
```bash
|
|
./opcua_client opc.tcp://192.168.1.100:4840
|
|
```
|
|
|
|
The example uses a sample node ID in namespace 1 (`my_variable`), so adjust the code if your server exposes different node names.
|
|
|
|
### Browser
|
|
|
|
```bash
|
|
./opcua_browser opc.tcp://192.168.1.100:4840
|
|
```
|
|
|
|
The browser opens the `Objects` folder and lets you select child nodes from the console.
|
|
|
|
## Notes
|
|
|
|
This is intended as a small learning and testing project. The code is deliberately compact and meant to be easy to adapt to your own OPC UA server.
|